#include <IntAna_IntConicQuad.hxx>
#include <IntAna_Quadric.hxx>
#include <NCollection_Vector.hxx>
+#include <ShapeAnalysis.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
+#include <TopoDS_Vertex.hxx>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
aTA = TopAbs_SOLID;
}
- // Map subshapes and shapes.
+ // Get free shapes.
const TopoDS_Shape& aShapesComp = theCompound->impl<TopoDS_Shape>();
- BOPCol_IndexedDataMapOfShapeListOfShape aMapEF;
- BOPTools::MapShapesAndAncestors(aShapesComp, aTS, aTA, aMapEF);
- if(aMapEF.IsEmpty()) {
+ for(TopoDS_Iterator anIter(aShapesComp); anIter.More(); anIter.Next() ) {
+ const TopoDS_Shape& aShape = anIter.Value();
+ if(aShape.ShapeType() > aTA) {
+ std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
+ aGeomShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aShape));
+ theFreeShapes.push_back(aGeomShape);
+ }
+ }
+
+ // Map subshapes and shapes.
+ BOPCol_IndexedDataMapOfShapeListOfShape aMapSA;
+ BOPTools::MapShapesAndAncestors(aShapesComp, aTS, aTA, aMapSA);
+ if(aMapSA.IsEmpty()) {
return;
}
// Get all shapes with common subshapes and free shapes.
NCollection_Map<TopoDS_Shape> aFreeShapes;
NCollection_Vector<NCollection_Map<TopoDS_Shape>> aShapesWithCommonSubshapes;
- for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapEF); anIter.More(); anIter.Next()) {
+ for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapSA); anIter.More(); anIter.Next()) {
const TopoDS_Shape& aShape = anIter.Key();
BOPCol_ListOfShape& aListOfShape = anIter.ChangeValue();
if(aListOfShape.IsEmpty()) {
aListOfShape.Clear();
for(NCollection_List<TopoDS_Shape>::Iterator aTempIter(aTempList); aTempIter.More(); aTempIter.Next()) {
const TopoDS_Shape& aTempShape = aTempIter.Value();
- for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapEF); anIter.More(); anIter.Next()) {
+ for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapSA); anIter.More(); anIter.Next()) {
BOPCol_ListOfShape& aTempListOfShape = anIter.ChangeValue();
if(aTempListOfShape.IsEmpty()) {
continue;
return aResultShape;
}
+
+//=================================================================================================
+void GeomAlgoAPI_ShapeTools::findBounds(const std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Vertex>& theV1,
+ std::shared_ptr<GeomAPI_Vertex>& theV2)
+{
+ if(!theShape.get()) {
+ std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex);
+ aVertex->setImpl(new TopoDS_Vertex());
+ theV1 = aVertex;
+ theV2 = aVertex;
+ return;
+ }
+
+ const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+ TopoDS_Vertex aV1, aV2;
+ ShapeAnalysis::FindBounds(aShape, aV1, aV2);
+
+ std::shared_ptr<GeomAPI_Vertex> aGeomV1(new GeomAPI_Vertex()), aGeomV2(new GeomAPI_Vertex());
+ aGeomV1->setImpl(new TopoDS_Vertex(aV1));
+ aGeomV2->setImpl(new TopoDS_Vertex(aV2));
+ theV1 = aGeomV1;
+ theV2 = aGeomV2;
+}