VR-Forces 4.1.1 Class Documentation
controlObjSR.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2000 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: controlObjSR.h,v $ $Revision: 1.23 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef CONTROLOBJSR_H
10 #define CONTROLOBJSR_H
11 
12 #include <vl/envProcessSR.h>
14 #include <vlpi/appearance.h>
15 
18 
19 class Dt3dBoundingVolume;
20 
21 #include <vector>
22 #include <map>
23 
26 class DtEnvironmentalBoundingSphereRecord;
27 class DtEnvironmentalRectangularVolumeRecord;
29 class DtGlobalObjectDesignatorList;
30 
32 {
40 };
41 
43 {
57 };
58 
59 class DtEnvironmentalPointRecord;
60 
61 // class DtControlObjectRepository:
62 //
63 // Instances of DtControlObjectRepository are
66 {
67 public:
68  typedef std::vector<DtVector> DtCOVertexList;
69  typedef std::vector<DtIttEnvProcData*> DtGeometricDataList;
70  typedef std::map<int, DtIttSourceDataCreator> DtIttSourceDataMap;
71 
72 public:
73 
74  // default constructor
76 
77  // destructor
78  virtual ~DtControlObjectRepository();
79 
80  // copy constructor
82 
83  // assignment operator
85 
86  // Return a copy/empty object of the same type as this.
87  virtual DtStateRepository* clone(bool copy = false) const;
88 
89  virtual const DtControlObjectKind& kind() const;
90  virtual void setKind(const DtControlObjectKind& k);
91 
92  virtual const DtControlObjectCategory& category() const;
93  virtual void setCategory(const DtControlObjectCategory& c);
94 
95  const std::vector<DtVector>& vertexList() const;
96 
97  // updateExtensions()
98  // extracts the extended environmental process state information,
99  // if present, from the state repository
100  virtual void updateExtensions();
101 
102  // Compares us against the supplied state repository and returns what's
103  // changed. Since this is being called from a location where the vertex list
104  // is already being checked, we don't need to do it.
105  virtual int compare(const DtControlObjectRepository* rhs);
106 
107  // Returns what has changed since the last time we called compare
108  virtual int compareToMostRecent();
109 
110  // Returns true if our stashed location is different than our
111  // current location
112  virtual bool locationsDifferent(bool updateIfDifferent);
113  virtual void emptyVertexList();
114 
115  // Adds mappings between environmental record types and the
116  // type of information to read off of the network into local
117  // environmental data structures
118  static void initializePuffFactory();
119  static void addToPuffFactory(int iRecordType, DtIttSourceDataCreator fcn);
120  static DtIttSourceData* createPuffRecord(DtNetEnvironmentalRecord* geometric,
121  DtNetEnvironmentalRecord* source);
122  static DtIttSourceData* createPuffRecord(DtNetEnvironmentalRecord* rec);
123 
124  virtual void getBoundingVolume(DtVector& location, double& radius) const;
125 
126  const DtGeometricDataList& geometricRecords() const;
127  bool geometricRecordsChanged() const;
128  void clearGeometricRecordsChanged();
129 
130  // If myNeedVrfObjectDataUpdate is true, update the vrf object data record. Also sets
131  // all vrf specific data records into state repository. Called from publisher
132  virtual void updateDataRecords();
133 
134  // Subordinate information. Not currently used by VRF
135  virtual int numberOfSubordinates() const;
136  virtual bool getSubordinate(int i, DtGlobalObjectDesignator& d);
137  virtual const DtGlobalObjectDesignatorList& subordinates() const;
138  virtual DtGlobalObjectDesignatorList& subordinates();
139 
140 public:
141  // Sets the vertices to use in the publication of this object. Will create the environmental records (as needed),
142  // put them into the state repository structure and also the vertex list. This routine assumes the DtList contains DtVectors
143  virtual void setVertices(const DtList& pnt);
144  virtual void appendVertex(const DtVector&);
145  virtual void setVertex(int i, const DtVector&);
146  virtual void removeVertex(int i);
147 
148 public:
149  // Environmental record settings
150 
151  // Used to set in appearance value of env state record and vrf object data message
152  virtual void setObjectType(const DtObjectType&);
153 
154 
155  // Returns the force type from the environmental header record (if it exists), else
156  // returns neutral by default
157  virtual DtForceType forceType() const;
158  virtual void setForceType(DtForceType i);
159 
160  // Returns the color (rgb) value of this object
161  virtual int color() const;
162  virtual void setColor(int);
163 
164  // Returns the parent of this object
165  virtual const DtString& parent() const;
166  virtual void setParent(const DtString&);
167 
168  virtual const DtString& userData() const;
169  virtual void setUserData(const DtString&);
170 
171  virtual void setVrfObjectName(const DtString&);
172  virtual const DtString& vrfObjectName();
173 
174  virtual DtAppearance appearance() const;
175  virtual void setAppearance(const DtAppearance& app);
176 
177  virtual void setNumberOfSubordinates(int);
178  virtual void setSubordinate(int i, const DtGlobalObjectDesignator&);
179 
180  // Returns the parent this object might be attached to
181  virtual const DtGlobalObjectDesignator& hostGlobalId() const;
182  virtual void setHostGlobalId(const DtGlobalObjectDesignator&);
183 
185  virtual void clearHostGlobalId();
186 
187 public:
195 
196  // In setting the bounding sphere radius, if a bounding sphere record does not exist, it
197  // will be created
198  virtual void setBoundingSphereRadius(double);
199  virtual double boundingSphereRadius() const;
200 
201  // Sets/gets the bounding sphere location. Will also create the record on set if it does not
202  // exist
203  virtual void setBoundingSphereLocation(const DtVector&);
204  virtual const DtVector& boundingSphereLocation() const;
205 
206  bool hasBoundingSphereRecord() const;
207 
208 public:
216 
217  bool hasBoundingRectRecord() const;
218 
219  virtual void setBoundingExtent(const DtVector&);
220  const DtVector& boundingExtent() const;
221 
222  virtual void setBoundingCornerLocation(const DtVector&);
223  virtual const DtVector& boundingCornerLocation() const;
224 
225  virtual void setBoundingOrientation(const DtTaitBryan&);
226  const DtTaitBryan& boundingOrientation() const;
227 
228 public:
231  virtual void setProjected(bool);
232  virtual bool projected() const;
233 
234  virtual void setClosedFigure(bool);
235  virtual bool closedFigure() const;
236 
237  virtual void setBound2D(bool);
238  virtual bool bound2D() const;
239 
241  virtual void setFillStyle(int);
242  virtual int fillStyle() const;
243 
244  virtual void setLineStyle(int);
245  virtual int lineStyle() const;
246 
247  virtual void setLineWidth(int);
248  virtual int lineWidth() const;
249 
250 public:
254  virtual void setCachePoints(bool);
255  bool cachePoints() const;
256 
257 
258 protected:
259  // createExtendedEnvironmentalStateRecord()
260  // allocates myExtEnvStateRecord, a DtSimEnvironmentalObjectStateRecord
261  // used by VR-Forces as extended environmental process state information:
262  virtual bool createExtendedEnvironmentalStateRecord();
263 
264  // extendedEnvironmentalStateRecord()
265  // returns the myExtEnvStateRecord for inspection by
266  // the caller. If myExtEnvStateRecord is NULL, it is created.
267  virtual DtSimEnvironmentalObjectStateRecord* extendedEnvironmentalStateRecord();
268 
269  // createVrfObjectStateRecord()
270  // allocates myVrfObjectStateRecord, a DtVrfObjectDataEnvRec
271  // used by VR-Forces as extended vrf object state information:
272  virtual bool createVrfObjectStateRecord();
273 
274  // extendedVrfObjectStateRecord()
275  // returns the myVrfObjectStateRecord for inspection by
276  // the caller. If myVrfObjectStateRecord is NULL, it is created.
277  virtual DtVrfObjectDataEnvRec* vrfObjectStateRecord();
278 
279  // createBoundingSphereRecord()
280  // allocates myBoundingSphereRecord
281  virtual bool createBoundingSphereRecord();
282 
283  // boundingSphereRecord()
284  // returns the myBoundingSphereRecord for inspection by
285  // the caller. If myBoundingSphereRecord is NULL, it is created.
286  virtual DtEnvironmentalBoundingSphereRecord* boundingSphereRecord();
287 
288  // createBoundingRectRecord()
289  // allocates myBoundingRectRecord
290  virtual bool createBoundingRectRecord();
291 
292  // boundingRectRecord()
293  // returns the myBoundingRectRecord for inspection by
294  // the caller. If myBoundingRectRecord is NULL, it is created.
295  virtual DtEnvironmentalRectangularVolumeRecord* boundingRectRecord();
296 
297 protected:
298  // Sets up internal object kind and category from object type
299  virtual void setupKindFromType(const DtEntityType& type);
300  virtual void getBoundingVolume(EnvGeomSpheriod* rec);
301  virtual void clearGeometricRecords();
302 
303 protected:
304  // Override to set myNeedVrfObjectDataUpdate to true
305  virtual void extensionModified();
306 
307 public:
308  static DtEnvironmentProcessRepository* create();
309 
312 
313  // Keeps a list of all geometry point records to use to update internal
314  // model datas from
316 
317  // DtSimEnvironmentalObjectStateRecord is a special form
318  // of DtEnvironmentalRecord, used to decode custom data
319  // that might be published from a VR-Forces back end, such
320  // as label, force type, appearance, etc.
321  // see "envObjState.h"
323  DtEnvironmentalBoundingSphereRecord* myBoundingSphereRecord;
326  DtEnvironmentalRectangularVolumeRecord* myBoundingRectRecord;
328 
329  // This information is needed for ITT puff clouds
334 
337 };
338 
340 {
341  return myGeometricRecords;
342 }
343 
345 {
347 }
348 
350 {
352 }
353 
355 {
356  return (myBoundingSphereRecord != NULL);
357 }
358 
360 {
361  return (myBoundingRectRecord != NULL);
362 }
363 
365 {
366  return myCachePoints;
367 }
368 
369 #endif

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)