VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtVrlinkSpiderWebVisualizers.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
12 
13 #pragma once
14 
17 
18 #include <vrvVrl/vrvVrl.h>
23 
25 
26 #include <matrix/topoCoord.h>
27 
28 namespace makVrv
29 {
30  namespace DT_PROTOCOL_NAMESPACE
31  {
32  template <typename T>
33  class DtVrlinkSpiderWebVisualizer : public T
34  {
35  public:
38  DtStateListener& listener, int modelSet)
39  : T(simulation, listener, modelSet)
40  , myVrlinkConnection((dynamic_cast<DtVrlinkConnection&>(simulation)))
42  {
43  this->myConnections.manageConnection(
45  &DtVrlinkSpiderWebVisualizer::resetSpatial,
46  this)));
47 
49  {
50  this->myConnections.manageConnection(myTacticalGraphicStateListener->signal_hostGlobalIdSet.connect(
52 
54  {
56 
57  if (this->myAttachedFlag)
58  {
59  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
60  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
61  }
62  }
63  }
64  }
65 
68  {
71  }
72 
74  void setPosition(int index, const DtVector& v)
75  {
76  DtVector local;
77 
79 
80  T::setPosition(index, local);
81  }
82 
85  void setColor(float r, float g, float b, float a)
86  {
87  if ((r == 0) && (g == 0) && (b == 0))
88  {
89  this->useDefaultColor();
90  }
91  else
92  {
93  T::setColor(r, g, b, a);
94  }
95  }
96 
97  void setHostGlobalId(const std::string& id)
98  {
99  // Make sure no previous setHostGlobalId calls leave connections to the
100  // entity listener lying around
103 
104  this->myHostToBeCreated = DtGlobalObjectDesignator(id.c_str());
105 
106  if (id.empty() || id == "0:0:0")
107  {
108  if (this->myAttachedFlag)
109  {
110  this->setAttached(0);
111  }
112  return;
113  }
114 
116  DtEntityVisualizerSet* hostVis = entityVis->findVisualizerSet(DtGlobalObjectDesignator(id.c_str()), this->myModelSet);
117  //If the host does not yet exist.
118  if (!hostVis)
119  {
120  //Disembark from current.
121  if (this->myAttachedFlag)
122  {
123  this->setAttached(0);
124  }
125  //Setup value to wait.
128  return;
129  }
130 
131  // The entity is embarking on an entity that's been created
132  this->setAttached(hostVis->uniqueID());
133  }
134 
135  protected:
136 
138  {
139  if (esl.esr().globalId() == myHostToBeCreated)
140  {
143  setHostGlobalId(this->myHostToBeCreated.string());
144  }
145  }
146 
148  {
149  T::setupSpiderWeb(f);
150 
151  if (this->myAttachedFlag)
152  {
153  this->myOffsetPoints.clear();
154  this->myRelativeLocation = DtVector::zero();
155 
156  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
157  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
158  }
159  }
160 
161  void endAttached()
162  {
163  T::endAttached();
164  this->myOffsetPoints.clear();
165  }
166 
168  {
169  T::startAttached();
170 
171  this->myOffsetPoints.clear();
172 
173  if (this->mySpiderWeb)
174  {
175  this->mySpiderWeb->setPosition(0, DtVector::zero());
176  }
177 
179  {
180  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
181  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
182  }
183  }
184 
185  protected:
188  std::vector<DtVector> myOffsetPoints;
190 
191  private:
194 
197 
200  };
201 
202  // @{
207  // @}
208  }
209 }
DtStateVisualizerCreatorTemplate< DtVrlinkSpiderWebVisualizer< Dt2DSpiderWebVisualizer > > DtVrlink2DSpiderWebVisualizerCreator
Creators that replace vrvCore representation of classes to allow coordinate translation.
Definition: DtVrlinkSpiderWebVisualizers.h:206
void netToLocalPos(const DtVector &netpos, DtVector &localpos) const
All orientation conversions use radians Convert an entity&#39;s spatial information between network and d...
static DtEntityExistenceListener & instance(DtVrlinkConnection &conn)
Static instance accessor.
boost::signal< void()> signal_coordinateSystemChanged
Emitted when the coordinate system changed.
Definition: DtConnection.h:177
Definition: DtStateVisualizer.h:309
DtEntityVisualizerSet * findVisualizerSet(const DtGlobalObjectDesignator &id, unsigned int modelSet)
Find a visualizer sets by it&#39;s simulation id and model set.
Contains makVrv::DtEntityElementProcessor class.
The DtBaseConnection is an abstract class.
Definition: DtBaseConnection.h:37
binderNoArgs< _Fn > bind(const _Fn &_Func, const _Ty &_Left)
Definition: DtSTLUtilities.h:76
Contains the makVrv::DtSpiderWebFacadeBase class declaration.
static DtEntityElementProcessor * findInstance(DtVrlinkConnection &conn)
Find an instance registered with a connection.
virtual const std::vector< DtVector > & offsetPoints() const
boost::signal< void(DtVrlinkEntityStateListener &)> signal_entityDiscovered
Emitted whenever an entity is discovered.
Definition: DtEntityExistenceListener.h:115
#define DT_PROTOCOL_NAMESPACE
Make VR-Vantage VRLink code export with library #ifdef DL_DLL_IGCONVRLINK #undef DL_DLL_IGCONVRLINK #...
Definition: export.h:32
boost::signal< void(const std::string &)> signal_hostGlobalIdSet
Definition: DtTacticalGraphicStateListener.h:44
virtual const DtVector & relativeLocation() const
Interface class for a Spider Web Facade.
Definition: DtSpiderWebFacadeBase.h:49
The DtEntityElementProcessor will connect to the DtEntityExistenceListener and handle the creation of...
Definition: DtEntityElementProcessor.h:38
This class is a set of entity visualizers, all of the visualizers in this set must support the entity...
Definition: DtEntityVisualizerSet.h:27
The DtStateListener is an abstract class.
Definition: DtStateListener.h:21
Contains DLL export macros.
Contains makVrv::DtEntityExistenceListener class.
virtual DtUniqueID uniqueID() const
Returns unique id of mySceneObjectAgent, else 0.
const DtCoordinateSystem & coordinateSystem() const
Get the coordinate system.
virtual const DtGlobalObjectDesignator & hostGlobalId() const
Returns the parent this object might be attached to.

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)