Salome HOME
[PythonAPI / sketcher] end of fix after merge od Dev_1.5.0
[modules/shaper.git] / src / PythonAPI / model / sketcher / point.py
index 5ba47e784330a1a633eb84bf647a4ebdf09dcc1c..603a6234adde92835d6f24bd6d5e0a827f3878ef 100644 (file)
@@ -1,16 +1,25 @@
 """Sketch point feature interface."""
 
 from GeomDataAPI import geomDataAPI_Point2D
+from model.roots import Interface
+from model.errors import FeatureInputInvalid
 
-class Point():
+class Point(Interface):
     """Interface on point feature for data manipulation."""
-    def __init__(self, point_feature, x, y):
-        self._point_feature = point_feature
+    def __init__(self, feature, x, y):
+        Interface.__init__(self, feature)
+        assert(self._feature.getKind() == "SketchPoint")
+        
+        # Initialize attributes of the feature
         self._point_data = geomDataAPI_Point2D(
-            self._point_feature.data().attribute("PointCoordinates")
+            self._feature.data().attribute("PointCoordinates")
             )
+        self.setValue(x, y)
+        self.execute()
+
+    def setValue(self, x, y):
+        """Set point coordinates."""
         self._point_data.setValue(x, y)
-        self._point_feature.execute()
 
     def pointData (self):
         """Return the point data."""