Salome HOME
Issue #904 - Fatal error aftre delete sketch from dataset used in extrusion in part
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Prism.h
index fde00d55d965ad3c0a5cbfacb611d7becb08cfba..cb0747181f34d74fad2cb08c539d55c8ba4efe5b 100644 (file)
@@ -23,55 +23,67 @@ class GeomAlgoAPI_Prism : public GeomAPI_Interface
 {
 public:
   /** \brief Creates extrusion for the given shape along the normal for this shape.
-   *  \param[in] theBasis face or wire to be extruded;
-   *  \param[in] theFromShape bottom bounding shape;
-   *  \param[in] theToShape top bounding shape;
+   *  \param[in] theBasis face or wire to be extruded.
+   *  \param[in] theToSize offset for "to" plane.
+   *  \param[in] theFromSize offset for "from" plane.
    */
   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
+                                       double                         theToSize,
+                                       double                         theFromSize);
+
+  /** \brief Creates extrusion for the given shape along the normal for this shape.
+   *  \param[in] theBasis face or wire to be extruded.
+   *  \param[in] theToShape top bounding shape.  Can be empty. In this case offset will be applied to the basis.
+   *  \param[in] theToSize offset for "to" plane.
+   *  \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis.
+   *  \param[in] theFromSize offset for "from" plane.
+   */
+  GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
+                                       std::shared_ptr<GeomAPI_Shape> theToShape,
+                                       double                         theToSize,
                                        std::shared_ptr<GeomAPI_Shape> theFromShape,
-                                       std::shared_ptr<GeomAPI_Shape> theToShape);
+                                       double                         theFromSize);
 
   /// \return true if algorithm succeed.
-  GEOMALGOAPI_EXPORT const bool isDone() const;
+  GEOMALGOAPI_EXPORT bool isDone() const;
 
   /// \return true if resulting shape is valid.
-  GEOMALGOAPI_EXPORT const bool isValid() const;
+  GEOMALGOAPI_EXPORT bool isValid() const;
 
   /// \return true if resulting shape has volume.
-  GEOMALGOAPI_EXPORT const bool hasVolume() const;
+  GEOMALGOAPI_EXPORT bool hasVolume() const;
 
   /// \return result of the Prism algorithm.
-  GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
+  GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Shape> shape() const;
 
-  /// \returns the first shape.
-  GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& firstShape();
+  /// \returns the list of from faces.
+  GEOMALGOAPI_EXPORT const ListOfShape& fromFaces() const;
 
-  /// \return the last shape.
-  GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& lastShape();
+  /// \return the list of to faces.
+  GEOMALGOAPI_EXPORT const ListOfShape& toFaces() const;
 
   /// \return map of sub-shapes of the result. To be used for History keeping.
-  GEOMALGOAPI_EXPORT void  mapOfShapes(GeomAPI_DataMapOfShapeShape& theMap) const;
+  GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
 
   /// \return interface for History processing.
-  GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape() const;
-
-  /// Destructor.
-  GEOMALGOAPI_EXPORT  ~GeomAlgoAPI_Prism();
+  GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
 
 private:
   /// Builds resulting shape.
-  void build(const std::shared_ptr<GeomAPI_Shape>& theBasis);
+  void build(const std::shared_ptr<GeomAPI_Shape>& theBasis,
+             const std::shared_ptr<GeomAPI_Shape>& theToShape,
+             double                                theToSize,
+             const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+             double                                theFromSize);
 
 private:
   /// Fields.
-  std::shared_ptr<GeomAPI_Shape> myFromShape;
-  std::shared_ptr<GeomAPI_Shape> myToShape;
   bool myDone;
   std::shared_ptr<GeomAPI_Shape> myShape;
-  std::shared_ptr<GeomAPI_Shape> myFirst;
-  std::shared_ptr<GeomAPI_Shape> myLast;
-  GeomAPI_DataMapOfShapeShape myMap;
-  GeomAlgoAPI_MakeShape* myMkShape;
+  ListOfShape myFromFaces;
+  ListOfShape myToFaces;
+  std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
+  std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;
 };
 
 #endif