VR-Forces 4.10 Class Documentation
 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) 2021 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/Vec4>
17 #include <osg/ref_ptr>
18 
19 namespace osg
20 {
21  class Texture;
22 }
23 
24 namespace makVrv
25 {
26  class DtDe;
27  class DtChannel;
28  class DtChannelConfiguration;
29  class DtChannelManager;
30  class DtModelDefinition;
31  class DtOsgChannel;
32  class DtOverlayRenderer;
33  class DtQuad;
34  class DtWindowConfiguration;
35  class DtLineSegment;
36 
47  {
48  public:
49 
52 
55 
58 
61 
64 
66  virtual void setVisible(bool isVisible);
67 
69  virtual bool visible();
70 
72  virtual void setChannelName( const std::string& deName,
73  const std::string& winName, const std::string& channelName );
74 
77  virtual void setModelDefinition( const std::string& modelDefinition );
78 
81  virtual void updateCompass( bool force);
82 
84  virtual void setDarkTickColor( float r, float g, float b, float a );
85 
87  virtual void setLightTickColor( float r, float g, float b, float a );
88 
90  virtual void setSymbolsFilename(const std::string& filename);
91 
94  virtual void setPixelRatio(float pixelRatio);
95 
96  protected:
97 
98  // \brief A stucture to define a set of characters and tickmark associated
99  // with a direction on the compass.
101  {
103  : numCharacters(0)
104  , lightSide(0)
105  , darkSide(0)
106  {
107  for (int i = 0; i < 3; ++i)
108  {
109  characterValue[i] = 0;
110  characters[i] = 0;
111  }
112  }
113 
114  int numCharacters; // number of active characters (generally 1, 2, or 3)
115  unsigned char characterValue[3];
116  DtQuad* characters[3];
119  };
120 
121  virtual void slot_channelCreated(DtChannelManager*, DtChannel*);
122 
123  virtual void slot_channelToBeDestroyed(DtChannelManager*, DtChannel*);
124 
125  virtual void slot_channelConfigurationModified( const std::string& deName,
126  const std::string& winName, const std::string& oldChannelName,
127  const DtChannelConfiguration& config);
128 
129  virtual void slot_windowConfigurationModified( const std::string& deName,
130  const std::string& winName, const DtWindowConfiguration& config );
131 
132  virtual void slot_update();
133 
136  bool updateCompassCharacter(const std::string& filename,
137  DtQuad* quad, osg::ref_ptr<osg::Texture>& texture,
138  const osg::Vec4& texCoords);
139 
140  // \brief Parse settings specific to the compass.
141  virtual void parseModelDefinition(DtModelDefinition* definition);
142 
143  // \brief Create the compass resources
144  virtual void createCompass();
145 
146  // \brief delete / clear the DtQuad and DtFilledPolygons, if they exist
147  void destroyCompass();
148 
149  // \brief Calculates the compass center position based on Location enum, margins, current window size
150  // and channel parameters
151  osg::Vec2 calcCompassCenterPosition();
152 
153  DtLineSegment* createDarkSide( DtOverlayRenderer& overlay );
154  DtLineSegment* createLightSide( DtOverlayRenderer& overlay );
155 
157  virtual void updateCompass();
158 
159  // \brief Computes texture coordinates for the given character.
160  virtual void computeCharacterCoords(const unsigned char value, osg::Vec4& coords);
161 
163  virtual void initCompassSymbolCharacterDisplay(CompassSymbol& symbol,
164  unsigned char charA, unsigned char charB, unsigned char charC, DtOverlayRenderer& overlay);
165 
167  virtual void initPopoutSymbolCharacterDisplay(CompassSymbol& symbol,
168  unsigned char charA, unsigned char charB, unsigned char charC, DtOverlayRenderer& overlay);
169 
172  virtual bool initCompassSymbolCharacters(CompassSymbol& symbol);
173 
174  // This type can be used to provide a list of vertices to the polygon objects
175  typedef std::vector<float> VertexList;
176 
178  static void rotate(const DtOsgChannel3dViewCompassInstance::VertexList& in,
180 
182  static void translate( const DtOsgChannel3dViewCompassInstance::VertexList& in,
183  const osg::Vec2& translation, DtOsgChannel3dViewCompassInstance::VertexList& out );
184 
186  static void scale( const DtOsgChannel3dViewCompassInstance::VertexList& in,
188 
189  protected:
190 
191  struct TickMark
192  {
194  : lightSide(0)
195  , darkSide(0)
196  {
197  // intentional noop
198  }
199 
202  };
203 
207 
209 
211 
212  int myCreateState; // 0 = need create, 1 = created, -1 = creation error
213 
215 
218  CompassSymbol myCompassSymbols[24];
223  };
224 }
225 
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
DtSignalConnectionManager myConnections
Definition: DtOsgChannel3dViewCompassInstance.h:205
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
Definition: DtOsgChannel3dViewCompassInstance.h:100
Interface for a DtChannel3dViewCompassInstance A model-like object that draws a 3d view first person ...
Definition: DtChannel3dViewCompassInstance.h:27
osg::Vec2 myCompassCenterPosition
Definition: DtOsgChannel3dViewCompassInstance.h:217
This owns a list of channel configurations.
Definition: DtWindowConfiguration.h:28
bool myCompassDirty
Definition: DtOsgChannel3dViewCompassInstance.h:222
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:77
CompassSymbol()
Definition: DtOsgChannel3dViewCompassInstance.h:102
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
Definition: DtOsgChannel3dViewCompassInstance.h:175
int myCreateState
Definition: DtOsgChannel3dViewCompassInstance.h:212
DtSignalConnectionManager myPixelRatioConnection
Definition: DtOsgChannel3dViewCompassInstance.h:206
int numCharacters
Definition: DtOsgChannel3dViewCompassInstance.h:114
Definition: DtOsgChannel3dViewCompassInstance.h:191
The abstract Channel Class.
Definition: DtChannel.h:30
DtDe & myDe
Definition: DtOsgChannel3dViewCompassInstance.h:204
TickMark myPopoutL
Definition: DtOsgChannel3dViewCompassInstance.h:220
TickMark()
Definition: DtOsgChannel3dViewCompassInstance.h:193
A class which represents a single line segment.
Definition: DtLineSegment.h:21
CompassSymbol myPopoutSymbol
Definition: DtOsgChannel3dViewCompassInstance.h:219
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
TickMark myPopoutR
Definition: DtOsgChannel3dViewCompassInstance.h:221
float myPixelRatio
Definition: DtOsgChannel3dViewCompassInstance.h:214
Base class for handling DtChannels.
Definition: DtChannelManager.h:32
A single 2D quadrilateral.
Definition: DtQuad.h:24
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:208
bool myCompassIsMagnetic
Definition: DtOsgChannel3dViewCompassInstance.h:210
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtLineSegment * darkSide
Definition: DtOsgChannel3dViewCompassInstance.h:201
DtLineSegment * darkSide
Definition: DtOsgChannel3dViewCompassInstance.h:118
DtLineSegment * lightSide
Definition: DtOsgChannel3dViewCompassInstance.h:117
osg::ref_ptr< osg::Texture > myCompassSymbolsTexture
Definition: DtOsgChannel3dViewCompassInstance.h:216
DtLineSegment * lightSide
Definition: DtOsgChannel3dViewCompassInstance.h:200
The DtOverlayRenderer implements the overlay concept.
Definition: DtOverlayRenderer.h:23

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)