Salome HOME
node index in quadtreenode
authorPaul RASCLE <paul.rascle@edf.fr>
Fri, 29 Apr 2016 09:22:42 +0000 (11:22 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Fri, 29 Apr 2016 09:22:42 +0000 (11:22 +0200)
src/HYDROData/HYDROData_QuadtreeNode.cxx
src/HYDROData/HYDROData_QuadtreeNode.hxx

index ba940dad7317689812958fdf7b38b9884d13330c..547b8a47daf3165c6f7d0a33ff8550ecdd71fd1e 100644 (file)
@@ -123,7 +123,7 @@ Bnd_B2d* HYDROData_QuadtreeNode::buildRootBox()
   Nodes_3D::iterator it = myNodes->begin();
   for (; it != myNodes->end(); it++)
     {
-      const gp_XYZ* n1 = *it;
+      const gpi_XYZ* n1 = *it;
       gp_XY p1(n1->X(), n1->Y());
       box->Add(p1);
     }
@@ -162,7 +162,7 @@ void HYDROData_QuadtreeNode::buildChildrenData()
   Nodes_3D::iterator it = myNodes->begin();
   while (it != myNodes->end())
     {
-      gp_XYZ* n1 = *it;
+      gpi_XYZ* n1 = *it;
       int ChildBoxNum = getChildIndex(n1->X(), n1->Y(), mid);
       HYDROData_QuadtreeNode* myChild = dynamic_cast<HYDROData_QuadtreeNode*>(myChildren[ChildBoxNum]);
       myChild->myNodes->push_back(n1);
@@ -187,7 +187,7 @@ void HYDROData_QuadtreeNode::buildChildrenData()
  * \param Result - list of Nodes potentials to be near Node
  */
 void HYDROData_QuadtreeNode::NodesAround(const gp_XY& Node,
-                                         list<const gp_XYZ*>* Result,
+                                         list<const gpi_XYZ*>* Result,
                                          const double precision)
 {
   gp_XY p(Node);
@@ -217,7 +217,7 @@ void HYDROData_QuadtreeNode::NodesAround(const gp_XY& Node,
  *  \retval bool - true if an exact overlapping found !!!
  */
 bool HYDROData_QuadtreeNode::NodesAround(const gp_XY& node,
-                                         map<double, const gp_XYZ*>& dist2Nodes,
+                                         map<double, const gpi_XYZ*>& dist2Nodes,
                                          double precision)
 {
   if (!dist2Nodes.empty())
@@ -246,7 +246,7 @@ bool HYDROData_QuadtreeNode::NodesAround(const gp_XY& node,
           Nodes_3D::iterator nIt = myNodes->begin();
           for (; nIt != myNodes->end(); ++nIt)
             {
-              const gp_XYZ* p = *nIt;
+              const gpi_XYZ* p = *nIt;
               gp_XY p2(p->X(), p->Y());
               double dist2 = (node - p2).SquareModulus();
               if (dist2 < minDist)
index 78497ffae78a521d0457700ebc98ef86184d4fe6..6ec99f766b304239616becdb2999f4138eeda902 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "HYDROData_Quadtree.hxx"
 #include <gp_Pnt.hxx>
+#include <gp_XYZ.hxx>
 
 #include <list>
 #include <set>
 //forward declaration
 class HYDROData_QuadtreeNode;
 class gp_XY;
-class gp_XYZ;
 
-typedef std::list<gp_XYZ*> Nodes_3D;
+class Standard_EXPORT gpi_XYZ: public gp_XYZ
+{
+public:
+  gpi_XYZ();
+
+  gpi_XYZ(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, int i): gp_XYZ(X, Y, Z), myIndex(i) {}
+
+  int getIndex() const {return myIndex; }
+protected:
+  int myIndex;
+};
+
+typedef std::list<gpi_XYZ*> Nodes_3D;
 
 class Standard_EXPORT HYDROData_QuadtreeNode: public HYDROData_Quadtree
 {
@@ -70,16 +82,16 @@ public:
 
   //! Return in Result a list of Nodes potentials to be near Node
   void NodesAround(const gp_XY& Node,
-                   std::list<const gp_XYZ*>* Result,
+                   std::list<const gpi_XYZ*>* Result,
                    const double precision = 0.);
 
   //! Return in dist2Nodes nodes mapped to their square distance from Node
   bool NodesAround(const gp_XY& node,
-                   std::map<double, const gp_XYZ*>& dist2Nodes,
+                   std::map<double, const gpi_XYZ*>& dist2Nodes,
                    double precision);
 
   //! Update data according to node movement
-  void UpdateByMoveNode(const gp_XYZ* node, const gp_Pnt& toPnt);
+  void UpdateByMoveNode(const gpi_XYZ* node, const gp_Pnt& toPnt);
 
   //! Return nb nodes in a tree
   int NbNodes() const