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) 2023 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 
18 namespace makVrv
19 {
20  class DtDe;
21  class DtChannel;
22  class DtChannelConfiguration;
23  class DtChannelManager;
24  class DtOsgChannel;
25  class DtOverlayRendererInterface;
26  class DtQuadProxyInterface;
27  class DtWindowConfiguration;
28  class DtLineSegment;
29  class DtCoordinateSystem;
30  class DtOsgTextureWrapper;
31 
36  {
37  public:
38 
41 
43  virtual ~DtOsgChannelCompassInstance();
44 
46  DtOsgChannelCompassInstance() = delete;
47 
50 
52  DtOsgChannelCompassInstance &operator=(const DtOsgChannelCompassInstance &other) = delete;
53 
55  virtual void setVisible(bool isVisible);
56 
58  virtual bool visible();
59 
61  virtual void setChannelName( const std::string& deName,
62  const std::string& winName, const std::string& channelName );
63 
66  virtual void setModelDefinition( const std::string& modelDefinition );
67 
70  virtual void updateCompass( bool force);
71 
72  void updateLetter( bool &dirtyFlag, const std::string& filename,
73  int tickIndex, DtQuadProxyInterface* letterQuad,
74  DtOsgTextureWrapper* letterTexture, bool& force );
75 
77  virtual void setNorthLetterFilename( const std::string& filename );
78 
80  virtual void setSouthLetterFilename( const std::string& filename );
81 
83  virtual void setEastLetterFilename( const std::string& filename );
84 
86  virtual void setWestLetterFilename( const std::string& filename );
87 
89  virtual void setStarFilename(const std::string& filename);
90 
92  virtual void setDarkTickColor( float r, float g, float b, float a );
93 
95  virtual void setLightTickColor( float r, float g, float b, float a );
96 
99  virtual void setPixelRatio(float pixelRatio);
100 
101  protected:
102 
103  virtual void slot_channelCreated(DtChannelManager*, DtChannel*);
104 
105  virtual void slot_channelToBeDestroyed(DtChannelManager*, DtChannel*);
106 
107  virtual void slot_channelConfigurationModified( const std::string& deName,
108  const std::string& winName, const std::string& oldChannelName,
109  const DtChannelConfiguration& config);
110 
111  virtual void slot_windowConfigurationModified( const std::string& deName,
112  const std::string& winName, const DtWindowConfiguration& config );
113 
115  virtual void slot_coordinateSystemChanged();
116 
117  // Create the compass frame
118  void createCompass();
119 
120  // delete / clear the DtQuad and DtFilledPolygons, if they exist
121  void destroyCompass();
122 
123  // Calculates a frame position based on Location enum, margins, current window size
124  // and channel parameters
125  osg::Vec2 calcCenterPosition();
126 
127  void slot_update();
128 
129  DtLineSegment* createDarkSide( DtOverlayRendererInterface& overlay );
130  DtLineSegment* createLightSide( DtOverlayRendererInterface& overlay );
131 
132  // This type can be used to provide a list of vertices to the polygon objects
133  typedef std::vector<float> VertexList;
134 
136  static void rotate(const DtOsgChannelCompassInstance::VertexList& in,
137  double rad, DtOsgChannelCompassInstance::VertexList& out );
138 
140  static void translate( const DtOsgChannelCompassInstance::VertexList& in,
141  const osg::Vec2& translation, DtOsgChannelCompassInstance::VertexList& out );
142 
143  static void scale( const DtOsgChannelCompassInstance::VertexList& in,
145 
146  protected:
147 
148  struct TickMark
149  {
151  : lightSide(0)
152  , darkSide(0)
153  {
154  // intentional noop
155  }
156 
159  };
160 
163 
165 
171 
177  osg::Vec2 myCenterPosition;
178 
179  // Set to true at beginning and whenever the letter filename changes
185 
186  // NW, NE, SW, SE +, if missing, E, S, and W
187  TickMark myLargeTickMarks[7];
188 
189  // Every 15 degrees, skipping the 4 letters and 4 large tick marks
190  TickMark mySmallTickMarks[16];
191 
193 
197 
200  DtCoordinateSystem* myCoordinateSystem = nullptr;
201  };
202 }
203 
Definition: DtOsgChannelCompassInstance.h:148
DtOsgChannel * myChannel
Definition: DtOsgChannelCompassInstance.h:164
DtQuadProxyInterface * myEastLetter
Definition: DtOsgChannelCompassInstance.h:174
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtQuadProxyInterface * myStarQuad
Definition: DtOsgChannelCompassInstance.h:176
DtQuadProxyInterface * myNorthLetter
Definition: DtOsgChannelCompassInstance.h:172
bool mySouthLetterDirty
Definition: DtOsgChannelCompassInstance.h:181
TickMark myMagneticNorthMark
Definition: DtOsgChannelCompassInstance.h:195
TickMark myTrueNorthMark
Definition: DtOsgChannelCompassInstance.h:194
DtOsgTextureWrapper * myWestTexture
Definition: DtOsgChannelCompassInstance.h:169
float myPixelRatio
Definition: DtOsgChannelCompassInstance.h:192
Interface for a DtChannelCompassInstance An object that draws a 2D compass.
Definition: DtChannelCompassInstance.h:21
TickMark()
Definition: DtOsgChannelCompassInstance.h:150
This owns a list of channel configurations.
Definition: DtWindowConfiguration.h:26
Contains makVrv::DtChannelCompassInstance class.
bool myWestLetterDirty
Definition: DtOsgChannelCompassInstance.h:183
DtOsgTextureWrapper * mySouthTexture
Definition: DtOsgChannelCompassInstance.h:167
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:55
The abstract Channel Class.
Definition: DtChannel.h:35
DtLineSegment * darkSide
Definition: DtOsgChannelCompassInstance.h:158
A class which represents a single line segment.
Definition: DtLineSegment.h:23
A single 2D quadrilateral.
Definition: DtQuadProxyInterface.h:21
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
bool myStarDirty
Definition: DtOsgChannelCompassInstance.h:184
vrvGraphics-based implementation of a 2D compass
Definition: DtOsgChannelCompassInstance.h:35
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
DtOsgTextureWrapper * myEastTexture
Definition: DtOsgChannelCompassInstance.h:168
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:133
DtQuadProxyInterface * myWestLetter
Definition: DtOsgChannelCompassInstance.h:175
TickMark myDaggerMark
Definition: DtOsgChannelCompassInstance.h:196
Base class to provide boost signal/slot management.
DtSignalConnectionManager myPixelRatioConnection
Definition: DtOsgChannelCompassInstance.h:162
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:157
Contains DLL export macros.
bool myEastLetterDirty
Definition: DtOsgChannelCompassInstance.h:182
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:72
DtQuadProxyInterface * mySouthLetter
Definition: DtOsgChannelCompassInstance.h:173
bool myNorthLetterDirty
Definition: DtOsgChannelCompassInstance.h:180
DtOsgTextureWrapper * myNorthTexture
Definition: DtOsgChannelCompassInstance.h:166
The DtOverlayRendererInterface implements the overlay concept. An overlay is a 2D scene that is drawn...
Definition: DtOverlayRendererInterface.h:80
DtOsgTextureWrapper * myStarTexture
Definition: DtOsgChannelCompassInstance.h:170
DtSignalConnectionManager myConnections
Definition: DtOsgChannelCompassInstance.h:161
osg::Vec2 myCenterPosition
Definition: DtOsgChannelCompassInstance.h:177

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)