PartSet_OperationEditLine::PartSet_OperationEditLine(const QString& theId,
QObject* theParent,
boost::shared_ptr<ModelAPI_Feature> theFeature)
-: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature)
+: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature), myIsBlockedSelection(false)
{
}
aFeature = theHighlighted.front().feature();
if (aFeature && aFeature == feature()) { // continue the feature edit
- blockSelection(true);
}
else {
+ XGUI_ViewerPrs aFeaturePrs = myFeatures.front();
commit();
emit featureConstructed(feature(), FM_Deactivation);
- if (aFeature) {
+
+ bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
+ if(aHasShift && !theHighlighted.empty()) {
+ std::list<XGUI_ViewerPrs> aSelected;
+ aSelected.push_back(aFeaturePrs);
+ aSelected.push_back(theHighlighted.front());
+ emit setSelection(aSelected);
+ }
+ else if (aFeature) {
emit launchOperation(PartSet_OperationEditLine::Type(), aFeature);
}
}
gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView);
+ blockSelection(true);
if (myCurPoint.myIsInitialized) {
double aCurX, aCurY;
PartSet_Tools::ConvertTo2D(myCurPoint.myPoint, sketch(), theView, aCurX, aCurY);
// do nothing in order to do not create a new feature
emit multiSelectionEnabled(false);
- blockSelection(true);
+ if (myFeatures.size() > 1)
+ blockSelection(true);
myCurPoint.clear();
}
void PartSet_OperationEditLine::blockSelection(bool isBlocked, const bool isRestoreSelection)
{
+ if (myIsBlockedSelection == isBlocked)
+ return;
+
+ myIsBlockedSelection = isBlocked;
if (isBlocked) {
emit setSelection(std::list<XGUI_ViewerPrs>());
emit stopSelection(myFeatures, true);
}
void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
- const std::list<XGUI_ViewerPrs>& /*theSelected*/,
+ const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted)
{
if (!hasSketchPlane()) {
}
}
else {
+ // if shift button is pressed and there are some already selected objects, the operation should
+ // not be started. We just want to combine some selected objects.
+ bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
+ if (aHasShift && theSelected.size() > 0)
+ return;
+
if (theHighlighted.size() == 1) {
boost::shared_ptr<ModelAPI_Feature> aFeature = theHighlighted.front().feature();
if (aFeature)