build(theShapes);
}
+//==================================================================================================
+GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain(const GeomShapePtr& theShape)
+{
+ build(theShape, false);
+}
+
+//==================================================================================================
void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape& theShapes)
{
if(theShapes.empty()) {
const TopoDS_Shape& aShell = aCombined.front()->impl<TopoDS_Shape>();
+ std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ aShape->setImpl(new TopoDS_Shape(aShell));
+ build(aShape, true);
+}
+
+//==================================================================================================
+void GeomAlgoAPI_UnifySameDomain::build(const GeomShapePtr& theShape,
+ const bool theIsToSimplifyShell)
+{
ShapeUpgrade_UnifySameDomain* aUnifyAlgo = new ShapeUpgrade_UnifySameDomain();
this->setImpl(aUnifyAlgo);
- aUnifyAlgo->Initialize(aShell);
+ const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+ aUnifyAlgo->Initialize(aShape);
aUnifyAlgo->Build();
TopoDS_Shape aResult = aUnifyAlgo->Shape();
return;
}
- if (aResult.ShapeType() == TopAbs_SHELL) {
+ if (theIsToSimplifyShell && aResult.ShapeType() == TopAbs_SHELL) {
int aNb = 0;
TopoDS_Iterator anIt(aResult);
for (; anIt.More(); anIt.Next()) {
}
}
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
- aShape->setImpl(new TopoDS_Shape(aResult));
- this->setShape(aShape);
+ std::shared_ptr<GeomAPI_Shape> aResShape(new GeomAPI_Shape());
+ aResShape->setImpl(new TopoDS_Shape(aResult));
+ this->setShape(aResShape);
this->setDone(true);
}
/// Constructor.
GEOMALGOAPI_EXPORT GeomAlgoAPI_UnifySameDomain(const ListOfShape& theShapes);
+ /// Constructor.
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_UnifySameDomain(const GeomShapePtr& theShape);
+
/// \return the list of shapes modified from the shape \a theShape.
/// \param[in] theShape base shape.
/// \param[out] theHistory modified shapes.
ListOfShape& theHistory);
private:
- /// Builds resulting shape.
+ /// Builds resulting shape from list of shapes.
void build(const ListOfShape& theShapes);
+
+ /// Builds resulting shape from the shape.
+ void build(const GeomShapePtr& theShape, const bool theIsToSimplifyShell);
};
#endif