VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtVrlinkArcVisualizers.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
12 
13 #pragma once
14 
15 #include <vrvVrl/vrvVrl.h>
21 
24 
25 #include <matrix/topoCoord.h>
26 
27 namespace makVrv
28 {
29  namespace DT_PROTOCOL_NAMESPACE
30  {
31  template <typename T>
32  class DtVrlinkArcVisualizer : public T
33  {
34  public:
37  int modelSet)
38  : T(simulation, listener, modelSet)
39  , myVrlinkConnection((dynamic_cast<DtVrlinkConnection&>(simulation)))
41  {
42  this->myConnections.manageConnection(
44  &DtVrlinkArcVisualizer::resetSpatial,
45  this)));
46 
48  {
49  this->myConnections.manageConnection(myTacticalGraphicStateListener->signal_hostGlobalIdSet.connect(
51 
53  {
55 
56  if (this->myAttachedFlag)
57  {
58  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
59  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
60  }
61  }
62  }
63  }
64 
67  {
70  }
71 
73  void setPosition(int index, const DtVector& v)
74  {
75  DtVector local;
76 
78 
79  T::setPosition(index, local);
80  }
81 
84  void setColor(float r, float g, float b, float a)
85  {
86  if ((r == 0) && (g == 0) && (b == 0))
87  {
88  this->useDefaultColor();
89  }
90  else
91  {
92  T::setColor(r, g, b, a);
93  }
94  }
95 
96  void setHostGlobalId(const std::string& id)
97  {
98  // Make sure no previous setHostGlobalId calls leave connections to the
99  // entity listener lying around
102 
103  this->myHostToBeCreated = DtGlobalObjectDesignator(id.c_str());
104 
105  if (id.empty() || id == "0:0:0")
106  {
107  if (this->myAttachedFlag)
108  {
109  this->setAttached(0);
110  }
111  return;
112  }
113 
115  DtEntityVisualizerSet* hostVis = entityVis->findVisualizerSet(DtGlobalObjectDesignator(id.c_str()), this->myModelSet);
116  //If the host does not yet exist.
117  if (!hostVis)
118  {
119  //Disembark from current.
120  if (this->myAttachedFlag)
121  {
122  this->setAttached(0);
123  }
124  //Setup value to wait.
127  return;
128  }
129 
130  // The entity is embarking on an entity that's been created
131  this->setAttached(hostVis->uniqueID());
132  }
133 
134  protected:
135 
137  {
138  if (esl.esr().globalId() == myHostToBeCreated)
139  {
142  setHostGlobalId(this->myHostToBeCreated.string());
143  }
144  }
145 
147  {
148  T::setupArc(f);
149 
150  if (this->myAttachedFlag)
151  {
152  this->myOffsetPoints.clear();
153  this->myRelativeLocation = DtVector::zero();
154 
155  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
156  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
157  }
158  }
159 
160  void endAttached()
161  {
162  T::endAttached();
163  this->myOffsetPoints.clear();
164  }
165 
167  {
168  T::startAttached();
169 
170  this->myOffsetPoints.clear();
171 
172  if (this->myArc)
173  {
174  this->myArc->setPosition(0, DtVector::zero());
175  }
176 
178  {
179  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
180  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
181  }
182  }
183 
184  protected:
187  std::vector<DtVector> myOffsetPoints;
189 
190  private:
193 
196 
199  };
200 
201  // @{
206  // @}
207  }
208 }
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
static DtEntityElementProcessor * findInstance(DtVrlinkConnection &conn)
Find an instance registered with a connection.
DtStateVisualizerCreatorTemplate< DtVrlinkArcVisualizer< Dt2DArcVisualizer > > DtVrlink2DArcVisualizerCreator
Creators that replace vrvCore representation of classes to allow coordinate translation.
Definition: DtVrlinkArcVisualizers.h:205
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
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
Interface class for an Arc Facade.
Definition: DtArcFacadeBase.h:50
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)