Salome HOME
[PythonAPI] Use _fillAttribute() in some sketch functions
[modules/shaper.git] / src / GeomAPI / GeomAPI_AISObject.cpp
index 30879add3d8743dd85afcbcfbe43b979a5ef439d..198a1892631ded1ab512bfaaf282d6f7b9473160 100644 (file)
@@ -83,6 +83,22 @@ void GeomAPI_AISObject::createShape(std::shared_ptr<GeomAPI_Shape> theShape)
   }
 }
 
+std::shared_ptr<GeomAPI_Shape> GeomAPI_AISObject::getShape() const
+{
+  std::shared_ptr<GeomAPI_Shape> aResult;
+
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
+    if (aShapeAIS) {
+      std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape);
+      aResult->setImpl(new TopoDS_Shape(aShapeAIS->Shape()));
+      return aResult;
+    }
+  }
+  return std::shared_ptr<GeomAPI_Shape>();
+}
+
 void GeomAPI_AISObject::createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
                                        std::shared_ptr<GeomAPI_Pnt> theEndPoint,
                                        std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
@@ -141,6 +157,21 @@ void GeomAPI_AISObject::createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoin
   }
 }
 
+bool GeomAPI_AISObject::isEmptyDistanceGeometry()
+{
+  bool anEmpty = false;
+
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(AIS_LengthDimension) aDimAIS = Handle(AIS_LengthDimension)::DownCast(anAIS);
+    if (!aDimAIS.IsNull()) {
+      anEmpty = !aDimAIS->IsValid();
+    }
+  }
+
+  return anEmpty;
+}
+
 void GeomAPI_AISObject::createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
                                      std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
                                      double theRadius)