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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef GeomAPI_Shape_H_
22 #define GeomAPI_Shape_H_
24 #include <GeomAPI_Interface.h>
28 /**\class GeomAPI_Shape
30 * \brief Interface to the topological shape object
32 class GeomAPI_Shape : public GeomAPI_Interface
37 COMPOUND, COMPSOLID, SOLID, SHELL,
38 FACE, WIRE, EDGE, VERTEX,
51 /// Creation of empty (null) shape
55 /// \return a new Shape with the same Orientation and Location and a new TShape with the same
56 /// geometry and no sub-shapes.
57 GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> emptyCopied() const;
59 /// Returns true if the underlied shape is null
63 /// Returns whether the shapes are equal
65 virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
67 /// Returns whether the shapes are same
69 virtual bool isSame(const std::shared_ptr<GeomAPI_Shape> theShape) const;
71 /// Returns whether the shape is a vertex
73 virtual bool isVertex() const;
75 /// Returns whether the shape is an edge
77 virtual bool isEdge() const;
79 /// Returns whether the shape is a face
81 virtual bool isFace() const;
83 /// Returns whether the shape is a compound
85 virtual bool isCompound() const;
87 /// Returns whether the shape is a compound of solids
89 virtual bool isCompoundOfSolids() const;
91 /// Returns whether the shape is a compound where all elements are topologically connected
93 virtual bool isConnectedTopology() const;
95 /// Returns whether the shape is a solid
97 virtual bool isSolid() const;
99 /// Returns whether the shape is a compsolid
101 virtual bool isCompSolid() const;
103 /// Returns whether the shape is planar
105 virtual bool isPlanar() const;
107 /// Returns the shape type
109 virtual ShapeType shapeType() const;
111 /// Returns the type enumeration by the string-type
112 GEOMAPI_EXPORT static ShapeType shapeTypeByStr(std::string theType);
114 /// \return the shape type as string.
116 virtual std::string shapeTypeStr() const;
118 /// \return the shape orientation.
119 GEOMAPI_EXPORT virtual Orientation orientation() const;
121 /// Sets the shape orientation.
122 GEOMAPI_EXPORT virtual void setOrientation(const Orientation theOrientation);
124 /// \return true if passed shape is a sub-shape of this shape.
125 /// \param theShape shape to search.
126 GEOMAPI_EXPORT virtual bool isSubShape(const std::shared_ptr<GeomAPI_Shape> theShape) const;
128 /// Computes boundary dimensions of the shape
129 /// Returns False if it is not possible
131 bool computeSize(double& theXmin, double& theYmin, double& theZmin,
132 double& theXmax, double& theYmax, double& theZmax) const;
134 /// Returns the shape as BRep stream
136 std::string getShapeStream() const;
138 /// Returns intersection of shapes
140 std::shared_ptr<GeomAPI_Shape> intersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
142 /// Returns true if min distance between shapes < tolerance.
144 bool isIntersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
147 //! Pointer on list of shapes
148 typedef std::list<std::shared_ptr<GeomAPI_Shape> > ListOfShape;
150 //! Pointer on attribute object
151 typedef std::shared_ptr<GeomAPI_Shape> GeomShapePtr;