VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgChannel3dViewCompassInstance.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>
16 #include <osg/Vec2>
17 #include <osg/Vec4>
18 #include <osg/ref_ptr>
19 
20 namespace osg
21 {
22  class Texture;
23 }
24 
25 namespace makVrv
26 {
27  class DtDe;
28  class DtChannel;
29  class DtChannelConfiguration;
30  class DtChannelManager;
31  class DtModelDefinition;
32  class DtOsgChannel;
33  class DtOverlayRenderer;
34  class DtQuad;
35  class DtWindowConfiguration;
36  class DtLineSegment;
37  class DtCoordinateSystem;
38 
48  {
49  public:
50 
53 
56 
59 
62  const DtOsgChannel3dViewCompassInstance &other) = delete;
63 
66  const DtOsgChannel3dViewCompassInstance &other) = delete;
67 
69  virtual void setVisible(bool isVisible);
70 
72  virtual bool visible();
73 
75  virtual void setChannelName(const std::string& deName,
76  const std::string& winName, const std::string& channelName);
77 
80  virtual void setModelDefinition(const std::string& modelDefinition);
81 
84  virtual void updateCompass( bool force);
85 
87  virtual void setDarkTickColor(float r, float g, float b, float a);
88 
90  virtual void setLightTickColor(float r, float g, float b, float a);
91 
93  virtual void setSymbolsFilename(const std::string& filename);
94 
97  virtual void setPixelRatio(float pixelRatio);
98 
99  protected:
100 
104  {
106  : numCharacters(0)
107  , lightSide(0)
108  , darkSide(0)
109  {
110  for (int i = 0; i < 4; ++i)
111  {
112  characterValue[i] = 0;
113  characters[i] = 0;
114  }
115  }
116 
118  unsigned char characterValue[4];
119  DtQuad* characters[4];
122  };
123 
125  virtual void slot_channelCreated(DtChannelManager*, DtChannel*);
126 
128  virtual void slot_channelToBeDestroyed(DtChannelManager*, DtChannel*);
129 
132  virtual void slot_channelConfigurationModified(const std::string& deName,
133  const std::string& winName, const std::string& oldChannelName,
134  const DtChannelConfiguration& config);
135 
138  virtual void slot_windowConfigurationModified( const std::string& deName,
139  const std::string& winName, const DtWindowConfiguration& config );
140 
143  virtual void slot_displayUnitUnitChanged(
144  const DtUnicode& displayUnitCollectionName,
145  const DtUnicode& displayUnitName, unsigned int newUnit,
146  unsigned int oldUnit);
147 
149  virtual void slot_update();
150 
152  virtual void slot_coordinateSystemChanged();
153 
156  bool updateCompassCharacter(const std::string& filename,
157  DtQuad* quad, osg::ref_ptr<osg::Texture>& texture,
158  const osg::Vec4& texCoords);
159 
161  virtual void parseModelDefinition(DtModelDefinition* definition);
162 
164  virtual void createCompass();
165 
167  void destroyCompass();
168 
171  osg::Vec2 calcCompassCenterPosition();
172 
174  DtLineSegment* createDarkSide(DtOverlayRenderer& overlay);
175 
177  DtLineSegment* createLightSide(DtOverlayRenderer& overlay);
178 
180  virtual bool updateOrientationUnits();
181 
183  virtual void updateCompass();
184 
189  virtual void computeCenteringOffsets(float* offsets,
190  const int numCharacters, const float characterWidth);
191 
195  virtual void computeHeadingString(const float radHeading,
196  std::string& outString);
197 
199  virtual void computeCharacterCoords(const unsigned char value,
200  osg::Vec4& coords);
201 
205  virtual void initCompassSymbolCharacterDisplay(CompassSymbol& symbol,
206  const std::string& text, DtOverlayRenderer& overlay);
207 
210  virtual void initPopoutSymbolCharacterDisplay(CompassSymbol& symbol,
211  DtOverlayRenderer& overlay);
212 
216  virtual bool initCompassSymbolCharacters(CompassSymbol& symbol);
217 
219  typedef std::vector<float> VertexList;
220 
222  static void rotate(const DtOsgChannel3dViewCompassInstance::VertexList& in,
224 
226  static void translate(
228  const osg::Vec2& translation,
230 
232  static void scale(const DtOsgChannel3dViewCompassInstance::VertexList& in,
234 
235  protected:
236 
239  struct TickMark
240  {
242  : lightSide(0)
243  , darkSide(0)
244  {
245  // intentional noop
246  }
247 
250  };
251 
254 
256 
258 
260 
261  int myCreateState; // 0 = need create, 1 = created, -1 = creation error
262 
264 
267  CompassSymbol myCompassSymbols[24];
272 
274 
277  DtCoordinateSystem* myCoordinateSystem = nullptr;
278  };
279 }
280 
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
DtSignalConnectionManager myConnections
Definition: DtOsgChannel3dViewCompassInstance.h:252
vrvGraphics-based implementation of a model-like object that draws a 3d view first person shooter sty...
Definition: DtOsgChannel3dViewCompassInstance.h:46
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
A stucture to define a set of characters and tickmark associated with a direction on the compass...
Definition: DtOsgChannel3dViewCompassInstance.h:103
Interface for a DtChannel3dViewCompassInstance A model-like object that draws a 3d view first person ...
Definition: DtChannel3dViewCompassInstance.h:29
osg::Vec2 myCompassCenterPosition
Definition: DtOsgChannel3dViewCompassInstance.h:266
This owns a list of channel configurations.
Definition: DtWindowConfiguration.h:28
bool myCompassDirty
Definition: DtOsgChannel3dViewCompassInstance.h:271
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:52
CompassSymbol()
Definition: DtOsgChannel3dViewCompassInstance.h:105
A model definition Interaction any number of named parameters, and also can be used to store cached d...
Definition: DtModelDefinition.h:38
std::vector< float > VertexList
This type can be used to provide a list of vertices to the polygon objects.
Definition: DtOsgChannel3dViewCompassInstance.h:219
bool myIsExactHeadingAlwaysShown
Definition: DtOsgChannel3dViewCompassInstance.h:259
int myCreateState
Definition: DtOsgChannel3dViewCompassInstance.h:261
DtSignalConnectionManager myPixelRatioConnection
Definition: DtOsgChannel3dViewCompassInstance.h:253
int numCharacters
Definition: DtOsgChannel3dViewCompassInstance.h:117
A structure to contain light and dark line segments for a compass tick mark.
Definition: DtOsgChannel3dViewCompassInstance.h:239
Contains the DtSharedDisplayUnitsSettings class declaration.
The abstract Channel Class.
Definition: DtChannel.h:35
TickMark myPopoutL
Definition: DtOsgChannel3dViewCompassInstance.h:269
TickMark()
Definition: DtOsgChannel3dViewCompassInstance.h:241
A class which represents a single line segment.
Definition: DtLineSegment.h:22
CompassSymbol myPopoutSymbol
Definition: DtOsgChannel3dViewCompassInstance.h:268
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
TickMark myPopoutR
Definition: DtOsgChannel3dViewCompassInstance.h:270
float myPixelRatio
Definition: DtOsgChannel3dViewCompassInstance.h:263
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
OrientationUnits
Enumeration of the different orientation units.
Definition: DtDisplayUnitsSettingsRecord.h:101
DtSharedDisplayUnitsSettings::OrientationUnits myOrientationUnit
Definition: DtOsgChannel3dViewCompassInstance.h:273
Base class for handling DtChannels. Derived classes should override the tick() method and advance the...
Definition: DtChannelManager.h:32
A single 2D quadrilateral. None of this class&#39;s member functions are virtual because: ...
Definition: DtQuad.h:28
Base class to provide boost signal/slot management.
Configuration for a single channel Serialized and sent to remote displays as necessary to configure r...
Definition: DtChannelConfiguration.h:26
Contains makVrv::DtChannel3dViewCompassInstance class.
Contains DLL export macros.
DtOsgChannel * myChannel
Definition: DtOsgChannel3dViewCompassInstance.h:255
bool myCompassIsMagnetic
Definition: DtOsgChannel3dViewCompassInstance.h:257
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
DtLineSegment * darkSide
Definition: DtOsgChannel3dViewCompassInstance.h:249
DtLineSegment * darkSide
Definition: DtOsgChannel3dViewCompassInstance.h:121
DtLineSegment * lightSide
Definition: DtOsgChannel3dViewCompassInstance.h:120
osg::ref_ptr< osg::Texture > myCompassSymbolsTexture
Definition: DtOsgChannel3dViewCompassInstance.h:265
DtLineSegment * lightSide
Definition: DtOsgChannel3dViewCompassInstance.h:248
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)