Salome HOME
2D points selection in multi-translation/rotation : multi-translation: using ModelAPI...
[modules/shaper.git] / src / GeomDataAPI / GeomDataAPI_Point2D.cpp
index dd8b39ec5d5c6bae09e425d7ad6dba8a783f7aef..3a72ceaccd3d53910a260a9b58712746aaf62d31 100644 (file)
@@ -6,6 +6,7 @@
 
 
 #include <GeomDataAPI_Point2D.h>
+#include <ModelAPI_AttributeRefAttr.h>
 
 void GeomDataAPI_Point2D::move(const double theDeltaX, const double theDeltaY)
 {
@@ -17,6 +18,22 @@ std::string GeomDataAPI_Point2D::attributeType()
   return typeId();
 }
 
+std::shared_ptr<GeomDataAPI_Point2D> GeomDataAPI_Point2D::getPoint2D(
+                                  const DataPtr& theData, const std::string& theAttribute)
+{
+  std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
+  if (!theData)
+    return aPointAttr;
+
+  std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
+                                 ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
+  if (anAttr && anAttr->attr()) {
+    aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
+  }
+  return aPointAttr;
+}
+
+
 GeomDataAPI_Point2D::GeomDataAPI_Point2D()
 {
 }