VR-Forces 4.6.1 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 
139  virtual void transformToSceneObjectCoord(const DtVector& dbCoord, DtVector& soCoord);
140 
143  virtual void transformToDatabaseCoord(const DtVector& soCoord, DtVector& dbCoord);
144 
146  void setColor(float r, float g, float b, float a);
147 
150  void setModelSet( int modelSet );
151 
153  int modelSet() const;
154 
157  void setIsProp( bool isProp );
158 
160  bool isProp() const;
161 
163  void setIsSupportObject( bool b );
164 
166  bool isSupportObject();
167 
169  void setSolid( bool b );
170 
172  bool isSolid() const;
173 
175  DtElementID elementID() const;
176 
178  void setElementID( DtElementID elementID );
179 
181  DtUniqueID uniqueId() const;
182 
184  const ModelList& models() const;
185 
187  ModelList& models();
188 
190  const TransformList& transforms() const;
191 
193  virtual void removePosition(int);
194 
197  void setBoundingBoxSize(double minX, double maxX,
198  double minY, double maxY, double minZ, double maxZ);
199 
201  const DtVector& boundingBoxExtents() const;
202 
204  void getBoundingBoxExtents(double& x, double& y, double& z) const;
205 
207  const DtVector& boundingBoxCenter() const;
208 
210  void getBoundingBoxCenter(double& x, double& y, double& z) const;
211 
213  double boundingRadius() const;
214 
218  void setVisible( bool visible );
219 
224  bool isVisible() const;
225 
227  void setUpdater(DtSceneObjectUpdater* updater);
228 
230  DtSceneObjectUpdater* findUpdater();
231  const DtSceneObjectUpdater* findUpdater() const;
232 
235 
237  boost::signal<void (DtModel*)> signal_modelAdded;
238 
240  boost::signal<void (DtModel*)> signal_modelRemoved;
241 
243  boost::signal< void (const DtUniqueID&) > signal_sceneObjectToBeDeleted;
244 
246  boost::signal<void (DtSceneObject*)> signal_boundingVolumeChanged;
247 
249 
250  protected:
251 
253  void initializeModel( DtModel* modelInstanceOwner );
254 
256  void modelChanged( DtModel* model );
257 
260  // are not. I highly doubt that this works at all, so please ignore.
261  bool modelVisibilityRequested( DtModel* model, bool visible);
262 
264  void resetModelTransforms();
265 
268  void updateBoundingBoxViaContents();
269 
271  void calculateBoundingRadius();
272 
274  virtual void addModelConnections( DtModel* model );
275 
277  virtual void removeModelConnections( DtModel* model );
278 
279  protected:
280 
286 
288  bool myIsProp;
298 
300  {
301  boost::signalslib::connection modelDestroyedConnection;
302  boost::signalslib::connection modelChangedConnection;
303  boost::signalslib::connection modelVisibilityConnection;
304  };
305  typedef std::pair<DtModel*, ModelConnections> ModelConnectionsPair;
306  typedef boost::unordered_map<DtModel*, ModelConnections> ModelConnectionsMap;
308  };
309 }

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)