VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtVrlinkBoxVisualizers.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
11 
12 #pragma once
13 
14 #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 DtVrlinkBoxVisualizer : public T
33  {
34  public:
36  int modelSet)
37  : T(simulation, listener, modelSet)
38  , myVrlinkConnection((dynamic_cast<DtVrlinkConnection&>(simulation)))
40  {
41  this->myConnections.manageConnection(
44  this ) ) );
45 
47  {
48  this->myConnections.manageConnection(myTacticalGraphicStateListener->signal_hostGlobalIdSet.connect(
50 
52  {
54 
55  if (this->myAttachedFlag)
56  {
57  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
58  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
59  }
60  }
61  }
62  }
63 
65  {
68  }
69 
70  void setHostGlobalId(const std::string& id)
71  {
72  // Make sure no previous setHostGlobalId calls leave connections to the
73  // entity listener lying around
76 
77  this->myHostToBeCreated = DtGlobalObjectDesignator(id.c_str());
78 
79  if(id.empty() || id == "0:0:0")
80  {
81  if(this->myAttachedFlag)
82  {
83  this->setAttached(0);
84  }
85  return;
86  }
87 
89  DtEntityVisualizerSet* hostVis = entityVis->findVisualizerSet(DtGlobalObjectDesignator(id.c_str()),this->myModelSet);
90  //If the host does not yet exist.
91  if (!hostVis)
92  {
93  //Disembark from current.
94  if (this->myAttachedFlag)
95  {
96  this->setAttached(0);
97  }
98  //Setup value to wait.
101  return;
102  }
103 
104  // The entity is embarking on an entity that's been created
105  this->setAttached(hostVis->uniqueID());
106  }
107 
109  virtual void setOrigin(const DtVector& v)
110  {
111  DtVector local;
112 
114 
115  T::setOrigin(local);
116  }
117 
119  virtual void addPoint(int index, const DtVector& v)
120  {
121  DtVector local;
122 
124 
125  T::addPoint(index, local);
126  }
127 
129  virtual void modifyPoint(int index, const DtVector& v)
130  {
131  DtVector local;
132 
134 
135  T::modifyPoint(index, local);
136  }
137 
138  virtual void setPoints(
140  {
142 
143  if (!this->myAttachedFlag)
144  {
145  DtEnvironmentalStateListener::ControlPointsList::iterator w = locals.begin();
146 
147  DtEnvironmentalStateListener::ControlPointsList::const_iterator i = v.begin();
148  DtEnvironmentalStateListener::ControlPointsList::const_iterator e = v.end();
149  for(;i != e;++i,++w)
150  {
152  }
153  }
154 
157  if ( this->myAreaFacade && !this->myAttachedUpdaterAgent)
158  {
159  this->myAreaFacade->resetOrigin();
160  }
161 
162  T::setPoints(locals);
163  }
164 
165  protected:
166 
168  {
169  if (esl.esr().globalId() == myHostToBeCreated)
170  {
173  setHostGlobalId(this->myHostToBeCreated.string());
174  }
175  }
176 
178  {
179  T::setupArea(f);
180 
181  if (this->myAttachedFlag)
182  {
183  this->myOffsetPoints.clear();
184  this->myRelativeLocation = DtVector::zero();
185 
186  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
187  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
188  }
189  }
190 
191  void endAttached()
192  {
193  T::endAttached();
194  this->myOffsetPoints.clear();
195  }
196 
198  {
200 
201  this->myOffsetPoints.clear();
202 
203  if (this->myAreaFacade)
204  {
205  this->myAreaFacade->setOrigin(DtVector::zero());
206  }
207 
209  {
210  this->setRelativeLocation(this->myTacticalGraphicStateListener->relativeLocation());
211  this->setOffsetPoints(this->myTacticalGraphicStateListener->offsetPoints());
212  }
213  }
214 
215  protected:
218  std::vector<DtVector> myOffsetPoints;
220  };
221 
224 
227  }
228 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)