Salome HOME
0c41f4e01847679382e899b66054ee7224af965b
[modules/shaper.git] / src / GeomAPI / GeomAPI_PlanarEdges.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef GEOMAPI_WIRE_H_
21 #define GEOMAPI_WIRE_H_
22
23 #include "GeomAPI.h"
24 #include "GeomAPI_Edge.h"
25 #include "GeomAPI_Pnt.h"
26 #include "GeomAPI_Dir.h"
27 #include "GeomAPI_Ax3.h"
28
29 #include <memory>
30
31 #include <list>
32
33 /**\class GeomAPI_PlanarEdges
34  * \ingroup DataModel
35  * \brief Interface to the set of edges located in one plane
36  *
37  * Normally this interface corresponds to the edges of the sketch
38  */
39 class GeomAPI_PlanarEdges : public GeomAPI_Shape
40 {
41  public:
42   /// Creation of empty (null) shape
43   GEOMAPI_EXPORT GeomAPI_PlanarEdges();
44
45   /// Returns whether the shape is alone vertex
46   GEOMAPI_EXPORT virtual bool isVertex() const;
47
48   /// Returns whether the shape is alone edge
49   GEOMAPI_EXPORT virtual bool isEdge() const;
50   /// Appends the edge to the set
51   GEOMAPI_EXPORT void addEdge(std::shared_ptr<GeomAPI_Shape> theEdge);
52   /// Returns the list of edges in this interface
53   GEOMAPI_EXPORT std::list<std::shared_ptr<GeomAPI_Shape> > getEdges();
54
55   /// Returns True if the wire is defined in a plane
56   GEOMAPI_EXPORT bool hasPlane() const;
57
58   /// Returns the plane origin point
59   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Pnt> origin() const;
60
61   /// Returns X direction vector
62   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> dirX() const;
63
64   /// Returns Y direction vector
65   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> dirY() const;
66
67   /// Returns Z direction vector
68   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> norm() const;
69
70   /// Returns whether the shape is planar
71   GEOMAPI_EXPORT virtual bool isPlanar() const;
72
73   /// Set working plane
74   /// \param theOrigin origin of the plane axis
75   /// \param theDirX X direction of the plane axis
76   /// \param theNorm normal direction of the plane axis
77   GEOMAPI_EXPORT void setPlane(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
78                                const std::shared_ptr<GeomAPI_Dir>& theDirX,
79                                const std::shared_ptr<GeomAPI_Dir>& theNorm);
80
81   /// Returns whether the shapes are equal
82   GEOMAPI_EXPORT
83   virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
84
85 private:
86
87   std::shared_ptr<GeomAPI_Ax3> myPlane;
88 };
89
90 #endif
91