+PartSet_SelectionMode PartSet_FeatureLinePrs::setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode)
+{
+ PartSet_SelectionMode aMode = theMode;
+ if (feature() && theFeature && theMode == SM_FirstPoint)
+ {
+ // use the last point of the previous feature as the first of the new one
+ boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ boost::shared_ptr<GeomDataAPI_Point2D> anInitPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
+ (aData->attribute(LINE_ATTR_END));
+ PartSet_Tools::setFeaturePoint(feature(), anInitPoint->x(), anInitPoint->y(), LINE_ATTR_START);
+ PartSet_Tools::setFeaturePoint(feature(), anInitPoint->x(), anInitPoint->y(), LINE_ATTR_END);
+
+ aData = feature()->data();
+ boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
+ (aData->attribute(LINE_ATTR_START));
+ PartSet_Tools::createConstraint(sketch(), anInitPoint, aPoint);
+ aMode = SM_SecondPoint;
+ }
+ return aMode;
+}
+