VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgChannelCompassInstance.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
15 #include <osg/Vec2>
16 #include <osg/ref_ptr>
17 #include <memory>
18 
19 namespace makVrv
20 {
21  class DtDe;
22  class DtChannel;
23  class DtChannelConfiguration;
24  class DtChannelManager;
25  class DtOsgChannel;
26  class DtOverlayRendererInterface;
27  class DtQuadProxyInterface;
28  class DtWindowConfiguration;
29  class DtLineSegment;
30  class DtCoordinateSystem;
31  class DtOsgTextureWrapper;
32 
37  {
38  public:
39 
42 
44  virtual ~DtOsgChannelCompassInstance();
45 
47  DtOsgChannelCompassInstance() = delete;
48 
51 
53  DtOsgChannelCompassInstance &operator=(const DtOsgChannelCompassInstance &other) = delete;
54 
56  virtual void setVisible(bool isVisible);
57 
59  virtual bool visible();
60 
62  virtual void setChannelName( const std::string& deName,
63  const std::string& winName, const std::string& channelName );
64 
67  virtual void setModelDefinition( const std::string& modelDefinition );
68 
71  virtual void updateCompass( bool force);
72 
73  void updateLetter( bool &dirtyFlag, const std::string& filename,
74  int tickIndex, DtQuadProxyInterface* letterQuad,
75  DtOsgTextureWrapper* letterTexture, bool& force );
76 
78  virtual void setNorthLetterFilename( const std::string& filename );
79 
81  virtual void setSouthLetterFilename( const std::string& filename );
82 
84  virtual void setEastLetterFilename( const std::string& filename );
85 
87  virtual void setWestLetterFilename( const std::string& filename );
88 
90  virtual void setStarFilename(const std::string& filename);
91 
93  virtual void setDarkTickColor( float r, float g, float b, float a );
94 
96  virtual void setLightTickColor( float r, float g, float b, float a );
97 
100  virtual void setPixelRatio(float pixelRatio);
101 
102  protected:
103 
104  virtual void slot_channelCreated(DtChannelManager*, DtChannel*);
105 
106  virtual void slot_channelToBeDestroyed(DtChannelManager*, DtChannel*);
107 
108  virtual void slot_channelConfigurationModified( const std::string& deName,
109  const std::string& winName, const std::string& oldChannelName,
110  const DtChannelConfiguration& config);
111 
112  virtual void slot_windowConfigurationModified( const std::string& deName,
113  const std::string& winName, const DtWindowConfiguration& config );
114 
116  virtual void slot_coordinateSystemChanged();
117 
118  // Create the compass frame
119  void createCompass();
120 
121  // delete / clear the DtQuad and DtFilledPolygons, if they exist
122  void destroyCompass();
123 
124  // Creates the compass texture objects.
125  virtual void createTextures(DtDe& de);
126 
127  // Deletes the compass texture objects.
128  virtual void destroyTextures();
129 
130  // Calculates a frame position based on Location enum, margins, current window size
131  // and channel parameters
132  osg::Vec2 calcCenterPosition();
133 
134  void slot_update();
135 
136  DtLineSegment* createDarkSide( DtOverlayRendererInterface& overlay );
137  DtLineSegment* createLightSide( DtOverlayRendererInterface& overlay );
138 
139  // This type can be used to provide a list of vertices to the polygon objects
140  typedef std::vector<float> VertexList;
141 
143  static void rotate(const DtOsgChannelCompassInstance::VertexList& in,
144  double rad, DtOsgChannelCompassInstance::VertexList& out );
145 
147  static void translate( const DtOsgChannelCompassInstance::VertexList& in,
148  const osg::Vec2& translation, DtOsgChannelCompassInstance::VertexList& out );
149 
150  static void scale( const DtOsgChannelCompassInstance::VertexList& in,
152 
153  protected:
154 
155  struct TickMark
156  {
158  : lightSide(0)
159  , darkSide(0)
160  {
161  // intentional noop
162  }
163 
166  };
167 
170 
172 
173  std::unique_ptr<DtOsgTextureWrapper> myNorthTexture;
174  std::unique_ptr<DtOsgTextureWrapper> mySouthTexture;
175  std::unique_ptr<DtOsgTextureWrapper> myEastTexture;
176  std::unique_ptr<DtOsgTextureWrapper> myWestTexture;
177  std::unique_ptr<DtOsgTextureWrapper> myStarTexture;
178 
184  osg::Vec2 myCenterPosition;
185 
186  // Set to true at beginning and whenever the letter filename changes
192 
193  // NW, NE, SW, SE +, if missing, E, S, and W
194  TickMark myLargeTickMarks[7];
195 
196  // Every 15 degrees, skipping the 4 letters and 4 large tick marks
197  TickMark mySmallTickMarks[16];
198 
200 
204 
207  DtCoordinateSystem* myCoordinateSystem = nullptr;
208  };
209 }
210 
Definition: DtOsgChannelCompassInstance.h:155
DtOsgChannel * myChannel
Definition: DtOsgChannelCompassInstance.h:171
std::unique_ptr< DtOsgTextureWrapper > mySouthTexture
Definition: DtOsgChannelCompassInstance.h:174
DtQuadProxyInterface * myEastLetter
Definition: DtOsgChannelCompassInstance.h:181
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
std::unique_ptr< DtOsgTextureWrapper > myEastTexture
Definition: DtOsgChannelCompassInstance.h:175
DtQuadProxyInterface * myStarQuad
Definition: DtOsgChannelCompassInstance.h:183
DtQuadProxyInterface * myNorthLetter
Definition: DtOsgChannelCompassInstance.h:179
bool mySouthLetterDirty
Definition: DtOsgChannelCompassInstance.h:188
TickMark myMagneticNorthMark
Definition: DtOsgChannelCompassInstance.h:202
TickMark myTrueNorthMark
Definition: DtOsgChannelCompassInstance.h:201
float myPixelRatio
Definition: DtOsgChannelCompassInstance.h:199
Interface for a DtChannelCompassInstance An object that draws a 2D compass.
Definition: DtChannelCompassInstance.h:21
TickMark()
Definition: DtOsgChannelCompassInstance.h:157
This owns a list of channel configurations.
Definition: DtWindowConfiguration.h:26
std::unique_ptr< DtOsgTextureWrapper > myStarTexture
Definition: DtOsgChannelCompassInstance.h:177
Contains makVrv::DtChannelCompassInstance class.
bool myWestLetterDirty
Definition: DtOsgChannelCompassInstance.h:190
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:58
The abstract Channel Class.
Definition: DtChannel.h:35
DtLineSegment * darkSide
Definition: DtOsgChannelCompassInstance.h:165
A class which represents a single line segment.
Definition: DtLineSegment.h:23
A single 2D quadrilateral.
Definition: DtQuadProxyInterface.h:21
std::unique_ptr< DtOsgTextureWrapper > myWestTexture
Definition: DtOsgChannelCompassInstance.h:176
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
bool myStarDirty
Definition: DtOsgChannelCompassInstance.h:191
vrvGraphics-based implementation of a 2D compass
Definition: DtOsgChannelCompassInstance.h:36
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtOsgTextureWrapper.h:24
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
Base class for handling DtChannels. Derived classes should override the tick() method and advance the...
Definition: DtChannelManager.h:32
std::vector< float > VertexList
Definition: DtOsgChannelCompassInstance.h:140
DtQuadProxyInterface * myWestLetter
Definition: DtOsgChannelCompassInstance.h:182
TickMark myDaggerMark
Definition: DtOsgChannelCompassInstance.h:203
Base class to provide boost signal/slot management.
DtSignalConnectionManager myPixelRatioConnection
Definition: DtOsgChannelCompassInstance.h:169
Configuration for a single channel Serialized and sent to remote displays as necessary to configure r...
Definition: DtChannelConfiguration.h:24
DtLineSegment * lightSide
Definition: DtOsgChannelCompassInstance.h:164
Contains DLL export macros.
bool myEastLetterDirty
Definition: DtOsgChannelCompassInstance.h:189
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
std::unique_ptr< DtOsgTextureWrapper > myNorthTexture
Definition: DtOsgChannelCompassInstance.h:173
DtQuadProxyInterface * mySouthLetter
Definition: DtOsgChannelCompassInstance.h:180
bool myNorthLetterDirty
Definition: DtOsgChannelCompassInstance.h:187
The DtOverlayRendererInterface implements the overlay concept. An overlay is a 2D scene that is drawn...
Definition: DtOverlayRendererInterface.h:80
DtSignalConnectionManager myConnections
Definition: DtOsgChannelCompassInstance.h:168
osg::Vec2 myCenterPosition
Definition: DtOsgChannelCompassInstance.h:184

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)