VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtOsgChannelCompassInstance.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtOsgChannelCompassInstance.h,v $ $Revision: 1.17 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 
15 #include <vrvOsg/vrvOsg.h>
18 #include <osg/Vec2>
19 #include <osg/ref_ptr>
20 
21 namespace osg
22 {
23  class Texture;
24 }
25 
26 namespace makVrv
27 {
28  class DtDe;
29  class DtChannel;
30  class DtChannelConfiguration;
31  class DtChannelManager;
32  class DtOsgChannel;
33  class DtOverlayRenderer;
34  class DtQuad;
35  class DtWindowConfiguration;
36  class DtLineSegment;
37 
42  {
43  public:
46 
48  virtual ~DtOsgChannelCompassInstance();
49 
51  virtual void setVisible(bool isVisible);
52 
54  virtual bool visible();
55 
57  virtual void setChannelName( const std::string& deName,
58  const std::string& winName, const std::string& channelName );
59 
62  virtual void setModelDefinition( const std::string& modelDefinition );
63 
66  virtual void updateCompass( bool force);
67 
68  void updateLetter( bool &dirtyFlag, const std::string& filename,
69  int tickIndex, DtQuad* letterQuad,
70  osg::ref_ptr<osg::Texture>& letterTexture, bool& force );
71 
73  virtual void setNorthLetterFilename( const std::string& filename );
74 
76  virtual void setSouthLetterFilename( const std::string& filename );
77 
79  virtual void setEastLetterFilename( const std::string& filename );
80 
82  virtual void setWestLetterFilename( const std::string& filename );
83 
85  virtual void setDarkTickColor( float r, float g, float b, float a );
86 
88  virtual void setLightTickColor( float r, float g, float b, float a );
89 
90  protected:
91 
92  virtual void slot_channelCreated(DtChannelManager*, DtChannel*);
93 
94  virtual void slot_channelToBeDestroyed(DtChannelManager*, DtChannel*);
95 
96  virtual void slot_channelConfigurationModified( const std::string& deName,
97  const std::string& winName, const std::string& oldChannelName,
98  const DtChannelConfiguration& config);
99 
100  virtual void slot_windowConfigurationModified( const std::string& deName,
101  const std::string& winName, const DtWindowConfiguration& config );
102 
103  // Create the compass frame
104  void createCompass();
105 
106  // delete / clear the DtQuad and DtFilledPolygons, if they exist
107  void destroyCompass();
108 
109  // Calculates a frame position based on Location enum, margins, current window size
110  // and channel parameters
111  osg::Vec2 calcCenterPosition();
112 
113  void slot_update();
114 
115  DtLineSegment* createDarkSide( DtOverlayRenderer& overlay );
116  DtLineSegment* createLightSide( DtOverlayRenderer& overlay );
117 
118  // This type can be used to provide a list of vertices to the polygon objects
119  typedef std::vector<float> VertexList;
120 
122  static void rotate(const DtOsgChannelCompassInstance::VertexList& in,
123  double rad, DtOsgChannelCompassInstance::VertexList& out );
124 
126  static void translate( const DtOsgChannelCompassInstance::VertexList& in,
127  const osg::Vec2& translation, DtOsgChannelCompassInstance::VertexList& out );
128 
129  static void scale( const DtOsgChannelCompassInstance::VertexList& in,
131 
132  protected:
133 
134  struct TickMark
135  {
138  };
139 
142 
144 
145  osg::ref_ptr<osg::Texture> myNorthTexture;
146  osg::ref_ptr<osg::Texture> mySouthTexture;
147  osg::ref_ptr<osg::Texture> myEastTexture;
148  osg::ref_ptr<osg::Texture> myWestTexture;
149 
154  osg::Vec2 myCenterPosition;
155 
156  // Set to true at beginning and whenever the letter filename changes
161 
162  // NW, NE, SW, SE +, if missing, E, S, and W
163  TickMark myLargeTickMarks[7];
164 
165  // Every 15 degrees, skipping the 4 letters and 4 large tick marks
166  TickMark mySmallTickMarks[16];
167  };
168 }
169 

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)