![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2003 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: specification.h,v $ $Revision: 1.14 $ $State: Exp $ 00007 *******************************************************************************/ 00008 #ifndef specification_H_ 00009 #define specification_H_ 00010 00011 // 00012 // \file specification.h 00013 // \brief Contains the declaration of the DtSpecification class. 00014 // 00015 00016 #include "gdb/gdbDefines.h" 00017 #include <stdio.h> 00018 #include <vlutil/vlString.h> 00019 #include "geometry/gdbColor.h" 00020 #include <vlutil/vlList.h> 00021 #include "gdb/specAttrib.h" 00022 00023 00024 // The DtSpecification class represents the meta-data associated with a vector network 00025 // feature. It is a collection of attributes, each a key-value pair, and provides 00026 // an interface for setting and getting the associated attributes. 00027 class DT_DLL_gdb DtSpecification 00028 { 00029 00030 public: 00031 00032 typedef DtList DtSpecAttributeContainer; 00033 typedef DtString DtAttributeKey; 00034 00035 00036 // default constructor 00037 DtSpecification(); 00038 00039 // destructor 00040 virtual ~DtSpecification(); 00041 00042 // copy constructor 00043 DtSpecification(const DtSpecification& orig); 00044 00045 // assignment operator 00046 DtSpecification& operator=(const DtSpecification& orig); 00047 00048 // @name Comparison operators 00050 virtual bool operator==(const DtSpecification& other) const; 00051 virtual bool operator!=(const DtSpecification& other) const; 00052 00053 // If the specified specification contains all of the attributes of this 00054 // specification, then this specification is a superset of the specified 00055 // specification. 00056 virtual bool isASupersetOf(const DtSpecification& other) const; 00058 00059 // accessor / mutator functions 00060 virtual const DtColor& color() const; 00061 virtual void setColor(const DtColor& c); 00062 00063 // returns a string that describes the surface characteristic. 00064 virtual DtString specificationString() const; 00065 00066 // debugging aid 00067 virtual void dump() const; 00068 00069 // get/set length 00070 virtual double length() const; 00071 virtual void setLength(double val); 00072 00073 // get/set width 00074 virtual double width() const; 00075 virtual void setWidth(double val); 00076 00077 // get/set rotation of the object about the Z-axis in degrees (0 if not specified) 00078 virtual int rotationAboutZ() const; 00079 virtual void setRotationAboutZ(int angleInDegrees); 00080 00081 // get/set visible flag 00082 virtual bool visible() const; 00083 virtual void setVisible(bool val); 00084 00085 // get a radius for drawing nodes 00086 virtual double drawingRadius() const; 00087 00088 // add (as copy) and lookup an attribute 00089 virtual void addAttribute(const DtSpecificationAttribute& att); 00090 00091 virtual void removeAttribute(const DtSpecificationAttribute& att); 00092 virtual void removeAttribute(const DtAttributeKey& label); 00093 00094 virtual DtSpecificationAttribute* attribute(const DtString& label); 00095 virtual const DtSpecificationAttribute* attribute(const DtString& label) const; 00096 00097 // add and lookup an integer attribute 00098 virtual void addIntegerAttribute(const DtString& label, int value); 00099 virtual bool lookupIntegerAttribute(const DtString& label, int& value) const; 00100 00101 // add and lookup a real attribute 00102 virtual void addRealAttribute(const DtString& label, double value); 00103 virtual bool lookupRealAttribute(const DtString& label, double& value) const; 00104 00105 // add and lookup a string attribute 00106 virtual void addStringAttribute(const DtString& label, const DtString& value); 00107 virtual bool lookupStringAttribute(const DtString& label, DtString& value) const; 00108 00109 // check for existence and return attribute pointer 00110 virtual const DtSpecificationAttribute* attributeOfType(const DtString& label, 00111 unsigned int type) const; 00112 00113 // input/output functions 00114 virtual bool readFrom(FILE* fp); 00115 virtual bool writeTo(FILE* fp); 00116 00117 // return a null specification 00118 static const DtSpecification& nullSpecification(); 00119 00120 // Returns the list of all attributes 00121 virtual const DtSpecAttributeContainer& attributes() const; 00122 00123 protected: 00124 00125 // specification attribute factory method 00126 virtual DtSpecificationAttribute* newAttribute(unsigned int type); 00127 00128 protected: 00129 00130 DtColor myColor; 00131 bool myVisible; 00132 DtSpecAttributeContainer myAttributes; 00133 00134 static const DtString theLengthString; 00135 static const DtString theWidthString; 00136 static const DtString theOrientationString; 00137 00138 static const DtSpecification theNullSpecification; 00139 }; 00140 00141 #endif