VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtSceneObject.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtUniqueID.h>
14 #include <matrix/vlVector.h>
15 #include <matrix/vlTaitBryan.h>
16 
17 #include <vrvUtil/signalslib.h>
18 
19 #include <boost/unordered_map.hpp>
20 
21 namespace makVrv
22 {
23  class DtDe;
24  class DtModel;
25  class DtQuat;
26  class DtSceneObjectUpdater;
27 
42  {
43 
44  public:
45 
47  {
49  DtTaitBryan orientation;
50  };
51 
52  typedef std::vector<ObjectTransform> TransformList;
53 
54  // A record which stores a model and it's visibility.
55  struct ModelRecord
56  {
59  };
60 
61  // Utility functor object for using std::find_if with the ModelList.
63  {
64  FindModelFunctor(DtModel* aKey = 0) : myKey(aKey) {}
65  FindModelFunctor(const FindModelFunctor& fm) : myKey(fm.myKey) {}
66 
67  bool operator() (const DtSceneObject::ModelRecord& rec) const
68  {
69  return myKey == rec.model;
70  }
71 
73  };
74 
75  typedef std::vector<ModelRecord> ModelList;
76 
77  enum ModelSet
78  {
79  ModelSet_Unspecified = -1,
80  ModelSet_3D = 0,
81  ModelSet_3DColorized = 1,
82  ModelSet_2DIcons = 5
83  };
84 
86  DtSceneObject( DtDe& de, DtUniqueID id );
87 
89  virtual ~DtSceneObject();
90 
93  void addModel(DtModel* model, int visualizerType );
94 
96  void removeModel(DtModel* model );
97 
99  void removeModels();
100 
103  void setPosition( int vtx, const DtVector& position );
104 
106  void addPosition( int vtx, const DtVector& position );
107 
109  void getPosition( int vtx, DtVector& position ) const;
110 
114  void setOffset( const DtVector& offset );
115 
117  void getOffset( DtVector& offset ) const;
118 
120  void setOrientation( int vtx, const DtTaitBryan& orientation );
121 
123  // topographic coordinate system (x north, y east, z down)
124  void setTopographicOrientation( int vtx,
125  const DtTaitBryan& topoOrientation );
126 
128  void getOrientation( int vtx, DtTaitBryan& orientation ) const;
129 
131  // topographic coordinate system (x north, y east, z down)
132  void getTopographicOrientation( int vtx, DtTaitBryan& orientation ) const;
133 
135  void getOrientation( int vtx, DtQuat& orientation ) const;
136 
138  void setColor(float r, float g, float b, float a);
139 
142  void setModelSet( int modelSet );
143 
145  int modelSet() const;
146 
149  void setIsProp( bool isProp );
150 
152  bool isProp() const;
153 
155  void setIsSupportObject( bool b );
156 
158  bool isSupportObject();
159 
161  void setSolid( bool b );
162 
164  bool isSolid() const;
165 
167  DtElementID elementID() const;
168 
170  void setElementID( DtElementID elementID );
171 
173  DtUniqueID uniqueId() const;
174 
176  const ModelList& models() const;
177 
179  ModelList& models();
180 
182  const TransformList& transforms() const;
183 
185  virtual void removePosition(int);
186 
189  void setBoundingBoxSize(double minX, double maxX,
190  double minY, double maxY, double minZ, double maxZ);
191 
193  const DtVector& boundingBoxExtents() const;
194 
196  void getBoundingBoxExtents(double& x, double& y, double& z) const;
197 
199  const DtVector& boundingBoxCenter() const;
200 
202  void getBoundingBoxCenter(double& x, double& y, double& z) const;
203 
205  double boundingRadius() const;
206 
210  void setVisible( bool visible );
211 
216  bool isVisible() const;
217 
219  void setUpdater(DtSceneObjectUpdater* updater);
220 
222  DtSceneObjectUpdater* findUpdater();
223  const DtSceneObjectUpdater* findUpdater() const;
224 
227 
229  boost::signal<void (DtModel*)> signal_modelAdded;
230 
232  boost::signal<void (DtModel*)> signal_modelRemoved;
233 
235  boost::signal< void (const DtUniqueID&) > signal_sceneObjectToBeDeleted;
236 
238  boost::signal<void (DtSceneObject*)> signal_boundingVolumeChanged;
239 
241 
242  protected:
243 
245  void initializeModel( DtModel* modelInstanceOwner );
246 
248  void modelChanged( DtModel* model );
249 
252  // are not. I highly doubt that this works at all, so please ignore.
253  bool modelVisibilityRequested( DtModel* model, bool visible);
254 
256  void resetModelTransforms();
257 
260  void updateBoundingBoxViaContents();
261 
263  void calculateBoundingRadius();
264 
266  virtual void addModelConnections( DtModel* model );
267 
269  virtual void removeModelConnections( DtModel* model );
270 
271  protected:
272 
278 
280  bool myIsProp;
290 
292  {
293  boost::signalslib::connection modelDestroyedConnection;
294  boost::signalslib::connection modelChangedConnection;
295  boost::signalslib::connection modelVisibilityConnection;
296  };
297  typedef std::pair<DtModel*, ModelConnections> ModelConnectionsPair;
298  typedef boost::unordered_map<DtModel*, ModelConnections> ModelConnectionsMap;
300  };
301 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)