From: dbv Date: Thu, 24 Dec 2015 07:50:08 +0000 (+0300) Subject: GeomAlgoAPI_Transform now derived from GeomAlgoAPI_MakeShape X-Git-Tag: V_2.1.0~79 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c11217430bc2c359938fa0a261d8fbc81b209f47;p=modules%2Fshaper.git GeomAlgoAPI_Transform now derived from GeomAlgoAPI_MakeShape --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp index a8e4b4138..d38f20c19 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp @@ -194,11 +194,11 @@ void FeaturesPlugin_Placement::LoadNamingDS(GeomAlgoAPI_Transform& theTransformA //load result theResultBody->storeModified(theSlaveObject, theTransformAlgo.shape()); // the initial Slave, the resulting Slave - std::shared_ptr aSubShapes = theTransformAlgo.mapOfShapes(); + std::shared_ptr aSubShapes = theTransformAlgo.mapOfSubShapes(); // put modifed faces in DF std::string aModName = "Modified"; - theResultBody->loadAndOrientModifiedShapes(theTransformAlgo.makeShape().get(), - theSlaveObject, _FACE, - _MODIFIEDF_TAG, aModName, *aSubShapes.get()); + theResultBody->loadAndOrientModifiedShapes(&theTransformAlgo, + theSlaveObject, _FACE, + _MODIFIEDF_TAG, aModName, *aSubShapes.get()); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp index 8c7cefb32..481ae1c72 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp @@ -4,7 +4,7 @@ // Created: 29 July 2015 // Author: Dmitry Bobylev -#include +#include "GeomAlgoAPI_Transform.h" #include @@ -16,8 +16,7 @@ //================================================================================================= GeomAlgoAPI_Transform::GeomAlgoAPI_Transform(std::shared_ptr theSourceShape, std::shared_ptr theTrsf) -: myDone(false), - myTrsf(theTrsf) +: myTrsf(theTrsf) { build(theSourceShape, theTrsf); } @@ -41,60 +40,18 @@ void GeomAlgoAPI_Transform::build(std::shared_ptr theSourceShape, if(!aBuilder) { return; } - myMkShape.reset(new GeomAlgoAPI_MakeShape(aBuilder)); + this->setImpl(aBuilder); + this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - myDone = aBuilder->IsDone() == Standard_True; - if(!myDone) { + if(aBuilder->IsDone() != Standard_True) { return; } - TopoDS_Shape aResult = aBuilder->Shape(); - // Fill data map to keep correct orientation of sub-shapes. - myMap.reset(new GeomAPI_DataMapOfShapeShape()); - for(TopExp_Explorer anExp(aResult, TopAbs_FACE); anExp.More(); anExp.Next()) { - std::shared_ptr aCurrentShape(new GeomAPI_Shape()); - aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current())); - myMap->bind(aCurrentShape, aCurrentShape); - } - - myShape.reset(new GeomAPI_Shape()); - myShape->setImpl(new TopoDS_Shape(aResult)); -} - -//================================================================================================= -const bool GeomAlgoAPI_Transform::isValid() const -{ - BRepCheck_Analyzer aChecker(myShape->impl()); - return (aChecker.IsValid() == Standard_True); -} - -//================================================================================================= -const bool GeomAlgoAPI_Transform::hasVolume() const -{ - bool hasVolume(false); - if(isValid() && (GeomAlgoAPI_ShapeTools::volume(myShape) > Precision::Confusion())) { - hasVolume = true; - } - return hasVolume; -} - -//================================================================================================= -const std::shared_ptr& GeomAlgoAPI_Transform::shape() const -{ - return myShape; -} - -//================================================================================================= -std::shared_ptr GeomAlgoAPI_Transform::mapOfShapes() const -{ - return myMap; -} - -//================================================================================================= -std::shared_ptr GeomAlgoAPI_Transform::makeShape() const -{ - return myMkShape; + std::shared_ptr aShape(new GeomAPI_Shape()); + aShape->setImpl(new TopoDS_Shape(aResult)); + this->setShape(aShape); + this->setDone(true); } //================================================================================================= diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h index aeb085ad3..584cdca90 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h @@ -9,43 +9,22 @@ #include #include -#include + #include #include -/** \class GeomAlgoAPI_Transform - * \ingroup DataAlgo - * \brief Creates a copy of the object by transformating it. - */ -class GeomAlgoAPI_Transform : public GeomAPI_Interface +/// \class GeomAlgoAPI_Transform +/// \ingroup DataAlgo +/// \brief Creates a copy of the object by transformating it. +class GeomAlgoAPI_Transform : public GeomAlgoAPI_MakeShape { public: - /** \brief Creates an object which is obtained from current object by transformating it. - * \param[in] theSourceShape a shape to be transformed. - * \param[in] theTrsf transformation. - */ + /// \brief Creates an object which is obtained from current object by transformating it. + /// \param[in] theSourceShape a shape to be transformed. + /// \param[in] theTrsf transformation. GEOMALGOAPI_EXPORT GeomAlgoAPI_Transform(std::shared_ptr theSourceShape, std::shared_ptr theTrsf); - /// \return true if algorithm succeed. - GEOMALGOAPI_EXPORT const bool isDone() const - { return myDone; } - - /// \return true if resulting shape is valid. - GEOMALGOAPI_EXPORT const bool isValid() const; - - /// \return true if resulting shape has volume. - GEOMALGOAPI_EXPORT const bool hasVolume() const; - - /// \return result of the transformation algorithm. - GEOMALGOAPI_EXPORT const std::shared_ptr& shape() const; - - /// \return map of sub-shapes of the result. To be used for History keeping. - GEOMALGOAPI_EXPORT std::shared_ptr mapOfShapes() const; - - /// \return interface for for History processing. - GEOMALGOAPI_EXPORT std::shared_ptr makeShape() const; - /// \return the transformation. GEOMALGOAPI_EXPORT std::shared_ptr transformation() const; @@ -55,12 +34,7 @@ private: std::shared_ptr theTrsf); private: - /// Fields. - bool myDone; std::shared_ptr myTrsf; - std::shared_ptr myShape; - std::shared_ptr myMap; - std::shared_ptr myMkShape; }; #endif