// tile.hpp -- a flightgear scenery tile // // Written by Frederic Bouvier, started February 2002. // // Copyright (C) 2002 Frederic Bouvier - fredb@users.sourceforge.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // $Id: tile.hpp,v 1.23 2005/05/09 07:02:15 fredb Exp $ #ifndef _tile_hpp_ #define _tile_hpp_ #include "bobject.hpp" #include "triobject.hpp" #include #include #include #include class FGSD_ObjectStatic; class FGSD_Tile { public: typedef std::list ObjectList; FGSD_Tile( const SGBucket& b ); ~FGSD_Tile(); bool load( const char *root, const char *base ); void drawGL( FGSD_BaseObject::ObjectType type, double alpha, bool fill, FGSD_BaseObject::DrawType drawType, double minx, double maxx, double miny, double maxy, double zLevel ); bool propertiesUnderMouse( double lon, double lat, double &height, std::string &material, std::string &airportID ) const; FGSD_BaseObject *objectUnderMouse( double lon, double lat, double zLevel ); void getAirportList( std::vector &__aptList ) const; bool removeObject( FGSD_BaseObject *__object ); void addObject( FGSD_BaseObject *__object ); FGSD_ObjectStatic *findStaticObject( const char *__name, double __lon, double __lat, double __elev, double __hdg ); void recalcStaticObjectHeight(); bool positionInTile( double lon, double lat ) const; bool modified() const; void setModified(); bool adjacent( const SGBucket &b, bool &top, bool &bottom, bool &left, bool &right ) const; bool changeMaterial( const std::string &mat, double lon, double lat ); std::string getName() const; SGBucket getBucket() const; FGSD_TriangleObject *getTerrain() const; bool saveTo( const std::string &outPath, const std::string &format, bool objectBase, bool object, bool objectStatic, bool objectShared, bool force ); bool saveToTerraGear( const std::string &outPath, bool objectBase, bool object, bool objectStatic, bool objectShared, bool force ); bool saveToAscii( const std::string &outPath, bool objectBase, bool object, bool objectStatic, bool objectShared, bool force ); private: SGPath _path; SGBucket _bucket; ObjectList _objectList; bool _modified; FGSD_TriangleObject *_object; }; inline bool FGSD_Tile::modified() const { return _modified || ( _object && _object->isModified() ); } inline void FGSD_Tile::setModified() { _modified = true; } inline std::string FGSD_Tile::getName() const { return _bucket.gen_index_str(); } inline SGBucket FGSD_Tile::getBucket() const { return _bucket; } inline FGSD_TriangleObject *FGSD_Tile::getTerrain() const { return _object; } #endif