VR-Forces 4.8 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) 2019 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 
138  void getOrientation( int vtx, DtQuat& orientation ) const;
139 
142  virtual void transformToSceneObjectCoord(const DtVector& dbCoord, DtVector& soCoord);
143 
146  virtual void transformToDatabaseCoord(const DtVector& soCoord, DtVector& dbCoord);
147 
149  void setColor(float r, float g, float b, float a);
150 
153  void setModelSet( int modelSet );
154 
156  int modelSet() const;
157 
160  void setIsProp( bool isProp );
161 
163  bool isProp() const;
164 
166  void setIsSupportObject( bool b );
167 
169  bool isSupportObject();
170 
172  void setSolid( bool b );
173 
175  bool isSolid() const;
176 
178  DtElementID elementID() const;
179 
181  void setElementID( DtElementID elementID );
182 
184  DtUniqueID uniqueId() const;
185 
187  const ModelList& models() const;
188 
190  ModelList& models();
191 
193  const TransformList& transforms() const;
194 
196  virtual void removePosition(int);
197 
200  void setBoundingBoxSize(double minX, double maxX,
201  double minY, double maxY, double minZ, double maxZ);
202 
204  const DtVector& boundingBoxExtents() const;
205 
207  void getBoundingBoxExtents(double& x, double& y, double& z) const;
208 
210  const DtVector& boundingBoxCenter() const;
211 
213  void getBoundingBoxCenter(double& x, double& y, double& z) const;
214 
216  double boundingRadius() const;
217 
221  void setVisible( bool visible );
222 
227  bool isVisible() const;
228 
229  //{@
234  virtual void setBeingObserved(bool observed);
235  virtual bool beingObserved() const;
237 
239  void setUpdater(DtSceneObjectUpdater* updater);
240 
242  DtSceneObjectUpdater* findUpdater();
243  const DtSceneObjectUpdater* findUpdater() const;
244 
246  virtual float getAndResetMinModelDistance();
247 
250 
252  boost::signal<void (DtModel*)> signal_modelAdded;
253 
255  boost::signal<void (DtModel*)> signal_modelRemoved;
256 
258  boost::signal< void (const DtUniqueID&) > signal_sceneObjectToBeDeleted;
259 
261  boost::signal<void (DtSceneObject*)> signal_boundingVolumeChanged;
262 
264 
265  protected:
266 
268  void initializeModel( DtModel* modelInstanceOwner );
269 
271  void modelChanged( DtModel* model );
272 
275  // are not. I highly doubt that this works at all, so please ignore.
276  bool modelVisibilityRequested( DtModel* model, bool visible);
277 
279  void resetModelTransforms();
280 
283  void updateBoundingBoxViaContents();
284 
286  void calculateBoundingRadius();
287 
289  virtual void addModelConnections( DtModel* model );
290 
292  virtual void removeModelConnections( DtModel* model );
293 
294 
295  protected:
296 
302 
304  bool myIsProp;
315 
317  {
318  boost::signalslib::connection modelDestroyedConnection;
319  boost::signalslib::connection modelChangedConnection;
320  boost::signalslib::connection modelVisibilityConnection;
321  };
322  typedef std::pair<DtModel*, ModelConnections> ModelConnectionsPair;
323  typedef boost::unordered_map<DtModel*, ModelConnections> ModelConnectionsMap;
325  };
326 }
DtVector position
Definition: DtSceneObject.h:48
Definition: DtSceneObject.h:46
boost::unordered_map< DtModel *, ModelConnections > ModelConnectionsMap
Definition: DtSceneObject.h:323
ModelList myModels
Definition: DtSceneObject.h:307
DtVector myBoundingBoxExtents
Definition: DtSceneObject.h:311
int myModelSet
Definition: DtSceneObject.h:303
boost::signal< void(const DtUniqueID &) > signal_sceneObjectToBeDeleted
Emitted before the scene object is destroyed.
Definition: DtSceneObject.h:258
double myBoundingRadius
Definition: DtSceneObject.h:312
Scene Object Updater.
Definition: DtSceneObjectUpdater.h:36
boost::signalslib::connection modelDestroyedConnection
Definition: DtSceneObject.h:318
Definition: DtSceneObject.h:55
ModelSet
Definition: DtSceneObject.h:77
boost::signal< void(DtModel *)> signal_modelAdded
Signaled after a model has been added.
Definition: DtSceneObject.h:252
DtUniqueID DtElementID
The ElementID is a specific type of unique ID used to represent VR-Vantage uniquely defined elements...
Definition: DtUniqueID.h:26
boost::signal< void(DtSceneObject *)> signal_boundingVolumeChanged
Emitted after the bounding volume of the object changes.
Definition: DtSceneObject.h:261
boost::signalslib::connection modelChangedConnection
Definition: DtSceneObject.h:319
bool myIsDrawnSolid
Definition: DtSceneObject.h:306
bool origVisibility
Definition: DtSceneObject.h:58
DtVector myBoundingBoxCenter
Definition: DtSceneObject.h:310
bool myVisibleFlag
Definition: DtSceneObject.h:308
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
bool myIsProp
Definition: DtSceneObject.h:304
FindModelFunctor(const FindModelFunctor &fm)
Definition: DtSceneObject.h:65
bool myBeingObserved
Definition: DtSceneObject.h:314
DtModel * model
Definition: DtSceneObject.h:57
DtUniqueID myUniqueId
Definition: DtSceneObject.h:298
boost::signalslib::connection modelVisibilityConnection
Definition: DtSceneObject.h:320
DtVector myOffset
Definition: DtSceneObject.h:313
Definition: DtSceneObject.h:62
DtSceneObjectUpdater * myUpdater
Definition: DtSceneObject.h:301
DtElementID myElementID
Definition: DtSceneObject.h:300
unsigned long long DtUniqueID
Definition: DtUniqueID.h:22
FindModelFunctor(DtModel *aKey=0)
Definition: DtSceneObject.h:64
std::pair< DtModel *, ModelConnections > ModelConnectionsPair
Definition: DtSceneObject.h:322
bool myGroundClampTo
Definition: DtSceneObject.h:305
TransformList myTransforms
Definition: DtSceneObject.h:299
bool myCalculateBoundingBoxFlag
Definition: DtSceneObject.h:309
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:56
Contains makVrv::DtUniqueID type.
ModelConnectionsMap myModelConnections
Definition: DtSceneObject.h:324
std::vector< ObjectTransform > TransformList
Definition: DtSceneObject.h:52
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
Definition: DtSceneObject.h:316
DtDe & myDe
Definition: DtSceneObject.h:297
A utility Quaternion class.
Definition: DtQuat.h:22
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
boost::signal< void(DtModel *)> signal_modelRemoved
Signaled after the model has been removed.
Definition: DtSceneObject.h:255
Contains DLL export macros.

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)