#include <string>
#include <simgear/bucket/newbucket.hxx>
-#include <simgear/math/point3d.hxx>
#include <simgear/misc/sg_path.hxx>
#include <osg/ref_ptr>
#include <strings.h>
#endif
-using std::string;
-using std::vector;
-
namespace simgear {
class ModelLoadHelper;
SGBucket tile_bucket;
std::string tileFileName;
- typedef vector < Point3D > point_list;
- typedef point_list::iterator point_list_iterator;
- typedef point_list::const_iterator const_point_list_iterator;
-
private:
// pointer to ssg range selector for this tile
const osgDB::ReaderWriter::Options* options);
/**
- * this value is used by the tile scheduler/loader to mark which
- * tiles are in the primary ring (i.e. the current tile or the
- * surrounding eight.) Other routines then can use this as an
- * optimization and not do some operation to tiles outside of this
- * inner ring. (For instance vasi color updating)
+ * This value is used by the tile scheduler/loader to load tiles
+ * in a useful sequence. The priority is set to reflect the tiles
+ * distance from the center, so all tiles are loaded in an innermost
+ * to outermost sequence.
*/
- bool is_inner_ring;
+ float _priority;
+ /** Flag indicating if tile belongs to current view. */
+ bool _current_view;
+ /** Time when tile expires. */
+ double _time_expired;
static ModelLoadHelper *_modelLoader;
// Constructor
TileEntry( const SGBucket& b );
+ TileEntry( const TileEntry& t );
// Destructor
~TileEntry();
* graph for this tile.
*/
void removeFromSceneGraph();
+
+ /**
+ * Refresh a tile, reload the node from disk.
+ */
+ void refresh();
-
/**
* return the scenegraph node for the terrain
*/
osg::LOD *getNode() const { return _node.get(); }
- double get_timestamp() const;
- void set_timestamp( double time_ms );
+ inline double get_time_expired() const { return _time_expired; }
+ inline void update_time_expired( double time_expired ) { if (_time_expired<time_expired) _time_expired = time_expired; }
- inline bool get_inner_ring() const { return is_inner_ring; }
- inline void set_inner_ring( bool val ) { is_inner_ring = val; }
+ inline void set_priority(float priority) { _priority=priority; }
+ inline float get_priority() const { return _priority; }
+ inline void set_current_view(bool current_view) { _current_view = current_view; }
+ inline bool is_current_view() const { return _current_view; }
+
+ /**
+ * Return true if the tile entry is still needed, otherwise return false
+ * indicating that the tile is no longer in active use.
+ */
+ inline bool is_expired(double current_time) const { return (_current_view) ? false : (current_time > _time_expired); }
// Get the ref_ptr to the DatabaseRequest object, in order to pass
// this to the pager.
class ModelLoadHelper {
public:
- virtual osg::Node *loadTileModel(const string& modelPath, bool cacheModel)=0;
+ virtual osg::Node *loadTileModel(const std::string& modelPath, bool cacheModel)=0;
};