Salome HOME
Sketch line feature based on points attributes
[modules/shaper.git] / src / Model / Model_Data.cpp
index 87c7be8672fda2dfa7b0a6b7c95ad461598d2bbc..121cd1902ce3bb63b3c025fd1c78c52a2585162a 100644 (file)
@@ -5,6 +5,8 @@
 #include <Model_Data.h>
 #include <Model_AttributeDocRef.h>
 #include <Model_AttributeDouble.h>
+#include <GeomData_Point.h>
+#include <GeomData_Point2D.h>
 #include <TDataStd_Name.hxx>
 
 using namespace std;
@@ -39,6 +41,10 @@ void Model_Data::addAttribute(string theID, string theAttrType)
     anAttr = new Model_AttributeDocRef(anAttrLab);
   else if (theAttrType == ModelAPI_AttributeDouble::type())
     anAttr = new Model_AttributeDouble(anAttrLab);
+  else if (theAttrType == GeomData_Point::type())
+    anAttr = new GeomData_Point(anAttrLab);
+  else if (theAttrType == GeomData_Point2D::type())
+    anAttr = new GeomData_Point2D(anAttrLab);
 
   if (anAttr)
     myAttrs[theID] = boost::shared_ptr<ModelAPI_Attribute>(anAttr);
@@ -75,3 +81,11 @@ boost::shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const string theID)
   }
   return aRes;
 }
+
+boost::shared_ptr<ModelAPI_Attribute> Model_Data::attribute(const std::string theID)
+{
+  boost::shared_ptr<ModelAPI_Attribute> aResult;
+  if (myAttrs.find(theID) == myAttrs.end()) // no such attribute
+    return aResult;
+  return myAttrs[theID];
+}