#include <TopoDS_Compound.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
-#include <TopoDS_Iterator.hxx>
#include <BRepCheck_Analyzer.hxx>
-#include <NCollection_IncAllocator.hxx>
-#include <BOPAlgo_Builder.hxx>
-#include <BOPAlgo_PaveFiller.hxx>
-#include <NCollection_Map.hxx>
-#include <NCollection_DataMap.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_ShapeMapHasher.hxx>
#include <gp_Pln.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <Geom_Plane.hxx>
#include <BRepBuilderAPI_FindPlane.hxx>
-
-typedef NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> HYDROData_MapOfShape;
-typedef HYDROData_MapOfShape::Iterator HYDROData_MapIteratorOfMapOfShape;
-typedef NCollection_DataMap<TopoDS_Shape, TopTools_ListOfShape, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfShape;
-typedef HYDROData_DataMapOfShapeListOfShape::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape;
-typedef NCollection_DataMap<TopoDS_Shape, QStringList, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfString;
-typedef HYDROData_DataMapOfShapeListOfString::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfString;
-#undef _NCollection_MapHasher
-
//#define DEB_SPLIT_TO_ZONES 1
#ifdef DEB_SPLIT_TO_ZONES
#include <BRepTools.hxx>
}
return Standard_False;
}
+//======================================================================================
+Standard_Integer HYDROData_SplitToZonesTool::SplitFaces(const TopoDS_Compound& theComp,
+ HYDROData_Transform& theTool)
+{
+ theTool.Clear();
+ theTool.SetArgument(theComp);
+ theTool.Detect();
+ const Standard_Boolean bToTransform = theTool.ToTransform();
+ theTool.SetToTransform(bToTransform);
+ theTool.Perform();
+ Standard_Integer anErr = theTool.ErrorStatus();
+ return anErr;
+}
+
+//======================================================================================
HYDROData_SplitToZonesTool::SplitDataList
HYDROData_SplitToZonesTool::Split( const HYDROData_SequenceOfObjects& theObjectList,
const HYDROData_SequenceOfObjects& theGroupsList,
aDM3.Bind(aSh, anInputGroupList.at(i).ObjectNames);
}
}
- // Step 1. Prepare Partition structures.
- Handle(NCollection_BaseAllocator) pA1 = new NCollection_IncAllocator, pA2 = new NCollection_IncAllocator;
- BOPAlgo_PaveFiller* aPaveFiller = new BOPAlgo_PaveFiller(pA1);
- BOPAlgo_Builder* aBuilder = new BOPAlgo_Builder(pA2);
+ // Step 1. Prepare Partition structures.
BOPCol_ListOfShape aLS;
-
QStringList aListOfNames;
TopoDS_Compound aCmp;
BRep_Builder aBB;
//TCollection_AsciiString aName = aNam + i + ".brep";
//BRepTools::Write(aSh, aName.ToCString());
}
- HYDROData_Transform sTool;
- sTool.Clear();
- sTool.SetArgument(aCmp);
- sTool.Detect();
- const Standard_Boolean bToTransform = sTool.ToTransform();
- Standard_Integer anErr(0);
- sTool.SetToTransform(bToTransform);
- sTool.Perform();
- anErr = sTool.ErrorStatus();
+ HYDROData_Transform splitTool;
+ const Standard_Integer anErr = SplitFaces(aCmp, splitTool);
if(anErr)
return anOutputSplitDataList;
- const TopoDS_Shape& aResult = sTool.Shape();
-
- /*
- else {
- BOP ==
- aPaveFiller->SetArguments(aLS);
- aPaveFiller->Perform();
- anErr = aPaveFiller->ErrorStatus();
- if(anErr)
- return anOutputSplitDataList;
- BOPDS_PDS pDS = aPaveFiller->PDS();
- if (!pDS)
- return anOutputSplitDataList;
- aBuilder->Clear();
-
- // Step 2. Split faces
- BOPCol_ListIteratorOfListOfShape anIt(aLS);
- for (; anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aS = anIt.Value();
- aBuilder->AddArgument(aS);
- }
- aBuilder->PerformWithFiller(*aPaveFiller);
- anErr = aBuilder->ErrorStatus();
-
- ////
- if(anErr)
- return anOutputSplitDataList;
- aResult = aBuilder->Shape();
- } */
-
+ const TopoDS_Shape& aResult = splitTool.Shape();
if (aResult.IsNull())
return anOutputSplitDataList;
BRepCheck_Analyzer aCheck (aResult);
//TCollection_AsciiString aNamG ("EdgG_");
for (int i =1;anIt.More();anIt.Next(),i++) {
Standard_Boolean foundF(Standard_False);
- const TopTools_ListOfShape& aListOfNew = /*aBuilder->*/sTool.Modified(anIt.Value());
+ const TopTools_ListOfShape& aListOfNew = splitTool.Modified(anIt.Value());
if(!aListOfNew.IsEmpty())
foundF = Standard_True;
TopTools_ListOfShape aList;
for(;it.More();it.Next())
aList.Append(it.Value());
// Bug in History: partition should give only modified entities! => temporary solution is used
- const TopTools_ListOfShape& aListOfGen = /*aBuilder->*/sTool.Generated(anIt.Value());
+ const TopTools_ListOfShape& aListOfGen = splitTool.Generated(anIt.Value());
if(!aListOfGen.IsEmpty())
foundF = Standard_True;
it.Initialize(aListOfGen);
TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE);
for (int j =1;exp.More();exp.Next(),j++) {
Standard_Boolean foundE(Standard_False);
- const TopTools_ListOfShape& aListM = /*aBuilder->*/sTool.Modified(exp.Current());
+ const TopTools_ListOfShape& aListM = splitTool.Modified(exp.Current());
//cout << "NB_EDGE_M = " << aListM.Extent() <<endl;
if(aListM.Extent()) foundE = Standard_True;
it.Initialize(aListM);
//aName = aNamM + i + j +k +".brep";
//BRepTools::Write(it.Value(),aName.ToCString());
}
- const TopTools_ListOfShape& aListG = /*aBuilder->*/sTool.Generated(exp.Current());
+ const TopTools_ListOfShape& aListG = splitTool.Generated(exp.Current());
if(aListG.Extent()) foundE = Standard_True;
it.Initialize(aListG);
for(int k=1;it.More();it.Next(),k++) {
#define HYDROData_SplitToZonesTool_H
#include <HYDROData_Object.h>
-
+#include <HYDROData_Transform.h>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Compound.hxx>
#include <TopoDS_Face.hxx>
-
+#include <TopTools_ShapeMapHasher.hxx>
+#include <NCollection_Map.hxx>
+#include <NCollection_DataMap.hxx>
+#include <TopTools_ListOfShape.hxx>
#include <QStringList>
class Handle(HYDROData_PolylineXY);
};
typedef QList <SplitData> SplitDataList;
- typedef QListIterator<SplitData> SplitDataListIterator;
+ typedef QListIterator<SplitData> SplitDataListIterator;
+ typedef NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> HYDROData_MapOfShape;
+ typedef HYDROData_MapOfShape::Iterator HYDROData_MapIteratorOfMapOfShape;
+ typedef NCollection_DataMap<TopoDS_Shape, TopTools_ListOfShape, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfShape;
+ typedef HYDROData_DataMapOfShapeListOfShape::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape;
+ typedef NCollection_DataMap<TopoDS_Shape, QStringList, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfString;
+ typedef HYDROData_DataMapOfShapeListOfString::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfString;
+ #undef _NCollection_MapHasher
public:
static SplitDataList ExtractSeparateData( const SplitData& theData );
+ /**
+ * Split input faces.
+ */
+ static Standard_Integer SplitFaces(const TopoDS_Compound& theComp, HYDROData_Transform& theTool);
};
#endif