VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgEarthPaperMapManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
13 
15 #include <vrvCore/DtTickable.h>
16 
17 #include <osgEarth/VisibleLayer>
18 
19 #include <map>
20 #include <set>
21 
22 namespace makVrv
23 {
24  class DtTerrainPatchObject;
25  class DtObserverObject;
26  class DtObserver;
27  class DtInputDriver;
28 
62  {
63  public:
65  DtOsgEarthPaperMapManager() = delete;
66 
68  virtual ~DtOsgEarthPaperMapManager();
69 
72 
74  DtOsgEarthPaperMapManager& operator=(const DtOsgEarthPaperMapManager&) = delete;
75 
78  virtual void addToGroups(std::string groupStr, osgEarth::VisibleLayer* layer, bool isect);
79 
82  virtual void addToGroup(std::string groupName, osgEarth::VisibleLayer* layer, bool isect);
83 
85  virtual void activateGroup(std::string groupName);
86 
88  std::string activeGroup();
89 
92  virtual void reset();
93 
95  virtual bool hasGroup(const std::string& groupName);
96 
98  virtual void updateAnyObserver3D();
99 
101  virtual void addLayer(osgEarth::Layer* layer);
102 
104  virtual void removeLayer(osgEarth::Layer* layer);
105 
107  virtual void printState();
108 
110  virtual std::vector<std::string> groupNames();
111 
114  virtual void update(DtTime tNow) override;
115 
118  virtual DtTime lastUpdateTime() const;
119 
121  virtual std::vector<std::string> getGroupsForLayer(osgEarth::VisibleLayer* layer);
122 
124  virtual bool layerInActiveGroup(osgEarth::VisibleLayer* layer);
125 
128  virtual void removeGroup(std::string groupName);
129 
130  protected:
133 
136 
138  virtual void slot_paperMapEnabledChanged(bool setting);
139 
141  virtual void slot_paperMapLayerTimeoutChanged(double timeout);
142 
144  virtual void slot_observerAdded(const std::string& observerName);
145 
147  virtual void slot_observerRemoved(const std::string& observerName);
148 
150  virtual void slot_onCurrentObserverChanged(DtInputDriver* inputDriver, DtObserver* observer);
151 
153  virtual void slot_observerGroupChanged(DtObserver* observer, std::string obsGroup);
154 
156  virtual void slot_projectionChanged(DtObserverObject* observer, bool is2D);
157 
159  virtual void slot_osgEarthMapNodeFound(DtTerrainPatchObject& tpo);
160 
162  virtual void slot_terrainPatchAboutToBeDeleted(DtTerrainPatchObject& patch);
163 
166  virtual void slot_paperMapIntersectionOverrideChanged(bool setting);
167 
168  public:
169 
171  static DtOsgEarthPaperMapManager& instance(DtDe& de);
172 
174  static const std::string& theClassName();
175 
176  protected:
177 
179 
180  // Represents a single VisibleLayer and its properties.
181  struct LayerState
182  {
183  osg::ref_ptr<osgEarth::VisibleLayer> layer; // reference to the layer in question
184  bool initialVisibility = true; // native visibility setting from the layer
185  bool intersectWhenHidden = false; // whether to intersect the layer when not visible
186  DtTime timeHidden; // GW: deprecate
187  bool layerInDefaultGroup = false; // whether the layer is in the "default" group
188  mutable osgEarth::Status layerStatus; // hold the status from a layer open attempt
189 
190  // to support std::set
191  bool operator < (const LayerState& rhs) const {
192  return layer < rhs.layer;
193  }
194  };
195 
196  // A single map contains a unique set of layers.
197  // A layer may belong to more than one map group.
198  using MapGroup = std::set<LayerState>;
199 
200  std::map<std::string, MapGroup> myMapGroups;
201 
202  // Which mapgroup is currently active
203  std::string myActiveGroupName = {};
204 
205  // Keeps track or which observers are in "2D" mode:
206  std::map<DtObserverObject*, bool> myObserverObj2DMap;
207 
208  // Whether ANY observer is in 3D mode.
209  bool myAnyObserverIn3D = true;
210 
211  // Keep track of when layers are closed or reopened
212  //LayerTimeMap myLayerTime;
213  //GW: remove this when necessary:
214  double myLayerTimeOut = 0.0;
215 
216  // Whether the entire feature is enabled
217  bool myPaperMapFeatureEnabled = true;
218 
219  // Whether the manager can override intersection settings (?)
220  bool myIntersectionOverrideEnabled = true;
221 
222  // Tracks the current observer
223  DtObserver* myCurrentObserver = nullptr;
224 
225  // Signals
226  //vrvSignalsLib::connection myLodScaleChangedConnection;
227  //vrvSignalsLib::connection myPaperMapLayerChangedConnection;
228  };
229 
233  {
234  public:
237 
240 
243 
246 
248  virtual DtOsgEarthPaperMapManager* create(DtDe& de);
249  };
250 }
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
#define DT_DLL_VRVOSGEARTH
Definition: vrvOsgEarth.h:21
osg::ref_ptr< osgEarth::VisibleLayer > layer
Definition: DtOsgEarthPaperMapManager.h:183
Definition: DtOsgEarthPaperMapManager.h:181
An abstract base class for objects that require updates. This object automatically adds itself to a D...
Definition: DtTickable.h:26
A DtTerrainPatchObject contains the methods for loading a file as a terrain. When loading a file as a...
Definition: DtTerrainPatchObject.h:35
osgEarth::Status layerStatus
Definition: DtOsgEarthPaperMapManager.h:188
A facade for a DtObserverObject.
Definition: DtObserver.h:38
This abstract base class defines the interface for OS-specific keyboard and mouse event listeners...
Definition: DtObserverObject.h:35
DtTime timeHidden
Definition: DtOsgEarthPaperMapManager.h:186
This class&#39;s main responsibility is to handle keyboard and mouse events from OSG (Qt events are route...
Definition: DtInputDriver.h:45
std::map< std::string, MapGroup > myMapGroups
Definition: DtOsgEarthPaperMapManager.h:200
DtOsgEarthPaperMapManagerCreator is used to create a DtOsgEarthPaperMapManager.
Definition: DtOsgEarthPaperMapManager.h:232
std::map< DtObserverObject *, bool > myObserverObj2DMap
Definition: DtOsgEarthPaperMapManager.h:206
Contains the declaration for makVrv::DtTickable.
Manager that adds, clears, activates/deactives groups (if any) read in by the DtPaperMapCallback The ...
Definition: DtOsgEarthPaperMapManager.h:61
Contains the DtPaperMapManagerSignaler class declaration.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
DtDe & myDe
Definition: DtOsgEarthPaperMapManager.h:178
std::set< LayerState > MapGroup
Definition: DtOsgEarthPaperMapManager.h:198
Contains DLL export macros.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)