Salome HOME
Added a selection attribute and naming basic mechanisms
[modules/shaper.git] / src / GeomAPI / GeomAPI_Shape.cpp
index 10bd21df9d82f6bc9d409b4204c819cbc2664af5..0e5bcb010afce528fa68654ab66f867f918af232 100644 (file)
@@ -6,26 +6,36 @@
 
 #include <TopoDS_Shape.hxx>
 
-#define MY_PNT static_cast<gp_Pnt*>(myImpl)
+#define MY_SHAPE static_cast<TopoDS_Shape*>(myImpl)
 
 GeomAPI_Shape::GeomAPI_Shape()
-    : GeomAPI_Interface(new TopoDS_Shape()) {
+    : GeomAPI_Interface(new TopoDS_Shape())
+{
 }
 
-bool GeomAPI_Shape::isNull()
+bool GeomAPI_Shape::isNull() const
 {
-  return MY_SHAPE->IsNull();
+  return MY_SHAPE->IsNull() == Standard_True;
 }
 
+bool GeomAPI_Shape::isEqual(const boost::shared_ptr<GeomAPI_Shape> theShape) const
+{
+  if (isNull())
+    return theShape->isNull();
+  if (theShape->isNull())
+    return false;
+
+  return MY_SHAPE->IsEqual(theShape->impl<TopoDS_Shape>()) == Standard_True;
+}
 
 bool GeomAPI_Shape::isVertex() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
-  return aShape.TShape()->ShapeType() == TopAbs_VERTEX;
+  return !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX;
 }
 
 bool GeomAPI_Shape::isEdge() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
-  return aShape.TShape()->ShapeType() == TopAbs_EDGE;
+  return aShape.ShapeType() == TopAbs_EDGE;
 }