VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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>
23 
24 #include <matrix/vlVector.h>
25 #include <matrix/geodeticCoord.h>
26 
27 namespace makVrv
28 {
29  struct DtVrlinkSimulatedBaseState;
30  class DtSimEntry;
31 }
32 
33 namespace makVrf
34 {
35  struct DtVrfObjectDataState;
36 
38 
40  {
41  public:
43  DtStreamString(const std::string&);
44  DtStreamString(std::string*);
45  DtStreamString(int size, const char* buf);
46 
47  virtual void write(std::ostringstream&) const;
48  virtual void read(std::istringstream&);
49 
50  const std::string& value() const
51  {
52  return myValue;
53  }
54 
55  protected:
56  std::string myValue;
57  std::string* myInput;
58  };
59 
60  DT_DLL_VRFGUICORE std::ostringstream& operator<<(std::ostringstream&, const DtStreamString&);
61  DT_DLL_VRFGUICORE std::istringstream& operator>>(std::istringstream&, DtStreamString&);
62 
63  DT_DLL_VRFGUICORE std::ostringstream& operator<<(std::ostringstream&, const DtVector&);
64  DT_DLL_VRFGUICORE std::istringstream& operator>>(std::istringstream&, DtVector&);
65 
67 
68  template <typename Type>
70  {
71  public:
73  : myValue(t)
74  , myInput(0)
75  {
76  }
77 
78  DtStreamNumber(Type* t)
79  : myInput(t)
80  {
81  }
82 
83  void write(std::ostringstream& s) const
84  {
85  s << myValue << " ";
86  }
87 
88  void read(std::istringstream& s)
89  {
90  s >> myValue;
91  s.ignore();
92 
93  if (myInput)
94  {
95  *myInput = myValue;
96  }
97  }
98 
99  Type value() const
100  {
101  return myValue;
102  }
103 
104  protected:
105  Type myValue;
106  Type* myInput;
107  };
108 
109  template <typename Type> std::ostringstream& operator<<(std::ostringstream& s, const DtStreamNumber<Type>& num)
110  {
111  num.write(s);
112 
113  return s;
114  }
115 
116  template <typename Type> std::istringstream& operator>>(std::istringstream& s, DtStreamNumber<Type>& num)
117  {
118  num.read(s);
119 
120  return s;
121  }
122 
124  {
125  typedef std::vector<DtGeodeticCoord> CopyOffsets;
126 
127  public:
129  virtual ~DtCopyObject();
130 
131  public:
133  {
134  DtPasteNewName = 0x00000001,
135  DtPasteAppearance = 0x00000002,
136  DtPasteHeading = 0x00000004,
137  DtPasteEngagement = 0x00000008,
138  DtPastePlan = 0x00000010,
139  DtPasteAboveSeaLevel = 0x00000020,
140  DtPasteAboveTerrain = 0x00000040,
141  DtPasteFormation = 0x00000080,
142  DtPasteStateProperties = 0x00000100,
143 
144  DtAllPasteFlags = DtPasteNewName | DtPasteAppearance | DtPasteHeading | DtPasteEngagement | DtPastePlan |
145  DtPasteAboveTerrain
146  };
147 
148  public:
150  virtual void copy(makVrv::DtSimEntry*);
151 
154  virtual void read(const std::string& buf);
155 
157  virtual void cancel();
158 
159  const std::string& name() const
160  {
161  return myName;
162  }
163 
164  const DtUUID& uuid() const
165  {
166  return myUUID;
167  }
168 
170  virtual std::string copyPendingMessage() const;
171 
173  virtual std::string pastePendingMessage() const;
174 
176  virtual void setAltitudeClampType(DtAltitudeClampType);
177  DtAltitudeClampType altitudeClampType() const;
178 
179  void setType(int t)
180  {
181  myType = t;
182  }
183 
184  int type() const
185  {
186  return myType;
187  }
188 
189  void setBuffer(const std::string& b)
190  {
191  myBuffer = b;
192  }
193 
194  const std::string& buffer() const
195  {
196  return myBuffer;
197  }
198 
200  virtual DtVrfObjectFacadeInterface* facade() const
201  {
202  return 0;
203  }
204 
206  virtual bool preserveOffsets() const;
207 
208  protected:
211  virtual void write(std::ostringstream& str, const makVrv::DtVrlinkSimulatedBaseState* data, makVrv::DtUniqueID id);
212 
214  virtual void write(std::ostringstream& str, const DtVrfObjectDataState* data);
215 
218  virtual DtVrfObjectDataState* createReadableObjectStateData() const;
219  virtual makVrv::DtVrlinkSimulatedBaseState* createReadableStateData() const;
220 
223  virtual void read(std::istringstream& str, makVrv::DtVrlinkSimulatedBaseState* data);
224 
226  virtual void read(std::istringstream& str, DtVrfObjectDataState* data);
227 
229  virtual void checkCopyComplete();
230 
233  virtual bool copyOperationsPending() const;
234 
236  virtual void copyComplete();
237 
239  virtual bool cancelComplete() const;
240 
241  public:
246  virtual void paste(const DtVector&, int flags = DtAllPasteFlags);
247 
249  virtual DtGeodeticCoord center() const;
250  virtual DtVector localCenter() const;
251  virtual DtGeodeticCoord calculateCenter() const;
252 
255  virtual DtVector origin() const;
256 
258  virtual DtVector pasteOrigin() const;
259 
262  virtual void setGeometricCenter(const DtGeodeticCoord&);
263 
264  const DtGeodeticCoord& geometricCenter() const;
265 
267  virtual void createFacade();
268 
270  virtual void setOrigin(const DtGeodeticCoord&);
271 
272  const makVrv::DtVrlinkSimulatedBaseState* readableStateData() const
273  {
274  return myReadableStateData;
275  }
276 
278  virtual bool updateDataBeforeCopy() const;
279  virtual void setUpdateDataBeforeCopy(bool);
280 
281  protected:
283  virtual void readComplete(std::istringstream& str);
284 
287  virtual void checkPasteComplete();
288 
290  virtual bool pasteComplete() const;
291 
294  virtual void createObject(const DtVector&);
295 
297  virtual int generateRequestId();
298 
300  virtual double groundHeight(const DtVector& currentLocal) const;
301 
304  virtual void setupOffsets(const DtGeodeticCoord&);
305 
306  virtual void slot_onStateViewUpdated(DtVrlinkSimulatedBaseStateView* state, makVrv::DtSimEntry* simEntry);
307 
309  virtual DtVector offsetLocation(int, const DtVector& loc) const;
310 
315  virtual DtGeodeticCoord calculateOffsetPoint(const DtGeodeticCoord& start, const DtGeodeticCoord& end,
316  double& altAboveTerrain, double& altAboveSeaLevel) const;
317 
319  virtual DtVector localLocation(const DtGeodeticCoord&, int) const;
320 
321  public:
322  boost::signal<void (DtCopyObject*)> signal_copyCancelled;
323  boost::signal<void (DtCopyObject*, const std::string&)> signal_copied;
324  boost::signal<void (DtCopyObject*, const std::string&)> signal_copyOperationPending;
325 
326  boost::signal<void (DtCopyObject*)> signal_pasted;
327  boost::signal<void (DtCopyObject*, const std::string&)> signal_pasteOperationPending;
328  boost::signal<void (DtCopyObject*)> signal_pasteCancelled;
329 
330  protected:
332  std::ostringstream myOutput;
333  std::string myName;
335 
338 
339  mutable DtGeodeticCoord myCenter;
340 
342 
343  typedef std::vector<double> HeightOffsets;
344 
347 
349  DtReferenceEllipsoid myReferenceEllipsoid;
350 
351  int myType;
352  std::string myBuffer;
353 
354  DtGeodeticCoord myGeometricCenter;
355 
356  bool myIsLocal;
359  };
360 
364  {
365  public:
366  virtual DtCopyObject* create(makVrv::DtDe&) = 0;
367  };
368 }

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)