VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
simEnvironmentalObjectStateRecord.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 //
7 // File: envObjState.h
8 //
9 // Class: DtSimEnvironmentalObjectStateRecord
10 //
11 #pragma once
12 
13 #include <vl/environmentalRecord.h>
14 #include <vlpi/appearance.h>
15 #include <vlpi/disEnums.h>
16 #include <vl/globalObjectDesignatorList.h>
18 
19 #define DtLineWidthFromAppearance(theAppr) ((theAppr >> 28) & 0x0000000F)
20 #define DtLineWidthToAppearance(theLineWidth) (theLineWidth << 28)
21 #define DtLineStyleFromAppearance(theAppr) ((theAppr >> 8) & 0x0000000F)
22 #define DtLineStyleToAppearance(theLineStyle) (theLineStyle << 8)
23 #define DtFillStyleFromAppearance(theAppr) ((theAppr >> 12) & 0x0000000F)
24 #define DtFillStyleToAppearance(theFillStyle) (theFillStyle << 12)
25 
26 // Definition of the FIXED PORTION of the environmental state object.
27 // This will be followed by a variable length string of bytes to represent
28 // the object label, and 0 or more global object designators to represent
29 // any subordinate objects within the object represented.
30 
31 // If this structure is of a previous type, use that structure instead
33 {
34  DtNetEnvironmentalRecord myHeader;
35  DtNetU32 myAppearance;
36  DtNetU8 myForceType;
37  DtNetU8 myLabelSize;
39 };
40 
42 {
43  DtNetEnvironmentalRecord myHeader;
44  DtNetU32 myAppearance;
45  DtNetU8 myForceType;
46  DtNetU8 myLabelSize;
48  DtNetU32 myColor;
49  DtNetU8 myParentSize;
50 };
51 
53 {
54  DtNetEnvironmentalRecord myHeader;
55  DtNetU32 myAppearance;
56  DtNetU8 myForceType;
57  DtNetU8 myLabelSize;
59  DtNetU32 myColor;
60  DtNetU8 myParentSize;
61  DtNetGlobalObjectDesignator myHostGlobalId;
62 };
63 
65 {
66  DtNetEnvironmentalRecord myHeader;
67  DtNetU32 myAppearance;
68  DtNetU8 myForceType;
69  DtNetU8 myLabelSize;
71  DtNetU32 myColor;
72  DtNetU8 myParentSize;
73  DtNetGlobalObjectDesignator myHostGlobalId;
74  DtNetU8 myUserDataSize;
75 };
76 
78 {
79  DtNetEnvironmentalRecord myHeader;
80  DtNetU32 myAppearance;
81  DtNetU8 myForceType;
82  DtNetU8 myLabelSize;
84  DtNetU32 myColor;
85  DtNetU8 myParentSize;
86  DtNetGlobalObjectDesignator myHostGlobalId;
87  DtNetU16 myUserDataSize;
88 };
89 
91 {
92  DtNetEnvironmentalRecord myHeader;
93  DtNetU32 myAppearance;
94  DtNetU8 myForceType;
95  DtNetU8 myLabelSize;
97  DtNetU32 myColor;
98  DtNetU8 myParentSize;
99  DtNetGlobalObjectDesignator myHostGlobalId;
100  DtNetU16 myUserDataSize;
101  DtNetFloat32 myPhysicalLineHeight;
102  DtNetFloat32 myPhysicalLineWidth;
103  DtNetU32 myVersion;
104 
107  DtNetVector64 myRelativeLocation;
108 
110  DtNetVector64 myVelocity;
111  DtNetVector64 myAcceleration;
112  DtNetU8 myDRAlgorithm;
113 
116  DtNetU32 myOffsetPoints;
117 
119 };
120 
128 
130 
131 //
132 // Class Description: DtEnvironmentalStateRecord implements a form of an
133 // environmental state record not explicitly defined in the standard, but
134 // used in MaK applications. It contains a DtForceType to identify the force
135 // with which the environmental object is associated (may be DtForceOther) and
136 // an entity state-like appearance vector (using DtAppearance).
137 //
138 
140 
142 
144 {
145 public:
146  // Default Constructor. To function properly, the state record should be
147  // initialized with an entity type. If you don't know it yet at creation
148  // time, you can use this constructor; but call setEntityType() before
149  // using the appearance accessors.
151 
152  // Constructor
154 
158 
159  // Assignment Operator
160  const DtSimEnvironmentalObjectStateRecord& operator=(
162 
163  // Destructor
165 
166  // Clone. Return a copy of this instance.
167  virtual DtEnvironmentalRecord* clone() const;
168 
169  virtual void setObjectType(const DtObjectType& objectType);
170 
171  // Appearance of the object.
172  virtual void setAppearance(const DtAppearance& appearance);
173  virtual const DtAppearance& appearance() const;
174 
175  // Force the object is associated with.
176  virtual void setForceType(DtForceType forceType);
177  virtual DtForceType forceType() const;
178 
179  virtual void setColor(int color);
180  virtual int color() const;
181 
182  virtual void setVrfObjectName(const DtString& label);
183  virtual const DtString& vrfObjectName() const;
184 
185  virtual void setParent(const DtString& parent);
186  virtual const DtString& parent() const;
187 
188  virtual void setUserData(const DtString& userData);
189  virtual const DtString& userData() const;
190 
191  virtual bool setNumberOfSubordinates(int newNumberOfSubordinates);
192  virtual int numberOfSubordinates() const;
193 
194  virtual bool setSubordinate(int index,
195  const DtGlobalObjectDesignator& subID);
196 
197  virtual bool getSubordinate(int index, DtGlobalObjectDesignator& subID)
198  const;
199 
200  virtual const DtGlobalObjectDesignatorList& subordinates() const;
201  virtual DtGlobalObjectDesignatorList& subordinates();
202 
203  // This doesn't need to be called explicitly. If any routine that needs
204  // the repository finds that it hasn't been created yet, it calls this
205  // method.
206  virtual bool createNetworkRepresentation();
207 
208  // returns the network representation of the environmental record
209  const DtNetEnvironmentalObjectStateRecord* objStateNetRep() const;
210  DtNetEnvironmentalObjectStateRecord* objStateNetRep();
211 
212  // used by the PDU class to fill in the network representation
213  virtual void setFromNet(const DtNetEnvironmentalRecord& buffer, int protocolVersion);
214 
215  virtual int netRepSize() const;
216 
217  // If object is attached, this is the id of the parent
218  virtual void setHostGlobalId(const DtGlobalObjectDesignator&);
219  virtual const DtGlobalObjectDesignator& hostGlobalId() const;
220 
223  virtual void setRelativeLocation(const DtVector&);
224  virtual const DtVector& relativeLocation() const;
225 
226  // Clears out the host global id (sets it to "")
227  virtual void clearHostGlobalId();
228 
229  // Get/set projected, close and bound2d as in bit pattern above
230  virtual void setProjected(bool);
231  virtual bool projected() const;
232 
233  virtual void setClosedFigure(bool);
234  virtual bool closedFigure() const;
235 
236  virtual void setBound2D(bool);
237  virtual bool bound2D() const;
238 
240  virtual void setFillStyle(int);
241  virtual int fillStyle() const;
242 
243  virtual void setLineStyle(int);
244  virtual int lineStyle() const;
245 
246  virtual void setLineWidth(int);
247  virtual int lineWidth() const;
248 
250  virtual void setPhysicalLineHeight(double);
251  virtual double physicalLineHeight() const;
252 
254  virtual void setPhysicalLineWidth(double);
255  virtual double physicalLineWidth() const;
256 
259  virtual void setVelocity(const DtVector&);
260  virtual const DtVector& velocity() const;
261 
262  virtual void setAcceleration(const DtVector&);
263  virtual const DtVector& acceleration() const;
264 
265  virtual void setDRAlogrithm(DtDeadReckonTypes);
266  virtual const DtDeadReckonTypes& drAlgorithm() const;
268 
269  virtual void setOffsetPoints(const std::vector<DtVector>&);
270  virtual const std::vector<DtVector>& offsetPoints() const;
271 
272 protected:
273 
274  virtual bool resizeNetRep(int newSize);
275 
276  // These two functions do the pointer math to get a pointer to
277  // the right place in the internal buffer for the start of these
278  // data areas.
279 
280  virtual void* pointerToLabel() const;
281  virtual void* pointerToParent() const;
282  virtual void* pointerToSubordinates() const;
283  virtual void* pointerToUserData() const;
284  virtual void* pointerToOffsetPoints() const;
285 
286  // Casts the 'this' pointer for changing elements in a const function.
288 
289  // Reworks the network buffer based on version
290  virtual void reworkStateRepForVersion(int bytesToCopy, int iVersion);
291 
292 protected:
293 
294  DtGlobalObjectDesignatorList mySubordinates;
295  DtAppearance myAppearance;
298  int myColor;
299  DtForceType myForceType;
300  DtGlobalObjectDesignator myHostGlobalId;
307  std::vector<DtVector> myOffsetPoints;
310  DtDeadReckonTypes myDRAlgorithm;
311 };

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)