From 0d9a107853208317a6352bb7f8c77eb54d5efbe1 Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 8 Dec 2015 11:47:58 +0300 Subject: [PATCH] Architecture changes --- src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp | 44 +++++++++++------------ src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h | 22 ++++++++---- src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h | 2 +- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp index e01f7d7a9..3b0d3ca8b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp @@ -14,19 +14,10 @@ #include //================================================================================================= -void GeomAlgoAPI_MakeShape::initialize() { - switch (myBuilderType) { - case OCCT_BRepBuilderAPI_MakeShape: { - myDone = implPtr()->IsDone() == Standard_True; - myShape->setImpl(new TopoDS_Shape(implPtr()->Shape())); - break; - } - case OCCT_BOPAlgo_Builder: { - myDone = true; - myShape->setImpl(new TopoDS_Shape(implPtr()->Shape())); - break; - } - } +GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape() +: myBuilderType(OCCT_BRepBuilderAPI_MakeShape), + myDone(false) +{ } //================================================================================================= @@ -100,15 +91,6 @@ bool GeomAlgoAPI_MakeShape::isDeleted(const std::shared_ptr theSh return isDeleted; } - -//================================================================================================= -GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape() -: myBuilderType(OCCT_BRepBuilderAPI_MakeShape), - myDone(false), - myShape(new GeomAPI_Shape()) -{ -} - //================================================================================================= void GeomAlgoAPI_MakeShape::setBuilderType(const BuilderType theBuilderType) { @@ -126,3 +108,21 @@ void GeomAlgoAPI_MakeShape::setShape(const std::shared_ptr theSha { myShape = theShape; } + +//================================================================================================= +void GeomAlgoAPI_MakeShape::initialize() { + switch (myBuilderType) { + case OCCT_BRepBuilderAPI_MakeShape: { + myDone = implPtr()->IsDone() == Standard_True; + myShape.reset(new GeomAPI_Shape()); + myShape->setImpl(new TopoDS_Shape(implPtr()->Shape())); + break; + } + case OCCT_BOPAlgo_Builder: { + myDone = true; + myShape.reset(new GeomAPI_Shape()); + myShape->setImpl(new TopoDS_Shape(implPtr()->Shape())); + break; + } + } +} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h index 07e618263..272f9f975 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h @@ -26,18 +26,30 @@ public: }; public: + /// \brief Empty constructor. + GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(); + /** \brief Constructor by builder and builder type. * \param[in] theBuilder pointer to the builder. * \param[in] theBuilderType builder type. */ template explicit GeomAlgoAPI_MakeShape(T* theBuilder, const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) : GeomAPI_Interface(theBuilder), - myBuilderType(theBuilderType), - myShape(new GeomAPI_Shape()) + myBuilderType(theBuilderType) { initialize(); } + /** \brief Initializes internals. + * \param[in] theBuilder pointer to the builder. + * \param[in] theBuilderType builder type. + */ + template void initialize(T* theBuilder, const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) + { + setImpl(theBuilder); + myBuilderType = theBuilder; + initialize(); + } /// \return status of builder. GEOMALGOAPI_EXPORT bool isDone() const; @@ -65,9 +77,6 @@ public: GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr theShape); protected: - /// \brief Default constructor. - GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(); - /** \brief Sets builder type. * \param[in] theBuilderType new builder type. */ @@ -83,8 +92,9 @@ protected: */ GEOMALGOAPI_EXPORT void setShape(const std::shared_ptr theShape); +private: /// \brief Initializes internals. - GEOMALGOAPI_EXPORT void initialize(); + void initialize(); private: GeomAlgoAPI_MakeShape::BuilderType myBuilderType; ///< Type of make shape builder. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h index a25bbe681..fee768599 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeSweep.h @@ -35,7 +35,7 @@ public: protected: GeomAlgoAPI_MakeSweep(){}; -protected: +private: ListOfShape myFromFaces; ListOfShape myToFaces; }; -- 2.39.2