VR-Forces 4.3 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 
20 #include <vrvCore/DtDe.h>
21 #include <vrvCore/DtUniqueID.h>
22 
23 #include <matrix/vlVector.h>
24 #include <matrix/geodeticCoord.h>
25 
26 namespace makVrv
27 {
28  struct DtVrlinkSimulatedBaseState;
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:
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 
166  virtual std::string copyPendingMessage() const;
167 
169  virtual std::string pastePendingMessage() const;
170 
172  virtual void setAltitudeClampType(DtAltitudeClampType);
173  DtAltitudeClampType altitudeClampType() const;
174 
175  void setType(int t)
176  {
177  myType = t;
178  }
179 
180  int type() const
181  {
182  return myType;
183  }
184 
185  void setBuffer(const std::string& b)
186  {
187  myBuffer = b;
188  }
189 
190  const std::string& buffer() const
191  {
192  return myBuffer;
193  }
194 
196  virtual DtVrfObjectFacadeInterface* facade() const
197  {
198  return 0;
199  }
200 
202  virtual bool preserveOffsets() const;
203 
204  protected:
207  virtual void write(std::ostringstream& str, const makVrv::DtVrlinkSimulatedBaseState* data, makVrv::DtUniqueID id);
208 
210  virtual void write(std::ostringstream& str, const DtVrfObjectDataState* data);
211 
214  virtual DtVrfObjectDataState* createReadableObjectStateData() const;
215  virtual makVrv::DtVrlinkSimulatedBaseState* createReadableStateData() const;
216 
219  virtual void read(std::istringstream& str, makVrv::DtVrlinkSimulatedBaseState* data);
220 
222  virtual void read(std::istringstream& str, DtVrfObjectDataState* data);
223 
225  virtual void checkCopyComplete();
226 
229  virtual bool copyOperationsPending() const;
230 
232  virtual void copyComplete();
233 
235  virtual bool cancelComplete() const;
236 
237  public:
242  virtual void paste(const DtVector&, int flags = DtAllPasteFlags);
243 
245  virtual DtGeodeticCoord center() const;
246  virtual DtVector localCenter() const;
247  virtual DtGeodeticCoord calculateCenter() const;
248 
251  virtual DtVector origin() const;
252 
254  virtual DtVector pasteOrigin() const;
255 
258  virtual void setGeometricCenter(const DtGeodeticCoord&);
259 
260  const DtGeodeticCoord& geometricCenter() const;
261 
263  virtual void createFacade();
264 
266  virtual void setOrigin(const DtGeodeticCoord&);
267 
268  const makVrv::DtVrlinkSimulatedBaseState* readableStateData() const
269  {
270  return myReadableStateData;
271  }
272 
274  virtual bool updateDataBeforeCopy() const;
275  virtual void setUpdateDataBeforeCopy(bool);
276 
277  protected:
279  virtual void readComplete(std::istringstream& str);
280 
283  virtual void checkPasteComplete();
284 
286  virtual bool pasteComplete() const;
287 
290  virtual void createObject(const DtVector&);
291 
293  virtual int generateRequestId();
294 
296  virtual double groundHeight(const DtVector& currentLocal) const;
297 
300  virtual void setupOffsets(const DtGeodeticCoord&);
301 
302  virtual void slot_onStateViewUpdated(DtVrlinkSimulatedBaseStateView* state, makVrv::DtSimEntry* simEntry);
303 
305  virtual DtVector offsetLocation(int, const DtVector& loc) const;
306 
311  virtual DtGeodeticCoord calculateOffsetPoint(const DtGeodeticCoord& start, const DtGeodeticCoord& end,
312  double& altAboveTerrain, double& altAboveSeaLevel) const;
313 
315  virtual DtVector localLocation(const DtGeodeticCoord&, int) const;
316 
317  public:
318  boost::signal<void (DtCopyObject*)> signal_copyCancelled;
319  boost::signal<void (DtCopyObject*, const std::string&)> signal_copied;
320  boost::signal<void (DtCopyObject*, const std::string&)> signal_copyOperationPending;
321 
322  boost::signal<void (DtCopyObject*)> signal_pasted;
323  boost::signal<void (DtCopyObject*, const std::string&)> signal_pasteOperationPending;
324  boost::signal<void (DtCopyObject*)> signal_pasteCancelled;
325 
326  protected:
328  std::ostringstream myOutput;
329  std::string myName;
331 
334 
335  mutable DtGeodeticCoord myCenter;
336 
338 
339  typedef std::vector<double> HeightOffsets;
340 
343 
345  DtReferenceEllipsoid myReferenceEllipsoid;
346 
347  int myType;
348  std::string myBuffer;
349 
350  DtGeodeticCoord myGeometricCenter;
351 
352  bool myIsLocal;
354  };
355 
359  {
360  public:
361  virtual DtCopyObject* create(makVrv::DtDe&) = 0;
362  };
363 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)