#ifndef _TILEMGR_HXX
#define _TILEMGR_HXX
-
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
#include <simgear/compiler.h>
-#include <simgear/math/point3d.hxx>
-#include <simgear/scene/model/location.hxx>
#include <simgear/bucket/newbucket.hxx>
-#include "newcache.hxx"
-
-#if defined(USE_MEM) || defined(WIN32)
-# define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
-#else
-# define FG_MEM_COPY(to,from,n) bcopy(from, to, n)
-#endif
+#include <simgear/scene/tgdb/TileEntry.hxx>
+#include <simgear/scene/tgdb/TileCache.hxx>
-// forward declaration
-class FGTileEntry;
+class SGReaderWriterBTGOptions;
-class osg::Node;
+namespace osg
+{
+class Node;
+}
-class FGTileMgr {
+class FGTileMgr : public simgear::ModelLoadHelper {
private:
SGBucket previous_bucket;
SGBucket current_bucket;
SGBucket pending;
-
- FGTileEntry *current_tile;
-
+ osg::ref_ptr<SGReaderWriterBTGOptions> _options;
+
// x and y distance of tiles to load/draw
float vis;
int xrange, yrange;
-
+
// current longitude latitude
double longitude;
double latitude;
- double altitude_m;
/**
* tile cache
*/
- FGNewCache tile_cache;
+ simgear::TileCache tile_cache;
public:
-
- // Constructor
FGTileMgr();
- // Destructor
~FGTileMgr();
- // Initialize the Tile Manager subsystem
+ // Initialize the Tile Manager
int init();
// Update the various queues maintained by the tilemagr (private
// local chunks. If the chunk isn't already in the cache, then
// read it from disk.
int update( double visibility_meters );
- int update( SGLocation *location, double visibility_meters);
+ int update( const SGGeod& location, double visibility_meters);
// Prepare the ssg nodes corresponding to each tile. For each
// tile, set the ssg transform and update it's range selector
/// Returns true if scenery is avaliable for the given lat, lon position
/// within a range of range_m.
/// lat and lon are expected to be in degrees.
- bool scenery_available(double lat, double lon, double range_m);
+ bool scenery_available(const SGGeod& position, double range_m);
// Load a model for a tile
- static osg::Node* loadTileModel(const string& modelPath, bool cacheModel);
+ osg::Node* loadTileModel(const string& modelPath, bool cacheModel);
// Returns true if all the tiles in the tile cache have been loaded
bool isSceneryLoaded();