1 """Sketch point feature interface."""
3 from GeomDataAPI import geomDataAPI_Point2D
4 from model.roots import Interface
5 from model.errors import FeatureInputInvalid
7 class Point(Interface):
8 """Interface on point feature for data manipulation."""
9 def __init__(self, feature, x, y):
10 Interface.__init__(self, feature)
11 assert(self._feature.getKind() == "SketchPoint")
13 # Initialize attributes of the feature
14 self._point_data = geomDataAPI_Point2D(
15 self._feature.data().attribute("PointCoordinates")
17 self._point_data.setValue(x, y)
19 # Control input and execute
20 if self.areInputValid():
23 raise FeatureInputInvalid(
24 "cannot create the Sketch Point, the input is invalid"
28 """Return the point data."""
29 return self._point_data
32 """Return the feature result."""
33 return self._point_feature.firstResult()