VR-Vantage 1.4.1 API Class Documentation
envObjState.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2001 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: envObjState.h,v $ $Revision: 1.16 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 //
00010 // File:        envObjState.h
00011 //
00012 // Class:       DtSimEnvironmentalObjectStateRecord
00013 //
00014 #ifndef DtSimEnvironmentalObjectStateRecord_H_
00015 #define DtSimEnvironmentalObjectStateRecord_H_
00016 
00017 #include <vl/envRec.h>
00018 #include <vlpi/appearance.h>
00019 #include <vlpi/disEnums.h>
00020 #include <vl/objDesList.h>
00021 #include <vrfExtProtocol/objType.h>
00022 
00023 #define DtLineWidthFromAppearance(theAppr) ((theAppr >> 28) & 0x0000000F)
00024 #define DtLineWidthToAppearance(theLineWidth) (theLineWidth << 28)
00025 #define DtLineStyleFromAppearance(theAppr) ((theAppr >> 8) & 0x0000000F)
00026 #define DtLineStyleToAppearance(theLineStyle) (theLineStyle << 8)
00027 #define DtFillStyleFromAppearance(theAppr) ((theAppr >> 12) & 0x0000000F)
00028 #define DtFillStyleToAppearance(theFillStyle) (theFillStyle << 12)
00029 
00030 // Definition of the FIXED PORTION of the environmental state object.
00031 // This will be followed by a variable length string of bytes to represent
00032 // the object label, and 0 or more global object designators to represent
00033 // any subordinate objects within the object represented.
00034 
00035 // If this structure is of a previous type, use that structure instead
00036 struct DtNetEnvironmentalObjectStateRecord_V1
00037 {
00038    DtNetEnvironmentalRecord myHeader;
00039    DtNetU32                 myAppearance;
00040    DtNetU8                  myForceType;
00041    DtNetU8                  myLabelSize;
00042    DtNetU16                 myNumberOfSubordinates;
00043 };
00044 
00045 struct DtNetEnvironmentalObjectStateRecord_V2
00046 {
00047    DtNetEnvironmentalRecord myHeader;
00048    DtNetU32                 myAppearance;
00049    DtNetU8                  myForceType;
00050    DtNetU8                  myLabelSize;
00051    DtNetU16                 myNumberOfSubordinates;
00052    DtNetU32                 myColor;
00053    DtNetU8                  myParentSize;
00054 };
00055 
00056 struct DtNetEnvironmentalObjectStateRecord_V3
00057 {
00058    DtNetEnvironmentalRecord      myHeader;
00059    DtNetU32                      myAppearance;
00060    DtNetU8                       myForceType;
00061    DtNetU8                       myLabelSize;
00062    DtNetU16                      myNumberOfSubordinates;
00063    DtNetU32                      myColor;
00064    DtNetU8                       myParentSize;
00065    DtNetGlobalObjectDesignator   myHostGlobalId;
00066 };
00067 
00068 struct DtNetEnvironmentalObjectStateRecord_V4
00069 {
00070    DtNetEnvironmentalRecord      myHeader;
00071    DtNetU32                      myAppearance;
00072    DtNetU8                       myForceType;
00073    DtNetU8                       myLabelSize;
00074    DtNetU16                      myNumberOfSubordinates;
00075    DtNetU32                      myColor;
00076    DtNetU8                       myParentSize;
00077    DtNetGlobalObjectDesignator   myHostGlobalId;
00078    DtNetU8                       myUserDataSize;
00079 };
00080 
00081 struct DtNetEnvironmentalObjectStateRecord
00082 {
00083    DtNetEnvironmentalRecord      myHeader;
00084    DtNetU32                      myAppearance;
00085    DtNetU8                       myForceType;
00086    DtNetU8                       myLabelSize;
00087    DtNetU16                      myNumberOfSubordinates;
00088    DtNetU32                      myColor;
00089    DtNetU8                       myParentSize;
00090    DtNetGlobalObjectDesignator   myHostGlobalId;
00091    DtNetU16                       myUserDataSize;
00092 };
00093 
00101 
00102 const int DtMaxEnvProcessLabelLength = 255;
00103 
00104 //
00105 // Class Description: DtEnvironmentalStateRecord implements a form of an
00106 // environmental state record not explicitly defined in the standard, but
00107 // used in MaK applications.  It contains a DtForceType to identify the force
00108 // with which the environmental object is associated (may be DtForceOther) and
00109 // an entity state-like appearance vector (using DtAppearance).
00110 //
00111 
00112 #include <vrfExtObjects/vrfExtObjectsDefines.h>
00113 class DT_DLL_vrfExtObjects DtSimEnvironmentalObjectStateRecord : public DtEnvironmentalRecord
00114 {
00115 public:
00116    // Default Constructor.  To function properly, the state record should be
00117    // initialized with an entity type.  If you don't know it yet at creation
00118    // time, you can use this constructor; but call setEntityType() before
00119    // using the appearance accessors.
00120    DtSimEnvironmentalObjectStateRecord();
00121 
00122    // Constructor
00123    DtSimEnvironmentalObjectStateRecord(const DtObjectType& objectType);
00124 
00125    // Copy Constructor
00126    DtSimEnvironmentalObjectStateRecord(
00127       const DtSimEnvironmentalObjectStateRecord& orig);
00128 
00129    // Assignment Operator
00130    const DtSimEnvironmentalObjectStateRecord& operator=(
00131       const DtSimEnvironmentalObjectStateRecord& orig);
00132 
00133    // Destructor
00134    virtual ~DtSimEnvironmentalObjectStateRecord();
00135 
00136    // Clone.  Return a copy of this instance.
00137    virtual DtEnvironmentalRecord* clone() const;
00138 
00139    virtual void setObjectType(const DtObjectType& objectType);
00140 
00141    // Appearance of the object.
00142    virtual void setAppearance(const DtAppearance& appearance);
00143    virtual const DtAppearance& appearance() const;
00144 
00145    // Force the object is associated with.
00146    virtual void setForceType(DtForceType forceType);
00147    virtual DtForceType forceType() const;
00148 
00149    virtual void setColor(int color);
00150    virtual int color() const;
00151 
00152    virtual void setVrfObjectName(const DtString& label);
00153    virtual const DtString& vrfObjectName() const;
00154 
00155    virtual void setParent(const DtString& parent);
00156    virtual const DtString& parent() const;
00157 
00158    virtual void setUserData(const DtString& userData);
00159    virtual const DtString& userData() const;
00160 
00161    virtual bool setNumberOfSubordinates(int newNumberOfSubordinates);
00162    virtual int numberOfSubordinates() const;
00163 
00164    virtual bool setSubordinate(int index,
00165       const DtGlobalObjectDesignator& subID);
00166 
00167    virtual bool getSubordinate(int index, DtGlobalObjectDesignator& subID)
00168       const;
00169 
00170    virtual const DtGlobalObjectDesignatorList& subordinates() const;
00171    virtual DtGlobalObjectDesignatorList& subordinates();
00172 
00173    // This doesn't need to be called explicitly.  If any routine that needs
00174    // the repository finds that it hasn't been created yet, it calls this
00175    // method.
00176    virtual bool createNetworkRepresentation();
00177 
00178    // returns the network representation of the environmental record
00179    const DtNetEnvironmentalObjectStateRecord* objStateNetRep() const;
00180    DtNetEnvironmentalObjectStateRecord* objStateNetRep();
00181 
00182    // used by the PDU class to fill in the network representation
00183    virtual void setFromNet(const DtNetEnvironmentalRecord& buffer);
00184 
00185    virtual int netRepSize() const;
00186 
00187    // If object is attached, this is the id of the parent
00188    virtual void setHostGlobalId(const DtGlobalObjectDesignator&);
00189    virtual const DtGlobalObjectDesignator& hostGlobalId() const;
00190 
00191    // Clears out the host global id (sets it to "")
00192    virtual void clearHostGlobalId();
00193 
00194    // Get/set projected, close and bound2d as in bit pattern above
00195    virtual void setProjected(bool);
00196    virtual bool projected() const;
00197 
00198    virtual void setClosedFigure(bool);
00199    virtual bool closedFigure() const;
00200 
00201    virtual void setBound2D(bool);
00202    virtual bool bound2D() const;
00203 
00205    virtual void setFillStyle(int);
00206    virtual int fillStyle() const;
00207 
00208    virtual void setLineStyle(int);
00209    virtual int lineStyle() const;
00210 
00211    virtual void setLineWidth(int);
00212    virtual int lineWidth() const;
00213 
00214 protected:
00215 
00216    virtual bool resizeNetRep(int newSize);
00217 
00218    // These two functions do the pointer math to get a pointer to
00219    // the right place in the internal buffer for the start of these
00220    // data areas.
00221 
00222    virtual void* pointerToLabel() const;
00223    virtual void* pointerToParent() const;
00224    virtual void* pointerToSubordinates() const;
00225    virtual void* pointerToUserData() const;
00226 
00227    // Casts the 'this' pointer for changing elements in a const function.
00228    DtSimEnvironmentalObjectStateRecord* self() const;
00229 
00230    // Reworks the network buffer based on version
00231    virtual void reworkStateRepForVersion(int bytesToCopy, int iVersion);
00232 
00233 protected:
00234 
00235    DtGlobalObjectDesignatorList mySubordinates;
00236    DtAppearance myAppearance;
00237    DtString myLabel;
00238    DtString myParent;
00239    int myColor;
00240    DtForceType myForceType;
00241    DtGlobalObjectDesignator   myHostGlobalId;
00242    DtString myUserData;
00243 
00244    int myNetRepSize;
00245 };
00246 
00247 #endif // DIS_VERS >= 5


Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)