VR-Forces 4.2 Class Documentation
DtCopyObject.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 
20 #include <vrvCore/DtDe.h>
21 #include <vrvCore/DtUniqueID.h>
22 
23 #include <matrix/vlVector.h>
24 #include <matrix/geodCoord.h>
25 
26 namespace makVrv
27 {
29  class DtSimEntry;
30 }
31 
32 class DtVector;
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:
129  DtCopyObject(makVrv::DtDe&);
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 
144  DtAllPasteFlags = DtPasteNewName | DtPasteAppearance | DtPasteHeading | DtPasteEngagement | DtPastePlan | DtPasteAboveTerrain
145  };
146 
147  public:
149  virtual void copy(makVrv::DtSimEntry*);
150 
153  virtual void read(const std::string& buf);
154 
156  virtual void cancel();
157 
158  const std::string& name() const
159  {
160  return myName;
161  }
162 
164  virtual std::string copyPendingMessage() const;
165 
167  virtual std::string pastePendingMessage() const;
168 
170  virtual void setAltitudeClampType(DtAltitudeClampType);
171  DtAltitudeClampType altitudeClampType() const;
172 
173  void setType(int t)
174  {
175  myType = t;
176  }
177 
178  int type() const
179  {
180  return myType;
181  }
182 
183  void setBuffer(const std::string& b)
184  {
185  myBuffer = b;
186  }
187 
188  const std::string& buffer() const
189  {
190  return myBuffer;
191  }
192 
194  virtual DtVrfObjectFacadeInterface* facade() const
195  {
196  return 0;
197  }
198 
200  virtual bool preserveOffsets() const;
201 
202  protected:
205  virtual void write(std::ostringstream& str, const makVrv::DtVrlinkSimulatedBaseState* data, makVrv::DtUniqueID id);
206 
208  virtual void write(std::ostringstream& str, const DtVrfObjectDataState* data);
209 
212  virtual DtVrfObjectDataState* createReadableObjectStateData() const;
213  virtual makVrv::DtVrlinkSimulatedBaseState* createReadableStateData() const;
214 
217  virtual void read(std::istringstream& str, makVrv::DtVrlinkSimulatedBaseState* data);
218 
220  virtual void read(std::istringstream& str, DtVrfObjectDataState* data);
221 
223  virtual void checkCopyComplete();
224 
227  virtual bool copyOperationsPending() const;
228 
230  virtual void copyComplete();
231 
233  virtual bool cancelComplete() const;
234 
235  public:
240  virtual void paste(const DtVector&, int flags = DtAllPasteFlags);
241 
243  virtual DtGeodeticCoord center() const;
244  virtual DtVector localCenter() const;
245  virtual DtGeodeticCoord calculateCenter() const;
246 
249  virtual DtVector origin() const;
250 
252  virtual DtVector pasteOrigin() const;
253 
256  virtual void setGeometricCenter(const DtGeodeticCoord&);
257 
258  const DtGeodeticCoord& geometricCenter() const;
259 
261  virtual void createFacade();
262 
264  virtual void setOrigin(const DtGeodeticCoord&);
265 
266  const makVrv::DtVrlinkSimulatedBaseState* readableStateData() const
267  {
268  return myReadableStateData;
269  }
270 
272  virtual bool updateDataBeforeCopy() const;
273  virtual void setUpdateDataBeforeCopy(bool);
274 
275  protected:
277  virtual void readComplete(std::istringstream& str);
278 
281  virtual void checkPasteComplete();
282 
284  virtual bool pasteComplete() const;
285 
288  virtual void createObject(const DtVector&);
289 
291  virtual int generateRequestId();
292 
294  virtual double groundHeight(const DtVector& currentLocal) const;
295 
298  virtual void setupOffsets(const DtGeodeticCoord&);
299 
300  virtual void slot_onStateViewUpdated(DtVrlinkSimulatedBaseStateView* state, makVrv::DtSimEntry* simEntry);
301 
303  virtual DtVector offsetLocation(int, const DtVector& loc) const;
304 
309  virtual DtGeodeticCoord calculateOffsetPoint(const DtGeodeticCoord& start, const DtGeodeticCoord& end,
310  double& altAboveTerrain, double& altAboveSeaLevel) const;
311 
313  virtual DtVector localLocation(const DtGeodeticCoord&, int) const;
314 
315  public:
316  boost::signal<void (DtCopyObject*)> signal_copyCancelled;
317  boost::signal<void (DtCopyObject*, const std::string&)> signal_copied;
318  boost::signal<void (DtCopyObject*, const std::string&)> signal_copyOperationPending;
319 
320  boost::signal<void (DtCopyObject*)> signal_pasted;
321  boost::signal<void (DtCopyObject*, const std::string&)> signal_pasteOperationPending;
322  boost::signal<void (DtCopyObject*)> signal_pasteCancelled;
323 
324  protected:
325  makVrv::DtDe& myDe;
326  std::ostringstream myOutput;
327  std::string myName;
329 
331  makVrv::DtVrlinkSimulatedBaseState* myReadableStateData;
332 
333  mutable DtGeodeticCoord myCenter;
334 
336 
337  typedef std::vector<double> HeightOffsets;
338 
341 
343  DtReferenceEllipsoid myReferenceEllipsoid;
344 
345  int myType;
346  std::string myBuffer;
347 
348  DtGeodeticCoord myGeometricCenter;
349 
350  bool myIsLocal;
352  };
353 
357  {
358  public:
359  virtual DtCopyObject* create(makVrv::DtDe&) = 0;
360  };
361 }

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)