VR-Forces 4.1.1 Class Documentation
Dt3DSegmentedLineModelInstance.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
14 
15 #include <osg/Geode>
16 #include <osg/MatrixTransform>
17 
18 #include <boost/unordered_map.hpp>
19 
20 namespace makVrv
21 {
22  class Dt3DLineModelInstanceSegmentInterface;
23  class Dt3DLineModelInstanceSegment;
24  class DtOsgSegmentPickable;
25 
29  : public DtOsgModelInstance
30  {
31  public:
32 
35 
38 
40  virtual void setPosition( int vtx, const DtVector& position );
41 
44  virtual DtVector removePosition( int vtx );
45 
47  virtual void setWidth(float width);
48 
50  virtual void setColor(float r, float g, float b, float a);
51 
53  virtual void setStipplePattern( unsigned int pattern, int repeatFactor );
54 
57  virtual void setStyleSegments(const std::vector<double>& segmentPercentages);
58 
60  virtual void setSegmentColor(unsigned int segmentIndex,
61  float r, float g, float b, float a);
62 
64  virtual void setSegmentLightningStyle(unsigned int segmentIndex,
65  bool enableLightningStyle);
66 
68  virtual void setSegmentStartArrow(unsigned int segmentIndex,
69  bool enableArrow);
70 
72  virtual void setSegmentEndArrow(unsigned int segmentIndex,
73  bool enableArrow);
74 
77  virtual void setSegmentStipplePattern(unsigned int segmentIndex,
78  unsigned int stipplePattern, int repeatFactor);
79 
81  virtual void setSegmentWidth(unsigned int segmentWidth, double width);
82 
85  virtual void setSegmentStartColor( unsigned int segmentIndex, float r,
86  float g, float b, float a );
87 
90  virtual void setSegmentEndColor( unsigned int segmentIndex, float r,
91  float g, float b, float a );
92 
94  virtual void setTerrainIntersect(bool enabled);
95 
97  virtual void setModelSet( int modelSet );
98 
101  virtual bool realize(DtModelDefinition& definition);
102 
104  virtual void addToConnector( DtOsgSceneConnector* connector );
105 
107  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
108 
110  virtual void setDepthTestEnabled(bool enabled);
111 
113  virtual void setVisible(bool isVisible);
114 
116  virtual void setPickable( bool pickable );
117 
119  bool pickable() const;
120 
122  virtual void update();
123 
124  private:
125 
128 
131 
134 
135  protected:
136 
138  virtual Dt3DLineModelInstanceSegmentInterface* createSegment();
139 
141  Dt3DLineModelInstanceSegment& lineSegment( int i);
142 
144  const Dt3DLineModelInstanceSegment& lineSegment(int i) const;
145 
147  virtual void updatePickableSegments();
148 
151  virtual void adjustSegmentVisibility( int vtx, bool visible );
152 
154  virtual void resizeSegments(int size);
155 
157  virtual void resizeSegmentAttributes(int size);
158 
160  virtual void updateGeometry();
161 
163  virtual void updateAllSegmentAttributes();
164 
165  protected:
166  // These are in database coordinates - the segments are in local (line coordinates)
167  std::vector<osg::Vec3d> myVertices;
168 
171  bool myVisible;
172 
173  std::vector<double> mySegmentPercentages;
174  std::vector<Dt3DLineModelInstanceSegmentInterface*> mySegments;
175 
176  osg::ref_ptr<osg::Group> myGroup;
177 
178  // These are for use with DtOsgSegmentPickable
181 
182  double myWidth;
183  osg::Vec4 myColor;
184  unsigned int myStipplePattern;
186 
188  {
189  osg::Vec4 color[2];
191  bool endArrow;
192  bool lightning;
193  double width;
194  unsigned int stipplePattern;
196  };
197 
200  std::vector<SegmentAttributes> mySegmentAttributes;
201  };
202 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)