X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_SketcherMgr.cpp;h=207aee541f8eab4098baa9d5352f13d168db45f3;hb=c55b14977783111c8b418b416c7f6c2fa545c5e5;hp=e404a2f4126c6cd75a3b800fa8dc73c6969e85fd;hpb=9b1c9735e67e7ca2aa7bf76bcdbcd86635da3b5f;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index e404a2f41..207aee541 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -57,11 +57,13 @@ #include #include +#include + #include #include //#include -//#include +#include #include #include @@ -69,6 +71,7 @@ #include #include +//#define DEBUG_DO_NOT_BY_ENTER /// Returns list of unique objects by sum of objects from List1 and List2 /*QList getSumList(const QList& theList1, @@ -164,8 +167,11 @@ void PartSet_SketcherMgr::onEnterViewPort() myIsMouseOverWindow = true; myIsPropertyPanelValueChanged = false; - if (!isNestedCreateOperation(getCurrentOperation())) - return; + #ifdef DEBUG_DO_NOT_BY_ENTER + return; + #endif + //if (!isNestedCreateOperation(getCurrentOperation())) + // return; } void PartSet_SketcherMgr::onLeaveViewPort() @@ -174,6 +180,10 @@ void PartSet_SketcherMgr::onLeaveViewPort() myIsMouseOverWindow = false; myIsPropertyPanelValueChanged = false; + #ifdef DEBUG_DO_NOT_BY_ENTER + return; + #endif + if (!isNestedCreateOperation(getCurrentOperation())) return; // the method should be performed if the popup menu is called, @@ -552,18 +562,9 @@ void PartSet_SketcherMgr::get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent void PartSet_SketcherMgr::launchEditing() { - // there should be activate the vertex selection mode because the edit can happens by the selected - // point - QIntList aModes; - aModes << TopAbs_VERTEX << TopAbs_EDGE; - // TODO: #391 - to be uncommented - /*aModes.append(AIS_DSM_Text); - aModes.append(AIS_DSM_Line); - aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX)); - aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));*/ - - XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); - aConnector->activateSubShapesSelection(aModes); + // there should be activate the sketch selection mode because the edit can happens + // by any sketch entity or consttant selected + activateObjectsInSketchMode(true); if (!myCurrentSelection.empty()) { FeaturePtr aFeature = myCurrentSelection.begin().key(); @@ -699,6 +700,10 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) { myIsMouseOverWindow = false; + myIsConstraintsShown = true; + // the objects activated in the sketch should be deactivated in order to do not have the specific + // sketch selection mode activated on objects in neutral point of the application(no started operation) + activateObjectsInSketchMode(false); XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); @@ -742,8 +747,12 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) aDisplayer->updateViewer(); } -void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* ) +void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation) { + if (constraintsIdList().contains(theOperation->id())) { + // Show constraints if a constraint was created + onShowConstraintsToggle(true); + } connectToPropertyPanel(true); } @@ -752,6 +761,10 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp) connectToPropertyPanel(false); myIsPropertyPanelValueChanged = false; myIsMouseOverViewProcessed = true; + + // the sketch objects selection should be activated in order to select any sketch + // object + activateObjectsInSketchMode(true); } void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation) @@ -759,10 +772,6 @@ void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation) if (isNestedCreateOperation(theOperation)) visualizeFeature(theOperation, true); - if (constraintsIdList().contains(theOperation->id())) { - // Show constraints if a constraint was created - onShowConstraintsToggle(true); - } } bool PartSet_SketcherMgr::canUndo() const @@ -789,7 +798,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const aCanDisplay = false; } else { // there are no an active sketch - // 2. sketch sub-features should not visualized if the sketch operatio is not active + // 2. sketch sub-features should not visualized if the sketch operation is not active FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get() != NULL) { std::shared_ptr aSketchFeature = @@ -805,6 +814,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const // a. the property panel values modification // b. the popup menu activated // c. widget editor control + #ifndef DEBUG_DO_NOT_BY_ENTER if (aCanDisplay && isNestedCreateOperation(getCurrentOperation())) { ModuleBase_Operation* aOperation = getCurrentOperation(); ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); @@ -818,6 +828,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow; } } + #endif return aCanDisplay; } @@ -825,6 +836,11 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr& thePln) { myPlaneFilter->setPlane(thePln->impl()); + + // after the plane is selected in the sketch, the sketch selection should be activated + // it can not be performed in the sketch label widget because, we don't need to switch off + // the selection by any label deactivation, but need to switch it off by stop the sketch + activateObjectsInSketchMode(true); } void PartSet_SketcherMgr::getCurrentSelection(const FeaturePtr& theFeature, @@ -985,6 +1001,10 @@ ModuleBase_Operation* PartSet_SketcherMgr::getCurrentOperation() const void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation, const bool isToDisplay) { + #ifdef DEBUG_DO_NOT_BY_ENTER + return; + #endif + if (!theOperation || theOperation->isEditOperation()) return; @@ -1014,6 +1034,23 @@ void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation, aDisplayer->updateViewer(); } +void PartSet_SketcherMgr::activateObjectsInSketchMode(const bool isActive) +{ + ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); + XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); + XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + + QIntList aModes; + if (isActive) { + aModes.append(SketcherPrs_Tools::Sel_Dimension_Text); + aModes.append(SketcherPrs_Tools::Sel_Dimension_Line); + aModes.append(SketcherPrs_Tools::Sel_Constraint); + aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX)); + aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE)); + } + aDisplayer->activateObjects(aModes); +} + void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly) { ModuleBase_IWorkshop* aWorkshop = myModule->workshop();