VR-Forces 4.1 Class Documentation
envObjState.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2001 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: envObjState.h,v $ $Revision: 1.16 $ $State: Exp $
7 *******************************************************************************/
8 
9 //
10 // File: envObjState.h
11 //
12 // Class: DtSimEnvironmentalObjectStateRecord
13 //
14 #ifndef DtSimEnvironmentalObjectStateRecord_H_
15 #define DtSimEnvironmentalObjectStateRecord_H_
16 
17 #include <vl/envRec.h>
18 #include <vlpi/appearance.h>
19 #include <vlpi/disEnums.h>
20 #include <vl/objDesList.h>
21 #include <vrfExtProtocol/objType.h>
22 
23 #define DtLineWidthFromAppearance(theAppr) ((theAppr >> 28) & 0x0000000F)
24 #define DtLineWidthToAppearance(theLineWidth) (theLineWidth << 28)
25 #define DtLineStyleFromAppearance(theAppr) ((theAppr >> 8) & 0x0000000F)
26 #define DtLineStyleToAppearance(theLineStyle) (theLineStyle << 8)
27 #define DtFillStyleFromAppearance(theAppr) ((theAppr >> 12) & 0x0000000F)
28 #define DtFillStyleToAppearance(theFillStyle) (theFillStyle << 12)
29 
30 // Definition of the FIXED PORTION of the environmental state object.
31 // This will be followed by a variable length string of bytes to represent
32 // the object label, and 0 or more global object designators to represent
33 // any subordinate objects within the object represented.
34 
35 // If this structure is of a previous type, use that structure instead
37 {
38  DtNetEnvironmentalRecord myHeader;
39  DtNetU32 myAppearance;
40  DtNetU8 myForceType;
41  DtNetU8 myLabelSize;
43 };
44 
46 {
47  DtNetEnvironmentalRecord myHeader;
48  DtNetU32 myAppearance;
49  DtNetU8 myForceType;
50  DtNetU8 myLabelSize;
52  DtNetU32 myColor;
53  DtNetU8 myParentSize;
54 };
55 
57 {
58  DtNetEnvironmentalRecord myHeader;
59  DtNetU32 myAppearance;
60  DtNetU8 myForceType;
61  DtNetU8 myLabelSize;
63  DtNetU32 myColor;
64  DtNetU8 myParentSize;
65  DtNetGlobalObjectDesignator myHostGlobalId;
66 };
67 
69 {
70  DtNetEnvironmentalRecord myHeader;
71  DtNetU32 myAppearance;
72  DtNetU8 myForceType;
73  DtNetU8 myLabelSize;
75  DtNetU32 myColor;
76  DtNetU8 myParentSize;
77  DtNetGlobalObjectDesignator myHostGlobalId;
78  DtNetU8 myUserDataSize;
79 };
80 
82 {
83  DtNetEnvironmentalRecord myHeader;
84  DtNetU32 myAppearance;
85  DtNetU8 myForceType;
86  DtNetU8 myLabelSize;
88  DtNetU32 myColor;
89  DtNetU8 myParentSize;
90  DtNetGlobalObjectDesignator myHostGlobalId;
91  DtNetU16 myUserDataSize;
92 };
93 
101 
103 
104 //
105 // Class Description: DtEnvironmentalStateRecord implements a form of an
106 // environmental state record not explicitly defined in the standard, but
107 // used in MaK applications. It contains a DtForceType to identify the force
108 // with which the environmental object is associated (may be DtForceOther) and
109 // an entity state-like appearance vector (using DtAppearance).
110 //
111 
114 {
115 public:
116  // Default Constructor. To function properly, the state record should be
117  // initialized with an entity type. If you don't know it yet at creation
118  // time, you can use this constructor; but call setEntityType() before
119  // using the appearance accessors.
121 
122  // Constructor
124 
125  // Copy Constructor
128 
129  // Assignment Operator
130  const DtSimEnvironmentalObjectStateRecord& operator=(
132 
133  // Destructor
135 
136  // Clone. Return a copy of this instance.
137  virtual DtEnvironmentalRecord* clone() const;
138 
139  virtual void setObjectType(const DtObjectType& objectType);
140 
141  // Appearance of the object.
142  virtual void setAppearance(const DtAppearance& appearance);
143  virtual const DtAppearance& appearance() const;
144 
145  // Force the object is associated with.
146  virtual void setForceType(DtForceType forceType);
147  virtual DtForceType forceType() const;
148 
149  virtual void setColor(int color);
150  virtual int color() const;
151 
152  virtual void setVrfObjectName(const DtString& label);
153  virtual const DtString& vrfObjectName() const;
154 
155  virtual void setParent(const DtString& parent);
156  virtual const DtString& parent() const;
157 
158  virtual void setUserData(const DtString& userData);
159  virtual const DtString& userData() const;
160 
161  virtual bool setNumberOfSubordinates(int newNumberOfSubordinates);
162  virtual int numberOfSubordinates() const;
163 
164  virtual bool setSubordinate(int index,
165  const DtGlobalObjectDesignator& subID);
166 
167  virtual bool getSubordinate(int index, DtGlobalObjectDesignator& subID)
168  const;
169 
170  virtual const DtGlobalObjectDesignatorList& subordinates() const;
171  virtual DtGlobalObjectDesignatorList& subordinates();
172 
173  // This doesn't need to be called explicitly. If any routine that needs
174  // the repository finds that it hasn't been created yet, it calls this
175  // method.
176  virtual bool createNetworkRepresentation();
177 
178  // returns the network representation of the environmental record
179  const DtNetEnvironmentalObjectStateRecord* objStateNetRep() const;
180  DtNetEnvironmentalObjectStateRecord* objStateNetRep();
181 
182  // used by the PDU class to fill in the network representation
183  virtual void setFromNet(const DtNetEnvironmentalRecord& buffer);
184 
185  virtual int netRepSize() const;
186 
187  // If object is attached, this is the id of the parent
188  virtual void setHostGlobalId(const DtGlobalObjectDesignator&);
189  virtual const DtGlobalObjectDesignator& hostGlobalId() const;
190 
191  // Clears out the host global id (sets it to "")
192  virtual void clearHostGlobalId();
193 
194  // Get/set projected, close and bound2d as in bit pattern above
195  virtual void setProjected(bool);
196  virtual bool projected() const;
197 
198  virtual void setClosedFigure(bool);
199  virtual bool closedFigure() const;
200 
201  virtual void setBound2D(bool);
202  virtual bool bound2D() const;
203 
205  virtual void setFillStyle(int);
206  virtual int fillStyle() const;
207 
208  virtual void setLineStyle(int);
209  virtual int lineStyle() const;
210 
211  virtual void setLineWidth(int);
212  virtual int lineWidth() const;
213 
214 protected:
215 
216  virtual bool resizeNetRep(int newSize);
217 
218  // These two functions do the pointer math to get a pointer to
219  // the right place in the internal buffer for the start of these
220  // data areas.
221 
222  virtual void* pointerToLabel() const;
223  virtual void* pointerToParent() const;
224  virtual void* pointerToSubordinates() const;
225  virtual void* pointerToUserData() const;
226 
227  // Casts the 'this' pointer for changing elements in a const function.
229 
230  // Reworks the network buffer based on version
231  virtual void reworkStateRepForVersion(int bytesToCopy, int iVersion);
232 
233 protected:
234 
235  DtGlobalObjectDesignatorList mySubordinates;
236  DtAppearance myAppearance;
239  int myColor;
240  DtForceType myForceType;
241  DtGlobalObjectDesignator myHostGlobalId;
243 
245 };
246 
247 #endif // DIS_VERS >= 5

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)