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

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)