Salome HOME
Replace void* with shared_ptr<void> in GeomAPI_Interface
[modules/shaper.git] / src / GeomAPI / GeomAPI_Shape.cpp
index 78d5105ee98e9e55bd110eba04b3445c85033c0c..41f1278608c1656de5fac1923b387e989653f260 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <sstream>
 
-#define MY_SHAPE static_cast<TopoDS_Shape*>(myImpl)
+#define MY_SHAPE implPtr<TopoDS_Shape>()
 
 GeomAPI_Shape::GeomAPI_Shape()
     : GeomAPI_Interface(new TopoDS_Shape())
@@ -46,13 +46,25 @@ bool GeomAPI_Shape::isVertex() const
 bool GeomAPI_Shape::isEdge() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
-  return aShape.ShapeType() == TopAbs_EDGE;
+  return !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE;
 }
 
 bool GeomAPI_Shape::isFace() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
-  return aShape.ShapeType() == TopAbs_FACE;
+  return !aShape.IsNull() && aShape.ShapeType() == TopAbs_FACE;
+}
+
+bool GeomAPI_Shape::isCompound() const
+{
+  const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+  return !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND;
+}
+
+bool GeomAPI_Shape::isSolid() const
+{
+  const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+  return !aShape.IsNull() && aShape.ShapeType() == TopAbs_SOLID;
 }
 
 bool GeomAPI_Shape::computeSize(double& theXmin, double& theYmin, double& theZmin,