break;
case SM_SecondPoint: {
setLinePoint(feature(), aX, anY, LINE_ATTR_END);
- commit();
- emit featureConstructed(feature(), FM_Deactivation);
- emit launchOperation(PartSet_OperationSketchLine::Type(), feature());
+ myPointSelectionMode = SM_DonePoint;
}
break;
default:
{
switch (myPointSelectionMode)
{
+ case SM_FirstPoint: {
+ double aX, anY;
+ gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView);
+ PartSet_Tools::ConvertTo2D(aPoint, sketch(), theView, aX, anY);
+ setLinePoint(feature(), aX, anY, LINE_ATTR_START);
+ setLinePoint(feature(), aX, anY, LINE_ATTR_END);
+ }
+ break;
case SM_SecondPoint:
{
gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView);
setLinePoint(aPoint, theView, LINE_ATTR_END);
}
break;
+ case SM_DonePoint:
+ {
+ commit();
+ emit featureConstructed(feature(), FM_Deactivation);
+ emit launchOperation(PartSet_OperationSketchLine::Type(), feature());
+ }
default:
break;
}
{
switch (theKey) {
case Qt::Key_Return: {
- abort();
+ if (myPointSelectionMode == SM_DonePoint)
+ {
+ commit();
+ emit featureConstructed(feature(), FM_Deactivation);
+ }
+ else
+ abort();
emit launchOperation(PartSet_OperationSketchLine::Type(), boost::shared_ptr<ModelAPI_Feature>());
}
break;
protected:
///< Structure to lists the possible types of point selection modes
- enum PointSelectionMode {SM_FirstPoint, SM_SecondPoint};
+ enum PointSelectionMode {SM_FirstPoint, SM_SecondPoint, SM_DonePoint};
private:
boost::shared_ptr<ModelAPI_Feature> mySketch; ///< the sketch feature