Salome HOME
Issue #1942: group - names are empty strings
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Box.h
index 4f772eed40cea54cee2e38c8ae1780abef0ff87b..449d633f6dc96cb4461dafa2e0b6d6014ccaa81c 100644 (file)
@@ -4,8 +4,8 @@
 // Created:     17 Mar 2016
 // Author:      Clarisse Genrault (CEA)
 
-#ifndef GeomAlgoAPI_Box_H_
-#define GeomAlgoAPI_Box_H_
+#ifndef GEOMALGOAPI_BOX_H_
+#define GEOMALGOAPI_BOX_H_
 
 #include <GeomAPI_Pnt.h>
 #include <GeomAlgoAPI_MakeShape.h>
 class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape
 {
  public:
+  /// Type of box operation
+  enum MethodType {
+    BOX_DIM,   ///< Box with dimensions
+    BOX_POINTS,  ///< Box with points
+  };
+
   GEOMALGOAPI_EXPORT GeomAlgoAPI_Box();
 
   /// Creates a box using the dimensions.
@@ -25,20 +31,34 @@ class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape
   /// \param theDz The dimension on Z
   GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(const double theDx, const double theDy, const double theDz);
 
-  /// Checks if each dimension "Dx", Dy" and "Dz" for the box construction is OK.
+  /// Creates a box using the two points that defined a diagonal.
+  /// \param theFirstPoint One extermity of the diagonal
+  /// \param theSecondPoint The other extremity of the diagonal
+  GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
+                                     std::shared_ptr<GeomAPI_Pnt> theSecondPoint);
+
+  /// Checks if data for the box construction is OK.
   GEOMALGOAPI_EXPORT bool check();
 
-  /// Builds the box with the dimensions "Dx", "Dy" and "Dz".
+  /// Builds the box.
   GEOMALGOAPI_EXPORT void build();
 
   /// Prepare the naming (redifined because it is specific for a box).
   GEOMALGOAPI_EXPORT void prepareNamingFaces();
 
  private:
+  /// Builds the box with the dimensions "Dx", "Dy" and "Dz".
+  void buildWithDimensions();
+  /// Builds the box with two points
+  void buildWithPoints();
+
   double myDx; /// Dimension on X to create a box.
   double myDy; /// Dimension on Y to create a box.
   double myDz; /// Dimension Z to create a box.
+  std::shared_ptr<GeomAPI_Pnt> myFirstPoint; /// First point to create a box.
+  std::shared_ptr<GeomAPI_Pnt> mySecondPoint; /// Second point to create a box.
+  MethodType myMethodType; /// Type of method used.
 };
 
 
-#endif
+#endif // GEOMALGOAPI_BOX_H_