![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2001 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: pointQTree.h,v $ $Revision: 1.12 $ $State: Exp $ 00007 *********************************************************************/ 00008 // \file pointQTree.h 00009 // \brief Contains the DtPointQuadTreeNode class definition. 00010 00011 #ifndef pointQTree_H_ 00012 #define pointQTree_H_ 00013 00014 #include "gdb/gdbDefines.h" 00015 #include <stdio.h> 00016 #include <vlutil/vlNetTypes.h> 00017 #include <vlutil/vlConfig.h> 00018 #include <list> 00019 00020 class DtNetworkNode; 00021 class DtNetworkNodeMetric; 00022 00023 // 00024 // DtPointQuadtreeNode is a node for a point quadtree. 00025 class DT_DLL_gdb DtPointQuadtreeNode 00026 { 00027 public: 00028 00029 // default constructor 00030 DtPointQuadtreeNode(); 00031 00032 // constructor with network node 00033 DtPointQuadtreeNode(DtNetworkNode* networkNode); 00034 00035 // destructor 00036 virtual ~DtPointQuadtreeNode(); 00037 00038 private: 00039 00040 // copy constructor (not implemented) 00041 DtPointQuadtreeNode(const DtPointQuadtreeNode& orig); 00042 00043 // assignment operator (not implemented) 00044 DtPointQuadtreeNode& operator=(const DtPointQuadtreeNode& orig); 00045 00046 public: 00047 00048 typedef std::list<const DtNetworkNode*> DtPtrConstNodeContainer; 00049 typedef DtPtrConstNodeContainer::const_iterator DtPtrConstNodeConstIter; 00050 typedef DtPtrConstNodeContainer::iterator DtPtrConstNodeIter; 00051 00052 typedef std::list<DtNetworkNode*> DtPtrNodeContainer; 00053 typedef DtPtrNodeContainer::const_iterator DtPtrNodeConstIter; 00054 typedef DtPtrNodeContainer::iterator DtPtrNodeIter; 00055 00056 // add a new network node (the lower and left boundaries in 00057 // each quad are closed) 00058 virtual void add(DtNetworkNode& newNetworkNode); 00059 00060 // collect all nodes that are validated by the metric 00061 virtual void collectAllNodes(const DtNetworkNodeMetric& metric, 00062 DtPtrConstNodeContainer& collectedNodes) const; 00063 virtual void collectAllNodes(const DtNetworkNodeMetric& metric, 00064 DtPtrNodeContainer& collectedNodes); 00065 00066 // find the best valid node in the tree as measured by the metric 00067 virtual const DtNetworkNode* findBestNode(const DtNetworkNodeMetric& metric) const; 00068 00069 // resets the state of the quadtree to an empty, initial state. 00070 // (same as state resulting from *default constructor*) 00071 virtual void clear(); 00072 00073 virtual int size() const; 00074 00075 virtual int sizeInBytes() const; 00076 00077 protected: 00078 00079 // Adds the node to the specified quadrant. If the quadrant is 0, then it is 00080 // allocated with the node as the construction parameter. 00081 void addToQuadrant(DtPointQuadtreeNode*& quadrant, DtNetworkNode& element); 00082 00083 // find the best valid node in a subtree. pointer best must be valid. Using 00084 // this prevents the metric from being re-evaluated on the same node. 00085 virtual const DtNetworkNode* findBestInSubtree(const DtNetworkNodeMetric& metric, 00086 double& bestCost) const; 00087 00088 protected: 00089 00090 DtNetworkNode* myElement; 00091 DtPointQuadtreeNode* mySW; 00092 DtPointQuadtreeNode* mySE; 00093 DtPointQuadtreeNode* myNE; 00094 DtPointQuadtreeNode* myNW; 00095 }; 00096 00097 #endif