/usr/include/osgEarth/MapNode is in libosgearth-dev 2.4.0+dfsg-6.
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 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2008-2013 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.
*
* 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 Lesser General Public License for more details.
*
* 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_MAPNODE_H
#define OSGEARTH_MAPNODE_H 1
#include <osgEarth/Common>
#include <osgEarth/Map>
#include <osgEarth/MapNodeOptions>
#include <osgEarth/SpatialReference>
#include <osgEarth/TerrainEngineNode>
namespace osgEarth
{
class OverlayDecorator;
class Terrain;
class MapNodeCullData;
/**
* OSG Node that forms the root of an osgEarth map. This node is a "view" component
* that renders data from a "Map" data model.
*/
class OSGEARTH_EXPORT MapNode : public osg::Group
{
public:
/**
* Attempts to load a MapNOde from a ".earth" file in the arguments list
*/
static MapNode* load( class osg::ArgumentParser& arguments );
public:
/**
* Creates an empty map node.
*/
MapNode();
/**
* Creates an empty map node.
*
* @param options
* Tile creation and rendering properties
*/
MapNode( const MapNodeOptions& options );
/**
* Creates a new map node.
*
* @param map
* Map data that this map node will render.
*/
MapNode( Map* map );
/**
* Creates a new map node.
*
* @param map
* Map data that this map node will render.
* @param options
* Tile creation and rendering properties
*/
MapNode( Map* map, const MapNodeOptions& options );
public:
virtual const char* libraryName() const { return "osgEarth"; }
virtual const char* className() const { return "MapNode"; }
/**
* Gets the Map that this MapNode is rendering.
*/
Map* getMap();
const Map* getMap() const;
/**
* Gets the spatial reference system of the underlying map.
* Convenience function.
*/
const SpatialReference* getMapSRS() const;
/**
* Gets an interface for querying the in-memory terrain scene graph directly.
*/
Terrain* getTerrain();
const Terrain* getTerrain() const;
/**
* Finds the topmost Map node in the specified scene graph, or returns NULL if
* no Map node exists in the graph.
*
* @param graph
* Node graph in which to search for a MapNode
* @param travMask
* Traversal mask to apply while searching
*/
static MapNode* findMapNode( osg::Node* graph, unsigned travMask =~0 );
static MapNode* get( osg::Node* graph, unsigned travMask =~0 ) { return findMapNode(graph, travMask); }
/**
* Returns true if the realized terrain model is geocentric, false if
* it is flat/projected.
*/
bool isGeocentric() const;
/**
* Accesses the group node that contains all the ModelLayers.
*/
osg::Group* getModelLayerGroup() const;
/**
* Accesses the root node for a specific ModelLayer.
*/
osg::Node* getModelLayerNode( ModelLayer* layer ) const;
/**
* Adds a node that decorates the terrain groups
*/
void addTerrainDecorator( osg::Group* decorator );
/**
* Removes a node previously added via addTerrainDecorator.
*/
void removeTerrainDecorator( osg::Group* decorator );
/**
* Gets the overlay decorator in this mapnode. Usually you do not need to
* access this directly. Instead install a DrapeableNode in the scene graph.
*/
OverlayDecorator* getOverlayDecorator() { return _overlayDecorator; }
/**
* Gets the engine properties associated with this node. The engine
* properties dictate how the map engine will create scene graph elements.
*/
const MapNodeOptions& getMapNodeOptions() const;
/**
* Gets the underlying terrain engine that renders the terrain surface of the map.
*/
TerrainEngineNode* getTerrainEngine() const;
/**
* Gets the Config object serializing external data. External data is information
* that osgEarth itself does not control, but that an app can include in the
* MapNode for the purposes of including it in a .earth file.
*/
Config& externalConfig() { return _externalConf; }
const Config& externalConfig() const { return _externalConf; }
/**
* Sets a custom texture compositor technique on the underlying terrain engine.
* This method is here b/c just calling getTerrainEngine()->getTextureCompositor()
* ->setTechnique() has problems (with init order of the terrain engine). Someday
* this needs to be cleaned up.
*/
void setCompositorTechnique( class TextureCompositorTechnique* tech );
public: // special purpose
/**
* Constructs a mapnode, optionally specifying whether th intialize the
* data sources in the map. Typically you would only use this CTOR if you are
* strictly using the MapNode for serialization.
*/
MapNode( Map* map, const MapNodeOptions& options, bool initMap );
public: //override osg::Node
virtual osg::BoundingSphere computeBound() const;
virtual void traverse( class osg::NodeVisitor& nv );
protected:
virtual ~MapNode();
private:
unsigned int _id;
osg::ref_ptr<Map> _map;
osg::ref_ptr< osg::Group > _models;
osg::ref_ptr< osg::Group > _overlayModels;
OverlayDecorator* _overlayDecorator;
MapNodeOptions _mapNodeOptions;
Config _externalConf;
// keep track of nodes created by model layers
typedef std::map<ModelLayer*,osg::Node*> ModelLayerNodeMap;
ModelLayerNodeMap _modelLayerNodes;
osg::Group* _maskLayerNode;
unsigned _lastNumBlacklistedFilenames;
osg::ref_ptr<TerrainEngineNode> _terrainEngine;
bool _terrainEngineInitialized;
osg::Group* _terrainEngineContainer;
public: // MapCallback proxy
void onModelLayerAdded( ModelLayer*, unsigned int );
void onModelLayerRemoved( ModelLayer* );
void onModelLayerMoved( ModelLayer* layer, unsigned int oldIndex, unsigned int newIndex );
public:
void onModelLayerOverlayChanged( ModelLayer* layer );
public:
struct TileRangeData : public osg::Referenced {
TileRangeData(double minRange, double maxRange) : _minRange( minRange ), _maxRange( maxRange ) { }
double _minRange;
double _maxRange;
};
private:
osg::ref_ptr< ModelLayerCallback > _modelLayerCallback;
osg::ref_ptr< MapCallback > _mapCallback;
void init();
MapNodeCullData* getCullData(osg::Camera* camera) const;
typedef std::map<osg::Camera*, osg::ref_ptr<MapNodeCullData> > CullDataMap;
mutable CullDataMap _cullData;
mutable Threading::ReadWriteMutex _cullDataMutex;
};
} // namespace osgEarth
#endif // OSGEARTH_MAPNODE_H
|