Salome HOME
f656eb2bea907a9237cd740a6c995f73510c04ce
[modules/shaper.git] / src / GeomAPI / GeomAPI_Shape.cpp
1 // File:        GeomAPI_Shape.cpp
2 // Created:     23 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include<GeomAPI_Shape.h>
6
7 #include <TopoDS_Shape.hxx>
8
9 #define MY_SHAPE static_cast<TopoDS_Shape*>(myImpl)
10
11 GeomAPI_Shape::GeomAPI_Shape()
12     : GeomAPI_Interface(new TopoDS_Shape())
13 {
14 }
15
16 bool GeomAPI_Shape::isNull() const
17 {
18   return MY_SHAPE->IsNull() == Standard_True;
19 }
20
21 bool GeomAPI_Shape::isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const
22 {
23   if (isNull())
24     return theShape->isNull();
25   if (theShape->isNull())
26     return false;
27
28   return MY_SHAPE->IsEqual(theShape->impl<TopoDS_Shape>()) == Standard_True;
29 }
30
31 bool GeomAPI_Shape::isVertex() const
32 {
33   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
34   return !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX;
35 }
36
37 bool GeomAPI_Shape::isEdge() const
38 {
39   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
40   return aShape.ShapeType() == TopAbs_EDGE;
41 }
42
43 bool GeomAPI_Shape::isFace() const
44 {
45   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
46   return aShape.ShapeType() == TopAbs_FACE;
47 }