Salome HOME
Merge branch 'csgroup_IS2'
[modules/shaper.git] / src / GeomDataAPI / GeomDataAPI_Point2D.cpp
index dd8b39ec5d5c6bae09e425d7ad6dba8a783f7aef..747be09f924b4f000d336f7a6834c23d57388299 100644 (file)
@@ -1,11 +1,24 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        GeomDataAPI_Point2D.cpp
-// Created:     24 Apr 2014
-// Author:      Mikhail PONIKAROV
-
+// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #include <GeomDataAPI_Point2D.h>
+#include <ModelAPI_AttributeRefAttr.h>
 
 void GeomDataAPI_Point2D::move(const double theDeltaX, const double theDeltaY)
 {
@@ -17,6 +30,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()
 {
 }