]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/tgdb/TileEntry.hxx
Remove using std:: from the metar header, remove HTTP support, add very basic unit...
[simgear.git] / simgear / scene / tgdb / TileEntry.hxx
index 1c620a415e0832a7248357e0dd9d2421e6652d31..7aec5d1f76e19bc261cfdc4dadef1ef07f8f420c 100644 (file)
@@ -74,13 +74,16 @@ private:
                           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;
 
@@ -88,6 +91,7 @@ public:
 
     // Constructor
     TileEntry( const SGBucket& b );
+    TileEntry( const TileEntry& t );
 
     // Destructor
     ~TileEntry();
@@ -127,18 +131,30 @@ public:
      * 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 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; }
 
-    inline bool get_inner_ring() const { return is_inner_ring; }
-    inline void set_inner_ring( bool val ) { is_inner_ring = val; }
+    /**
+     * 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.
@@ -150,7 +166,7 @@ public:
 
 class ModelLoadHelper {
 public:
-    virtual osg::Node *loadTileModel(const string& modelPath, bool cacheModel)=0;
+    virtual osg::Node *loadTileModel(const std::string& modelPath, bool cacheModel)=0;
 
 };