Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Line.cpp
index 429f7e132cf55ae41fcd7a55d8ba8f85af136eb4..555b8ae7f4e18e85e3d490e5537bd7a6fd2c899e 100644 (file)
@@ -9,6 +9,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Session.h>
 
 using namespace std;
 
 SketchPlugin_Line::SketchPlugin_Line()
-    : SketchPlugin_Feature()
+    : SketchPlugin_SketchEntity()
 {}
 
 void SketchPlugin_Line::initAttributes()
 {
-  data()->addAttribute(START_ID(), GeomDataAPI_Point2D::type());
-  data()->addAttribute(END_ID(), GeomDataAPI_Point2D::type());
-  data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::type());
+  SketchPlugin_SketchEntity::initAttributes();
+
+  data()->addAttribute(START_ID(), GeomDataAPI_Point2D::typeId());
+  data()->addAttribute(END_ID(), GeomDataAPI_Point2D::typeId());
+  data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID());
 }
 
@@ -97,8 +100,14 @@ double SketchPlugin_Line::distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>&
   return aDelta;
 }
 
+const std::string& SketchPlugin_Line::getKind()
+{
+  static std::string MY_KIND = SketchPlugin_Line::ID();
+  return MY_KIND;
+}
+
 bool SketchPlugin_Line::isFixed() {
-  return data()->selection(EXTERNAL_ID())->context().get();
+  return data()->selection(EXTERNAL_ID())->context().get() != NULL;
 }
 
 void SketchPlugin_Line::attributeChanged(const std::string& theID) {