1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
20 #ifndef GeomAPI_Shape_H_
21 #define GeomAPI_Shape_H_
23 #include <GeomAPI_Interface.h>
27 /**\class GeomAPI_Shape
29 * \brief Interface to the topological shape object
31 class GeomAPI_Shape : public GeomAPI_Interface
36 COMPOUND, COMPSOLID, SOLID, SHELL,
37 FACE, WIRE, EDGE, VERTEX,
50 /// Creation of empty (null) shape
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;
58 /// Returns true if the underlied shape is null
62 /// Returns whether the shapes are equal
64 virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
66 /// Returns whether the shapes are same
68 virtual bool isSame(const std::shared_ptr<GeomAPI_Shape> theShape) const;
70 /// Returns whether the shape is a vertex
72 virtual bool isVertex() const;
74 /// Returns whether the shape is an edge
76 virtual bool isEdge() const;
78 /// Returns whether the shape is a face
80 virtual bool isFace() const;
82 /// Returns whether the shape is a compound
84 virtual bool isCompound() const;
86 /// Returns whether the shape is a compound of solids
88 virtual bool isCompoundOfSolids() const;
90 /// Returns whether the shape is a compound where all elements are topologically connected
92 virtual bool isConnectedTopology() const;
94 /// Returns whether the shape is a solid
96 virtual bool isSolid() const;
98 /// Returns whether the shape is a compsolid
100 virtual bool isCompSolid() const;
102 /// Returns whether the shape is planar
104 virtual bool isPlanar() const;
106 /// Returns the shape type
108 virtual ShapeType shapeType() const;
110 /// Returns the type enumeration by the string-type
111 GEOMAPI_EXPORT static ShapeType shapeTypeByStr(std::string theType);
113 /// \return the shape type as string.
115 virtual std::string shapeTypeStr() const;
117 /// \return the shape orientation.
118 GEOMAPI_EXPORT virtual Orientation orientation() const;
120 /// Sets the shape orientation.
121 GEOMAPI_EXPORT virtual void setOrientation(const Orientation theOrientation);
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;
127 /// Computes boundary dimensions of the shape
128 /// Returns False if it is not possible
130 bool computeSize(double& theXmin, double& theYmin, double& theZmin,
131 double& theXmax, double& theYmax, double& theZmax) const;
133 /// Returns the shape as BRep stream
135 std::string getShapeStream() const;
137 /// Returns intersection of shapes
139 std::shared_ptr<GeomAPI_Shape> intersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
141 /// Returns true if min distance between shapes < tolerance.
143 bool isIntersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
146 //! Pointer on list of shapes
147 typedef std::list<std::shared_ptr<GeomAPI_Shape> > ListOfShape;
149 //! Pointer on attribute object
150 typedef std::shared_ptr<GeomAPI_Shape> GeomShapePtr;