diff --git a/src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx b/src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx index da37dfca9b..688656ca3b 100644 --- a/src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx +++ b/src/BRepMesh/BRepMesh_BaseMeshAlgo.cxx @@ -99,38 +99,44 @@ Standard_Boolean BRepMesh_BaseMeshAlgo::initDataStructure() for (Standard_Integer aEdgeIt = 0; aEdgeIt < aDWire->EdgesNb(); ++aEdgeIt) { - const IMeshData::IEdgeHandle aDEdge = aDWire->GetEdge(aEdgeIt); + const IMeshData::IEdgeHandle aDEdge = aDWire->GetEdge (aEdgeIt); const IMeshData::ICurveHandle& aCurve = aDEdge->GetCurve(); - const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve( - myDFace.get(), aDWire->GetEdgeOrientation(aEdgeIt)); + const IMeshData::ListOfInteger& aListOfPCurves = aDEdge->GetPCurves (myDFace.get()); - const TopAbs_Orientation aOri = fixSeamEdgeOrientation(aDEdge, aPCurve); - - Standard_Integer aPrevNodeIndex = -1; - const Standard_Integer aLastPoint = aPCurve->ParametersNb() - 1; - for (Standard_Integer aPointIt = 0; aPointIt <= aLastPoint; ++aPointIt) + for (IMeshData::ListOfInteger::Iterator aPCurveIt(aListOfPCurves); aPCurveIt.More(); aPCurveIt.Next()) { - const Standard_Integer aNodeIndex = registerNode( - aCurve ->GetPoint(aPointIt), - aPCurve->GetPoint(aPointIt), - BRepMesh_Frontier, Standard_False/*aPointIt > 0 && aPointIt < aLastPoint*/); + const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve (aPCurveIt.Value()); - aPCurve->GetIndex(aPointIt) = aNodeIndex; - myUsedNodes->Bind(aNodeIndex, aNodeIndex); + const TopAbs_Orientation aOri = fixSeamEdgeOrientation(aDEdge, aPCurve); - if (aPrevNodeIndex != -1 && aPrevNodeIndex != aNodeIndex) + Standard_Integer aPrevNodeIndex = -1; + const Standard_Integer aLastPoint = aPCurve->ParametersNb() - 1; + + Standard_Integer aPointIt = 0; + for (; aPointIt <= aLastPoint; ++aPointIt) { - const Standard_Integer aLinksNb = myStructure->NbLinks(); - const Standard_Integer aLinkIndex = addLinkToMesh(aPrevNodeIndex, aNodeIndex, aOri); - if (aWireIt != 0 && aLinkIndex <= aLinksNb) - { - // Prevent holes around wire of zero area. - BRepMesh_Edge& aLink = const_cast(myStructure->GetLink(aLinkIndex)); - aLink.SetMovability(BRepMesh_Fixed); - } - } + const Standard_Integer aNodeIndex = registerNode( + aCurve->GetPoint(aPointIt), + aPCurve->GetPoint(aPointIt), + BRepMesh_Frontier, Standard_False/*aPointIt > 0 && aPointIt < aLastPoint*/); - aPrevNodeIndex = aNodeIndex; + aPCurve->GetIndex (aPointIt) = aNodeIndex; + myUsedNodes->Bind (aNodeIndex, aNodeIndex); + + if (aPrevNodeIndex != -1 && aPrevNodeIndex != aNodeIndex) + { + const Standard_Integer aLinksNb = myStructure->NbLinks(); + const Standard_Integer aLinkIndex = addLinkToMesh(aPrevNodeIndex, aNodeIndex, aOri); + if (aWireIt != 0 && aLinkIndex <= aLinksNb) + { + // Prevent holes around wire of zero area. + BRepMesh_Edge& aLink = const_cast(myStructure->GetLink(aLinkIndex)); + aLink.SetMovability(BRepMesh_Fixed); + } + } + + aPrevNodeIndex = aNodeIndex; + } } } } diff --git a/src/BRepMeshData/BRepMeshData_Edge.cxx b/src/BRepMeshData/BRepMeshData_Edge.cxx index 9b30ed791a..7ac30a2d92 100644 --- a/src/BRepMeshData/BRepMeshData_Edge.cxx +++ b/src/BRepMeshData/BRepMeshData_Edge.cxx @@ -91,6 +91,15 @@ const IMeshData::IPCurveHandle& BRepMeshData_Edge::GetPCurve ( myPCurves (aListOfPCurves.Last ()); } +//======================================================================= +// Function: GetPCurves +// Purpose : +//======================================================================= +const IMeshData::ListOfInteger& BRepMeshData_Edge::GetPCurves (const IMeshData::IFacePtr& theDFace) const +{ + return myPCurvesMap.Find (theDFace); +} + //======================================================================= // Function: GetPCurve // Purpose : diff --git a/src/BRepMeshData/BRepMeshData_Edge.hxx b/src/BRepMeshData/BRepMeshData_Edge.hxx index 0f64ab5804..088e90dcab 100644 --- a/src/BRepMeshData/BRepMeshData_Edge.hxx +++ b/src/BRepMeshData/BRepMeshData_Edge.hxx @@ -48,6 +48,10 @@ public: const IMeshData::IFacePtr& theDFace, const TopAbs_Orientation theOrientation) const Standard_OVERRIDE; + //! Returns an array of pcurves indices for the specified discrete face. + Standard_EXPORT virtual const IMeshData::ListOfInteger& GetPCurves( + const IMeshData::IFacePtr& theDFace) const Standard_OVERRIDE; + //! Returns pcurve with the given index. Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve ( const Standard_Integer theIndex) const Standard_OVERRIDE; diff --git a/src/IMeshData/IMeshData_Edge.hxx b/src/IMeshData/IMeshData_Edge.hxx index f83c89fff6..9eb2699e85 100644 --- a/src/IMeshData/IMeshData_Edge.hxx +++ b/src/IMeshData/IMeshData_Edge.hxx @@ -52,6 +52,10 @@ public: const IMeshData::IFacePtr& theDFace, const TopAbs_Orientation theOrientation) const = 0; + //! Returns an array of pcurves indices for the specified discrete face. + Standard_EXPORT virtual const IMeshData::ListOfInteger& GetPCurves ( + const IMeshData::IFacePtr& theDFace) const = 0; + //! Returns pcurve with the given index. Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve ( const Standard_Integer theIndex) const = 0;