1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_Shape.cpp
4 // Created: 23 Apr 2014
5 // Author: Mikhail PONIKAROV
7 #include<GeomAPI_Shape.h>
9 #include <TopoDS_Shape.hxx>
10 #include <BRepBndLib.hxx>
11 #include <Bnd_Box.hxx>
13 #define MY_SHAPE static_cast<TopoDS_Shape*>(myImpl)
15 GeomAPI_Shape::GeomAPI_Shape()
16 : GeomAPI_Interface(new TopoDS_Shape())
20 bool GeomAPI_Shape::isNull() const
22 return MY_SHAPE->IsNull() == Standard_True;
25 bool GeomAPI_Shape::isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const
28 return theShape->isNull();
29 if (theShape->isNull())
32 return MY_SHAPE->IsEqual(theShape->impl<TopoDS_Shape>()) == Standard_True;
35 bool GeomAPI_Shape::isVertex() const
37 const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
38 return !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX;
41 bool GeomAPI_Shape::isEdge() const
43 const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
44 return aShape.ShapeType() == TopAbs_EDGE;
47 bool GeomAPI_Shape::isFace() const
49 const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
50 return aShape.ShapeType() == TopAbs_FACE;
53 bool GeomAPI_Shape::computeSize(double& theXmin, double& theYmin, double& theZmin,
54 double& theXmax, double& theYmax, double& theZmax) const
56 const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
60 BRepBndLib::Add(aShape, aBndBox);
61 aBndBox.Get(theXmin, theYmin, theZmin, theXmax, theYmax, theZmax);