VR-Forces 4.10 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) 2021 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  void setPositionAndOrientation(int vtx, const DtVector& position, const DtTaitBryan& orientation);
124 
126  // topographic coordinate system (x north, y east, z down)
127  void setTopographicOrientation( int vtx,
128  const DtTaitBryan& topoOrientation );
129 
131  void getOrientation( int vtx, DtTaitBryan& orientation ) const;
132 
134  // topographic coordinate system (x north, y east, z down)
135  void getTopographicOrientation( int vtx, DtTaitBryan& orientation ) const;
136 
140  DtTaitBryan getTopographicOrientation(const DtVector& geocLocation, const DtTaitBryan& geocOrientation) const;
141 
143  void getOrientation( int vtx, DtQuat& orientation ) const;
144 
147  virtual void transformToSceneObjectCoord(const DtVector& dbCoord, DtVector& soCoord);
148 
151  virtual void transformToDatabaseCoord(const DtVector& soCoord, DtVector& dbCoord);
152 
154  void setColor(float r, float g, float b, float a);
155 
158  void setModelSet( int modelSet );
159 
161  int modelSet() const;
162 
165  void setIsProp( bool isProp );
166 
168  bool isProp() const;
169 
171  void setIsSupportObject( bool b );
172 
174  bool isSupportObject();
175 
177  void setSolid( bool b );
178 
180  bool isSolid() const;
181 
183  DtElementID elementID() const;
184 
186  void setElementID( DtElementID elementID );
187 
189  DtUniqueID uniqueId() const;
190 
192  const ModelList& models() const;
193 
195  ModelList& models();
196 
198  const TransformList& transforms() const;
199 
201  virtual void removePosition(int);
202 
205  void setBoundingBoxSize(double minX, double maxX,
206  double minY, double maxY, double minZ, double maxZ);
207 
209  const DtVector& boundingBoxExtents() const;
210 
212  void getBoundingBoxExtents(double& x, double& y, double& z) const;
213 
215  const DtVector& boundingBoxCenter() const;
216 
218  void getBoundingBoxCenter(double& x, double& y, double& z) const;
219 
221  double boundingRadius() const;
222 
226  void setVisible( bool visible );
227 
232  bool isVisible() const;
233 
234  //{@
239  virtual void setBeingObserved(bool observed);
240  virtual bool beingObserved() const;
242 
244  void setUpdater(DtSceneObjectUpdater* updater);
245 
247  DtSceneObjectUpdater* findUpdater();
248  const DtSceneObjectUpdater* findUpdater() const;
249 
251  virtual float getAndResetMinModelDistance();
252 
255 
257  boost::signalslib::signal<void (DtModel*)> signal_modelAdded;
258 
260  boost::signalslib::signal<void (DtModel*)> signal_modelRemoved;
261 
263  boost::signalslib::signal< void (const DtUniqueID&) > signal_sceneObjectToBeDeleted;
264 
266  boost::signalslib::signal<void (DtSceneObject*)> signal_boundingVolumeChanged;
267 
269 
270  protected:
271 
273  void initializeModel( DtModel* modelInstanceOwner );
274 
276  void modelChanged( DtModel* model );
277 
280  // are not. I highly doubt that this works at all, so please ignore.
281  bool modelVisibilityRequested( DtModel* model, bool visible);
282 
284  void resetModelTransforms();
285 
288  void updateBoundingBoxViaContents();
289 
291  void calculateBoundingRadius();
292 
294  virtual void addModelConnections( DtModel* model );
295 
297  virtual void removeModelConnections( DtModel* model );
298 
299 
300  protected:
301 
307 
309  bool myIsProp;
320 
322  {
323  boost::signalslib::connection modelDestroyedConnection;
324  boost::signalslib::connection modelChangedConnection;
325  boost::signalslib::connection modelVisibilityConnection;
326  };
327  typedef std::pair<DtModel*, ModelConnections> ModelConnectionsPair;
328  typedef boost::unordered_map<DtModel*, ModelConnections> ModelConnectionsMap;
330  };
331 }
DtVector position
Definition: DtSceneObject.h:48
Definition: DtSceneObject.h:46
boost::unordered_map< DtModel *, ModelConnections > ModelConnectionsMap
Definition: DtSceneObject.h:328
boost::signalslib::signal< void(DtModel *)> signal_modelAdded
Signaled after a model has been added.
Definition: DtSceneObject.h:257
ModelList myModels
Definition: DtSceneObject.h:312
DtVector myBoundingBoxExtents
Definition: DtSceneObject.h:316
int myModelSet
Definition: DtSceneObject.h:308
double myBoundingRadius
Definition: DtSceneObject.h:317
Scene Object Updater.
Definition: DtSceneObjectUpdater.h:36
boost::signalslib::connection modelDestroyedConnection
Definition: DtSceneObject.h:323
Definition: DtSceneObject.h:55
boost::signalslib::signal< void(DtSceneObject *)> signal_boundingVolumeChanged
Emitted after the bounding volume of the object changes.
Definition: DtSceneObject.h:266
ModelSet
Definition: DtSceneObject.h:77
DtUniqueID DtElementID
The ElementID is a specific type of unique ID used to represent VR-Vantage uniquely defined elements...
Definition: DtUniqueID.h:23
boost::signalslib::connection modelChangedConnection
Definition: DtSceneObject.h:324
bool myIsDrawnSolid
Definition: DtSceneObject.h:311
bool origVisibility
Definition: DtSceneObject.h:58
DtVector myBoundingBoxCenter
Definition: DtSceneObject.h:315
bool myVisibleFlag
Definition: DtSceneObject.h:313
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
bool myIsProp
Definition: DtSceneObject.h:309
FindModelFunctor(const FindModelFunctor &fm)
Definition: DtSceneObject.h:65
bool myBeingObserved
Definition: DtSceneObject.h:319
DtModel * model
Definition: DtSceneObject.h:57
DtUniqueID myUniqueId
Definition: DtSceneObject.h:303
boost::signalslib::connection modelVisibilityConnection
Definition: DtSceneObject.h:325
DtVector myOffset
Definition: DtSceneObject.h:318
Definition: DtSceneObject.h:62
DtSceneObjectUpdater * myUpdater
Definition: DtSceneObject.h:306
DtElementID myElementID
Definition: DtSceneObject.h:305
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
FindModelFunctor(DtModel *aKey=0)
Definition: DtSceneObject.h:64
std::pair< DtModel *, ModelConnections > ModelConnectionsPair
Definition: DtSceneObject.h:327
bool myGroundClampTo
Definition: DtSceneObject.h:310
TransformList myTransforms
Definition: DtSceneObject.h:304
bool myCalculateBoundingBoxFlag
Definition: DtSceneObject.h:314
boost::signalslib::signal< void(const DtUniqueID &) > signal_sceneObjectToBeDeleted
Emitted before the scene object is destroyed.
Definition: DtSceneObject.h:263
A DtSceneObject represents an object that can be positioned in the scene by (possibly) attaching it t...
Definition: DtSceneObject.h:41
A model which owns a single model instance.
Definition: DtModel.h:55
Contains makVrv::DtUniqueID type.
ModelConnectionsMap myModelConnections
Definition: DtSceneObject.h:329
std::vector< ObjectTransform > TransformList
Definition: DtSceneObject.h:52
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
boost::signalslib::signal< void(DtModel *)> signal_modelRemoved
Signaled after the model has been removed.
Definition: DtSceneObject.h:260
Definition: DtSceneObject.h:321
DtDe & myDe
Definition: DtSceneObject.h:302
A utility Quaternion class.
Definition: DtQuat.h:19
DtTaitBryan orientation
Definition: DtSceneObject.h:49
std::vector< ModelRecord > ModelList
Definition: DtSceneObject.h:75
DtModel * myKey
Definition: DtSceneObject.h:72
voidpf uLong offset
Definition: ioapi.h:42
Contains DLL export macros.

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)