![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2001 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: netwrkNode.h,v $ $Revision: 1.21 $ $State: Exp $ 00007 *********************************************************************/ 00008 #ifndef netwrkNode_H_ 00009 #define netwrkNode_H_ 00010 00011 // \file netwrkNode.h 00012 // \brief Contains the declaration of the DtNetworkNode class, as well as related interface functions. 00013 // 00014 00015 #include "gdb/gdbDefines.h" 00016 #include "gdb/specMgr.h" 00017 #include "gdb/netwrkSpecEl.h" 00018 00019 #include <vlutil/vlConfig.h> 00020 #include <geometry/point.h> 00021 #include <vlutil/vlNetTypes.h> 00022 #include <vlutil/vlPrint.h> 00023 #include <matrix/3dBoundingVolume.h> 00024 #include <matrix/vlDcm.h> 00025 00026 #include <set> 00027 #include <assert.h> 00028 00029 class DtNetworkEdge; 00030 00031 00032 // 00033 // DtNetworkNode represents a node in the vector network. Typically, it is used 00034 // to approximate point objects at the level of detail of the network. For instance, 00035 // in most terrains, trees and other similar objects are usually represented by 00036 // nodes. Additionally, the nodes are used as glue to join separate edges together 00037 // to create the connected network. 00038 class DT_DLL_gdb DtNetworkNode : public DtNetworkSpecElement 00039 { 00040 public: 00041 00042 typedef std::set<DtNetworkEdge*> DtConnectedEdgeContainer; 00043 typedef DtConnectedEdgeContainer::iterator DtConnectedEdgeIter; 00044 typedef DtConnectedEdgeContainer::const_iterator DtConnectedEdgeConstIter; 00045 00046 // default constructor 00047 DtNetworkNode(); 00048 00049 // destructor 00050 virtual ~DtNetworkNode(); 00051 00052 virtual void addEdge(DtNetworkEdge& edge); 00053 virtual void removeEdge(DtNetworkEdge& edge); 00054 00055 // get the connected edges. 00056 virtual const DtConnectedEdgeContainer& connectedEdges() const; 00057 00058 // Get the number of edges connected to the node 00059 virtual unsigned int degree() const; 00060 00061 // get/set location 00062 virtual const DtPoint& location() const; 00063 virtual void setLocation(const DtPoint& location); 00064 00065 virtual DtString type(); 00066 00067 virtual int sizeInBytes() const; 00068 00069 // Override to update our bounding volume and orientation 00070 virtual bool setSpecification(const DtSpecification& newSpecification, 00071 bool allowDuplicates = false); 00072 virtual void setSpecificationID(DtSpecificationID specID); 00073 00074 const Dt3dBoundingVolume& boundingVolume() const; 00075 const DtDcm& orientation() const; 00076 00077 protected: 00078 00079 virtual void setBoundingVolumeFromSpecification(); 00080 virtual void setOrientationFromSpecification(); 00081 00082 protected: 00083 00084 DtPoint myLocation; 00085 DtConnectedEdgeContainer myEdges; 00086 00087 // Bounding volume of node, based on DtWidth, DtHeight, and 00088 // DtLength specification attributes. 00089 Dt3dBoundingVolume myBoundingVolume; 00090 00091 // Orientaion of node, based on DtOrienation specification 00092 // attribute. In database coordinates. 00093 DtDcm myOrientation; 00094 00095 private: 00096 // These are private because there is a relationship between 00097 // nodes and edges that cannot be shared between nodes. If a node 00098 // is a start node of an edge, then using that node to construct 00099 // another node, or to assign it to another node, is improper. 00100 00101 // copy constructor 00102 DtNetworkNode(const DtNetworkNode& orig); 00103 00104 // assignment operator 00105 DtNetworkNode& operator=(const DtNetworkNode& orig); 00106 00107 }; 00108 00109 00110 bool DtNodeIsCircular(const DtNetworkNode& node); 00111 00112 00113 #endif