//
#include "PartSet_SketcherReentrantMgr.h"
+#include "PartSet_ExternalObjectsMgr.h"
#include "PartSet_Module.h"
#include "PartSet_SketcherMgr.h"
#include "PartSet_WidgetPoint2d.h"
#include "GeomDataAPI_Point2D.h"
#include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_ISelectionActivate.h>
#include <ModuleBase_OperationFeature.h>
#include <ModuleBase_ModelWidget.h>
#include <ModuleBase_ViewerPrs.h>
#include <ModuleBase_OperationDescription.h>
#include "ModuleBase_ToolBox.h"
#include "ModuleBase_ISelection.h"
+#include "ModuleBase_ISelectionActivate.h"
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Line.h>
myClickedSketchPoint = PartSet_Tools::getPnt2d(theEvent, theWindow,
module()->sketchMgr()->activeSketch());
+ FeaturePtr anExternalCreatedFeature;
if (!aPreSelected.empty()) {
ModuleBase_ViewerPrsPtr aValue = aPreSelected.first();
module()->getGeomSelection(aValue, mySelectedObject, mySelectedAttribute);
if (aPointWidget) {
GeomShapePtr aShape;
aPointWidget->getGeomSelection_(aValue, mySelectedObject, aShape);
+ ObjectPtr anExternalObject =
+ aPointWidget->getExternalObjectMgr()->getExternalObjectValidated();
+ // if external object is during reentrant operation and is used as a parameter of feature
+ // it should be removed after the operation is restarted. (Circle feature, Projection)
+ if (anExternalObject.get())
+ anExternalCreatedFeature = ModelAPI_Feature::feature(anExternalObject);
}
}
restartOperation();
+ // remove created external feature
+ if (anExternalCreatedFeature.get()) {
+ QObjectPtrList anObjects;
+ anObjects.append(anExternalCreatedFeature);
+ workshop()->deleteFeatures(anObjects);
+ }
+
myClickedSketchPoint = std::shared_ptr<GeomAPI_Pnt2d>();
mySelectedObject = ObjectPtr();
mySelectedAttribute = AttributePtr();
aReentrantMessage->setClickedPoint(myClickedSketchPoint);
}
-void PartSet_SketcherReentrantMgr::onWidgetActivated()
-{
- if (!isActiveMgr())
- return;
- if (!myIsInternalEditOperation)
- return;
-
- PartSet_Module* aModule = module();
- ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget();
- ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel();
- if (aFirstWidget != aPanel->activeWidget()) {
- ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(aFirstWidget);
- if (aWSelector)
- aWSelector->activateSelectionAndFilters(true);
- }
-}
+//void PartSet_SketcherReentrantMgr::onWidgetActivated()
+//{
+// if (!isActiveMgr())
+// return;
+// if (!myIsInternalEditOperation)
+// return;
+//
+// PartSet_Module* aModule = module();
+// ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget();
+// ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel();
+// if (aFirstWidget != aPanel->activeWidget()) {
+// ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>
+// (aFirstWidget);
+// if (aWSelector) {
+// myWorkshop->selectionActivate()->updateSelectionModesAndFilters(aWSelector);
+// }
+// }
+//}
void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID)
{
return;
if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
- bool isStarted = false;
- if (!module()->sketchMgr()->sketchSolverError()) {
- if (myRestartingMode != RM_Forbided) {
- myRestartingMode = RM_LastFeatureUsed;
- isStarted = startInternalEdit(thePreviousAttributeID);
+ if (aFOperation->isNeedToBeAborted()) {
+ aFOperation->abort();
+ }
+ else {
+ bool isStarted = false;
+ if (!module()->sketchMgr()->sketchSolverError()) {
+ if (myRestartingMode != RM_Forbided) {
+ myRestartingMode = RM_LastFeatureUsed;
+ isStarted = startInternalEdit(thePreviousAttributeID);
+ }
}
+ if (!isStarted)
+ aFOperation->commit();
}
- if (!isStarted)
- aFOperation->commit();
}
}
(myWorkshop->currentOperation());
if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
+ /// improvement to deselect automatically all eventual selected objects, when
+ // returning to the neutral point of the Sketcher or start internal edit
+ workshop()->selector()->clearSelection();
+
aFOperation->setEditOperation(true/*, false*/);
createInternalFeature();
connect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped()));
// activate selection filters of the first widget in the viewer
- onWidgetActivated();
+ //onWidgetActivated();
// activate the last active widget in the Property Panel
if (!thePreviousAttributeID.empty()) {
std::cout << "PartSet_SketcherReentrantMgr::deleteInternalFeature: "
<< myInternalFeature->data()->name() << std::endl;
#endif
- if (myInternalActiveWidget) {
- ModuleBase_WidgetSelector* aWSelector =
- dynamic_cast<ModuleBase_WidgetSelector*>(myInternalActiveWidget);
- if (aWSelector)
- aWSelector->activateSelectionAndFilters(false);
+ if (myInternalActiveWidget)
myInternalActiveWidget = 0;
- }
delete myInternalWidget;
myInternalWidget = 0;