/usr/include/osgEarthDrivers/engine_mp/TileNodeRegistry is in libosgearth-dev 2.7.0+dfsg-2+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2015 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_DRIVERS_MP_TERRAIN_ENGINE_TILE_NODE_REGISTRY
#define OSGEARTH_DRIVERS_MP_TERRAIN_ENGINE_TILE_NODE_REGISTRY 1
#include "Common"
#include "TileNode"
#include <osgEarth/Revisioning>
#include <osgEarth/ThreadingUtils>
#include <OpenThreads/Atomic>
#include <map>
namespace osgEarth { namespace Drivers { namespace MPTerrainEngine
{
using namespace osgEarth;
/**
* Holds a reference to each tile created by the driver.
*/
class TileNodeRegistry : public osg::Referenced
{
public:
typedef std::map< TileKey, osg::ref_ptr<TileNode> > TileNodeMap;
// Prototype for a locked tileset operation (see run)
struct Operation {
virtual void operator()(TileNodeMap& tiles) =0;
};
struct ConstOperation {
virtual void operator()(const TileNodeMap& tiles) const =0;
};
// Operation that runs when another node enters the registry.
struct DeferredOperation {
virtual void operator()(TileNode* requestingNode, TileNode* expectedNode) const =0;
};
public:
TileNodeRegistry( const std::string& name );
/* Enabled revisioning on TileNodes, to support incremental update. */
void setRevisioningEnabled(bool value);
/**
* Sets the revision of the map model - the registry will assign this
* to TileNodes added with add().
*
* @param rev Revision of map
* @param setToDirty In addition to update the revision, immediately set
* all tiles to dirty as well, effectively forcing an
* update.
*/
void setMapRevision( const Revision& rev, bool setToDirty =false );
/** Map revision that the reg will assign to new tiles. */
const Revision& getMapRevision() const { return _maprev; }
/**
* Marks all tiles intersecting the extent as dirty. If incremental
* update is enabled, they will automatically reload.
*
* NOTE: Input extent SRS must match the terrain's SRS exactly.
* The method does not check.
*/
void setDirty(const GeoExtent& extent, unsigned minLevel, unsigned maxLevel);
/**
* Sets the current cull traversal frame number so that tiles have
* access to the information. Atomic.
*/
void setTraversalFrame(unsigned frame) { _frameNumber.exchange(frame); }
unsigned getTraversalFrame() const { return _frameNumber; }
virtual ~TileNodeRegistry() { }
/** Adds a tile to the registry */
void add( TileNode* tile );
/** Adds several tiles to the registry */
//void add( const TileNodeVector& tiles );
/** Removes a tile */
void remove( TileNode* tile );
/** Moves a tile from this registry to another registry */
void move( TileNode* tile, TileNodeRegistry* destination );
/** Finds a tile in the registry */
bool get( const TileKey& key, osg::ref_ptr<TileNode>& out_tile );
/** Finds a tile in the registry and then removes it. */
bool take( const TileKey& key, osg::ref_ptr<TileNode>& out_tile );
/** Whether there are tiles in this registry (snapshot in time) */
bool empty() const;
/** Runs an operation against the exclusively locked tile set. */
void run( Operation& op );
/** Runs an operation against the read-locked tile set. */
void run( const ConstOperation& op ) const;
/** Number of tiles in the registry. */
unsigned size() const { return _tiles.size(); }
/** Tells the registry to listen for the TileNode for the specific key
to arrive, and upon its arrival, notifies the waiter. After notifying
the waiter, it removes the listen request. */
void listenFor(const TileKey& keyToWaitFor, TileNode* waiter);
protected:
bool _revisioningEnabled;
Revision _maprev;
std::string _name;
TileNodeMap _tiles;
OpenThreads::Atomic _frameNumber;
mutable Threading::ReadWriteMutex _tilesMutex;
typedef std::vector<TileKey> TileKeyVector;
typedef std::map<TileKey, TileKeyVector> Notifications;
Notifications _notifications;
};
} } } // namespace osgEarth::Drivers::MPTerrainEngine
#endif // OSGEARTH_DRIVERS_MP_TERRAIN_ENGINE_TILE_NODE_REGISTRY
|