]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAPI/GeomAPI_Shape.h
Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / GeomAPI / GeomAPI_Shape.h
1 // Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
18 //
19
20 #ifndef GeomAPI_Shape_H_
21 #define GeomAPI_Shape_H_
22
23 #include <GeomAPI_Interface.h>
24 #include <memory>
25 #include <list>
26
27 /**\class GeomAPI_Shape
28  * \ingroup DataModel
29  * \brief Interface to the topological shape object
30  */
31 class GeomAPI_Shape : public GeomAPI_Interface
32 {
33 public:
34   /// Shape type enum
35   enum ShapeType {
36     COMPOUND, COMPSOLID, SOLID, SHELL,
37     FACE, WIRE, EDGE, VERTEX,
38     SHAPE
39   };
40
41   /// Shape orientation
42   enum Orientation {
43     FORWARD,
44     REVERSED,
45     INTERNAL,
46     EXTERNAL
47   };
48
49  public:
50   /// Creation of empty (null) shape
51   GEOMAPI_EXPORT
52   GeomAPI_Shape();
53
54   /// \return a new Shape with the same Orientation and Location and a new TShape with the same
55   ///         geometry and no sub-shapes.
56   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> emptyCopied() const;
57
58   /// Returns true if the underlied shape is null
59   GEOMAPI_EXPORT
60   bool isNull() const;
61
62   /// Returns whether the shapes are equal
63   GEOMAPI_EXPORT
64   virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
65
66   /// Returns whether the shapes are same
67   GEOMAPI_EXPORT
68   virtual bool isSame(const std::shared_ptr<GeomAPI_Shape> theShape) const;
69
70   /// Returns whether the shape is a vertex
71   GEOMAPI_EXPORT
72   virtual bool isVertex() const;
73
74   /// Returns whether the shape is an edge
75   GEOMAPI_EXPORT
76   virtual bool isEdge() const;
77
78   /// Returns whether the shape is a face
79   GEOMAPI_EXPORT
80   virtual bool isFace() const;
81
82   /// Returns whether the shape is a compound
83   GEOMAPI_EXPORT
84   virtual bool isCompound() const;
85
86   /// Returns whether the shape is a compound of solids
87   GEOMAPI_EXPORT
88   virtual bool isCompoundOfSolids() const;
89
90   /// Returns whether the shape is a compound where all elements are topologically connected
91   GEOMAPI_EXPORT
92   virtual bool isConnectedTopology() const;
93
94   /// Returns whether the shape is a solid
95   GEOMAPI_EXPORT
96   virtual bool isSolid() const;
97
98   /// Returns whether the shape is a compsolid
99   GEOMAPI_EXPORT
100   virtual bool isCompSolid() const;
101
102   /// Returns whether the shape is planar
103   GEOMAPI_EXPORT
104   virtual bool isPlanar() const;
105
106   /// Returns the shape type
107   GEOMAPI_EXPORT
108   virtual ShapeType shapeType() const;
109
110   /// Returns the type enumeration by the string-type
111   GEOMAPI_EXPORT static ShapeType shapeTypeByStr(std::string theType);
112
113   /// \return the shape type as string.
114   GEOMAPI_EXPORT
115   virtual std::string shapeTypeStr() const;
116
117   /// \return the shape orientation.
118   GEOMAPI_EXPORT virtual Orientation orientation() const;
119
120   /// Sets the shape orientation.
121   GEOMAPI_EXPORT virtual void setOrientation(const Orientation theOrientation);
122
123   /// \return true if passed shape is a sub-shape of this shape.
124   /// \param theShape shape to search.
125   GEOMAPI_EXPORT virtual bool isSubShape(const std::shared_ptr<GeomAPI_Shape> theShape) const;
126
127   /// Computes boundary dimensions of the shape
128   /// Returns False if it is not possible
129   GEOMAPI_EXPORT
130   bool computeSize(double& theXmin, double& theYmin, double& theZmin,
131                    double& theXmax, double& theYmax, double& theZmax) const;
132
133   /// Returns the shape as BRep stream
134   GEOMAPI_EXPORT
135   std::string getShapeStream() const;
136
137   /// Returns intersection of shapes
138   GEOMAPI_EXPORT
139   std::shared_ptr<GeomAPI_Shape> intersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
140
141   /// Returns true if min distance between shapes < tolerance.
142   GEOMAPI_EXPORT
143   bool isIntersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
144 };
145
146 //! Pointer on list of shapes
147 typedef std::list<std::shared_ptr<GeomAPI_Shape> > ListOfShape;
148
149 //! Pointer on attribute object
150 typedef std::shared_ptr<GeomAPI_Shape> GeomShapePtr;
151
152 #endif