X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_MakeShape.h;h=acbc9c84fbf5247c7820ee6dad889bf833986089;hb=b2a662eec6a0258d51a67ee7e341541e7a710752;hp=8d6c83aab18d921f9ffdd2747456c4e3111ebe2f;hpb=811b2ca2d1a046ba83da8c4848c2d3cf061b6afa;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h index 8d6c83aab..acbc9c84f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h @@ -12,25 +12,42 @@ #include #include -/** \class GeomAlgoAPI_MakeShape - * \ingroup DataAlgo - * \brief Interface to the root class of all topological shapes constructions - */ +/// \class GeomAlgoAPI_MakeShape +/// \ingroup DataAlgo +/// \brief Interface to the root class of all topological shapes constructions class GeomAlgoAPI_MakeShape : public GeomAPI_Interface { public: /// Builder type enum enum BuilderType { OCCT_BRepBuilderAPI_MakeShape, - OCCT_BOPAlgo_Builder + OCCT_BOPAlgo_Builder, + UNKNOWN }; public: - /** \brief Constructor by builder and builder type. - * \param[in] theBuilder pointer to the builder. - * \param[in] theBuilderType builder type. - */ - GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(void* theBuilder, const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape); + /// \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) + { + 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; @@ -38,43 +55,47 @@ public: /// \return a shape built by the shape construction algorithm. GEOMALGOAPI_EXPORT virtual const std::shared_ptr shape() const; - /** \return the list of shapes generated from the shape \a theShape. - * \param[in] theShape base shape. - * \param[out] theHistory generated shapes. - */ + /// \return true if resulting shape is valid. + GEOMALGOAPI_EXPORT bool isValid() const; + + /// \return true if resulting shape has volume. + GEOMALGOAPI_EXPORT bool hasVolume() const; + + /// \return map of sub-shapes of the result. To be used for History keeping. + GEOMALGOAPI_EXPORT std::shared_ptr mapOfSubShapes() const; + + /// \return the list of shapes generated from the shape \a theShape. + /// \param[in] theShape base shape. + /// \param[out] theHistory generated shapes. GEOMALGOAPI_EXPORT virtual void generated(const std::shared_ptr theShape, ListOfShape& theHistory); - /** \return the list of shapes modified from the shape \a theShape. - * \param[in] theShape base shape. - * \param[out] theHistory modified shapes. - */ + /// \return the list of shapes modified from the shape \a theShape. + /// \param[in] theShape base shape. + /// \param[out] theHistory modified shapes. GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr theShape, ListOfShape& theHistory); - /** \return true if theShape was deleted. - * \param[in] theShape base shape. - */ + /// \return true if theShape was deleted. + /// \param[in] theShape base shape. 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. + void setBuilderType(const BuilderType theBuilderType); - /** \brief Sets builder type. - * \param[in] theBuilderType new builder type. - */ - GEOMALGOAPI_EXPORT void setBuilderType(const BuilderType theBuilderType); + /// \brief Sets status of builder. + /// \param[in] theFlag new status. + void setDone(const bool theFlag); - /** \brief Sets status of builder. - * \param[in] theFlag new status. - */ - GEOMALGOAPI_EXPORT void setDone(const bool theFlag); + /// \brief Sets result shape. + /// \param[in] theShape new shape. + void setShape(const std::shared_ptr theShape); - /** \brief Sets result shape. - * \param[in] theShape new shape. - */ - GEOMALGOAPI_EXPORT void setShape(const std::shared_ptr theShape); +private: + /// \brief Initializes internals. + void initialize(); private: GeomAlgoAPI_MakeShape::BuilderType myBuilderType; ///< Type of make shape builder.