Salome HOME
093779c7b2fc5b5142d9c53b7904f3ec8dc006ca
[modules/shaper.git] / src / GeomAPI / GeomAPI_Shape.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Shape.hxx
4 // Created:     23 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomAPI_Shape_H_
8 #define GeomAPI_Shape_H_
9
10 #include <GeomAPI_Interface.h>
11 #include <memory>
12 #include <list>
13
14 /**\class GeomAPI_Shape
15  * \ingroup DataModel
16  * \brief Interface to the topological shape object
17  */
18 class GeomAPI_Shape : public GeomAPI_Interface
19 {
20 public:
21   /// Shape type enum
22   enum ShapeType {
23     COMPOUND, COMPSOLID, SOLID, SHELL,
24     FACE, WIRE, EDGE, VERTEX,
25     SHAPE
26   };
27
28   /// Shape orientation
29   enum Orientation {
30     FORWARD,
31     REVERSED,
32     INTERNAL,
33     EXTERNAL
34   };
35
36  public:
37   /// Creation of empty (null) shape
38   GEOMAPI_EXPORT
39   GeomAPI_Shape();
40
41   /// \return a new Shape with the same Orientation and Location and a new TShape with the same
42   ///         geometry and no sub-shapes.
43   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> emptyCopied() const;
44
45   /// Returns true if the underlied shape is null
46   GEOMAPI_EXPORT
47   bool isNull() const;
48
49   /// Returns whether the shapes are equal
50   GEOMAPI_EXPORT
51   virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
52
53   /// Returns whether the shapes are same
54   GEOMAPI_EXPORT
55   virtual bool isSame(const std::shared_ptr<GeomAPI_Shape> theShape) const;
56
57   /// Returns whether the shape is a vertex
58   GEOMAPI_EXPORT
59   virtual bool isVertex() const;
60
61   /// Returns whether the shape is an edge
62   GEOMAPI_EXPORT
63   virtual bool isEdge() const;
64
65   /// Returns whether the shape is a face
66   GEOMAPI_EXPORT
67   virtual bool isFace() const;
68
69   /// Returns whether the shape is a compound
70   GEOMAPI_EXPORT
71   virtual bool isCompound() const;
72
73   /// Returns whether the shape is a compound of solids
74   GEOMAPI_EXPORT
75   virtual bool isCompoundOfSolids() const;
76
77   /// Returns whether the shape is a compound where all elements are topologically connected
78   GEOMAPI_EXPORT
79   virtual bool isConnectedTopology() const;
80
81   /// Returns whether the shape is a solid
82   GEOMAPI_EXPORT
83   virtual bool isSolid() const;
84
85   /// Returns whether the shape is a compsolid
86   GEOMAPI_EXPORT
87   virtual bool isCompSolid() const;
88
89   /// Returns whether the shape is planar
90   GEOMAPI_EXPORT
91   virtual bool isPlanar() const;
92
93   /// Returns the shape type
94   GEOMAPI_EXPORT
95   virtual ShapeType shapeType() const;
96
97   /// Returns the type enumeration by the string-type
98   GEOMAPI_EXPORT static ShapeType shapeTypeByStr(std::string theType);
99
100   /// \return the shape type as string.
101   GEOMAPI_EXPORT
102   virtual std::string shapeTypeStr() const;
103
104   /// \return the shape orientation.
105   GEOMAPI_EXPORT virtual Orientation orientation() const;
106
107   /// Sets the shape orientation.
108   GEOMAPI_EXPORT virtual void setOrientation(const Orientation theOrientation);
109
110   /// \return true if passed shape is a sub-shape of this shape.
111   /// \param theShape shape to search.
112   GEOMAPI_EXPORT virtual bool isSubShape(const std::shared_ptr<GeomAPI_Shape> theShape) const;
113
114   /// Computes boundary dimensions of the shape
115   /// Returns False if it is not possible
116   GEOMAPI_EXPORT
117   bool computeSize(double& theXmin, double& theYmin, double& theZmin,
118                    double& theXmax, double& theYmax, double& theZmax) const;
119
120   /// Returns the shape as BRep stream
121   GEOMAPI_EXPORT
122   std::string getShapeStream() const;
123 };
124
125 //! Pointer on list of shapes
126 typedef std::list<std::shared_ptr<GeomAPI_Shape> > ListOfShape;
127
128 //! Pointer on attribute object
129 typedef std::shared_ptr<GeomAPI_Shape> GeomShapePtr;
130
131 #endif