-// File: BRepFill_TrimShellCorner.cxx
-// Created: Tue Oct 21 17:58:29 2003
-// Author: Mikhail KLOKOV
-// <mkk@kurox>
-
-#include <BRepFill_TrimShellCorner.ixx>
-
-#include <BRepAlgoAPI_Section.hxx>
+// Created on: 2003-10-21
+// Created by: Mikhail KLOKOV
+// Copyright (c) 2003-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <BOPAlgo_BOP.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPCol_DataMapOfShapeListOfShape.hxx>
+#include <BOPCol_ListOfShape.hxx>
+#include <BOPDS_DS.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
+#include <BRepAlgoAPI_Section.hxx>
+#include <BRepFill_TrimShellCorner.hxx>
#include <BRepLib_MakeEdge.hxx>
+#include <BRepLib_MakeWire.hxx>
#include <BRepTools_ReShape.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Compound.hxx>
-
+#include <gce_MakeLin.hxx>
+#include <GCPnts_UniformAbscissa.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom_Curve.hxx>
+#include <GeomLib.hxx>
+#include <gp_Ax2.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt2d.hxx>
#include <IntTools_BeanFaceIntersector.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Range.hxx>
-
-#include <BOPTools_Pave.hxx>
-#include <BOPTools_DSFiller.hxx>
-#include <BOPTools_PaveFiller.hxx>
-#include <BOPTools_CArray1OfVVInterference.hxx>
-#include <BOPTools_CArray1OfVEInterference.hxx>
-#include <BOPTools_CArray1OfEEInterference.hxx>
-#include <BOPTools_CArray1OfSSInterference.hxx>
-#include <BOPTools_VVInterference.hxx>
-#include <BOPTools_VEInterference.hxx>
-#include <BOPTools_EEInterference.hxx>
-#include <BOPTools_SSInterference.hxx>
-#include <BOPTools_InterferencePool.hxx>
-#include <BOPTools_Curve.hxx>
-#include <BOPTools_SequenceOfCurves.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_CommonBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
-#include <BOPTools_PaveSet.hxx>
-#include <BOPTools_ListIteratorOfListOfPave.hxx>
-#include <BooleanOperations_ShapesDataStructure.hxx>
-#include <BOP_BuilderTools.hxx>
-
-#include <Geom_Curve.hxx>
-#include <Geom2d_Curve.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <TopLoc_Location.hxx>
+#include <IntTools_Tools.hxx>
+#include <TColgp_Array1OfDir.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array2OfPnt.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+#include <TColStd_Array1OfBoolean.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListOfInteger.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Wire.hxx>
#include <TopTools_Array1OfListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-
-#include <gp_Pln.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColgp_Array2OfPnt.hxx>
-#include <TColgp_Array1OfDir.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <GCPnts_UniformAbscissa.hxx>
-#include <GeomLib.hxx>
-#include <BRepLib_MakeWire.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
-#include <TColStd_Array1OfBoolean.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-#include <gce_MakeLin.hxx>
-
-static Standard_Boolean IsFromFirstToSecond(const TopoDS_Edge& theEdge,
- const Standard_Real theParameterOnUEdge,
- const TopoDS_Edge& theUEdge1,
- const TopoDS_Edge& theUEdge2,
- const TopoDS_Face& theFace);
-static Standard_Boolean FindParameter(const BOPTools_PaveSet& thePaveSet,
- const BooleanOperations_KindOfInterference& theType,
- const Standard_Integer theInterfIndex,
- Standard_Real& theParam);
-
-static Standard_Boolean FindCommonVertex(const BOPTools_DSFiller& theDSFiller,
- const Standard_Integer theEIndex1,
- const Standard_Integer theEIndex2,
- TopoDS_Vertex& theCommonVertex,
- Standard_Real& theParamOnE1,
- Standard_Real& theParamOnE2);
+static Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
+ const Standard_Integer theEIndex1,
+ const Standard_Integer theEIndex2,
+ TopoDS_Vertex& theCommonVertex,
+ Standard_Real& theParamOnE1,
+ Standard_Real& theParamOnE2);
static Standard_Boolean MakeFacesNonSec(const Standard_Integer theIndex,
- const Handle(TopTools_HArray2OfShape)& theUEdges,
- const Handle(TopTools_HArray2OfShape)& theBounds,
- const BOPTools_DSFiller& theDSFiller,
- const Standard_Integer theFaceIndex1,
- const Standard_Integer theFaceIndex2,
- TopTools_DataMapOfShapeListOfShape& theHistMap);
+ const Handle(TopTools_HArray2OfShape)& theUEdges,
+ const Handle(TopTools_HArray2OfShape)& theBounds,
+ const BOPDS_PDS& theDS,
+ const Standard_Integer theFaceIndex1,
+ const Standard_Integer theFaceIndex2,
+ TopTools_DataMapOfShapeListOfShape& theHistMap);
static Standard_Boolean MakeFacesSec(const Standard_Integer theIndex,
- const Handle(TopTools_HArray2OfShape)& theUEdges,
- const Handle(TopTools_HArray2OfShape)& theBounds,
- const BOPTools_DSFiller& theDSFiller,
- const Standard_Integer theFaceIndex1,
- const Standard_Integer theFaceIndex2,
- const Standard_Integer theSSInterfIndex,
- const gp_Ax2& AxeOfBisPlane,
- TopTools_DataMapOfShapeListOfShape& theHistMap);
+ const Handle(TopTools_HArray2OfShape)& theUEdges,
+ const Handle(TopTools_HArray2OfShape)& theBounds,
+ const BOPDS_PDS& theDS,
+ const Standard_Integer theFaceIndex1,
+ const Standard_Integer theFaceIndex2,
+ const Standard_Integer theSSInterfIndex,
+ const gp_Ax2& AxeOfBisPlane,
+ TopTools_DataMapOfShapeListOfShape& theHistMap);
static Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges,
- const BOPTools_DSFiller& theDSFiller,
- TopTools_DataMapOfShapeListOfShape& theHistMap);
+ const BOPDS_PDS& theDS,
+ TopTools_DataMapOfShapeListOfShape& theHistMap);
static void FindFreeVertices(const TopoDS_Shape& theShape,
- const TopTools_MapOfShape& theVerticesToAvoid,
- TopTools_ListOfShape& theListOfVertex);
+ const TopTools_MapOfShape& theVerticesToAvoid,
+ TopTools_ListOfShape& theListOfVertex);
static Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList,
- const gp_Pnt2d& theFirstPoint,
- const gp_Pnt2d& theLastPoint,
- const TopoDS_Face& theFace,
- TopTools_ListOfShape& theOrientedList);
+ const gp_Pnt2d& theFirstPoint,
+ const gp_Pnt2d& theLastPoint,
+ const TopoDS_Face& theFace,
+ TopTools_ListOfShape& theOrientedList);
static Standard_Boolean FillGap(const TopoDS_Vertex& theFirstVertex,
- const TopoDS_Vertex& theLastVertex,
- const gp_Pnt2d& theFirstPoint,
- const gp_Pnt2d& theLastPoint,
- const TopoDS_Face& theFace,
- const TopoDS_Compound& theSectionEdges,
- TopTools_ListOfShape& theOrderedList);
+ const TopoDS_Vertex& theLastVertex,
+ const gp_Pnt2d& theFirstPoint,
+ const gp_Pnt2d& theLastPoint,
+ const TopoDS_Face& theFace,
+ const TopoDS_Compound& theSectionEdges,
+ TopTools_ListOfShape& theOrderedList);
static Standard_Boolean FindNextEdge(const TopoDS_Vertex& theFirstVertex,
- const TopoDS_Vertex& theLastVertex,
- const TopTools_IndexedDataMapOfShapeListOfShape& theMapVE,
- const TopTools_MapOfShape& theMapToAvoid,
- TopTools_ListOfShape& theOrderedList);
+ const TopoDS_Vertex& theLastVertex,
+ const TopTools_IndexedDataMapOfShapeListOfShape& theMapVE,
+ const TopTools_MapOfShape& theMapToAvoid,
+ TopTools_ListOfShape& theOrderedList);
static Standard_Boolean FindVertex(const TopoDS_Edge& theEdge,
- const Standard_Integer theRank,
- const BOPTools_DSFiller& theDSFiller,
- const TopTools_DataMapOfShapeListOfShape& theHistMap,
- TopoDS_Vertex& theVertex,
- BOPTools_Pave& thePave);
+ const Standard_Integer theRank,
+ const BOPDS_PDS& theDS,
+ const TopTools_DataMapOfShapeListOfShape& theHistMap,
+ TopoDS_Vertex& theVertex,
+ BOPDS_Pave& thePave);
static Standard_Boolean FindNextVertex(const Standard_Integer theEdgeIndex,
- const BOPTools_Pave& thePrevPave,
- const BOPTools_DSFiller& theDSFiller,
- TopoDS_Vertex& theNextVertex,
- BOPTools_Pave& thePave);
+ const BOPDS_Pave& thePrevPave,
+ const BOPDS_PDS& theDS,
+ TopoDS_Vertex& theNextVertex,
+ BOPDS_Pave& thePave);
-static Standard_Boolean GetPave(const Standard_Integer theEdgeIndex,
- const Standard_Boolean isFirst,
- const BOPTools_DSFiller& theDSFiller,
- BOPTools_Pave& thePave);
+static Standard_Boolean GetPave(const Standard_Integer theEdgeIndex,
+ const Standard_Boolean isFirst,
+ const BOPDS_PDS& theDS,
+ BOPDS_Pave& thePave);
static Standard_Boolean FindFromUEdge(const TopoDS_Edge& theUE1Old,
- const TopoDS_Edge& theUE2Old,
- const TopoDS_Edge& theUE1New,
- const TopoDS_Edge& theUE2New,
- const TopoDS_Face& theFace,
- const TopoDS_Compound& theSecEdges,
- const Standard_Integer theRank,
- const TopoDS_Edge& theBoundEdge,
- const Standard_Integer theBoundEdgeIndex,
- const BOPTools_DSFiller& theDSFiller,
- const TopTools_DataMapOfShapeListOfShape& theHistMap,
- TopoDS_Compound& theSecEdgesNew,
- TopTools_ListOfShape& theListOfWireEdges,
- BOPTools_Pave& theFoundPave,
- Standard_Boolean& isOnUEdge);
-
-static Standard_Boolean FindFromVEdge(const BOPTools_Pave& thePrevPave,
- const Standard_Boolean& isOnUEdge,
- const TopoDS_Edge& theUE1Old,
- const TopoDS_Edge& theUE2Old,
- const TopoDS_Face& theFace,
- const TopoDS_Compound& theSecEdges,
- const Standard_Integer theRank,
- const TopoDS_Edge& theBoundEdge,
- const Standard_Integer theBoundEdgeIndex,
- const BOPTools_DSFiller& theDSFiller,
- const TopTools_DataMapOfShapeListOfShape& theHistMap,
- TopTools_ListOfShape& theListOfWireEdges,
- Standard_Boolean& isSectionFound);
+ const TopoDS_Edge& theUE2Old,
+ const TopoDS_Edge& theUE1New,
+ const TopoDS_Edge& theUE2New,
+ const TopoDS_Face& theFace,
+ const TopoDS_Compound& theSecEdges,
+ const Standard_Integer theRank,
+ const TopoDS_Edge& theBoundEdge,
+ const Standard_Integer theBoundEdgeIndex,
+ const BOPDS_PDS& theDS,
+ const TopTools_DataMapOfShapeListOfShape& theHistMap,
+ TopoDS_Compound& theSecEdgesNew,
+ TopTools_ListOfShape& theListOfWireEdges,
+ BOPDS_Pave& theFoundPave,
+ Standard_Boolean& isOnUEdge);
+
+static Standard_Boolean FindFromVEdge(const BOPDS_Pave& thePrevPave,
+ const Standard_Boolean& isOnUEdge,
+ const TopoDS_Edge& theUE1Old,
+ const TopoDS_Edge& theUE2Old,
+ const TopoDS_Face& theFace,
+ const TopoDS_Compound& theSecEdges,
+ const Standard_Integer theRank,
+ const TopoDS_Edge& theBoundEdge,
+ const Standard_Integer theBoundEdgeIndex,
+ const BOPDS_PDS& theDS,
+ const TopTools_DataMapOfShapeListOfShape& theHistMap,
+ TopTools_ListOfShape& theListOfWireEdges,
+ Standard_Boolean& isSectionFound);
static void RemoveEdges(const TopoDS_Compound& theSourceComp,
- const TopTools_ListOfShape& theListToRemove,
- TopoDS_Compound& theResultComp);
+ const TopTools_ListOfShape& theListToRemove,
+ TopoDS_Compound& theResultComp);
-static Standard_Boolean FilterSectionEdges(const BOPTools_SequenceOfCurves& theBCurves,
- const TopoDS_Face& theSecPlane,
- const BOPTools_DSFiller& theDSFiller,
- TopoDS_Compound& theResult);
+static Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve& theBCurves,
+ const TopoDS_Face& theSecPlane,
+ const BOPDS_PDS& theDS,
+ TopoDS_Compound& theResult);
static Standard_Boolean GetUEdges(const Standard_Integer theIndex,
- const Standard_Integer theRank,
- const Handle(TopTools_HArray2OfShape)& theUEdges,
- const TopoDS_Edge& theBoundEdge,
- const TopoDS_Face& theFace,
- TopoDS_Edge& theFirstUEdge,
- TopoDS_Edge& theSecondUEdge);
+ const Standard_Integer theRank,
+ const Handle(TopTools_HArray2OfShape)& theUEdges,
+ const TopoDS_Edge& theBoundEdge,
+ const TopoDS_Face& theFace,
+ TopoDS_Edge& theFirstUEdge,
+ TopoDS_Edge& theSecondUEdge);
static Standard_Real ComputeAveragePlaneAndMaxDeviation(const TopoDS_Shape& aWire,
- gp_Pln& thePlane,
- Standard_Boolean& IsSingular);
+ gp_Pln& thePlane,
+ Standard_Boolean& IsSingular);
static Standard_Boolean ChooseSection(const TopoDS_Shape& Comp,
- const gp_Ax2& bis,
- TopoDS_Shape& resWire,
- gp_Pln& resPlane,
- Standard_Boolean& IsSingular);
-
-static Standard_Boolean ChoosePlane(const TopoDS_Shape& Comp,
- const gp_Ax2& bis,
- gp_Pln& resPlane,
- TopoDS_Compound& NewComp);
-
+ const gp_Ax2& bis,
+ TopoDS_Shape& resWire,
+ gp_Pln& resPlane,
+ Standard_Boolean& IsSingular);
// ===========================================================================================
// function: Constructor
// purpose:
// ===========================================================================================
BRepFill_TrimShellCorner::BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces,
- const gp_Ax2& theAxeOfBisPlane,
- const TopoDS_Face& theSecPlane) :
+ const gp_Ax2& theAxeOfBisPlane,
+ const TopoDS_Face& theSecPlane) :
myAxeOfBisPlane(theAxeOfBisPlane),
myDone(Standard_False),
myHasSection(Standard_False)
{
myFaces = new TopTools_HArray2OfShape(theFaces->LowerRow(), theFaces->UpperRow(),
- theFaces->LowerCol(), theFaces->UpperCol());
+ theFaces->LowerCol(), theFaces->UpperCol());
myFaces->ChangeArray2() = theFaces->Array2();
mySecPln = theSecPlane;
}
// purpose:
// ===========================================================================================
BRepFill_TrimShellCorner::BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces,
- const gp_Ax2& theAxeOfBisPlane,
- const TopoDS_Wire& theSpine,
- const TopoDS_Face& theSecPlane):
+ const gp_Ax2& theAxeOfBisPlane,
+ const TopoDS_Wire& theSpine,
+ const TopoDS_Face& theSecPlane):
myAxeOfBisPlane(theAxeOfBisPlane),
myDone(Standard_False),
myHasSection(Standard_False)
{
myFaces = new TopTools_HArray2OfShape(theFaces->LowerRow(), theFaces->UpperRow(),
- theFaces->LowerCol(), theFaces->UpperCol());
+ theFaces->LowerCol(), theFaces->UpperCol());
myFaces->ChangeArray2() = theFaces->Array2();
mySpine = theSpine;
mySecPln = theSecPlane;
void BRepFill_TrimShellCorner::AddBounds(const Handle(TopTools_HArray2OfShape)& theBounds)
{
myBounds = new TopTools_HArray2OfShape(theBounds->LowerRow(), theBounds->UpperRow(),
- theBounds->LowerCol(), theBounds->UpperCol());
+ theBounds->LowerCol(), theBounds->UpperCol());
myBounds->ChangeArray2() = theBounds->Array2();
}
void BRepFill_TrimShellCorner::AddUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges)
{
myUEdges = new TopTools_HArray2OfShape(theUEdges->LowerRow(), theUEdges->UpperRow(),
- theUEdges->LowerCol(), theUEdges->UpperCol());
+ theUEdges->LowerCol(), theUEdges->UpperCol());
myUEdges->ChangeArray2() = theUEdges->Array2();
}
// ===========================================================================================
void BRepFill_TrimShellCorner::Perform()
{
+ Standard_Integer anIndex1, anIndex2, nF1, nF2, i, j, aNbP, aNbC;
+ Standard_Boolean bhassec;
+
myDone = Standard_False;
myHistMap.Clear();
for(ii = myFaces->LowerRow(); ii <= myFaces->UpperRow(); ii++) {
aBB.Add(aShell, myFaces->Value(ii, jj));
}
+ aShell.Closed (BRep_Tool::IsClosed (aShell));
if(jj == myFaces->LowerCol()) {
myShape1 = aShell;
myShape2 = aShell;
}
}
-
- BOPTools_DSFiller aDSFiller;
- aDSFiller.SetShapes(myShape1, myShape2);
-
- if (!aDSFiller.IsDone()) {
+
+ BOPAlgo_PaveFiller aPF;
+ BOPCol_ListOfShape aLS;
+ aLS.Append(myShape1);
+ aLS.Append(myShape2);
+ aPF.SetArguments(aLS);
+ //
+ aPF.Perform();
+ if (aPF.ErrorStatus()) {
return;
}
- aDSFiller.Perform();
-
- BRepAlgoAPI_Section aSectionAlgo(myShape1, myShape2, aDSFiller, Standard_False);
- aSectionAlgo.ComputePCurveOn1(Standard_True);
- aSectionAlgo.ComputePCurveOn2(Standard_True);
- aSectionAlgo.Approximation(Standard_True);
- aSectionAlgo.Build();
-
- if(!aSectionAlgo.IsDone())
- return;
-
- const BooleanOperations_ShapesDataStructure& aDS = aDSFiller.DS();
- const BOPTools_InterferencePool& anInterfPool = aDSFiller.InterfPool();
- BOPTools_InterferencePool* pInterfPool =
- (BOPTools_InterferencePool*) &anInterfPool;
- BOPTools_CArray1OfSSInterference& aFFs =
- pInterfPool->SSInterferences();
+ //
+ const BOPDS_PDS& theDS = aPF.PDS();
+ //
+ BOPDS_VectorOfInterfFF& aFFs = theDS->InterfFF();
Standard_Integer aNbFFs = aFFs.Extent();
- if(!SplitUEdges(myUEdges, aDSFiller, myHistMap)) {
+ if(!SplitUEdges(myUEdges, theDS, myHistMap)) {
return;
}
for(ii = myFaces->LowerRow(); ii <= myFaces->UpperRow(); ii++) {
TopoDS_Shape aF1 = myFaces->Value(ii, myFaces->LowerCol());
TopoDS_Shape aF2 = myFaces->Value(ii, myFaces->UpperCol());
- Standard_Integer anIndex1 = aDS.ShapeIndex(aF1, 1);
- Standard_Integer anIndex2 = aDS.ShapeIndex(aF2, 2);
-
- if((anIndex1 == 0) || (anIndex1 == 0))
+ //
+ anIndex1 = theDS->Index(aF1);
+ anIndex2 = theDS->Index(aF2);
+
+ if((anIndex1 == -1) || (anIndex2 == -1))
continue;
- Standard_Integer i = 0;
-
- for (i=1; i <= aNbFFs; i++) {
- BOPTools_SSInterference& aFFi=aFFs(i);
+
+ for (i=0; i < aNbFFs; ++i) {
+ BOPDS_InterfFF& aFFi = aFFs(i);
+ aFFi.Indices(nF1, nF2);
+ //
+ BOPDS_VectorOfPoint& aVP=aFFi.ChangePoints();
+ aNbP=aVP.Extent();
+ const BOPDS_VectorOfCurve& aVC=aFFi.Curves();
+ aNbC=aVC.Extent();
+ if (!aNbP && !aNbC) {
+ if (!theDS->HasInterfSubShapes(nF1, nF2)) {
+ continue;
+ }
+ }
//
- Standard_Integer nF1 = aFFi.Index1();
- Standard_Integer nF2 = aFFi.Index2();
-
if((nF1 == anIndex1) && (nF2 == anIndex2)) {
- BOPTools_SequenceOfCurves& aBCurves = aFFi.Curves();
- Standard_Integer aNbCurves = aBCurves.Length();
- Standard_Integer j = 0;
- Standard_Boolean bhassec = Standard_False;
-
- for (j = 1; j <= aNbCurves; j++) {
- const BOPTools_Curve& aBCurve = aBCurves(j);
- const BOPTools_ListOfPaveBlock& aSectEdges = aBCurve.NewPaveBlocks();
-
- if(!aSectEdges.IsEmpty()) {
- bhassec = Standard_True;
- break;
- }
- }
-
- if(!bhassec) {
- if(!MakeFacesNonSec(ii, myUEdges, myBounds, aDSFiller, anIndex1, anIndex2, myHistMap)) {
- myHistMap.Clear();
- return;
- }
- }
- else {
- if(!MakeFacesSec(ii, myUEdges, myBounds, aDSFiller, anIndex1, anIndex2,
- i, myAxeOfBisPlane, myHistMap)) {
- myHistMap.Clear();
- return;
- }
- }
- break;
+ bhassec = Standard_False;
+ //
+ for (j = 0; j < aNbC; ++j) {
+ const BOPDS_Curve& aBCurve = aVC(j);
+ const BOPDS_ListOfPaveBlock& aSectEdges = aBCurve.PaveBlocks();
+ //
+ if (aSectEdges.Extent()) {
+ bhassec = Standard_True;
+ break;
+ }
+ }
+
+ if(!bhassec) {
+ if(!MakeFacesNonSec(ii, myUEdges, myBounds, theDS, anIndex1, anIndex2, myHistMap)) {
+ myHistMap.Clear();
+ return;
+ }
+ }
+ else {
+ if(!MakeFacesSec(ii, myUEdges, myBounds, theDS, anIndex1, anIndex2,
+ i, myAxeOfBisPlane, myHistMap)) {
+ myHistMap.Clear();
+ return;
+ }
+ }
+ break;
}
}
}
// purpose:
// ===========================================================================================
void BRepFill_TrimShellCorner::Modified(const TopoDS_Shape& theShape,
- TopTools_ListOfShape& theModified)
+ TopTools_ListOfShape& theModified)
{
theModified.Clear();
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean MakeFacesNonSec(const Standard_Integer theIndex,
- const Handle(TopTools_HArray2OfShape)& theUEdges,
- const Handle(TopTools_HArray2OfShape)& theBounds,
- const BOPTools_DSFiller& theDSFiller,
- const Standard_Integer theFaceIndex1,
- const Standard_Integer theFaceIndex2,
- TopTools_DataMapOfShapeListOfShape& theHistMap)
+ const Handle(TopTools_HArray2OfShape)& theUEdges,
+ const Handle(TopTools_HArray2OfShape)& theBounds,
+ const BOPDS_PDS& theDS,
+ const Standard_Integer theFaceIndex1,
+ const Standard_Integer theFaceIndex2,
+ TopTools_DataMapOfShapeListOfShape& theHistMap)
{
-
Standard_Boolean bHasNewEdge = Standard_False;
TopoDS_Edge aNewEdge;
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
- const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
-// BOPTools_DSFiller& aDSFiller = (*((BOPTools_DSFiller*)&theDSFiller));
-// BOPTools_InterferencePool* pIntrPool = (BOPTools_InterferencePool*)&aDSFiller.InterfPool();
-// const BOPTools_CArray1OfEEInterference& aEEs = pIntrPool->EEInterfs();
- const BOPTools_PavePool& aPavePool = aPaveFiller.PavePool();
BRep_Builder aBB;
const TopoDS_Shape& aE1 = theBounds->Value(theIndex, 1);
// search common vertex between bounds. begin
TopoDS_Vertex aCommonVertex;
- Standard_Integer anIndex1 = aDS.ShapeIndex(aE1, 1);
- Standard_Integer anIndex2 = aDS.ShapeIndex(aE2, 2);
+ Standard_Integer anIndex1 = theDS->Index(aE1);
+ Standard_Integer anIndex2 = theDS->Index(aE2);
Standard_Real apar1 = 0., apar2 = 0.;
Standard_Boolean bvertexfound =
- FindCommonVertex(theDSFiller, anIndex1, anIndex2, aCommonVertex, apar1, apar2);
+ FindCommonVertex(theDS, anIndex1, anIndex2, aCommonVertex, apar1, apar2);
// search common vertex between bounds. end
Handle(BRepTools_ReShape) aSubstitutor = new BRepTools_ReShape();
// search common vertices between uedges. begin
TopTools_ListOfShape aCommonVertices;
- Standard_Boolean acommonflag = 0; // 0 - no, 1 - first pair, 2 - second pair, 3 - both
+ Standard_Integer acommonflag = 0; // 0 - no, 1 - first pair, 2 - second pair, 3 - both
Standard_Integer ueit = 0, eindex = 0;
for(ueit = 1, eindex = theIndex; ueit <= 2; ueit++, eindex++) {
const TopTools_ListOfShape& lst = theHistMap.Find(aShape1);
if(!lst.IsEmpty())
- aUE1 = TopoDS::Edge(lst.First());
+ aUE1 = TopoDS::Edge(lst.First());
}
if(theHistMap.IsBound(aShape2)) {
const TopTools_ListOfShape& lst = theHistMap.Find(aShape2);
if(!lst.IsEmpty())
- aUE2 = TopoDS::Edge(lst.First());
+ aUE2 = TopoDS::Edge(lst.First());
}
if(!aShape1.IsSame(aUE1))
if(aCommonVertices.Extent() == 2) {
aNewEdge = BRepLib_MakeEdge(TopoDS::Vertex(aCommonVertices.First()),
- TopoDS::Vertex(aCommonVertices.Last()));
+ TopoDS::Vertex(aCommonVertices.Last()));
bHasNewEdge = Standard_True;
}
Standard_Integer fit = 0;
TopoDS_Shape aUE = aShape;
if(theHistMap.IsBound(aShape)) {
- const TopTools_ListOfShape& lst = theHistMap.Find(aShape);
+ const TopTools_ListOfShape& lst = theHistMap.Find(aShape);
- if(!lst.IsEmpty())
- aUE = TopoDS::Edge(lst.First());
+ if(!lst.IsEmpty())
+ aUE = TopoDS::Edge(lst.First());
}
const TopoDS_Shape& aV = (fit == 1) ? TopExp::FirstVertex(TopoDS::Edge(aUE)) : TopExp::LastVertex(TopoDS::Edge(aUE));
aMapV.Add(aV);
return Standard_False;
Standard_Integer aFaceIndex = (fit == 1) ? theFaceIndex1 : theFaceIndex2;
- TopoDS_Shape aFace = aDS.Shape(aFaceIndex);
+ TopoDS_Shape aFace = theDS->Shape(aFaceIndex);
TopAbs_Orientation aFaceOri = aFace.Orientation();
- TopAbs_Orientation anEdgeOri = TopAbs_FORWARD;
aFace.Orientation(TopAbs_FORWARD);
TopExp_Explorer anExpE(aFace, TopAbs_EDGE);
- const TopoDS_Shape& aCheckEdge = (fit == 1) ? aE1 : aE2;
-
- for(; anExpE.More(); anExpE.Next()) {
- if(aCheckEdge.IsSame(anExpE.Current()))
- anEdgeOri = anExpE.Current().Orientation();
- }
if(bHasNewEdge) {
aNewEdge.Orientation(TopAbs_FORWARD);
if(!alonevertices.IsEmpty()) {
Standard_Integer anEIndex = (fit == 1) ? anIndex1 : anIndex2;
- const BOPTools_PaveSet& aPaveSet = aPavePool(aDS.RefEdge(anEIndex));
- BOPTools_ListIteratorOfListOfPave anPIt(aPaveSet.Set());
Standard_Boolean bfound1 = Standard_False;
Standard_Boolean bfound2 = Standard_False;
Standard_Real aparam1 = 0., aparam2 = 0.;
- for(; anPIt.More(); anPIt.Next()) {
- const BOPTools_Pave& aPave = anPIt.Value();
- TopoDS_Shape aV = aDS.Shape(aPave.Index());
-
- if(aV.IsSame(alonevertices.First())) {
- if(!bfound1) {
- aparam1 = aPave.Param();
- bfound1 = Standard_True;
- }
- }
-
- if(aV.IsSame(alonevertices.Last())) {
- if(!bfound2) {
- aparam2 = aPave.Param();
- bfound2 = Standard_True;
- }
- }
+ BOPDS_ListOfPave aLP;
+ theDS->Paves(anEIndex, aLP);
+ BOPDS_ListIteratorOfListOfPave aIt;
+ aIt.Initialize(aLP);
+ for ( ; aIt.More(); aIt.Next()) {
+ const BOPDS_Pave& aPave = aIt.Value();
+ TopoDS_Shape aV = theDS->Shape(aPave.Index());
+
+ if(aV.IsSame(alonevertices.First())) {
+ if(!bfound1) {
+ aparam1 = aPave.Parameter();
+ bfound1 = Standard_True;
+ }
+ }
+
+ if(aV.IsSame(alonevertices.Last())) {
+ if(!bfound2) {
+ aparam2 = aPave.Parameter();
+ bfound2 = Standard_True;
+ }
+ }
}
if(bfound1 && bfound2) {
- TopoDS_Edge aNewBoundE;
-
- if(fit == 1) {
- aNewBoundE = TopoDS::Edge(aE1.EmptyCopied());
- }
- else {
- aNewBoundE = TopoDS::Edge(aE2.EmptyCopied());
- }
- TopoDS_Vertex aV1, aV2;
-
- if(aparam1 < aparam2) {
- aV1 = TopoDS::Vertex(alonevertices.First());
- aV2 = TopoDS::Vertex(alonevertices.Last());
- }
- else {
- aV1 = TopoDS::Vertex(alonevertices.Last());
- aV2 = TopoDS::Vertex(alonevertices.First());
- Standard_Real tmp = aparam1;
- aparam1 = aparam2;
- aparam2 = tmp;
- }
- aV1.Orientation(TopAbs_FORWARD);
- aV2.Orientation(TopAbs_REVERSED);
- aBB.Add(aNewBoundE, aV1);
- aBB.Add(aNewBoundE, aV2);
- aBB.Range(aNewBoundE, aparam1, aparam2);
- aNewBoundE.Orientation(TopAbs_FORWARD);
-
- aOrderedList.Append(aNewBoundE);
-
- if(bHasNewEdge) {
- TopExp_Explorer anExpV(aNewEdge, TopAbs_VERTEX);
- Standard_Boolean bfoundv = Standard_False;
-
- for(; !bfoundv && anExpV.More(); anExpV.Next()) {
- if(aV2.IsSame(anExpV.Current()))
- bfoundv = Standard_True;
- }
-
- if(bfoundv)
- aOrderedList.Append(aNewEdge);
- else
- aOrderedList.Prepend(aNewEdge);
- }
+ TopoDS_Edge aNewBoundE;
+
+ if(fit == 1) {
+ aNewBoundE = TopoDS::Edge(aE1.EmptyCopied());
+ }
+ else {
+ aNewBoundE = TopoDS::Edge(aE2.EmptyCopied());
+ }
+ TopoDS_Vertex aV1, aV2;
+
+ if(aparam1 < aparam2) {
+ aV1 = TopoDS::Vertex(alonevertices.First());
+ aV2 = TopoDS::Vertex(alonevertices.Last());
+ }
+ else {
+ aV1 = TopoDS::Vertex(alonevertices.Last());
+ aV2 = TopoDS::Vertex(alonevertices.First());
+ Standard_Real tmp = aparam1;
+ aparam1 = aparam2;
+ aparam2 = tmp;
+ }
+ aV1.Orientation(TopAbs_FORWARD);
+ aV2.Orientation(TopAbs_REVERSED);
+ aBB.Add(aNewBoundE, aV1);
+ aBB.Add(aNewBoundE, aV2);
+ aBB.Range(aNewBoundE, aparam1, aparam2);
+ aNewBoundE.Orientation(TopAbs_FORWARD);
+
+ aOrderedList.Append(aNewBoundE);
+
+ if(bHasNewEdge) {
+ TopExp_Explorer anExpV(aNewEdge, TopAbs_VERTEX);
+ Standard_Boolean bfoundv = Standard_False;
+
+ for(; !bfoundv && anExpV.More(); anExpV.Next()) {
+ if(aV2.IsSame(anExpV.Current()))
+ bfoundv = Standard_True;
+ }
+
+ if(bfoundv)
+ aOrderedList.Append(aNewEdge);
+ else
+ aOrderedList.Prepend(aNewEdge);
+ }
}
else {
- return Standard_False;
+ return Standard_False;
}
}
else {
if(bHasNewEdge) {
- aOrderedList.Append(aNewEdge);
+ aOrderedList.Append(aNewEdge);
}
}
TopTools_ListIteratorOfListOfShape anItE(aOrderedList);
for(; anItE.More(); anItE.Next()) {
- aBB.Add(aW, anItE.Value());
+ aBB.Add(aW, anItE.Value());
}
if(fit == 1)
- aSubstitutor->Replace(aE1.Oriented(TopAbs_FORWARD), aW);
+ aSubstitutor->Replace(aE1.Oriented(TopAbs_FORWARD), aW);
else
- aSubstitutor->Replace(aE2.Oriented(TopAbs_FORWARD), aW);
+ aSubstitutor->Replace(aE2.Oriented(TopAbs_FORWARD), aW);
}
aSubstitutor->Apply(aFace);
TopoDS_Shape aNewValue = aSubstitutor->Value(anExpE.Current());
if(aNewValue.IsNull() || aNewValue.IsSame(anExpE.Current()))
- continue;
+ continue;
if(theHistMap.IsBound(anExpE.Current()))
- continue;
+ continue;
TopTools_ListOfShape aListOfNewEdge;
TopExp_Explorer anExpE2(aNewValue, TopAbs_EDGE);
for(; anExpE2.More(); anExpE2.Next()) {
- aListOfNewEdge.Append(anExpE2.Current());
+ aListOfNewEdge.Append(anExpE2.Current());
}
theHistMap.Bind(anExpE.Current(), aListOfNewEdge);
}
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean MakeFacesSec(const Standard_Integer theIndex,
- const Handle(TopTools_HArray2OfShape)& theUEdges,
- const Handle(TopTools_HArray2OfShape)& theBounds,
- const BOPTools_DSFiller& theDSFiller,
- const Standard_Integer theFaceIndex1,
- const Standard_Integer theFaceIndex2,
- const Standard_Integer theSSInterfIndex,
- const gp_Ax2& AxeOfBisPlane,
- TopTools_DataMapOfShapeListOfShape& theHistMap)
+ const Handle(TopTools_HArray2OfShape)& theUEdges,
+ const Handle(TopTools_HArray2OfShape)& theBounds,
+ const BOPDS_PDS& theDS,
+ const Standard_Integer theFaceIndex1,
+ const Standard_Integer theFaceIndex2,
+ const Standard_Integer theSSInterfIndex,
+ const gp_Ax2& AxeOfBisPlane,
+ TopTools_DataMapOfShapeListOfShape& theHistMap)
{
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
-// const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
- BOPTools_DSFiller& aDSFiller = (*((BOPTools_DSFiller*)&theDSFiller));
- BOPTools_InterferencePool* pIntrPool = (BOPTools_InterferencePool*)&aDSFiller.InterfPool();
- BOPTools_CArray1OfSSInterference& aFFs = pIntrPool->SSInterferences();
-// const BOPTools_PavePool& aPavePool = aPaveFiller.PavePool();
-// const BOPTools_SplitShapesPool& aSplitShapesPool = aPaveFiller.SplitShapesPool();
-
+ const BOPDS_VectorOfInterfFF& aFFs = theDS->InterfFF();
+ const BOPDS_InterfFF& aFFi = aFFs(theSSInterfIndex);
+ const BOPDS_VectorOfCurve& aBCurves = aFFi.Curves();
+
TopoDS_Compound aSecEdges;
- BOPTools_SSInterference& aFFi = aFFs(theSSInterfIndex);
- BOPTools_SequenceOfCurves& aBCurves = aFFi.Curves();
TopoDS_Face aSecPlane;
- if(!FilterSectionEdges(aBCurves, aSecPlane, theDSFiller, aSecEdges))
+ if(!FilterSectionEdges(aBCurves, aSecPlane, theDS, aSecEdges))
return Standard_False;
TopoDS_Shape SecWire;
}
TopTools_ListOfShape aCommonVertices;
-// Standard_Boolean acommonflag = 0; // 0 - no, 1 - first pair, 2 - second pair, 3 - both
+// Standard_Integer acommonflag = 0; // 0 - no, 1 - first pair, 2 - second pair, 3 - both
Standard_Integer fit = 0; //, ueit = 0, eindex = 0, i = 0;
Handle(BRepTools_ReShape) aSubstitutor = new BRepTools_ReShape();
- for(fit = 1; fit <= 2; fit++) {
- Standard_Integer aFaceIndex = (fit == 1) ? theFaceIndex1 : theFaceIndex2;
- TopoDS_Face aFace = TopoDS::Face(aDS.Shape(aFaceIndex));
+ for(fit = 0; fit < 2; fit++) {
+ Standard_Integer aFaceIndex = (fit == 0) ? theFaceIndex1 : theFaceIndex2;
+ TopoDS_Face aFace = TopoDS::Face(theDS->Shape(aFaceIndex));
TopAbs_Orientation aFaceOri = aFace.Orientation();
TopoDS_Face aFaceF = aFace;
aFaceF.Orientation(TopAbs_FORWARD);
- TopoDS_Edge aBoundEdge = TopoDS::Edge(theBounds->Value(theIndex, theBounds->LowerCol() + fit - 1));
- Standard_Integer aBoundEdgeIndex = aDS.ShapeIndex(aBoundEdge, fit);
+ TopoDS_Edge aBoundEdge = TopoDS::Edge(theBounds->Value(theIndex, theBounds->LowerCol() +fit));
+ Standard_Integer aBoundEdgeIndex = theDS->Index(aBoundEdge);
TopoDS_Edge aUE1;
TopoDS_Edge aUE2;
const TopTools_ListOfShape& lst = theHistMap.Find(aUE1);
if(!lst.IsEmpty()) {
- const TopoDS_Shape& anEdge = lst.First().Oriented(aUE1.Orientation());
+ const TopoDS_Shape& anEdge = lst.First().Oriented(aUE1.Orientation());
- if(!aUE1.IsSame(anEdge))
- aSubstitutor->Replace(aUE1.Oriented(TopAbs_FORWARD), anEdge.Oriented(TopAbs_FORWARD));
- aUE1 = TopoDS::Edge(anEdge);
+ if(!aUE1.IsSame(anEdge))
+ aSubstitutor->Replace(aUE1.Oriented(TopAbs_FORWARD), anEdge.Oriented(TopAbs_FORWARD));
+ aUE1 = TopoDS::Edge(anEdge);
}
}
const TopTools_ListOfShape& lst = theHistMap.Find(aUE2);
if(!lst.IsEmpty()) {
- const TopoDS_Shape& anEdge = lst.First().Oriented(aUE2.Orientation());
+ const TopoDS_Shape& anEdge = lst.First().Oriented(aUE2.Orientation());
- if(!aUE2.IsSame(anEdge))
- aSubstitutor->Replace(aUE2.Oriented(TopAbs_FORWARD), anEdge.Oriented(TopAbs_FORWARD));
- aUE2 = TopoDS::Edge(anEdge);
+ if(!aUE2.IsSame(anEdge))
+ aSubstitutor->Replace(aUE2.Oriented(TopAbs_FORWARD), anEdge.Oriented(TopAbs_FORWARD));
+ aUE2 = TopoDS::Edge(anEdge);
}
}
TopoDS_Vertex aPrevVertex, aNextVertex;
TopoDS_Compound aCompOfSecEdges = aSecEdges;
TopTools_ListOfShape aListOfWireEdges;
BRep_Builder aBB;
- BOPTools_Pave aPave1;
+ BOPDS_Pave aPave1;
Standard_Boolean isPave1OnUEdge = Standard_True;
if(FindFromUEdge(aUE1old, aUE2old, aUE1, aUE2, aFace, aSecEdges, fit, aBoundEdge, aBoundEdgeIndex,
- theDSFiller, theHistMap, aCompOfSecEdges, aListOfWireEdges, aPave1, isPave1OnUEdge)) {
+ theDS, theHistMap, aCompOfSecEdges, aListOfWireEdges, aPave1, isPave1OnUEdge)) {
TopTools_ListOfShape aSecondListOfEdges;
Standard_Boolean bisSectionFound = Standard_False;
if(!FindFromVEdge(aPave1, isPave1OnUEdge, aUE1old, aUE2old, aFace, aCompOfSecEdges, fit, aBoundEdge,
- aBoundEdgeIndex, theDSFiller, theHistMap, aSecondListOfEdges, bisSectionFound)) {
- return Standard_False;
+ aBoundEdgeIndex, theDS, theHistMap, aSecondListOfEdges, bisSectionFound)) {
+ return Standard_False;
}
if(!bisSectionFound && aListOfWireEdges.IsEmpty()) {
- return Standard_False;
+ return Standard_False;
}
aListOfWireEdges.Append(aSecondListOfEdges);
}
TopTools_ListIteratorOfListOfShape aEIt(aListOfWireEdges);
for(; aEIt.More(); aEIt.Next()) {
- if(!aBoundEdge.IsSame(aEIt.Value()))
- aBB.Add(aW, aEIt.Value());
+ if(!aBoundEdge.IsSame(aEIt.Value()))
+ aBB.Add(aW, aEIt.Value());
}
aSubstitutor->Replace(aBoundEdge.Oriented(TopAbs_FORWARD), aW);
}
TopoDS_Shape aNewValue = aSubstitutor->Value(anExpE.Current());
if(aNewValue.IsNull() || aNewValue.IsSame(anExpE.Current()))
- continue;
+ continue;
if(theHistMap.IsBound(anExpE.Current()))
- continue;
+ continue;
TopTools_ListOfShape aListOfNewEdge;
TopExp_Explorer anExpE2(aNewValue, TopAbs_EDGE);
for(; anExpE2.More(); anExpE2.Next()) {
- aListOfNewEdge.Append(anExpE2.Current());
+ aListOfNewEdge.Append(anExpE2.Current());
}
theHistMap.Bind(anExpE.Current(), aListOfNewEdge);
}
// purpose:
// ------------------------------------------------------------------------------------------
Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges,
- const BOPTools_DSFiller& theDSFiller,
- TopTools_DataMapOfShapeListOfShape& theHistMap) {
-
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
-// const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
-// const BOPTools_SplitShapesPool& aSplitShapesPool = aPaveFiller.SplitShapesPool();
- BOPTools_DSFiller& aDSFiller = (*((BOPTools_DSFiller*)&theDSFiller));
- BOPTools_InterferencePool* pIntrPool = (BOPTools_InterferencePool*)&aDSFiller.InterfPool();
- // const BOPTools_CommonBlockPool& aCBPool = aPaveFiller.CommonBlockPool();
-// const BOPTools_PavePool& aPavePool = aPaveFiller.PavePool();
-// const BOPTools_CArray1OfEEInterference& aEEs = pIntrPool->EEInterfs();
- const BOPTools_CArray1OfVEInterference& aVEs = pIntrPool->VEInterferences();
- const BOPTools_CArray1OfVVInterference& aVVs = pIntrPool->VVInterferences();
+ const BOPDS_PDS& theDS,
+ TopTools_DataMapOfShapeListOfShape& theHistMap) {
+
+ const BOPDS_VectorOfInterfVV& aVVs = theDS->InterfVV();
BRep_Builder aBB;
- Standard_Integer ueit = 0;
+ Standard_Integer ueit = 0, upRow, lowCol, upCol;
TopTools_Array2OfShape aNewVertices(1,2,1,2);
-
- for(ueit = theUEdges->LowerRow(); ueit <= theUEdges->UpperRow(); ueit++) {
- const TopoDS_Shape& aE1 = theUEdges->Value(ueit, theUEdges->LowerCol());
- const TopoDS_Shape& aE2 = theUEdges->Value(ueit, theUEdges->UpperCol());
+ //
+ upRow = theUEdges->UpperRow();
+ lowCol = theUEdges->LowerCol();
+ upCol = theUEdges->UpperCol();
+ //
+ for(ueit = theUEdges->LowerRow(); ueit <= upRow; ueit++) {
+ const TopoDS_Shape& aE1 = theUEdges->Value(ueit, lowCol);
+ const TopoDS_Shape& aE2 = theUEdges->Value(ueit, upCol);
if(theHistMap.IsBound(aE1) || theHistMap.IsBound(aE2))
continue;
- Standard_Integer anEIndex1 = aDS.ShapeIndex(aE1, 1);
- Standard_Integer anEIndex2 = aDS.ShapeIndex(aE2, 2);
+ Standard_Integer anEIndex1 = theDS->Index(aE1);
+ Standard_Integer anEIndex2 = theDS->Index(aE2);
TopoDS_Vertex aCommonVertex;
Standard_Real apar1 = 0., apar2 = 0.;
Standard_Boolean bvertexfound =
- FindCommonVertex(theDSFiller, anEIndex1, anEIndex2, aCommonVertex, apar1, apar2);
-
- if(!bvertexfound) {
- Standard_Integer j = 0;
- for(j = 0; j < 2; j++) {
- Standard_Integer veit = 0;
-
- for(veit = 1; veit <= aVEs.Extent(); veit++) {
-
- }
- }
- }
-
+ FindCommonVertex(theDS, anEIndex1, anEIndex2, aCommonVertex, apar1, apar2);
+ //
if(!bvertexfound) {
TopoDS_Vertex V1 = TopExp::LastVertex(TopoDS::Edge(aE1));
TopoDS_Vertex V2 = TopExp::FirstVertex(TopoDS::Edge(aE2));
- Standard_Integer vindex1 = aDS.ShapeIndex(V1, 1);
- Standard_Integer vindex2 = aDS.ShapeIndex(V2, 2);
+ Standard_Integer vindex1 = theDS->Index(V1);
+ Standard_Integer vindex2 = theDS->Index(V2);
Standard_Integer vvit = 0;
-
- for(vvit = 1; !bvertexfound && (vvit <= aVVs.Extent()); vvit++) {
- const BOPTools_VVInterference& aVV = aVVs(vvit);
-
- if(((vindex1 == aVV.Index1()) && (vindex2 = aVV.Index2())) ||
- ((vindex1 == aVV.Index2()) && (vindex2 = aVV.Index1()))) {
-
- if(aVV.NewShape() == 0) {
- continue;
- }
- aCommonVertex = TopoDS::Vertex(aDS.Shape(aVV.NewShape()));
- bvertexfound = Standard_True;
- apar1 = BRep_Tool::Parameter(V1, TopoDS::Edge(aE1));
- apar2 = BRep_Tool::Parameter(V2, TopoDS::Edge(aE2));
- }
+ Standard_Integer aNbVVs = aVVs.Extent();
+
+ for(vvit = 0; !bvertexfound && (vvit < aNbVVs); vvit++) {
+ //const BOPTools_VVInterference& aVV = aVVs(vvit);
+ const BOPDS_InterfVV& aVV = aVVs(vvit);
+
+ if(((vindex1 == aVV.Index1()) && (vindex2 == aVV.Index2())) ||
+ ((vindex1 == aVV.Index2()) && (vindex2 == aVV.Index1()))) {
+
+ if(!aVV.HasIndexNew()) {
+ continue;
+ }
+ aCommonVertex = TopoDS::Vertex(theDS->Shape(aVV.IndexNew()));
+ bvertexfound = Standard_True;
+ apar1 = BRep_Tool::Parameter(V1, TopoDS::Edge(aE1));
+ apar2 = BRep_Tool::Parameter(V2, TopoDS::Edge(aE2));
+ }
}
}
// purpose:
// ------------------------------------------------------------------------------------------
void FindFreeVertices(const TopoDS_Shape& theShape,
- const TopTools_MapOfShape& theVerticesToAvoid,
- TopTools_ListOfShape& theListOfVertex) {
+ const TopTools_MapOfShape& theVerticesToAvoid,
+ TopTools_ListOfShape& theListOfVertex) {
theListOfVertex.Clear();
TopTools_IndexedDataMapOfShapeListOfShape aMap;
}
}
-// ------------------------------------------------------------------------------------------
-// static function: FindParameter
-// purpose:
-// ------------------------------------------------------------------------------------------
-Standard_Boolean FindParameter(const BOPTools_PaveSet& thePaveSet,
- const BooleanOperations_KindOfInterference& theType,
- const Standard_Integer theInterfIndex,
- Standard_Real& theParam) {
- BOPTools_ListIteratorOfListOfPave anPIt(thePaveSet.Set());
- Standard_Boolean bfound = Standard_False;
-
- for(; anPIt.More(); anPIt.Next()) {
- const BOPTools_Pave& aPave = anPIt.Value();
-
- if((aPave.Type() == theType) &&
- (aPave.Interference() == theInterfIndex)) {
- theParam = aPave.Param();
- bfound = Standard_True;
- break;
- }
- }
- return bfound;
-}
-
// ------------------------------------------------------------------------------------------
// static function: FindCommonVertex
// purpose:
// ------------------------------------------------------------------------------------------
-Standard_Boolean FindCommonVertex(const BOPTools_DSFiller& theDSFiller,
- const Standard_Integer theEIndex1,
- const Standard_Integer theEIndex2,
- TopoDS_Vertex& theCommonVertex,
- Standard_Real& theParamOnE1,
- Standard_Real& theParamOnE2) {
-
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
- const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
- const BOPTools_PavePool& aPavePool = aPaveFiller.PavePool();
- BOPTools_DSFiller& aDSFiller = (*((BOPTools_DSFiller*)&theDSFiller));
- BOPTools_InterferencePool* pIntrPool = (BOPTools_InterferencePool*)&aDSFiller.InterfPool();
- const BOPTools_CArray1OfEEInterference& aEEs = pIntrPool->EEInterfs();
+Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
+ const Standard_Integer theEIndex1,
+ const Standard_Integer theEIndex2,
+ TopoDS_Vertex& theCommonVertex,
+ Standard_Real& theParamOnE1,
+ Standard_Real& theParamOnE2) {
+
+ const BOPDS_VectorOfInterfEE& aEEs = theDS->InterfEE();
Standard_Boolean bvertexfound = Standard_False;
TopoDS_Vertex aCommonVertex;
Standard_Integer eeit = 0;
- for(eeit = 1; eeit <= aEEs.Extent(); eeit++) {
- const BOPTools_EEInterference& aEE = aEEs(eeit);
+ Standard_Integer aNbEEs;
+ aNbEEs = aEEs.Extent();
+ for(eeit = 0; eeit < aNbEEs; ++eeit) {
+ const BOPDS_InterfEE& aEE = aEEs(eeit);
if((theEIndex1 == aEE.Index1() && theEIndex2 == aEE.Index2()) ||
(theEIndex1 == aEE.Index2() && theEIndex2 == aEE.Index1())) {
- if(aEE.NewShape() == 0)
- continue;
-
- if(aDS.GetShapeType(aEE.NewShape()) == TopAbs_VERTEX) {
- theCommonVertex = TopoDS::Vertex(aDS.Shape(aEE.NewShape()));
-
- bvertexfound = Standard_True;
- Standard_Integer i = 0;
-
- for(i = 0; i < 2; i++) {
- Standard_Integer anEIndex = (i == 0) ? theEIndex1 : theEIndex2;
- const BOPTools_PaveSet& aPaveSet = aPavePool(aDS.RefEdge(anEIndex));
- Standard_Boolean bfound = Standard_False;
-
- if(i == 0)
- bfound = FindParameter(aPaveSet, BooleanOperations_EdgeEdge, eeit, theParamOnE1);
- else
- bfound = FindParameter(aPaveSet, BooleanOperations_EdgeEdge, eeit, theParamOnE2);
-
- if(!bfound) {
- bvertexfound = Standard_False;
- break;
- }
- }
- }
- else if(aDS.GetShapeType(aEE.NewShape()) == TopAbs_EDGE) {
-
+ if(!aEE.HasIndexNew())
+ continue;
+
+ IntTools_CommonPrt aCP = aEE.CommonPart();
+ if(aCP.Type() == TopAbs_VERTEX) {
+ theCommonVertex = *(TopoDS_Vertex*)&theDS->Shape(aEE.IndexNew());
+ if (theEIndex1 == aEE.Index1()) {
+ IntTools_Tools::VertexParameters(aCP, theParamOnE1, theParamOnE2);
+ } else {
+ IntTools_Tools::VertexParameters(aCP, theParamOnE2, theParamOnE1);
+ }
+ //
+ bvertexfound = Standard_True;
+ break;
}
}
}
return bvertexfound;
}
-// ------------------------------------------------------------------------------------------
-// static function: IsFromFirstToSecond
-// purpose:
-// ------------------------------------------------------------------------------------------
-Standard_Boolean IsFromFirstToSecond(const TopoDS_Edge& theEdge,
- const Standard_Real theParameterOnUEdge,
- const TopoDS_Edge& theUEdge1,
- const TopoDS_Edge& theUEdge2,
- const TopoDS_Face& theFace) {
- TopoDS_Face aFace = theFace;
- aFace.Orientation(TopAbs_FORWARD);
- TopoDS_Edge E1, E2;
- TopExp_Explorer anExp(aFace, TopAbs_EDGE);
-
- for(; anExp.More(); anExp.Next()) {
- if(E1.IsNull() && theUEdge1.IsSame(anExp.Current())) {
- E1 = TopoDS::Edge(anExp.Current());
- }
- else if(E2.IsNull() && theUEdge2.IsSame(anExp.Current())) {
- E2 = TopoDS::Edge(anExp.Current());
- }
- }
-
- if(E1.IsNull() || E2.IsNull())
- return Standard_True;
-
- gp_Pnt2d PU1, PU2, pf, pl;
- Standard_Real f, l;
- Handle(Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(E1, aFace, f, l);
- Handle(Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(E2, aFace, f, l);
- Handle(Geom2d_Curve) CC = BRep_Tool::CurveOnSurface(theEdge, aFace, f, l);
- PU1 = C1->Value(theParameterOnUEdge);
- PU2 = C2->Value(theParameterOnUEdge);
- BRep_Tool::Range(theEdge, f, l);
- pf = CC->Value(f);
- pl = CC->Value(l);
- Standard_Real aTolerance = Precision::Confusion();
-
- if(pf.Distance(PU1) < aTolerance)
- return Standard_True;
-
- if(pl.Distance(PU2) < aTolerance)
- return Standard_True;
-
- return Standard_False;
-}
-
// ----------------------------------------------------------------------------------------------------
// static function: GetUEdges
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean GetUEdges(const Standard_Integer theIndex,
- const Standard_Integer theRank,
- const Handle(TopTools_HArray2OfShape)& theUEdges,
- const TopoDS_Edge& theBoundEdge,
- const TopoDS_Face& theFace,
- TopoDS_Edge& theFirstUEdge,
- TopoDS_Edge& theSecondUEdge) {
- const TopoDS_Shape& aUE1 = theUEdges->Value(theIndex, theUEdges->LowerCol() + theRank - 1);
- const TopoDS_Shape& aUE2 = theUEdges->Value(theIndex + 1, theUEdges->LowerCol() + theRank - 1);
+ const Standard_Integer theRank,
+ const Handle(TopTools_HArray2OfShape)& theUEdges,
+ const TopoDS_Edge& theBoundEdge,
+ const TopoDS_Face& theFace,
+ TopoDS_Edge& theFirstUEdge,
+ TopoDS_Edge& theSecondUEdge) {
+ const TopoDS_Shape& aUE1 = theUEdges->Value(theIndex, theUEdges->LowerCol() + theRank);
+ const TopoDS_Shape& aUE2 = theUEdges->Value(theIndex + 1, theUEdges->LowerCol() + theRank);
TopoDS_Face aFace = theFace;
aFace.Orientation(TopAbs_FORWARD);
if(C1.IsNull())
return Standard_False;
- gp_Pnt2d PU1 = (theRank == 1) ? C1->Value(l) : C1->Value(f);
+ gp_Pnt2d PU1 = (theRank == 0) ? C1->Value(l) : C1->Value(f);
Handle(Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(theBoundEdge, aFace, f, l);
if(C2.IsNull())
return Standard_False;
BRep_Tool::Range(theBoundEdge, f, l);
gp_Pnt2d pf = C2->Value(f);
- TopoDS_Vertex aV = (theRank == 1) ? TopExp::LastVertex(E1) : TopExp::FirstVertex(E1);
+ TopoDS_Vertex aV = (theRank == 0) ? TopExp::LastVertex(E1) : TopExp::FirstVertex(E1);
Standard_Real aTolerance = BRep_Tool::Tolerance(aV);
BRepAdaptor_Surface aBAS(aFace, Standard_False);
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean FillGap(const TopoDS_Vertex& theFirstVertex,
- const TopoDS_Vertex& theLastVertex,
- const gp_Pnt2d& theFirstPoint,
- const gp_Pnt2d& theLastPoint,
- const TopoDS_Face& theFace,
- const TopoDS_Compound& theSectionEdges,
- TopTools_ListOfShape& theOrderedList) {
+ const TopoDS_Vertex& theLastVertex,
+ const gp_Pnt2d& theFirstPoint,
+ const gp_Pnt2d& theLastPoint,
+ const TopoDS_Face& theFace,
+ const TopoDS_Compound& theSectionEdges,
+ TopTools_ListOfShape& theOrderedList) {
TopTools_IndexedDataMapOfShapeListOfShape aMap;
TopExp::MapShapesAndAncestors(theSectionEdges, TopAbs_VERTEX, TopAbs_EDGE, aMap);
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean FindNextEdge(const TopoDS_Vertex& theFirstVertex,
- const TopoDS_Vertex& theLastVertex,
- const TopTools_IndexedDataMapOfShapeListOfShape& theMapVE,
- const TopTools_MapOfShape& theMapToAvoid,
- TopTools_ListOfShape& theOrderedList) {
+ const TopoDS_Vertex& theLastVertex,
+ const TopTools_IndexedDataMapOfShapeListOfShape& theMapVE,
+ const TopTools_MapOfShape& theMapToAvoid,
+ TopTools_ListOfShape& theOrderedList) {
TopoDS_Vertex aCurVertex = theFirstVertex;
TopTools_MapOfShape aMapToAvoid;
aMapToAvoid = theMapToAvoid;
TopoDS_Vertex aSaveCurVertex = aCurVertex;
if(!aMapToAvoid.Contains(anEdge)) {
- TopoDS_Vertex V1, V2;
- TopExp::Vertices(TopoDS::Edge(anEdge), V1, V2);
-
- if(!aCurVertex.IsSame(V1)) {
- aCurVertex = V1;
- }
- else if(!aCurVertex.IsSame(V2)) {
- aCurVertex = V2;
- }
- aMapToAvoid.Add(anEdge);
- befound = Standard_True;
- aListOfEdge.Append(anEdge);
-
- if(!aCurVertex.IsSame(theLastVertex)) {
- TopTools_ListOfShape aListtmp;
-
- if(!FindNextEdge(aCurVertex, theLastVertex, theMapVE, aMapToAvoid, aListtmp)) {
- aListOfEdge.Clear();
- aCurVertex = aSaveCurVertex;
- continue;
- }
- else {
- aListOfEdge.Append(aListtmp);
- theOrderedList.Append(aListOfEdge);
- return Standard_True;
- }
- }
- break;
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(TopoDS::Edge(anEdge), V1, V2);
+
+ if(!aCurVertex.IsSame(V1)) {
+ aCurVertex = V1;
+ }
+ else if(!aCurVertex.IsSame(V2)) {
+ aCurVertex = V2;
+ }
+ aMapToAvoid.Add(anEdge);
+ befound = Standard_True;
+ aListOfEdge.Append(anEdge);
+
+ if(!aCurVertex.IsSame(theLastVertex)) {
+ TopTools_ListOfShape aListtmp;
+
+ if(!FindNextEdge(aCurVertex, theLastVertex, theMapVE, aMapToAvoid, aListtmp)) {
+ aListOfEdge.Clear();
+ aCurVertex = aSaveCurVertex;
+ continue;
+ }
+ else {
+ aListOfEdge.Append(aListtmp);
+ theOrderedList.Append(aListOfEdge);
+ return Standard_True;
+ }
+ }
+ break;
}
}
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList,
- const gp_Pnt2d& theFirstPoint,
- const gp_Pnt2d& theLastPoint,
- const TopoDS_Face& theFace,
- TopTools_ListOfShape& theOrientedList) {
+ const gp_Pnt2d& theFirstPoint,
+ const gp_Pnt2d& theLastPoint,
+ const TopoDS_Face& theFace,
+ TopTools_ListOfShape& theOrientedList) {
TopTools_ListIteratorOfListOfShape anIt(theOrderedList);
if(!anIt.More())
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean FindVertex(const TopoDS_Edge& theEdge,
- const Standard_Integer theRank,
- const BOPTools_DSFiller& theDSFiller,
- const TopTools_DataMapOfShapeListOfShape& theHistMap,
- TopoDS_Vertex& theVertex,
- BOPTools_Pave& thePave) {
+ const Standard_Integer theRank,
+ const BOPDS_PDS& theDS,
+ const TopTools_DataMapOfShapeListOfShape& theHistMap,
+ TopoDS_Vertex& theVertex,
+ BOPDS_Pave& thePave) {
if(!theHistMap.IsBound(theEdge))
return Standard_False;
if(lst.IsEmpty())
return Standard_False;
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
TopoDS_Edge aNewEdge = TopoDS::Edge(lst.First());
Standard_Real f, l;
BRep_Tool::Range(aNewEdge, f, l);
- if(theRank == 1) {
- thePave.SetParam(l);
+ if(theRank == 0) {
+ thePave.SetParameter(l);
theVertex = TopExp::LastVertex(aNewEdge);
}
else {
- thePave.SetParam(f);
+ thePave.SetParameter(f);
theVertex = TopExp::FirstVertex(aNewEdge);
}
- Standard_Integer anIndex = aDS.ShapeIndex(theVertex, theRank);
-
- if(anIndex == 0) {
- Standard_Integer i = 0;
-
- for(i = aDS.NumberOfSourceShapes() + 1; i <= aDS.NumberOfInsertedShapes(); i++) {
- const TopoDS_Shape& aShape = aDS.Shape(i);
-
- if(theVertex.IsSame(aShape)) {
- anIndex = i;
- break;
+ Standard_Integer anIndex = theDS->Index(theVertex);
+ if (anIndex == -1) {
+ Standard_Integer i, i1, i2;
+ i1=theDS->NbSourceShapes();
+ i2=theDS->NbShapes();
+ for (i=i1; i<i2; ++i) {
+ const TopoDS_Shape& aSx=theDS->Shape(i);
+ if(aSx.IsSame(theVertex)) {
+ anIndex = i;
+ break;
}
}
}
+
thePave.SetIndex(anIndex);
return Standard_True;
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean FindNextVertex(const Standard_Integer theEdgeIndex,
- const BOPTools_Pave& thePrevPave,
- const BOPTools_DSFiller& theDSFiller,
- TopoDS_Vertex& theNextVertex,
- BOPTools_Pave& thePave) {
-
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
- const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
- const BOPTools_PavePool& aPavePool = aPaveFiller.PavePool();
- const BOPTools_PaveSet& aPaveSet = aPavePool(aDS.RefEdge(theEdgeIndex));
- BOPTools_PaveSet aSortedPaveSet;
- aSortedPaveSet = aPaveSet;
- aSortedPaveSet.SortSet();
-
- BOPTools_ListIteratorOfListOfPave anIt(aSortedPaveSet.Set());
- BOPTools_Pave anullpave(0, 0.);
- Standard_Boolean btakepave = (thePrevPave.IsEqual(anullpave));
- Standard_Boolean bfound = Standard_False;
- BOPTools_Pave atmppave;
-
- for(; anIt.More(); anIt.Next()) {
- if(btakepave) {
- atmppave = anIt.Value();
-
- if(atmppave.Type() != BooleanOperations_UnknownInterference) {
- theNextVertex = TopoDS::Vertex(aDS.Shape(atmppave.Index()));
- thePave = atmppave;
- bfound = Standard_True;
- break;
+ const BOPDS_Pave& thePrevPave,
+ const BOPDS_PDS& theDS,
+ TopoDS_Vertex& theNextVertex,
+ BOPDS_Pave& thePave) {
+
+ Standard_Boolean bTakePave, bFound;
+ BOPDS_Pave aTmpPave;
+ BOPDS_ListIteratorOfListOfPave aItP;
+ //
+ BOPDS_Pave anullpave;
+ bFound = Standard_False;
+ bTakePave = thePrevPave.IsEqual(anullpave);
+
+ BOPDS_ListOfPave aLP;
+ theDS->Paves(theEdgeIndex, aLP);
+ aItP.Initialize(aLP);
+ for (; aItP.More(); aItP.Next()) {
+ aTmpPave = aItP.Value();
+ //
+ if (bTakePave) {
+ if (theDS->IsNewShape(aTmpPave.Index())) {
+ theNextVertex = *(TopoDS_Vertex*)&theDS->Shape(aTmpPave.Index());
+ thePave = aTmpPave;
+ bFound = Standard_True;
+ break;
}
}
-
- if(thePrevPave.IsEqual(anIt.Value())) {
- btakepave = Standard_True;
+ //
+ else if (aTmpPave.IsEqual(thePrevPave)) {
+ bTakePave = Standard_True;
}
}
-
- return bfound;
+
+ return bFound;
}
// ----------------------------------------------------------------------------------------------------
// static function: GetPave
// purpose:
// ----------------------------------------------------------------------------------------------------
-Standard_Boolean GetPave(const Standard_Integer theEdgeIndex,
- const Standard_Boolean isFirst,
- const BOPTools_DSFiller& theDSFiller,
- BOPTools_Pave& thePave) {
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
- const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
- const BOPTools_PavePool& aPavePool = aPaveFiller.PavePool();
-
- const BOPTools_PaveSet& aPaveSet = aPavePool(aDS.RefEdge(theEdgeIndex));
- BOPTools_PaveSet aSortedPaveSet;
- aSortedPaveSet = aPaveSet;
- aSortedPaveSet.SortSet();
-
- if(aSortedPaveSet.Set().IsEmpty())
- return Standard_False;
+Standard_Boolean GetPave(const Standard_Integer theEdgeIndex,
+ const Standard_Boolean isFirst,
+ const BOPDS_PDS& theDS,
+ BOPDS_Pave& thePave) {
- if(isFirst) {
- thePave = aSortedPaveSet.Set().First();
+ Handle(BOPDS_PaveBlock) aPB;
+ BOPDS_ListOfPave aLP;
+
+ theDS->Paves(theEdgeIndex, aLP);
+ if (!aLP.Extent()) {
+ return Standard_False;
+ }
+ //
+ if (isFirst) {
+ thePave = aLP.First();
}
else {
- thePave = aSortedPaveSet.Set().Last();
+ thePave = aLP.Last();
}
+
return Standard_True;
}
-
// ----------------------------------------------------------------------------------------------------
// static function: FindFromUEdge
// purpose:
// ----------------------------------------------------------------------------------------------------
Standard_Boolean FindFromUEdge(const TopoDS_Edge& theUE1Old,
- const TopoDS_Edge& theUE2Old,
- const TopoDS_Edge& theUE1New,
- const TopoDS_Edge& theUE2New,
- const TopoDS_Face& theFace,
- const TopoDS_Compound& theSecEdges,
- const Standard_Integer theRank,
- const TopoDS_Edge& theBoundEdge,
- const Standard_Integer theBoundEdgeIndex,
- const BOPTools_DSFiller& theDSFiller,
- const TopTools_DataMapOfShapeListOfShape& theHistMap,
- TopoDS_Compound& theSecEdgesNew,
- TopTools_ListOfShape& theListOfWireEdges,
- BOPTools_Pave& theFoundPave,
- Standard_Boolean& isOnUEdge) {
+ const TopoDS_Edge& theUE2Old,
+ const TopoDS_Edge& theUE1New,
+ const TopoDS_Edge& theUE2New,
+ const TopoDS_Face& theFace,
+ const TopoDS_Compound& theSecEdges,
+ const Standard_Integer theRank,
+ const TopoDS_Edge& theBoundEdge,
+ const Standard_Integer theBoundEdgeIndex,
+ const BOPDS_PDS& theDS,
+ const TopTools_DataMapOfShapeListOfShape& theHistMap,
+ TopoDS_Compound& theSecEdgesNew,
+ TopTools_ListOfShape& theListOfWireEdges,
+ BOPDS_Pave& theFoundPave,
+ Standard_Boolean& isOnUEdge) {
theFoundPave.SetIndex(0);
- theFoundPave.SetParam(0.);
+ theFoundPave.SetParameter(0.);
isOnUEdge = Standard_True;
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
- const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
- const BOPTools_PavePool& aPavePool = aPaveFiller.PavePool();
-
TopoDS_Face aFaceF = theFace;
aFaceF.Orientation(TopAbs_FORWARD);
TopoDS_Vertex aPrevVertex, aNextVertex;
TopTools_ListOfShape aListOfWireEdges;
// BRep_Builder aBB;
- BOPTools_Pave aPave1(0, 0.), aPave2(0, 0.);
+ BOPDS_Pave aPave1, aPave2;
Standard_Real f = 0., l = 0.;
gp_Pnt2d p1, p2;
TopoDS_Vertex aFirstV, aLastV;
- BOPTools_Pave atmpPave;
+ BOPDS_Pave atmpPave;
- if(!FindVertex(theUE1Old, theRank, theDSFiller, theHistMap, aPrevVertex, atmpPave)) {
+ if(!FindVertex(theUE1Old, theRank, theDS, theHistMap, aPrevVertex, atmpPave)) {
return Standard_True;
}
aFirstV = aPrevVertex;
Standard_Boolean bSecFound = Standard_False;
Handle(Geom2d_Curve) aC1 = BRep_Tool::CurveOnSurface(theUE1New, aFaceF, f, l);
- p1 = (theRank == 1) ? aC1->Value(l) : aC1->Value(f);
- BOPTools_Pave afoundpave(0, 0.);
- const BOPTools_PaveSet& aPaveSet = aPavePool(aDS.RefEdge(theBoundEdgeIndex));
- Standard_Integer nbpave = aPaveSet.Set().Extent();
+ p1 = (theRank == 0) ? aC1->Value(l) : aC1->Value(f);
+ BOPDS_Pave afoundpave;
+ BOPDS_ListOfPave aLP;
+ theDS->Paves(theBoundEdgeIndex, aLP);
+ Standard_Integer nbpave = aLP.Extent();
Standard_Integer pit = 0;
-
- while(FindNextVertex(theBoundEdgeIndex, aPave1, theDSFiller, aNextVertex, aPave2) && (pit < nbpave)) {
+
+ while(FindNextVertex(theBoundEdgeIndex, aPave1, theDS, aNextVertex, aPave2) && (pit < nbpave)) {
aLastV = aNextVertex;
Handle(Geom2d_Curve) aC2 = BRep_Tool::CurveOnSurface(theBoundEdge, aFaceF, f, l);
- p2 = aC2->Value(aPave2.Param());
+ p2 = aC2->Value(aPave2.Parameter());
TopTools_ListOfShape aOrderedList;
if(FillGap(aFirstV, aLastV, p1, p2, aFaceF, aCompOfSecEdges, aOrderedList)) {
pit++;
}
- if(!bSecFound && FindVertex(theUE2Old, theRank, theDSFiller, theHistMap, aNextVertex, aPave2)) {
+ if(!bSecFound && FindVertex(theUE2Old, theRank, theDS, theHistMap, aNextVertex, aPave2)) {
aLastV = aNextVertex;
Handle(Geom2d_Curve) aC2 = BRep_Tool::CurveOnSurface(theUE2New, aFaceF, f, l);
- p2 = aC2->Value(aPave2.Param());
+ p2 = aC2->Value(aPave2.Parameter());
TopTools_ListOfShape aOrderedList;
if(FillGap(aFirstV, aLastV, p1, p2, aFaceF, aCompOfSecEdges, aOrderedList)) {
// static function: FindFromVEdge
// purpose:
// ----------------------------------------------------------------------------------------------------
-Standard_Boolean FindFromVEdge(const BOPTools_Pave& thePrevPave,
- const Standard_Boolean& isOnUEdge,
- const TopoDS_Edge& theUE1Old,
- const TopoDS_Edge& theUE2Old,
- const TopoDS_Face& theFace,
- const TopoDS_Compound& theSecEdges,
- const Standard_Integer theRank,
- const TopoDS_Edge& theBoundEdge,
- const Standard_Integer theBoundEdgeIndex,
- const BOPTools_DSFiller& theDSFiller,
- const TopTools_DataMapOfShapeListOfShape& theHistMap,
- TopTools_ListOfShape& theListOfWireEdges,
- Standard_Boolean& isSectionFound) {
+Standard_Boolean FindFromVEdge(const BOPDS_Pave& thePrevPave,
+ const Standard_Boolean& isOnUEdge,
+ const TopoDS_Edge& theUE1Old,
+ const TopoDS_Edge& theUE2Old,
+ const TopoDS_Face& theFace,
+ const TopoDS_Compound& theSecEdges,
+ const Standard_Integer theRank,
+ const TopoDS_Edge& theBoundEdge,
+ const Standard_Integer theBoundEdgeIndex,
+ const BOPDS_PDS& theDS,
+ const TopTools_DataMapOfShapeListOfShape& theHistMap,
+ TopTools_ListOfShape& theListOfWireEdges,
+ Standard_Boolean& isSectionFound) {
+
theListOfWireEdges.Clear();
isSectionFound = Standard_False;
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
- const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
- const BOPTools_SplitShapesPool& aSplitShapesPool = aPaveFiller.SplitShapesPool();
- const BOPTools_PavePool& aPavePool = aPaveFiller.PavePool();
-
+ //
TopoDS_Face aFaceF = theFace;
aFaceF.Orientation(TopAbs_FORWARD);
TopoDS_Vertex aPrevVertex, aNextVertex;
TopTools_ListOfShape aListOfWireEdges;
// BRep_Builder aBB;
- BOPTools_Pave aPave1(0, 0.), aPave2(0, 0.);
+ BOPDS_Pave aPave1, aPave2;
if(isOnUEdge) {
TopoDS_Vertex atmpVertex;
- BOPTools_Pave aPaveOfE2;
+ BOPDS_Pave aPaveOfE2;
- if(FindVertex(theUE2Old, theRank, theDSFiller, theHistMap, atmpVertex, aPaveOfE2)) {
+ if(FindVertex(theUE2Old, theRank, theDS, theHistMap, atmpVertex, aPaveOfE2)) {
if(thePrevPave.IsEqual(aPaveOfE2))
- return Standard_True;
+ return Standard_True;
}
}
aPave1 = thePrevPave;
if(isOnUEdge) {
- BOPTools_Pave atmpPave;
+ BOPDS_Pave atmpPave;
- if(!GetPave(theBoundEdgeIndex, Standard_True, theDSFiller, atmpPave)) {
+ if(!GetPave(theBoundEdgeIndex, Standard_True, theDS, atmpPave)) {
return Standard_False;
}
aPave1 = atmpPave;
}
- p1 = aC2->Value(aPave1.Param());
- aPrevVertex = TopoDS::Vertex(aDS.Shape(aPave1.Index()));
+ p1 = aC2->Value(aPave1.Parameter());
+ aPrevVertex = TopoDS::Vertex(theDS->Shape(aPave1.Index()));
- const BOPTools_PaveSet& aPaveSet = aPavePool(aDS.RefEdge(theBoundEdgeIndex));
- Standard_Integer nbpave = aPaveSet.Set().Extent();
+ BOPDS_ListOfPave aLP;
+ theDS->Paves(theBoundEdgeIndex, aLP);
+ Standard_Integer nbpave = aLP.Extent();
Standard_Integer pit = 0;
TopTools_Array1OfListOfShape anArrayOfListOfSec(1, nbpave);
// by pairs non continuously. begin
Standard_Integer k = 0;
- BOPTools_Pave aFirstPave = aPave1;
+ BOPDS_Pave aFirstPave = aPave1;
TopoDS_Vertex aFirstVertex = aPrevVertex;
gp_Pnt2d apfirst = p1;
- BOPTools_ListOfPave aFirstPaves, aLastPaves;
+ BOPDS_ListOfPave aFirstPaves, aLastPaves;
TColStd_ListOfInteger aListOfFlags;
Standard_Integer apaircounter = 1;
Standard_Boolean bfound = Standard_False;
pit = 0;
- while(FindNextVertex(theBoundEdgeIndex, aPave1, theDSFiller, aNextVertex, aPave2) && (pit < nbpave)) {
+ while(FindNextVertex(theBoundEdgeIndex, aPave1, theDS, aNextVertex, aPave2) && (pit < nbpave)) {
aFirstV = aPrevVertex;
aLastV = aNextVertex;
- p2 = aC2->Value(aPave2.Param());
+ p2 = aC2->Value(aPave2.Parameter());
TopTools_ListOfShape aOrderedList;
if(FillGap(aFirstV, aLastV, p1, p2, aFaceF, aCompOfSecEdges, aOrderedList)) {
- TopoDS_Compound aComp;
- RemoveEdges(aCompOfSecEdges, aOrderedList, aComp);
- aCompOfSecEdges = aComp;
-
- anArrayOfListOfSec(apaircounter++).Append(aOrderedList);
- BOPTools_PaveBlock aPB(theBoundEdgeIndex, aFirstPave, aPave2);
- aFirstPaves.Append(aFirstPave);
- aLastPaves.Append(aPave2);
- aListOfFlags.Append(1);
- aFirstPave = aPave2;
- aFirstVertex = aNextVertex;
- apfirst = p2;
- aPrevVertex = aNextVertex;
- bSecFound = Standard_True;
- bfound = Standard_True;
+ TopoDS_Compound aComp;
+ RemoveEdges(aCompOfSecEdges, aOrderedList, aComp);
+ aCompOfSecEdges = aComp;
+
+ anArrayOfListOfSec(apaircounter++).Append(aOrderedList);
+ aFirstPaves.Append(aFirstPave);
+ aLastPaves.Append(aPave2);
+ aListOfFlags.Append(1);
+ aFirstPave = aPave2;
+ aFirstVertex = aNextVertex;
+ apfirst = p2;
+ aPrevVertex = aNextVertex;
+ bSecFound = Standard_True;
+ bfound = Standard_True;
}
aPave1 = aPave2;
pit++;
}
- if(FindVertex(theUE2Old, theRank, theDSFiller, theHistMap, aNextVertex, aPave2)) {
+ if(FindVertex(theUE2Old, theRank, theDS, theHistMap, aNextVertex, aPave2)) {
aFirstV = aPrevVertex;
aLastV = aNextVertex;
Handle(Geom2d_Curve) aC3 = BRep_Tool::CurveOnSurface(theUE2Old, aFaceF, f, l);
- p2 = aC3->Value(aPave2.Param());
+ p2 = aC3->Value(aPave2.Parameter());
TopTools_ListOfShape aOrderedList;
if(FillGap(aFirstV, aLastV, p1, p2, aFaceF, aCompOfSecEdges, aOrderedList)) {
- TopoDS_Compound aComp;
- RemoveEdges(aCompOfSecEdges, aOrderedList, aComp);
- aCompOfSecEdges = aComp;
- anArrayOfListOfSec(apaircounter++).Append(aOrderedList);
- BOPTools_PaveBlock aPB(-1, aFirstPave, aPave2);
- aFirstPaves.Append(aFirstPave);
- aLastPaves.Append(aPave2);
- aListOfFlags.Append(0);
- bSecFound = Standard_True;
- break;
+ TopoDS_Compound aComp;
+ RemoveEdges(aCompOfSecEdges, aOrderedList, aComp);
+ aCompOfSecEdges = aComp;
+ anArrayOfListOfSec(apaircounter++).Append(aOrderedList);
+ aFirstPaves.Append(aFirstPave);
+ aLastPaves.Append(aPave2);
+ aListOfFlags.Append(0);
+ bSecFound = Standard_True;
+ break;
}
}
if(!bfound) {
- if(!FindNextVertex(theBoundEdgeIndex, aFirstPave, theDSFiller, aNextVertex, aPave2)) {
- break;
+ if(!FindNextVertex(theBoundEdgeIndex, aFirstPave, theDS, aNextVertex, aPave2)) {
+ break;
}
aFirstPave = aPave2;
- apfirst = aC2->Value(aPave2.Param());
+ apfirst = aC2->Value(aPave2.Parameter());
aFirstVertex = aNextVertex;
}
}
aPave1 = thePrevPave;
if(isOnUEdge) {
- BOPTools_Pave atmpPave;
+ BOPDS_Pave atmpPave;
- if(!GetPave(theBoundEdgeIndex, Standard_True, theDSFiller, atmpPave)) {
+ if(!GetPave(theBoundEdgeIndex, Standard_True, theDS, atmpPave)) {
return Standard_False;
}
aPave1 = atmpPave;
}
- p1 = aC2->Value(aPave1.Param());
- aPrevVertex = TopoDS::Vertex(aDS.Shape(aPave1.Index()));
+ p1 = aC2->Value(aPave1.Parameter());
+ aPrevVertex = TopoDS::Vertex(theDS->Shape(aPave1.Index()));
pit = 0;
- while(FindNextVertex(theBoundEdgeIndex, aPave1, theDSFiller, aNextVertex, aPave2) && (pit < nbpave)) {
+ while(FindNextVertex(theBoundEdgeIndex, aPave1, theDS, aNextVertex, aPave2) && (pit < nbpave)) {
aFirstV = aPrevVertex;
aLastV = aNextVertex;
- p2 = aC2->Value(aPave2.Param());
+ p2 = aC2->Value(aPave2.Parameter());
Standard_Boolean bisinside = Standard_False;
Standard_Integer apbindex = 0;
Standard_Integer apbcounter = 1;
- BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
- BOPTools_ListIteratorOfListOfPave aPIt1, aPIt2;
+ BOPDS_ListIteratorOfListOfPaveBlock aPBIt;
+ BOPDS_ListIteratorOfListOfPave aPIt1, aPIt2;
TColStd_ListIteratorOfListOfInteger aFlagIt;
for(aPIt1.Initialize(aFirstPaves), aPIt2.Initialize(aLastPaves), aFlagIt.Initialize(aListOfFlags);
- aPIt1.More() && aPIt2.More() && aFlagIt.More();
- aPIt1.Next(), aPIt2.Next(), aFlagIt.Next(), apbcounter++) {
+ aPIt1.More() && aPIt2.More() && aFlagIt.More();
+ aPIt1.Next(), aPIt2.Next(), aFlagIt.Next(), apbcounter++) {
Standard_Boolean bfin = Standard_False;
Standard_Boolean blin = Standard_False;
if(aPave1.IsEqual(aPIt1.Value())) {
- bfin = Standard_True;
+ bfin = Standard_True;
}
else {
- bfin = (aPave1.Param() > aPIt1.Value().Param());
+ bfin = (aPave1.Parameter() > aPIt1.Value().Parameter());
}
if(aFlagIt.Value()) {
- if(aPave2.IsEqual(aPIt2.Value())) {
- blin = Standard_True;
- }
- else {
- blin = (aPave2.Param() < aPIt2.Value().Param());
- }
+ if(aPave2.IsEqual(aPIt2.Value())) {
+ blin = Standard_True;
+ }
+ else {
+ blin = (aPave2.Parameter() < aPIt2.Value().Parameter());
+ }
}
else {
- if((aPave2.Index() == aPIt2.Value().Index()) && (aPave2.Index() > 0)) {
- Handle(Geom2d_Curve) pc = BRep_Tool::CurveOnSurface(theUE2Old, aFaceF, f, l);
- gp_Pnt2d p3 = pc->Value(aPIt2.Value().Param());
- TopoDS_Vertex aV = TopoDS::Vertex(aDS.Shape(aPave2.Index()));
- BRepAdaptor_Surface aBAS(aFaceF, Standard_False);
- Standard_Real aTolerance = BRep_Tool::Tolerance(aV);
- Standard_Real utol = aBAS.UResolution(aTolerance);
- Standard_Real vtol = aBAS.VResolution(aTolerance);
- aTolerance = (utol > vtol) ? utol : vtol;
-
- if(p2.Distance(p3) < aTolerance)
- blin = Standard_True;
- }
+ if((aPave2.Index() == aPIt2.Value().Index()) && (aPave2.Index() > 0)) {
+ Handle(Geom2d_Curve) pc = BRep_Tool::CurveOnSurface(theUE2Old, aFaceF, f, l);
+ gp_Pnt2d p3 = pc->Value(aPIt2.Value().Parameter());
+ TopoDS_Vertex aV = TopoDS::Vertex(theDS->Shape(aPave2.Index()));
+ BRepAdaptor_Surface aBAS(aFaceF, Standard_False);
+ Standard_Real aTolerance = BRep_Tool::Tolerance(aV);
+ Standard_Real utol = aBAS.UResolution(aTolerance);
+ Standard_Real vtol = aBAS.VResolution(aTolerance);
+ aTolerance = (utol > vtol) ? utol : vtol;
+
+ if(p2.Distance(p3) < aTolerance)
+ blin = Standard_True;
+ }
}
if(bfin && blin) {
- apbindex = apbcounter;
- bisinside = Standard_True;
- break;
+ apbindex = apbcounter;
+ bisinside = Standard_True;
+ break;
}
}
TopTools_ListOfShape aOrderedList;
if(FillGap(aFirstV, aLastV, p1, p2, aFaceF, aCompOfSecEdges, aOrderedList)) {
- TopoDS_Compound aComp;
- RemoveEdges(aCompOfSecEdges, aOrderedList, aComp);
- aCompOfSecEdges = aComp;
- aListOfWireEdges.Append(aOrderedList);
+ TopoDS_Compound aComp;
+ RemoveEdges(aCompOfSecEdges, aOrderedList, aComp);
+ aCompOfSecEdges = aComp;
+ aListOfWireEdges.Append(aOrderedList);
- bSecFound = Standard_True;
+ bSecFound = Standard_True;
}
else {
- TopoDS_Edge aESplit;
- BOPTools_PaveBlock aPB(theBoundEdgeIndex, aPave1, aPave2);
- // get split
- aPBIt.Initialize(aSplitShapesPool(aDS.RefEdge(theBoundEdgeIndex)));
-
- for(; aPBIt.More(); aPBIt.Next()) {
- if(aPB.IsEqual(aPBIt.Value())) {
- if(aPBIt.Value().Edge() > 0) {
- aESplit = TopoDS::Edge(aDS.Shape(aPBIt.Value().Edge()));
- break;
- }
- }
- }
-
- if(!aESplit.IsNull()) {
- aListOfWireEdges.Append(aESplit);
- }
+ TopoDS_Edge aESplit;
+ // get split
+ aPBIt.Initialize(theDS->PaveBlocks(theBoundEdgeIndex));
+
+ for(; aPBIt.More(); aPBIt.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB1 = aPBIt.Value();
+ if (aPB1->OriginalEdge() == theBoundEdgeIndex &&
+ aPB1->Pave1().IsEqual(aPave1) &&
+ aPB1->Pave2().IsEqual(aPave2) ) {
+ if(aPB1->Edge() > 0) {
+ aESplit = *(TopoDS_Edge*)&theDS->Shape(aPB1->Edge());
+ break;
+ }
+ }
+ }
+
+ if(!aESplit.IsNull()) {
+ aListOfWireEdges.Append(aESplit);
+ }
}
}
else {
if(apbindex > 0) {
- TopTools_ListOfShape& aListOfSec = anArrayOfListOfSec(apbindex);
- aListOfWireEdges.Append(aListOfSec);
+ TopTools_ListOfShape& aListOfSec = anArrayOfListOfSec(apbindex);
+ aListOfWireEdges.Append(aListOfSec);
}
}
aPave1 = aPave2;
pit++;
}
- if(FindVertex(theUE2Old, theRank, theDSFiller, theHistMap, aNextVertex, aPave2)) {
+ if(FindVertex(theUE2Old, theRank, theDS, theHistMap, aNextVertex, aPave2)) {
aFirstV = aPrevVertex;
aLastV = aNextVertex;
Handle(Geom2d_Curve) aC3 = BRep_Tool::CurveOnSurface(theUE2Old, aFaceF, f, l);
- p2 = aC3->Value(aPave2.Param());
+ p2 = aC3->Value(aPave2.Parameter());
Standard_Boolean bisinside = Standard_False;
Standard_Integer apbindex = 0;
Standard_Integer apbcounter = 1;
- BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
- BOPTools_ListIteratorOfListOfPave aPIt1, aPIt2;
+ BOPDS_ListIteratorOfListOfPaveBlock aPBIt;
+ BOPDS_ListIteratorOfListOfPave aPIt1, aPIt2;
TColStd_ListIteratorOfListOfInteger aFlagIt;
for(aPIt1.Initialize(aFirstPaves), aPIt2.Initialize(aLastPaves), aFlagIt.Initialize(aListOfFlags);
- aPIt1.More() && aPIt2.More() && aFlagIt.More();
- aPIt1.Next(), aPIt2.Next(), aFlagIt.Next(), apbcounter++) {
+ aPIt1.More() && aPIt2.More() && aFlagIt.More();
+ aPIt1.Next(), aPIt2.Next(), aFlagIt.Next(), apbcounter++) {
Standard_Boolean bfin = Standard_False;
Standard_Boolean blin = Standard_False;
if(aPave1.IsEqual(aPIt1.Value())) {
- bfin = Standard_True;
+ bfin = Standard_True;
}
else {
- bfin = (aPave1.Param() > aPIt1.Value().Param());
+ bfin = (aPave1.Parameter() > aPIt1.Value().Parameter());
}
if(aFlagIt.Value()) {
- if(aPave2.IsEqual(aPIt2.Value())) {
- blin = Standard_True;
- }
- else {
- blin = (aPave2.Param() < aPIt2.Value().Param());
- }
+ if(aPave2.IsEqual(aPIt2.Value())) {
+ blin = Standard_True;
+ }
+ else {
+ blin = (aPave2.Parameter() < aPIt2.Value().Parameter());
+ }
}
else {
- blin = Standard_True;
+ blin = Standard_True;
}
if(bfin && blin) {
- apbindex = apbcounter;
- bisinside = Standard_True;
- break;
+ apbindex = apbcounter;
+ bisinside = Standard_True;
+ break;
}
}
TopTools_ListOfShape aOrderedList;
if(FillGap(aFirstV, aLastV, p1, p2, aFaceF, aCompOfSecEdges, aOrderedList)) {
- TopoDS_Compound aComp;
- RemoveEdges(aCompOfSecEdges, aOrderedList, aComp);
- aCompOfSecEdges = aComp;
- aListOfWireEdges.Append(aOrderedList);
+ TopoDS_Compound aComp;
+ RemoveEdges(aCompOfSecEdges, aOrderedList, aComp);
+ aCompOfSecEdges = aComp;
+ aListOfWireEdges.Append(aOrderedList);
- bSecFound = Standard_True;
+ bSecFound = Standard_True;
}
else {
- //add split
- TopoDS_Edge aESplit;
- // get split
- if(!GetPave(theBoundEdgeIndex, Standard_False, theDSFiller, aPave2))
- return Standard_False;
- BOPTools_PaveBlock aPB(theBoundEdgeIndex, aPave1, aPave2);
- aPBIt.Initialize(aSplitShapesPool(aDS.RefEdge(theBoundEdgeIndex)));
-
- for(; aPBIt.More(); aPBIt.Next()) {
- if(aPB.IsEqual(aPBIt.Value())) {
- if(aPBIt.Value().Edge() > 0) {
- aESplit = TopoDS::Edge(aDS.Shape(aPBIt.Value().Edge()));
- break;
- }
- }
- }
-
- if(!aESplit.IsNull()) {
- aListOfWireEdges.Append(aESplit);
- }
+ //add split
+ TopoDS_Edge aESplit;
+ // get split
+ if(!GetPave(theBoundEdgeIndex, Standard_False, theDS, aPave2))
+ return Standard_False;
+ //
+ aPBIt.Initialize(theDS->PaveBlocks(theBoundEdgeIndex));
+ for(; aPBIt.More(); aPBIt.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB1 = aPBIt.Value();
+ if (aPB1->OriginalEdge() == theBoundEdgeIndex &&
+ aPB1->Pave1().IsEqual(aPave1) &&
+ aPB1->Pave2().IsEqual(aPave2) ) {
+ if(aPB1->Edge() > 0) {
+ aESplit = *(TopoDS_Edge*)&theDS->Shape(aPB1->Edge());
+ break;
+ }
+ }
+ }
+
+ if(!aESplit.IsNull()) {
+ aListOfWireEdges.Append(aESplit);
+ }
}
}
else {
if(apbindex > 0) {
- TopTools_ListOfShape& aListOfSec = anArrayOfListOfSec(apbindex);
- aListOfWireEdges.Append(aListOfSec);
+ TopTools_ListOfShape& aListOfSec = anArrayOfListOfSec(apbindex);
+ aListOfWireEdges.Append(aListOfSec);
}
}
}
//add split
TopoDS_Edge aESplit;
// get split
- if(!GetPave(theBoundEdgeIndex, Standard_False, theDSFiller, aPave2))
+ if(!GetPave(theBoundEdgeIndex, Standard_False, theDS, aPave2))
return Standard_False;
- BOPTools_PaveBlock aPB(theBoundEdgeIndex, aPave1, aPave2);
- BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
- aPBIt.Initialize(aSplitShapesPool(aDS.RefEdge(theBoundEdgeIndex)));
+ BOPDS_ListIteratorOfListOfPaveBlock aPBIt;
+ aPBIt.Initialize(theDS->PaveBlocks(theBoundEdgeIndex));
for(; aPBIt.More(); aPBIt.Next()) {
- if(aPB.IsEqual(aPBIt.Value())) {
- if(aPBIt.Value().Edge() > 0) {
- aESplit = TopoDS::Edge(aDS.Shape(aPBIt.Value().Edge()));
- break;
- }
+ const Handle(BOPDS_PaveBlock)& aPB1 = aPBIt.Value();
+ if (aPB1->OriginalEdge() == theBoundEdgeIndex &&
+ aPB1->Pave1().IsEqual(aPave1) &&
+ aPB1->Pave2().IsEqual(aPave2) ) {
+ if(aPB1->Edge() > 0) {
+ aESplit = *(TopoDS_Edge*)&theDS->Shape(aPB1->Edge());
+ break;
+ }
}
}
// purpose:
// ----------------------------------------------------------------------------------------------------
void RemoveEdges(const TopoDS_Compound& theSourceComp,
- const TopTools_ListOfShape& theListToRemove,
- TopoDS_Compound& theResultComp) {
+ const TopTools_ListOfShape& theListToRemove,
+ TopoDS_Compound& theResultComp) {
BRep_Builder aBB;
TopoDS_Compound aComp;
aBB.MakeCompound(aComp);
// static function: FilterSectionEdges
// purpose:
// ----------------------------------------------------------------------------------------------------
-Standard_Boolean FilterSectionEdges(const BOPTools_SequenceOfCurves& theBCurves,
- const TopoDS_Face& theSecPlane,
- const BOPTools_DSFiller& theDSFiller,
- TopoDS_Compound& theResult) {
+Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve& theBCurves,
+ const TopoDS_Face& theSecPlane,
+ const BOPDS_PDS& theDS,
+ TopoDS_Compound& theResult) {
theResult.Nullify();
- const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
BRep_Builder aBB;
aBB.MakeCompound(theResult);
- Standard_Integer aNbCurves = theBCurves.Length();
+ Standard_Integer aNbCurves = theBCurves.Extent();
Standard_Integer cit = 0;
+ BOPDS_ListIteratorOfListOfPaveBlock aPBIt;
+
+ for(cit = 0; cit < aNbCurves; ++cit) {
+ const BOPDS_Curve& aBCurve = theBCurves(cit);
+ const BOPDS_ListOfPaveBlock& aSectEdges = aBCurve.PaveBlocks();
- for(cit = 1; cit <= aNbCurves; cit++) {
- const BOPTools_Curve& aBCurve = theBCurves(cit);
- const BOPTools_ListOfPaveBlock& aSectEdges = aBCurve.NewPaveBlocks();
-
- BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSectEdges);
-
+ aPBIt.Initialize(aSectEdges);
for (; aPBIt.More(); aPBIt.Next()) {
- BOPTools_PaveBlock& aPB = aPBIt.Value();
- Standard_Integer nSect = aPB.Edge();
- const TopoDS_Shape& aS = aDS.GetShape(nSect);
+ const Handle(BOPDS_PaveBlock)& aPB = aPBIt.Value();
+ Standard_Integer nSect = aPB->Edge();
+ const TopoDS_Shape& aS = theDS->Shape(nSect);
TopoDS_Edge anEdge = TopoDS::Edge(aS);
Standard_Boolean bAddEdge = Standard_True;
if(!theSecPlane.IsNull()) {
- IntTools_BeanFaceIntersector anIntersector(anEdge, theSecPlane);
- Standard_Real f = 0., l = 0.;
- BRep_Tool::Range(anEdge, f, l);
- anIntersector.SetBeanParameters(f, l);
- //
- IntTools_Context aContext;
- anIntersector.SetContext(&aContext);
- //
- anIntersector.Perform();
-
- if(anIntersector.IsDone()) {
- bAddEdge = Standard_False;
- Standard_Integer r = 0;
-
- for(r = 1; r <= anIntersector.Result().Length(); r++) {
- const IntTools_Range& aRange = anIntersector.Result().Value(r);
-
- if(((aRange.First() - f) < Precision::PConfusion()) &&
- ((l - aRange.Last()) < Precision::PConfusion())) {
- bAddEdge = Standard_True;
- }
- }
- }
- else {
-// cout << "not done..." << endl;
- }
- }
+ IntTools_BeanFaceIntersector anIntersector(anEdge, theSecPlane);
+ Standard_Real f = 0., l = 0.;
+ BRep_Tool::Range(anEdge, f, l);
+ anIntersector.SetBeanParameters(f, l);
+ //
+ Handle(IntTools_Context) aContext = new IntTools_Context;
+ anIntersector.SetContext(aContext);
+ //
+ anIntersector.Perform();
+
+ if(anIntersector.IsDone()) {
+ bAddEdge = Standard_False;
+ Standard_Integer r = 0;
+
+ for(r = 1; r <= anIntersector.Result().Length(); r++) {
+ const IntTools_Range& aRange = anIntersector.Result().Value(r);
+
+ if(((aRange.First() - f) < Precision::PConfusion()) &&
+ ((l - aRange.Last()) < Precision::PConfusion())) {
+ bAddEdge = Standard_True;
+ break;
+ }//if(((aRange.First() - f) < Precision::PConfusion()) &&
+ }//for(r = 1; r <= anIntersector.Result().Length(); r++) {
+ }//if(anIntersector.IsDone()) {
+ }//if(!theSecPlane.IsNull()) {
if(bAddEdge) {
- aBB.Add(theResult, aS);
+ aBB.Add(theResult, aS);
}
- }
- }
+ }//for (; aPBIt.More(); aPBIt.Next()) {
+ }//for(cit = 0; cit < aNbCurves; ++cit) {
+
return Standard_True;
}
//purpose :
//=======================================================================
static Standard_Real ComputeAveragePlaneAndMaxDeviation(const TopoDS_Shape& aWire,
- gp_Pln& thePlane,
- Standard_Boolean& IsSingular)
+ gp_Pln& thePlane,
+ Standard_Boolean& IsSingular)
{
Standard_Integer N = 40, nedges = 0;
BRepAdaptor_Curve aCurve(anEdge);
GCPnts_UniformAbscissa Distribution( aCurve, N+1 );
for (i = 1; i <= N; i++)
- {
- Standard_Real par = Distribution.Parameter(i);
- Pnts( ind++ ) = aCurve.Value(par);
- }
+ {
+ Standard_Real par = Distribution.Parameter(i);
+ Pnts( ind++ ) = aCurve.Value(par);
+ }
}
gp_Ax2 Axe;
{
Standard_Real dist = thePlane.Distance( Pnts(i) );
if (dist > MaxDeviation)
- MaxDeviation = dist;
+ MaxDeviation = dist;
}
return MaxDeviation;
}
//purpose :
//=======================================================================
static Standard_Boolean ChooseSection(const TopoDS_Shape& Comp,
- const gp_Ax2& bis,
- TopoDS_Shape& resWire,
- gp_Pln& resPlane,
- Standard_Boolean& IsSingular)
+ const gp_Ax2& bis,
+ TopoDS_Shape& resWire,
+ gp_Pln& resPlane,
+ Standard_Boolean& IsSingular)
{
IsSingular = Standard_False;
Standard_Real TolDeviation = 0.01; //, TolConf = 1.e-4, TolAng = 1.e-5;
{
TopExp_Explorer explo( OldComp, TopAbs_EDGE );
if (!explo.More())
- break;
+ break;
TopoDS_Edge FirstEdge = TopoDS::Edge( explo.Current() );
TopoDS_Wire NewWire = BRepLib_MakeWire( FirstEdge );
B.Remove( OldComp, FirstEdge );
if (NewWire.Closed())
- {
- Wseq.Append(NewWire);
- continue;
- }
+ {
+ Wseq.Append(NewWire);
+ continue;
+ }
for (;;)
- {
- TopoDS_Vertex Extremity [2];
- TopExp::Vertices( NewWire, Extremity[0], Extremity[1] );
- if (Extremity[0].IsNull() || Extremity[1].IsNull())
- {
- anError = Standard_True;
- break;
- }
- TopTools_IndexedDataMapOfShapeListOfShape VEmap;
- TopExp::MapShapesAndAncestors( OldComp, TopAbs_VERTEX, TopAbs_EDGE, VEmap );
- TopTools_ListOfShape Vedges [2];
- for (j = 0; j < 2; j++)
- if (VEmap.Contains( Extremity[j] ))
- Vedges[j] = VEmap.FindFromKey( Extremity[j] );
- if (Vedges[0].IsEmpty() && Vedges[1].IsEmpty())
- //no more edges in OldComp to continue NewWire
- break;
- Standard_Boolean Modified = Standard_False;
- for (j = 0; j < 2; j++)
- {
- if (Vedges[j].Extent() == 1)
- {
- const TopoDS_Edge& anEdge = TopoDS::Edge( Vedges[j].First() );
- NewWire = BRepLib_MakeWire( NewWire, anEdge );
- B.Remove( OldComp, anEdge );
- Modified = Standard_True;
- }
- }
- if (!Modified) //only multiple connections
- {
- ind = (Vedges[0].IsEmpty())? 1 : 0;
- TopTools_SequenceOfShape Edges;
- TopTools_ListIteratorOfListOfShape itl( Vedges[ind] );
- for (; itl.More(); itl.Next())
- Edges.Append( itl.Value() );
- Standard_Integer theind=0;
- Standard_Real MinDeviation = RealLast();
- for (j = 1; j <= Edges.Length(); j++)
- {
- TopoDS_Wire aWire = BRepLib_MakeWire( NewWire, TopoDS::Edge(Edges(j)) );
- gp_Pln aPlane;
- Standard_Boolean issing;
- Standard_Real Deviation = ComputeAveragePlaneAndMaxDeviation( aWire, aPlane, issing );
- if (Deviation < MinDeviation)
- {
- MinDeviation = Deviation;
- theind = j;
- }
- }
- NewWire = BRepLib_MakeWire( NewWire, TopoDS::Edge(Edges(theind)) );
- B.Remove( OldComp, Edges(theind) );
- }
- if (NewWire.Closed())
- break;
- }
+ {
+ TopoDS_Vertex Extremity [2];
+ TopExp::Vertices( NewWire, Extremity[0], Extremity[1] );
+ if (Extremity[0].IsNull() || Extremity[1].IsNull())
+ {
+ anError = Standard_True;
+ break;
+ }
+ TopTools_IndexedDataMapOfShapeListOfShape VEmap;
+ TopExp::MapShapesAndAncestors( OldComp, TopAbs_VERTEX, TopAbs_EDGE, VEmap );
+ TopTools_ListOfShape Vedges [2];
+ for (j = 0; j < 2; j++)
+ if (VEmap.Contains( Extremity[j] ))
+ Vedges[j] = VEmap.FindFromKey( Extremity[j] );
+ if (Vedges[0].IsEmpty() && Vedges[1].IsEmpty())
+ //no more edges in OldComp to continue NewWire
+ break;
+ Standard_Boolean Modified = Standard_False;
+ for (j = 0; j < 2; j++)
+ {
+ if (Vedges[j].Extent() == 1)
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge( Vedges[j].First() );
+ NewWire = BRepLib_MakeWire( NewWire, anEdge );
+ B.Remove( OldComp, anEdge );
+ Modified = Standard_True;
+ }
+ }
+ if (!Modified) //only multiple connections
+ {
+ ind = (Vedges[0].IsEmpty())? 1 : 0;
+ TopTools_SequenceOfShape Edges;
+ TopTools_ListIteratorOfListOfShape itl( Vedges[ind] );
+ for (; itl.More(); itl.Next())
+ Edges.Append( itl.Value() );
+ Standard_Integer theind=0;
+ Standard_Real MinDeviation = RealLast();
+ for (j = 1; j <= Edges.Length(); j++)
+ {
+ TopoDS_Wire aWire = BRepLib_MakeWire( NewWire, TopoDS::Edge(Edges(j)) );
+ gp_Pln aPlane;
+ Standard_Boolean issing;
+ Standard_Real Deviation = ComputeAveragePlaneAndMaxDeviation( aWire, aPlane, issing );
+ if (Deviation < MinDeviation)
+ {
+ MinDeviation = Deviation;
+ theind = j;
+ }
+ }
+ NewWire = BRepLib_MakeWire( NewWire, TopoDS::Edge(Edges(theind)) );
+ B.Remove( OldComp, Edges(theind) );
+ }
+ if (NewWire.Closed())
+ break;
+ }
Wseq.Append(NewWire);
if (anError)
- break;
+ break;
}
Standard_Real Deviation=0.;
if (!anError && !Explo.More())
{
if (Wseq.Length() == 1)
- {
- resWire = Wseq.First();
- Deviation = ComputeAveragePlaneAndMaxDeviation( resWire, resPlane, IsSingular );
- return Standard_True;
- }
+ {
+ resWire = Wseq.First();
+ Deviation = ComputeAveragePlaneAndMaxDeviation( resWire, resPlane, IsSingular );
+ return Standard_True;
+ }
else
- {
- for (i = 1; i <= Wseq.Length(); i++)
- {
- TopoDS_Wire aWire = TopoDS::Wire( Wseq(i) );
- gp_Pln aPln;
- Standard_Boolean issing;
- Standard_Real aDeviation =
- ComputeAveragePlaneAndMaxDeviation( aWire, aPln, issing );
- if (issing)
- continue;
-
- Standard_Real Angle = aPln.Axis().Angle( bis.Axis() );
- if (Angle > M_PI/2)
- Angle = M_PI - Angle;
-
- if (Angle < MinAngle)
- {
- MinAngle = Angle;
- resWire = aWire;
- resPlane = aPln;
- Deviation = aDeviation;
- }
- }
- if (Deviation <= TolDeviation)
- return Standard_True;
- }
+ {
+ for (i = 1; i <= Wseq.Length(); i++)
+ {
+ TopoDS_Wire aWire = TopoDS::Wire( Wseq(i) );
+ gp_Pln aPln;
+ Standard_Boolean issing;
+ Standard_Real aDeviation =
+ ComputeAveragePlaneAndMaxDeviation( aWire, aPln, issing );
+ if (issing)
+ continue;
+
+ Standard_Real Angle = aPln.Axis().Angle( bis.Axis() );
+ if (Angle > M_PI/2)
+ Angle = M_PI - Angle;
+
+ if (Angle < MinAngle)
+ {
+ MinAngle = Angle;
+ resWire = aWire;
+ resPlane = aPln;
+ Deviation = aDeviation;
+ }
+ }
+ if (Deviation <= TolDeviation)
+ return Standard_True;
+ }
}
return Standard_False;
//end of simplest case
}
-
-//=======================================================================
-//function : ChoosePlane
-//purpose :
-//=======================================================================
-static Standard_Boolean ChoosePlane(const TopoDS_Shape& Comp,
- const gp_Ax2& bis,
- gp_Pln& resPlane,
- TopoDS_Compound& NewComp)
-{
- Standard_Real TolConf = 1.e-4, TolAng = 1.e-5;
-
- Standard_Integer N = 100;
- Standard_Integer Eind, ind, i, j;
- TopTools_SequenceOfShape Eseq;
- TopExp_Explorer Explo( Comp, TopAbs_EDGE );
- for (; Explo.More(); Explo.Next())
- Eseq.Append( Explo.Current() );
-
- Standard_Integer NumberOfEdges = Eseq.Length();
- TColgp_Array2OfPnt Points( 0, NumberOfEdges*2-1, 1, N/4 );
-
- for (Eind = 0; Eind < NumberOfEdges; Eind++)
- {
- TopoDS_Edge anEdge = TopoDS::Edge( Eseq(Eind+1) );
- BRepAdaptor_Curve aCurve(anEdge);
- GCPnts_UniformAbscissa Distribution( aCurve, N+1 );
- for (i = 1; i <= N/4; i++)
- {
- Standard_Real par = Distribution.Parameter(i);
- Points( Eind*2, i ) = aCurve.Value(par);
- }
- for (i = 3*N/4+2; i <= N+1; i++)
- {
- Standard_Real par = Distribution.Parameter(i);
- Points( Eind*2+1, i-3*N/4-1 ) = aCurve.Value(par);
- }
- }
-
- TColgp_Array1OfPnt Origins( 0, NumberOfEdges*2-1 );
- TColgp_Array1OfDir Normals( 0, NumberOfEdges*2-1 );
- TColStd_Array1OfBoolean IsSingular( 0, NumberOfEdges*2-1 );
- Standard_Real MinAngle = M_PI/2;
- Standard_Integer MinInd;
- for (ind = 0; ind < NumberOfEdges*2; ind++)
- {
- TColgp_Array1OfPnt pnts( 1, N/4 );
- for (i = 1; i <= N/4; i++)
- pnts(i) = Points( ind, i );
- gp_Ax2 Axe;
- GeomLib::AxeOfInertia( pnts, Axe, IsSingular(ind) );
- if (!IsSingular(ind))
- {
- Origins(ind) = Axe.Location();
- Normals(ind) = Axe.Direction();
- Standard_Real Angle = bis.Angle( Axe );
- if (Angle > M_PI/2)
- Angle = M_PI - Angle;
- if (Angle < MinAngle)
- {
- MinAngle = Angle;
- MinInd = ind;
- }
- }
- }
-
- gp_Ax2 TheAxe( Origins(MinInd), Normals(MinInd) );
- Standard_Real MaxAngleWithPln = M_PI/16;
- TColStd_SequenceOfInteger iseq;
- TColgp_SequenceOfPnt Pseq;
- for (ind = 0; ind < NumberOfEdges*2; ind++)
- if (!IsSingular(ind))
- {
- Standard_Real Angle = Normals(ind).Angle( TheAxe.Direction() );
- if (Angle > M_PI/2)
- Angle = M_PI - Angle;
- if (Angle <= MaxAngleWithPln)
- {
- iseq.Append(ind);
- for (j = 1; j <= N/4; j++)
- Pseq.Append( Points(ind,j) );
- }
- }
-
- TColgp_Array1OfPnt Parray( 1, Pseq.Length() );
- for (i = 1; i <= Parray.Length(); i++)
- Parray(i) = Pseq(i);
- Standard_Boolean issing;
- GeomLib::AxeOfInertia( Parray, TheAxe, issing );
- resPlane = gp_Pln( TheAxe );
-
- i = 1;
- BRep_Builder B;
- B.MakeCompound(NewComp);
- while (i <= iseq.Length())
- {
- Standard_Integer ind0 = iseq(i);
- if (IsEven(ind0) && i < iseq.Length() && iseq(i+1) == ind0+1) //the whole edge
- {
- B.Add( NewComp, Eseq(ind0/2+1) );
- i += 2;
- }
- else
- i++;
- }
-
- Standard_Integer slen = Pseq.Length();
- for (ind = 0; ind < NumberOfEdges*2; ind += 2)
- {
- Standard_Integer IndSing = -1, IndNotSing = -1;
- gp_Lin aLine;
- if (IsSingular(ind) && IsSingular(ind+1))
- {
- Standard_Boolean OnPlane0 = Standard_False, OnPlane1 = Standard_False;
- aLine = gce_MakeLin( Points(ind, 1), Points(ind, N/4) );
- if (resPlane.Contains( aLine, TolConf, TolAng ))
- {
- for (j = 1; j <= N/4; j++)
- Pseq.Append( Points(ind,j) );
- OnPlane0 = Standard_True;
- }
- aLine = gce_MakeLin( Points(ind+1, 1), Points(ind+1, N/4) );
- if (resPlane.Contains( aLine, TolConf, TolAng ))
- {
- for (j = 1; j <= N/4; j++)
- Pseq.Append( Points(ind+1,j) );
- OnPlane1 = Standard_True;
- }
- if (OnPlane0 && OnPlane1)
- B.Add( NewComp, Eseq(ind/2+1) );
- }
- else if (IsSingular(ind))
- {
- IndSing = ind;
- IndNotSing = ind+1;
- }
- else if (IsSingular(ind+1))
- {
- IndNotSing = ind;
- IndSing = ind+1;
- }
- if (IndSing != -1 && IndNotSing != -1)
- {
- aLine = gce_MakeLin( Points(IndSing, 1), Points(IndSing, N/4) );
- if (resPlane.Contains( aLine, TolConf, TolAng ))
- {
- for (j = 1; j <= N/4; j++)
- Pseq.Append( Points(IndSing,j) );
-
- for (i = 1; i <= iseq.Length(); i++)
- if (iseq(i) == IndNotSing)
- break;
- if (i <= iseq.Length())
- B.Add( NewComp, Eseq(ind/2+1) );
- }
- }
- }
-
- //Recompute the axe of plane
- if (Pseq.Length() > slen)
- {
- TColgp_Array1OfPnt Parray2( 1, Pseq.Length() );
- for (i = 1; i <= Parray2.Length(); i++)
- Parray2(i) = Pseq(i);
- GeomLib::AxeOfInertia( Parray2, TheAxe, issing );
- resPlane = gp_Pln( TheAxe );
- }
-
- //Temporary
- return Standard_True;
-}