/usr/include/osgEarthQt/DataManager is in libosgearth-dev 2.5.0+dfsg-8build1.
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 | /* -*-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 OSGEARTHQT_DATAMANAGER_H
#define OSGEARTHQT_DATAMANAGER_H 1
#include <osgEarthQt/Common>
#include <osgEarthQt/Actions>
#include <osgEarth/Map>
#include <osgEarth/MapNode>
#include <osgEarth/Viewpoint>
#include <osgEarthAnnotation/AnnotationNode>
#include <QObject>
namespace osgEarth { namespace QtGui
{
using namespace osgEarth;
using namespace osgEarth::Annotation;
using namespace osgEarth::QtGui;
struct DataManagerMapCallback;
struct DataManagerElevationLayerCallback;
struct DataManagerImageLayerCallback;
struct DataManagerModelLayerCallback;
//---------------------------------------------------------------------------
class OSGEARTHQT_EXPORT DataManager : public QObject, public osg::Referenced, public ActionManager
{
Q_OBJECT
public:
DataManager(osgEarth::MapNode* mapNode);
osgEarth::MapNode* MapNode() { return _mapNode.get(); }
osgEarth::Map* map() { return _mapNode->getMap(); }
void addAnnotation(osgEarth::Annotation::AnnotationNode* annotation, osg::Group* parent/*=0L*/);
void removeAnnotation(osgEarth::Annotation::AnnotationNode* annotation, osg::Group* parent=0L);
void getAnnotations(AnnotationVector& out_annotations) const;
void setSelectedDecoration(const std::string& decoration) { _selectedDecoration = decoration; }
void addSelectedAnnotation(osgEarth::Annotation::AnnotationNode* annotation);
void removeSelectedAnnotation(osgEarth::Annotation::AnnotationNode* annotation);
void setSelectedAnnotations(const AnnotationVector& annotations);
void clearSelectedAnnotations();
bool isSelected(osgEarth::Annotation::AnnotationNode* annotation);
void getViewpoints(std::vector<osgEarth::Viewpoint>& out_viewpoints) const;
public: //ActionManager
void addBeforeActionCallback( ActionCallback* cb );
void addAfterActionCallback( ActionCallback* cb );
bool doAction( void* sender, Action* action, bool reversible =true );
bool undoAction();
bool canUndo() const;
void clearUndoActions();
ReversibleAction* getNextUndoAction() const;
signals:
void mapChanged();
void selectionChanged(/*const AnnotationVector& selection*/);
void annotationAdded(osgEarth::Annotation::AnnotationNode* annotation);
void annotationRemoved(osgEarth::Annotation::AnnotationNode* annotation);
protected:
virtual ~DataManager() { }
void initialize();
void onMapChanged();
void onMapChanged(const osgEarth::MapModelChange& change);
private:
osg::ref_ptr<osgEarth::MapNode> _mapNode;
osg::ref_ptr<osgEarth::Map> _map;
Threading::ReadWriteMutex _dataMutex;
AnnotationVector _annotations;
AnnotationVector _selection;
std::string _selectedDecoration;
std::vector<osgEarth::Viewpoint> _viewpoints;
osg::ref_ptr<DataManagerElevationLayerCallback> _elevationCallback;
osg::ref_ptr<DataManagerImageLayerCallback> _imageCallback;
osg::ref_ptr<DataManagerModelLayerCallback> _modelCallback;
// ActionManager-related members
std::list< osg::ref_ptr<Action> > _undoStack;
typedef std::list< osg::ref_ptr<ActionCallback> > ActionCallbackList;
ActionCallbackList _beforeCallbacks;
ActionCallbackList _afterCallbacks;
int _maxUndoStackSize;
friend struct DataManagerMapCallback;
friend struct DataManagerElevationLayerCallback;
friend struct DataManagerImageLayerCallback;
friend struct DataManagerModelLayerCallback;
};
//---------------------------------------------------------------------------
struct DataManagerMapCallback : public osgEarth::MapCallback
{
DataManagerMapCallback(DataManager* dm) : _dm(dm) { }
void onMapModelChanged( const MapModelChange& change )
{
if (_dm.valid())
_dm->onMapChanged(change);
}
osg::observer_ptr<DataManager> _dm;
};
//---------------------------------------------------------------------------
struct DataManagerElevationLayerCallback : public osgEarth::ElevationLayerCallback
{
DataManagerElevationLayerCallback(DataManager* dm) : _dm(dm) { }
void onEnabledChanged(TerrainLayer* layer)
{
if (_dm.valid())
_dm->onMapChanged();
}
osg::observer_ptr<DataManager> _dm;
};
//---------------------------------------------------------------------------
struct DataManagerImageLayerCallback : public osgEarth::ImageLayerCallback
{
DataManagerImageLayerCallback(DataManager* dm) : _dm(dm) { }
void onOpacityChanged(ImageLayer* layer)
{
if (_dm.valid())
_dm->onMapChanged();
}
void onEnabledChanged(TerrainLayer* layer)
{
if (_dm.valid())
_dm->onMapChanged();
}
osg::observer_ptr<DataManager> _dm;
};
//---------------------------------------------------------------------------
struct DataManagerModelLayerCallback : public osgEarth::ModelLayerCallback
{
DataManagerModelLayerCallback(DataManager* dm) : _dm(dm) { }
void onEnabledChanged(ModelLayer* layer)
{
if (_dm.valid())
_dm->onMapChanged();
}
void onOverlayChanged(ModelLayer* layer)
{
if (_dm.valid())
_dm->onMapChanged();
}
osg::observer_ptr<DataManager> _dm;
};
} }
#endif // OSGEARTHQT_DATAMANAGER_H
|