From: Paul RASCLE Date: Fri, 29 Apr 2016 09:22:42 +0000 (+0200) Subject: node index in quadtreenode X-Git-Tag: v1.6~113^2~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cfb3b430b88a4fb131d21cd37148043300d65be1;p=modules%2Fhydro.git node index in quadtreenode --- diff --git a/src/HYDROData/HYDROData_QuadtreeNode.cxx b/src/HYDROData/HYDROData_QuadtreeNode.cxx index ba940dad..547b8a47 100644 --- a/src/HYDROData/HYDROData_QuadtreeNode.cxx +++ b/src/HYDROData/HYDROData_QuadtreeNode.cxx @@ -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(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* Result, + list* 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& dist2Nodes, + map& 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) diff --git a/src/HYDROData/HYDROData_QuadtreeNode.hxx b/src/HYDROData/HYDROData_QuadtreeNode.hxx index 78497ffa..6ec99f76 100644 --- a/src/HYDROData/HYDROData_QuadtreeNode.hxx +++ b/src/HYDROData/HYDROData_QuadtreeNode.hxx @@ -35,6 +35,7 @@ #include "HYDROData_Quadtree.hxx" #include +#include #include #include @@ -44,9 +45,20 @@ //forward declaration class HYDROData_QuadtreeNode; class gp_XY; -class gp_XYZ; -typedef std::list 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 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* Result, + std::list* Result, const double precision = 0.); //! Return in dist2Nodes nodes mapped to their square distance from Node bool NodesAround(const gp_XY& node, - std::map& dist2Nodes, + std::map& 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