Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Placement.h
index 703f609c159c6f7a23dc45d209e34ac34555d797..27f3973bb487dde4f8e81a5a90ad2a9138dc3f3e 100644 (file)
@@ -1,79 +1,71 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        GeomAlgoAPI_Placement.h
-// Created:     2 Dec 2014
-// Author:      Artem ZHIDKOV
+// Copyright (C) 2014-2023  CEA, EDF
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #ifndef GeomAlgoAPI_Placement_H_
 #define GeomAlgoAPI_Placement_H_
 
 #include <GeomAlgoAPI.h>
-#include <GeomAPI_Shape.h>
-#include <GeomAPI_Dir.h>
-#include <GeomAPI_Face.h>
 #include <GeomAlgoAPI_MakeShape.h>
-#include <GeomAPI_DataMapOfShapeShape.h>
-#include <memory>
 
-/**\class GeomAlgoAPI_Placement
- * \ingroup DataAlgo
- * \brief Creates the copied object which face is placed on the given plane
- */
-class GeomAlgoAPI_Placement : public GeomAPI_Interface
+#include <GeomAPI_Shape.h>
+#include <GeomAPI_Trsf.h>
+
+/// \class GeomAlgoAPI_Placement
+/// \ingroup DataAlgo
+/// \brief Creates the copied object which sub-element is placed on the given element
+class GeomAlgoAPI_Placement : public GeomAlgoAPI_MakeShape
 {
 public:
-  /** \brief Creates an object which is obtained from current object by transformation calculated
-   *         as a movement of the source plane to be coincident with the destination plane
-   *  \param[in] theSourceShape  shape to be moved
-   *  \param[in] theDestShape    invariabt shape
-   *  \param[in] theSourcePlane  plane on the shape to be made coincident with destination plane
-   *  \param[in] theDestPlane    destination plane
-   *  \param[in] theIsReverse    indicates that the solid materials should be on the same side against the destination plane
-   *  \param[in] theIsCentering  indicates the planes should be centered
-   */
-  GEOMALGOAPI_EXPORT GeomAlgoAPI_Placement(std::shared_ptr<GeomAPI_Shape> theSourceShape,
-                                           std::shared_ptr<GeomAPI_Shape> theDestShape,
-                                           std::shared_ptr<GeomAPI_Face> theSourcePlane,
-                                           std::shared_ptr<GeomAPI_Face> theDestPlane,
-                                           bool theIsReverse = false,
-                                           bool theIsCentering = false);
-
-  /// Returns True if algorithm succeed
-  GEOMALGOAPI_EXPORT const bool isDone() const
-  { return myDone; }
-
-  ///  Returns True if resulting shape is valid
-  GEOMALGOAPI_EXPORT const bool isValid() const;
+  /// \brief Creates an object which is obtained from current object by transformation calculated
+  ///        as a movement of the source object to be coincident with the destination object
+  /// \param[in] theSourceSolid  a shape to be moved
+  /// \param[in] theDestSolid    invariant shape
+  /// \param[in] theSourceShape  a shape on the solid to be made coincident with destination object
+  /// \param[in] theDestShape    destination object
+  /// \param[in] theIsReverse    indicates that the solid materials should be on the same side
+  ///                            against the destination plane
+  /// \param[in] theIsCentering  indicates the planes should be centered
+  /// \param[in] theSimpleTransform makes just transformation of shape
+  ///                               without changing of topology or geometry
+  GEOMALGOAPI_EXPORT GeomAlgoAPI_Placement(const std::shared_ptr<GeomAPI_Shape> theSourceSolid,
+                                           const std::shared_ptr<GeomAPI_Shape> theDestSolid,
+                                           const std::shared_ptr<GeomAPI_Shape> theSourceShape,
+                                           const std::shared_ptr<GeomAPI_Shape> theDestShape,
+                                           const bool theIsReverse = false,
+                                           const bool theIsCentering = false,
+                                           const bool theSimpleTransform = false);
 
-  /// Returns True if resulting shape has volume
-  GEOMALGOAPI_EXPORT const bool hasVolume() const;
-
-  /// Returns result of the Placement algorithm which may be a Solid or a Face
-  GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape () const;
-
-  /// Returns map of sub-shapes of the result. To be used for History keeping
-  GEOMALGOAPI_EXPORT void  mapOfShapes (GeomAPI_DataMapOfShapeShape& theMap) const;
-
-  /// Return interface for for History processing
-  GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape () const;
-
-  /// Destructor
-  GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Placement();
+  /// Returns the simple transformation
+  GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Trsf> transformation() const;
 
 private:
   /// builds resulting shape
-  void build(const std::shared_ptr<GeomAPI_Shape>& theSourceShape,
+  void build(const std::shared_ptr<GeomAPI_Shape>& theSourceSolid,
+             const std::shared_ptr<GeomAPI_Shape>& theDestSolid,
+             const std::shared_ptr<GeomAPI_Shape>& theSourceShape,
              const std::shared_ptr<GeomAPI_Shape>& theDestShape,
-             const std::shared_ptr<GeomAPI_Face>& theSourcePlane,
-             const std::shared_ptr<GeomAPI_Face>& theDestPlane,
-             bool theIsReverse,
-             bool theIsCentering);
+             const bool theIsReverse,
+             const bool theIsCentering,
+             const bool theSimpleTransform);
 
-  /// fields
-  bool myDone;
-  std::shared_ptr<GeomAPI_Shape> myShape;
-  GeomAPI_DataMapOfShapeShape myMap;
-  GeomAlgoAPI_MakeShape * myMkShape;
+private:
+  std::shared_ptr<GeomAPI_Trsf> myTrsf; ///< transformation of the shape in case theSimpleTransform
 };
 
 #endif