VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
controlObjectRepository.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include <vl/environmentProcessRepository.h>
11 #include <vlpi/appearance.h>
12 
15 
16 class Dt3dBoundingVolume;
17 
18 #include <vector>
19 #include <map>
20 
23 class DtEnvironmentalBoundingSphereRecord;
24 class DtEnvironmentalRectangularVolumeRecord;
26 class DtGlobalObjectDesignatorList;
27 
29 {
37 };
38 
40 {
54 };
55 
56 class DtEnvironmentalPointRecord;
57 
58 // class DtControlObjectRepository:
59 //
60 // Instances of DtControlObjectRepository are
62 
65 {
66 public:
67 
68  // default constructor
69  DtExtendedEnvironmentalDataRecord(const char* data, int length);
71 
75 
76  // destructor
78 
80 
81  // Returns a newly created instance of a DtIfVrfObjectData.
82  virtual DtEnvironmentalRecord * clone() const;
83 
86  virtual const char* networkData() const;
87  virtual const char* setNetworkData(const DtNetEnvironmentalRecord*);
88 
90  virtual int netRepSize() const;
91  virtual void setFromNet(const DtNetEnvironmentalRecord& buffer, int protocolVersion);
92 
93 protected:
94  virtual bool createNetworkRepresentation();
95  virtual bool resizeNetRep(int newSize);
96 
97 protected:
99  const char* myData;
100 };
101 
103 
106 {
107 public:
110 
113 
115  virtual void updateDataRecords(DtControlObjectRepository*);
116 
118  virtual void decodeDataRecords(DtControlObjectRepository*);
119 
121  virtual bool readFromRecord(const DtNetEnvironmentalRecord*);
122 };
123 
125 {
126 public:
127  typedef std::vector<DtVector> DtCOVertexList;
128  typedef std::vector<DtIttEnvironmentalProcessData*> DtGeometricDataList;
129  typedef std::map<int, DtIttSourceDataCreator> DtIttSourceDataMap;
130 
131 public:
132 
133  // default constructor
135 
136  // destructor
137  virtual ~DtControlObjectRepository();
138 
139  // copy constructor
141 
142  // assignment operator
144 
145  // Return a copy/empty object of the same type as this.
146  virtual DtStateRepository* clone(bool copy = false) const;
147 
148  virtual const DtControlObjectKind& kind() const;
149  virtual void setKind(const DtControlObjectKind& k);
150 
151  virtual const DtControlObjectCategory& category() const;
152  virtual void setCategory(const DtControlObjectCategory& c);
153 
154  const std::vector<DtVector>& vertexList() const;
155 
156  // updateExtensions()
157  // extracts the extended environmental process state information,
158  // if present, from the state repository
159  virtual void updateExtensions();
160 
161  // Compares us against the supplied state repository and returns what's
162  // changed. Since this is being called from a location where the vertex list
163  // is already being checked, we don't need to do it.
164  virtual int compare(const DtControlObjectRepository* rhs);
165 
166  // Returns what has changed since the last time we called compare
167  virtual int compareToMostRecent();
168 
169  // Returns true if our stashed location is different than our
170  // current location
171  virtual bool locationsDifferent(bool updateIfDifferent);
172  virtual void emptyVertexList();
173 
174  // Adds mappings between environmental record types and the
175  // type of information to read off of the network into local
176  // environmental data structures
177  static void initializePuffFactory();
178  static void addToPuffFactory(int iRecordType, DtIttSourceDataCreator fcn);
179  static DtIttSourceData* createPuffRecord(DtNetEnvironmentalRecord* geometric,
180  DtNetEnvironmentalRecord* source);
181  static DtIttSourceData* createPuffRecord(DtNetEnvironmentalRecord* rec);
182 
183  virtual void getBoundingVolume(DtVector& location, double& radius) const;
184 
185  const DtGeometricDataList& geometricRecords() const;
186  bool geometricRecordsChanged() const;
187  void clearGeometricRecordsChanged();
188 
189  // If myNeedVrfObjectDataUpdate is true, update the vrf object data record. Also sets
190  // all vrf specific data records into state repository. Called from publisher
191  virtual void updateDataRecords();
192 
193  // Subordinate information. Not currently used by VRF
194  virtual int numberOfSubordinates() const;
195  virtual bool getSubordinate(int i, DtGlobalObjectDesignator& d);
196  virtual const DtGlobalObjectDesignatorList& subordinates() const;
197  virtual DtGlobalObjectDesignatorList& subordinates();
198 
200  virtual void setExtendedData(const std::map<DtString, DtString>& ed);
201  virtual void setExtendedData(const DtString& key, const DtString& value);
202 
205  virtual double orientation() const;
206 
207 public:
208  // Sets the vertices to use in the publication of this object. Will create the environmental records (as needed),
209  // put them into the state repository structure and also the vertex list. This routine assumes the DtList contains DtVectors
210  virtual void setVertices(const DtList& pnt);
211  virtual void appendVertex(const DtVector&);
212  virtual void setVertex(int i, const DtVector&);
213  virtual void removeVertex(int i);
214 
215 public:
216  // Environmental record settings
217 
218  // Used to set in appearance value of env state record and vrf object data message
219  virtual void setObjectType(const DtObjectType&);
220 
221 
222  // Returns the force type from the environmental header record (if it exists), else
223  // returns neutral by default
224  virtual DtForceType forceType() const;
225  virtual void setForceType(DtForceType i);
226 
227  // Returns the color (rgb) value of this object
228  virtual int color() const;
229  virtual void setColor(int);
230 
231  // Returns the parent of this object
232  virtual const DtString& parent() const;
233  virtual void setParent(const DtString&);
234 
235  virtual const DtString& userData() const;
236  virtual void setUserData(const DtString&);
237 
238  virtual void setVrfObjectName(const DtString&);
239  virtual const DtString& vrfObjectName();
240 
241  virtual DtAppearance appearance() const;
242  virtual void setAppearance(const DtAppearance& app);
243 
244  virtual void setNumberOfSubordinates(int);
245  virtual void setSubordinate(int i, const DtGlobalObjectDesignator&);
246 
247  // Returns the parent this object might be attached to
248  virtual const DtGlobalObjectDesignator& hostGlobalId() const;
249  virtual void setHostGlobalId(const DtGlobalObjectDesignator&);
250 
252  virtual void clearHostGlobalId();
253 
262  virtual bool getFontInformation(DtString& font, int& fontSize) const;
263  virtual void setFontInformation(const DtString&, int fontSize);
264 
266  virtual bool getFontColor(unsigned int& color) const;
267  virtual void setFontColor(unsigned int color);
268 
269  virtual bool getArrowInformation(int& arrowHeadPlacement, int& arrowStyle, int& arrowSize) const;
270  virtual void setArrowInformation(int arrowHeadPlacement, int arrowStyle, int arrowSize);
271 
272 public:
280 
281  // In setting the bounding sphere radius, if a bounding sphere record does not exist, it
282  // will be created
283  virtual void setBoundingSphereRadius(double);
284  virtual double boundingSphereRadius() const;
285 
286  // Sets/gets the bounding sphere location. Will also create the record on set if it does not
287  // exist
288  virtual void setBoundingSphereLocation(const DtVector&);
289  virtual const DtVector& boundingSphereLocation() const;
290 
291  bool hasBoundingSphereRecord() const;
292 
293 public:
301 
302  bool hasBoundingRectRecord() const;
303 
304  virtual void setBoundingExtent(const DtVector&);
305  const DtVector& boundingExtent() const;
306 
307  virtual void setBoundingCornerLocation(const DtVector&);
308  virtual const DtVector& boundingCornerLocation() const;
309 
310  virtual void setBoundingOrientation(const DtTaitBryan&);
311  const DtTaitBryan& boundingOrientation() const;
312 
313 public:
316  virtual void setProjected(bool);
317  virtual bool projected() const;
318 
319  virtual void setClosedFigure(bool);
320  virtual bool closedFigure() const;
321 
322  virtual void setBound2D(bool);
323  virtual bool bound2D() const;
324 
326  virtual void setFillStyle(int);
327  virtual int fillStyle() const;
328 
329  virtual void setLineStyle(int);
330  virtual int lineStyle() const;
331 
332  virtual void setLineWidth(int);
333  virtual int lineWidth() const;
334 
336  virtual void setPhysicalLineHeight(double);
337  virtual double physicalLineHeight() const;
338 
340  virtual void setPhysicalLineWidth(double);
341  virtual double physicalLineWidth() const;
342 
345  virtual void setRelativeLocation(const DtVector&);
346  virtual const DtVector& relativeLocation() const;
347 
350  virtual void setVelocity(const DtVector&);
351  virtual const DtVector& velocity() const;
352 
353  virtual void setAcceleration(const DtVector&);
354  virtual const DtVector& acceleration() const;
355 
356  virtual void setDRAlogrithm(DtDeadReckonTypes);
357  virtual const DtDeadReckonTypes& drAlgorithm() const;
359 
360  virtual void setOffsetPoints(const std::vector<DtVector>&);
361  virtual const std::vector<DtVector>& offsetPoints() const;
362 
363 public:
367  virtual void setCachePoints(bool);
368  bool cachePoints() const;
369 
372  virtual DtString extendedData(const DtString& key) const;
373 
374  const DtVrfExtendedRecordData& extendedRecordData() const
375  {
376  return myExtendedRecordData;
377  }
378 
379  DtVrfExtendedRecordData& extendedRecordData()
380  {
381  return myExtendedRecordData;
382  }
383 
384  int numberOfDatumRecords() const;
385  void setNumberOfDatumRecords(int);
386 
387 protected:
388  // createExtendedEnvironmentalStateRecord()
389  // allocates myExtEnvStateRecord, a DtSimEnvironmentalObjectStateRecord
390  // used by VR-Forces as extended environmental process state information:
391  virtual bool createExtendedEnvironmentalStateRecord();
392 
393  // extendedEnvironmentalStateRecord()
394  // returns the myExtEnvStateRecord for inspection by
395  // the caller. If myExtEnvStateRecord is NULL, it is created.
396  virtual DtSimEnvironmentalObjectStateRecord* extendedEnvironmentalStateRecord();
397 
398  // createVrfObjectStateRecord()
399  // allocates myVrfObjectStateRecord, a DtVrfObjectDataEnvironmentalRecord
400  // used by VR-Forces as extended vrf object state information:
401  virtual bool createVrfObjectStateRecord();
402 
403  // extendedVrfObjectStateRecord()
404  // returns the myVrfObjectStateRecord for inspection by
405  // the caller. If myVrfObjectStateRecord is NULL, it is created.
406  virtual DtVrfObjectDataEnvironmentalRecord* vrfObjectStateRecord();
407 
408  // createBoundingSphereRecord()
409  // allocates myBoundingSphereRecord
410  virtual bool createBoundingSphereRecord();
411 
412  // boundingSphereRecord()
413  // returns the myBoundingSphereRecord for inspection by
414  // the caller. If myBoundingSphereRecord is NULL, it is created.
415  virtual DtEnvironmentalBoundingSphereRecord* boundingSphereRecord();
416 
417  // createBoundingRectRecord()
418  // allocates myBoundingRectRecord
419  virtual bool createBoundingRectRecord();
420 
421  // boundingRectRecord()
422  // returns the myBoundingRectRecord for inspection by
423  // the caller. If myBoundingRectRecord is NULL, it is created.
424  virtual DtEnvironmentalRectangularVolumeRecord* boundingRectRecord();
425 
426 protected:
427  // Sets up internal object kind and category from object type
428  virtual void setupKindFromType(const DtEntityType& type);
429  virtual void getBoundingVolume(EnvGeomSpheriod* rec);
430  virtual void clearGeometricRecords();
431 
432 protected:
433  // Override to set myNeedVrfObjectDataUpdate to true
434  virtual void extensionModified();
435 
436 public:
437  static DtEnvironmentProcessRepository* create();
438 
441 
442  // Keeps a list of all geometry point records to use to update internal
443  // model datas from
445 
446  // DtSimEnvironmentalObjectStateRecord is a special form
447  // of DtEnvironmentalRecord, used to decode custom data
448  // that might be published from a VR-Forces back end, such
449  // as label, force type, appearance, etc.
450  // see "envObjState.h"
452  DtEnvironmentalBoundingSphereRecord* myBoundingSphereRecord;
455  DtEnvironmentalRectangularVolumeRecord* myBoundingRectRecord;
456 
457  // This information is needed for ITT puff clouds
462 
465 
467 };
468 
470 {
471  return myGeometricRecords;
472 }
473 
475 {
477 }
478 
480 {
482 }
483 
485 {
486  return (myBoundingSphereRecord != NULL);
487 }
488 
490 {
491  return (myBoundingRectRecord != NULL);
492 }
493 
495 {
496  return myCachePoints;
497 }

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)