X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_MakeShape.h;h=0131da44660d4a454a108377a63d6c352e15c66d;hb=530f5aff42069e844c4a4ef164088ea23ba0e2dd;hp=b4e46e54a15d7e1c1fbc3263086ebcfcff148625;hpb=de65be6c9f19bdf26ecb91fd3afd51c4d54e8d4a;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h index b4e46e54a..0131da446 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h @@ -6,57 +6,104 @@ #ifndef GeomAlgoAPI_MakeShape_H_ #define GeomAlgoAPI_MakeShape_H_ -#include #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: - /// Algo type enum - enum AlgoType { - MakeShape, - MakePipe, - BOPAlgoBuilder + /// Builder type enum + enum BuilderType { + Unknown, + OCCT_BRepBuilderAPI_MakeShape, + OCCT_BOPAlgo_Builder }; public: - /// Constructor by the already stored builder in the interface - GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(void* theBuilder, const AlgoType theAlgoType = MakeShape); + /// \brief Empty constructor. + GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(); - /// Constructor by the builder and wire. Used for pipe builder. - GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(void* theBuilder, - const std::shared_ptr theWire, - const std::shared_ptr theBaseShape); + /// \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(); + } - /// Returns a shape built by the shape construction algorithm + /// \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 = theBuilderType; + initialize(); + } + + /// \return status of builder. + GEOMALGOAPI_EXPORT bool isDone() const; + + /// \return a shape built by the shape construction algorithm. GEOMALGOAPI_EXPORT virtual const std::shared_ptr shape() const; - /// Returns the list of shapes generated from the shape \a theShape - GEOMALGOAPI_EXPORT virtual void generated( - const std::shared_ptr theShape, ListOfShape& theHistory); + /// \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); - /// Returns the list of shapes modified from the shape \a theShape - GEOMALGOAPI_EXPORT virtual void modified( - 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. + GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr theShape, + ListOfShape& theHistory); - /// Returns whether the shape is deleted + /// \return true if theShape was deleted. + /// \param[in] theShape base shape. GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr theShape); protected: - GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(){}; + /// \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. + void setDone(const bool theFlag); + + /// \brief Sets result shape. + /// \param[in] theShape new shape. + void setShape(const std::shared_ptr theShape); protected: - GeomAlgoAPI_MakeShape::AlgoType myAlgoType; ///< Type of make shape algo. + std::shared_ptr myMap; ///< Data map to keep correct orientation of sub-shapes. + +private: + /// \brief Initializes internals. + void initialize(); + +private: + GeomAlgoAPI_MakeShape::BuilderType myBuilderType; ///< Type of make shape builder. + bool myDone; ///< Builder status. std::shared_ptr myShape; ///< Resulting shape. - std::shared_ptr myWire; ///< Wire for pipe algo. - std::shared_ptr myBaseShape; ///< Base shape of algo. }; typedef std::list > ListOfMakeShape;