X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_MakeShape.h;h=6fc03c6f8683246ddfdfac6a95786288d024fa66;hb=f0cec241aae9ca16d86e166f45cb5c4987d2c792;hp=272f9f9750f468786ba35f961d0bec8060713a32;hpb=0d9a107853208317a6352bb7f8c77eb54d5efbe1;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h index 272f9f975..6fc03c6f8 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h @@ -3,6 +3,9 @@ // File: GeomAlgoAPI_MakeShape.h // Created: 17 Oct 2014 // Author: Sergey ZARITCHNY +// +// Modified by Clarisse Genrault (CEA) : 17 Mar 2016 + #ifndef GeomAlgoAPI_MakeShape_H_ #define GeomAlgoAPI_MakeShape_H_ @@ -11,16 +14,18 @@ #include #include +#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 { + Unknown, OCCT_BRepBuilderAPI_MakeShape, OCCT_BOPAlgo_Builder }; @@ -29,10 +34,9 @@ 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. - */ + /// \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) @@ -40,14 +44,13 @@ public: initialize(); } - /** \brief Initializes internals. - * \param[in] theBuilder pointer to the builder. - * \param[in] theBuilderType builder type. - */ + /// \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; + myBuilderType = theBuilderType; initialize(); } @@ -57,41 +60,64 @@ 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); + /// \return true if the data were correct. + GEOMALGOAPI_EXPORT virtual bool check() { return true; }; + + /// \return the list of created faces. + GEOMALGOAPI_EXPORT std::map< std::string, std::shared_ptr > getCreatedFaces() {return myCreatedFaces;} + + /// \return the error. + GEOMALGOAPI_EXPORT std::string getError() { return myError; } + + /// \brief Prepare the naming of faces. + GEOMALGOAPI_EXPORT virtual void prepareNamingFaces(); + + /// \brief Check the validity of the produced shape. + GEOMALGOAPI_EXPORT bool checkValid(std::string theMessage); + protected: - /** \brief Sets builder type. - * \param[in] theBuilderType new builder type. - */ - GEOMALGOAPI_EXPORT void setBuilderType(const BuilderType theBuilderType); + /// \brief Sets builder type. + /// \param[in] theBuilderType new builder type. + void setBuilderType(const BuilderType theBuilderType); - /** \brief Sets status of builder. - * \param[in] theFlag new status. - */ - GEOMALGOAPI_EXPORT void setDone(const bool theFlag); + /// \brief Sets status of builder. + /// \param[in] theFlag new status. + void setDone(const bool theFlag); - /** \brief Sets result shape. - * \param[in] theShape new shape. - */ - GEOMALGOAPI_EXPORT void setShape(const std::shared_ptr theShape); + /// \brief Sets result shape. + /// \param[in] theShape new shape. + void setShape(const std::shared_ptr theShape); +protected: + std::shared_ptr myMap; ///< Data map to keep correct orientation of sub-shapes. + std::string myError; /// Error occurred during the execution of an algorithm. + std::map< std::string, std::shared_ptr > myCreatedFaces; /// Map of created faces with their name for naming. + private: /// \brief Initializes internals. void initialize(); @@ -100,7 +126,6 @@ private: GeomAlgoAPI_MakeShape::BuilderType myBuilderType; ///< Type of make shape builder. bool myDone; ///< Builder status. std::shared_ptr myShape; ///< Resulting shape. - std::shared_ptr myMap; ///< Data map to keep correct orientation of sub-shapes. }; typedef std::list > ListOfMakeShape;