VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
copyObject.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
13 
14 #pragma once
15 
16 #include <vrfGuiCore/vrfGuiCore.h>
19 #include <vrfutil/rwUUID.h>
20 
21 #include <vrvCore/DtDe.h>
22 #include <vrvCore/DtUniqueID.h>
24 
25 #include <matrix/vlVector.h>
26 #include <matrix/geodeticCoord.h>
27 
28 namespace makVrv
29 {
30  struct DtVrlinkSimulatedBaseState;
31  class DtSimEntry;
32 }
33 
34 namespace makVrf
35 {
36  struct DtVrfObjectDataState;
37 
39 
41  {
42  public:
44  DtStreamString(const std::string&);
45  DtStreamString(std::string*);
46  DtStreamString(int size, const char* buf);
47 
48  virtual void write(std::ostringstream&) const;
49  virtual void read(std::istringstream&);
50 
51  const std::string& value() const
52  {
53  return myValue;
54  }
55 
56  protected:
57  std::string myValue;
58  std::string* myInput;
59  };
60 
61  DT_DLL_VRFGUICORE std::ostringstream& operator<<(std::ostringstream&, const DtStreamString&);
62  DT_DLL_VRFGUICORE std::istringstream& operator>>(std::istringstream&, DtStreamString&);
63 
64  DT_DLL_VRFGUICORE std::ostringstream& operator<<(std::ostringstream&, const DtVector&);
65  DT_DLL_VRFGUICORE std::istringstream& operator>>(std::istringstream&, DtVector&);
66 
68 
69  template <typename Type>
71  {
72  public:
74  : myValue(t)
75  , myInput(0)
76  {
77  }
78 
79  DtStreamNumber(Type* t)
80  : myInput(t)
81  {
82  }
83 
84  void write(std::ostringstream& s) const
85  {
86  s << myValue << " ";
87  }
88 
89  void read(std::istringstream& s)
90  {
91  s >> myValue;
92  s.ignore();
93 
94  if (myInput)
95  {
96  *myInput = myValue;
97  }
98  }
99 
100  Type value() const
101  {
102  return myValue;
103  }
104 
105  protected:
106  Type myValue;
107  Type* myInput;
108  };
109 
110  template <typename Type> std::ostringstream& operator<<(std::ostringstream& s, const DtStreamNumber<Type>& num)
111  {
112  num.write(s);
113 
114  return s;
115  }
116 
117  template <typename Type> std::istringstream& operator>>(std::istringstream& s, DtStreamNumber<Type>& num)
118  {
119  num.read(s);
120 
121  return s;
122  }
123 
125  {
126  typedef std::vector<DtGeodeticCoord> CopyOffsets;
127 
128  public:
130  virtual ~DtCopyObject();
131 
132  public:
134  {
135  DtPasteNewName = 0x00000001,
136  DtPasteAppearance = 0x00000002,
137  DtPasteHeading = 0x00000004,
138  DtPasteEngagement = 0x00000008,
139  DtPastePlan = 0x00000010,
140  DtPasteAboveSeaLevel = 0x00000020,
141  DtPasteAboveTerrain = 0x00000040,
142  DtPasteFormation = 0x00000080,
143  DtPasteStateProperties = 0x00000100,
144 
145  DtAllPasteFlags = DtPasteNewName | DtPasteAppearance | DtPasteHeading | DtPasteEngagement | DtPastePlan |
146  DtPasteAboveTerrain
147  };
148 
149  public:
151  virtual void copy(makVrv::DtSimEntry*);
152 
155  virtual void read(const std::string& buf);
156 
158  virtual void cancel();
159 
160  const std::string& name() const
161  {
162  return myName;
163  }
164 
165  const DtUUID& uuid() const
166  {
167  return myUUID;
168  }
169 
171  virtual std::string copyPendingMessage() const;
172 
174  virtual std::string pastePendingMessage() const;
175 
177  virtual void setAltitudeClampType(DtAltitudeClampType);
178  DtAltitudeClampType altitudeClampType() const;
179 
180  void setType(int t)
181  {
182  myType = t;
183  }
184 
185  int type() const
186  {
187  return myType;
188  }
189 
190  void setBuffer(const std::string& b)
191  {
192  myBuffer = b;
193  }
194 
195  const std::string& buffer() const
196  {
197  return myBuffer;
198  }
199 
201  virtual DtVrfObjectFacadeInterface* facade() const
202  {
203  return 0;
204  }
205 
207  virtual bool preserveOffsets() const;
208 
209  protected:
212  virtual void write(std::ostringstream& str, const makVrv::DtVrlinkSimulatedBaseState* data, makVrv::DtUniqueID id);
213 
215  virtual void write(std::ostringstream& str, const DtVrfObjectDataState* data);
216 
219  virtual DtVrfObjectDataState* createReadableObjectStateData() const;
220  virtual makVrv::DtVrlinkSimulatedBaseState* createReadableStateData() const;
221 
224  virtual void read(std::istringstream& str, makVrv::DtVrlinkSimulatedBaseState* data);
225 
227  virtual void read(std::istringstream& str, DtVrfObjectDataState* data);
228 
230  virtual void checkCopyComplete();
231 
234  virtual bool copyOperationsPending() const;
235 
237  virtual void copyComplete();
238 
240  virtual bool cancelComplete() const;
241 
242  public:
247  virtual void paste(const DtVector&, int flags = DtAllPasteFlags);
248 
250  virtual DtGeodeticCoord center() const;
251  virtual DtVector localCenter() const;
252  virtual DtGeodeticCoord calculateCenter() const;
253 
256  virtual DtVector origin() const;
257 
259  virtual DtVector pasteOrigin() const;
260 
263  virtual void setGeometricCenter(const DtGeodeticCoord&);
264 
265  const DtGeodeticCoord& geometricCenter() const;
266 
268  virtual void createFacade();
269 
271  virtual void setOrigin(const DtGeodeticCoord&);
272 
273  const makVrv::DtVrlinkSimulatedBaseState* readableStateData() const
274  {
275  return myReadableStateData;
276  }
277 
279  virtual bool updateDataBeforeCopy() const;
280  virtual void setUpdateDataBeforeCopy(bool);
281 
282  protected:
284  virtual void readComplete(std::istringstream& str);
285 
288  virtual void checkPasteComplete();
289 
291  virtual bool pasteComplete() const;
292 
295  virtual void createObject(const DtVector&);
296 
298  virtual int generateRequestId();
299 
301  virtual double groundHeight(const DtVector& currentLocal) const;
302 
305  virtual void setupOffsets(const DtGeodeticCoord&);
306 
307  virtual void slot_onStateViewUpdated(DtVrlinkSimulatedBaseStateView* state, makVrv::DtSimEntry* simEntry);
308 
310  virtual DtVector offsetLocation(int, const DtVector& loc) const;
311 
316  virtual DtGeodeticCoord calculateOffsetPoint(const DtGeodeticCoord& start, const DtGeodeticCoord& end,
317  double& altAboveTerrain, double& altAboveSeaLevel) const;
318 
320  virtual DtVector localLocation(const DtGeodeticCoord&, int) const;
321 
322  virtual void forceUpdate(DtVrlinkSimulatedBaseStateView* stateView, makVrv::DtSimEntry* simEntry);
323 
324  public:
325  boost::signal<void (DtCopyObject*)> signal_copyCancelled;
326  boost::signal<void (DtCopyObject*, const std::string&)> signal_copied;
327  boost::signal<void (DtCopyObject*, const std::string&)> signal_copyOperationPending;
328 
329  boost::signal<void (DtCopyObject*)> signal_pasted;
330  boost::signal<void (DtCopyObject*, const std::string&)> signal_pasteOperationPending;
331  boost::signal<void (DtCopyObject*)> signal_pasteCancelled;
332 
333  protected:
335  std::ostringstream myOutput;
336  std::string myName;
338 
341 
342  mutable DtGeodeticCoord myCenter;
343 
345 
346  typedef std::vector<double> HeightOffsets;
347 
350 
352  DtReferenceEllipsoid myReferenceEllipsoid;
353 
354  int myType;
355  std::string myBuffer;
356 
357  DtGeodeticCoord myGeometricCenter;
358 
359  bool myIsLocal;
362 
363  bool myUpdated;
364 
366  };
367 
371  {
372  public:
373  virtual DtCopyObject* create(makVrv::DtDe&) = 0;
374  };
375 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)