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