1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #include "PartSet_Module.h"
4 #include "PartSet_WidgetSketchLabel.h"
5 #include "PartSet_Validators.h"
6 #include "PartSet_Tools.h"
7 #include "PartSet_WidgetPoint2d.h"
8 #include "PartSet_WidgetPoint2dDistance.h"
9 #include "PartSet_WidgetPoint2DFlyout.h"
10 #include "PartSet_WidgetShapeSelector.h"
11 #include "PartSet_WidgetPoint2dAngle.h"
12 #include "PartSet_WidgetMultiSelector.h"
13 #include "PartSet_WidgetEditor.h"
14 #include "PartSet_WidgetFileSelector.h"
15 #include "PartSet_WidgetSketchCreator.h"
16 #include "PartSet_SketcherMgr.h"
17 #include "PartSet_MenuMgr.h"
18 #include "PartSet_CustomPrs.h"
19 #include "PartSet_IconFactory.h"
21 #include "PartSet_Filters.h"
22 #include "PartSet_FilterInfinite.h"
24 #include <PartSetPlugin_Remove.h>
25 #include <PartSetPlugin_Part.h>
26 #include <PartSetPlugin_Duplicate.h>
28 #include <ModuleBase_Operation.h>
29 #include <ModuleBase_OperationAction.h>
30 #include <ModuleBase_IViewer.h>
31 #include <ModuleBase_IViewWindow.h>
32 #include <ModuleBase_IPropertyPanel.h>
33 #include <ModuleBase_WidgetEditor.h>
34 #include <ModuleBase_WidgetValidated.h>
35 #include <ModuleBase_FilterFactory.h>
36 #include <ModuleBase_Tools.h>
37 #include <ModuleBase_OperationFeature.h>
39 #include <GeomValidators_ShapeType.h>
40 #include <GeomValidators_Finite.h>
41 #include <GeomValidators_Face.h>
42 #include <GeomValidators_ConstructionComposite.h>
43 #include <GeomValidators_ZeroOffset.h>
44 #include <GeomValidators_BooleanArguments.h>
45 #include <GeomValidators_Different.h>
46 #include <GeomValidators_PartitionArguments.h>
49 #include <ModelAPI_Object.h>
50 #include <ModelAPI_Events.h>
51 #include <ModelAPI_Validator.h>
52 #include <ModelAPI_Data.h>
53 #include <ModelAPI_Session.h>
54 #include <GeomValidators_DifferentShapes.h>
55 #include <ModelAPI_ResultBody.h>
56 #include <ModelAPI_AttributeString.h>
58 #include <GeomDataAPI_Point2D.h>
59 #include <GeomDataAPI_Point.h>
60 #include <GeomDataAPI_Dir.h>
62 #include <XGUI_Displayer.h>
63 #include <XGUI_Workshop.h>
64 #include <XGUI_OperationMgr.h>
65 #include <XGUI_PropertyPanel.h>
66 #include <XGUI_ModuleConnector.h>
67 #include <XGUI_ContextMenuMgr.h>
68 #include <XGUI_Tools.h>
69 #include <XGUI_ObjectsBrowser.h>
70 #include <XGUI_SelectionMgr.h>
71 #include <XGUI_DataModel.h>
72 #include <XGUI_ErrorMgr.h>
74 #include <SketchPlugin_Feature.h>
75 #include <SketchPlugin_Sketch.h>
76 #include <SketchPlugin_Line.h>
77 #include <SketchPlugin_Arc.h>
78 #include <SketchPlugin_Circle.h>
79 #include <SketchPlugin_Point.h>
80 #include <SketchPlugin_ConstraintAngle.h>
81 #include <SketchPlugin_ConstraintLength.h>
82 #include <SketchPlugin_ConstraintDistance.h>
83 #include <SketchPlugin_ConstraintParallel.h>
84 #include <SketchPlugin_ConstraintPerpendicular.h>
85 #include <SketchPlugin_ConstraintRadius.h>
87 #include <SketcherPrs_SymbolPrs.h>
88 #include <SketcherPrs_Tools.h>
90 #include <Events_Loop.h>
91 #include <Config_PropManager.h>
92 #include <Config_Keywords.h>
94 #include <StdSelect_TypeOfFace.hxx>
95 #include <TopoDS_Vertex.hxx>
97 #include <TopoDS_Shape.hxx>
98 #include <BRep_Tool.hxx>
99 #include <AIS_Dimension.hxx>
102 #include <QMouseEvent>
105 #include <QApplication>
106 #include <QMessageBox>
107 #include <QMainWindow>
110 #include <GeomAlgoAPI_FaceBuilder.h>
111 #include <GeomDataAPI_Dir.h>
113 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
119 /*!Create and return new instance of XGUI_Module*/
120 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
122 return new PartSet_Module(theWshop);
125 PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
126 : ModuleBase_IModule(theWshop),
127 myRestartingMode(RM_None), myVisualLayerId(0), myHasConstraintShown(true)
129 new PartSet_IconFactory();
131 mySketchMgr = new PartSet_SketcherMgr(this);
133 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
134 XGUI_Workshop* aWorkshop = aConnector->workshop();
136 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
137 connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased()));
138 connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
139 this, SLOT(onOperationActivatedByPreselection()));
141 ModuleBase_IViewer* aViewer = theWshop->viewer();
142 connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
143 this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
144 connect(aViewer, SIGNAL(viewTransformed(int)),
145 SLOT(onViewTransformed(int)));
146 connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)),
147 SLOT(onViewCreated(ModuleBase_IViewWindow*)));
149 myMenuMgr = new PartSet_MenuMgr(this);
150 myCustomPrs = new PartSet_CustomPrs(theWshop);
152 Events_Loop* aLoop = Events_Loop::loop();
153 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
155 mySelectionFilters.Append(new PartSet_GlobalFilter(myWorkshop));
156 mySelectionFilters.Append(new PartSet_FilterInfinite(myWorkshop));
159 PartSet_Module::~PartSet_Module()
161 SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
162 for (; aIt.More(); aIt.Next()) {
163 Handle(SelectMgr_Filter) aFilter = aIt.Value();
164 if (!aFilter.IsNull())
170 void PartSet_Module::activateSelectionFilters()
172 SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
173 for (; aIt.More(); aIt.Next()) {
174 Handle(SelectMgr_Filter) aFilter = aIt.Value();
175 if (!aFilter.IsNull())
176 myWorkshop->viewer()->addSelectionFilter(aFilter);
180 void PartSet_Module::deactivateSelectionFilters()
182 SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
183 for (; aIt.More(); aIt.Next()) {
184 Handle(SelectMgr_Filter) aFilter = aIt.Value();
185 if (!aFilter.IsNull())
186 myWorkshop->viewer()->removeSelectionFilter(aFilter);
190 void PartSet_Module::registerValidators()
192 //Registering of validators
193 SessionPtr aMgr = ModelAPI_Session::get();
194 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
195 aFactory->registerValidator("PartSet_DistanceSelection", new PartSet_DistanceSelection);
196 aFactory->registerValidator("PartSet_LengthSelection", new PartSet_LengthSelection);
197 aFactory->registerValidator("PartSet_PerpendicularSelection", new PartSet_PerpendicularSelection);
198 aFactory->registerValidator("PartSet_ParallelSelection", new PartSet_ParallelSelection);
199 aFactory->registerValidator("PartSet_RadiusSelection", new PartSet_RadiusSelection);
200 aFactory->registerValidator("PartSet_RigidSelection", new PartSet_RigidSelection);
201 aFactory->registerValidator("PartSet_CoincidentSelection", new PartSet_CoincidentSelection);
202 aFactory->registerValidator("PartSet_HVDirSelection", new PartSet_HVDirSelection);
203 aFactory->registerValidator("PartSet_TangentSelection", new PartSet_TangentSelection);
204 aFactory->registerValidator("PartSet_FilletSelection", new PartSet_FilletSelection);
205 aFactory->registerValidator("PartSet_AngleSelection", new PartSet_AngleSelection);
206 aFactory->registerValidator("PartSet_EqualSelection", new PartSet_EqualSelection);
207 aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
208 aFactory->registerValidator("PartSet_CoincidentAttr", new PartSet_CoincidentAttr);
210 aFactory->registerValidator("GeomValidators_DifferentShapes", new GeomValidators_DifferentShapes);
211 aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
212 aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
213 aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite);
215 aFactory->registerValidator("GeomValidators_ConstructionComposite",
216 new GeomValidators_ConstructionComposite);
218 aFactory->registerValidator("GeomValidators_ZeroOffset",
219 new GeomValidators_ZeroOffset);
221 aFactory->registerValidator("GeomValidators_BooleanArguments",
222 new GeomValidators_BooleanArguments);
224 aFactory->registerValidator("PartSet_SketchEntityValidator",
225 new PartSet_SketchEntityValidator);
227 aFactory->registerValidator("GeomValidators_Different",
228 new GeomValidators_Different);
230 aFactory->registerValidator("GeomValidators_PartitionArguments",
231 new GeomValidators_PartitionArguments);
234 void PartSet_Module::registerFilters()
236 //Registering of selection filters
237 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
238 ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
241 void PartSet_Module::registerProperties()
243 Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
245 Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness",
246 Config_Prop::Integer, SKETCH_WIDTH);
249 void PartSet_Module::onOperationCommitted(ModuleBase_Operation* theOperation)
251 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
252 mySketchMgr->commitNestedSketch(theOperation);
255 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
258 // the selection is cleared after commit the create operation
259 // in order to do not use the same selected objects in the restarted operation
260 // for common behaviour, the selection is cleared even if the operation is not restarted
261 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
262 XGUI_Workshop* aWorkshop = aConnector->workshop();
263 aWorkshop->selector()->clearSelection();
265 /// Restart sketcher operations automatically
266 FeaturePtr aFeature = aFOperation->feature();
267 std::shared_ptr<SketchPlugin_Feature> aSPFeature =
268 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
269 if (aSPFeature && (myRestartingMode == RM_LastFeatureUsed ||
270 myRestartingMode == RM_EmptyFeatureUsed)) {
271 myLastOperationId = aFOperation->id();
272 myLastFeature = myRestartingMode == RM_LastFeatureUsed ? aFOperation->feature() : FeaturePtr();
273 if (!sketchMgr()->sketchSolverError()) {
274 if (!aFOperation->isEditOperation()) {
275 FeaturePtr anOperationFeature = aFOperation->feature();
276 if (anOperationFeature.get() != NULL) {
277 editFeature(anOperationFeature);
278 // 4. activate the first obligatory widget
279 if (!myPreviousAttributeID.empty()) {
280 ModuleBase_Operation* anEditOperation = currentOperation();
281 if (anEditOperation) {
282 ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
283 ModuleBase_ModelWidget* aPreviousAttributeWidget = 0;
284 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
285 for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) {
286 if (aWidgets[i]->attributeID() == myPreviousAttributeID)
287 aPreviousAttributeWidget = aWidgets[i];
289 if (aPreviousAttributeWidget)
290 aPreviousAttributeWidget->focusTo();
296 launchOperation(myLastOperationId);
297 breakOperationSequence();
303 void PartSet_Module::breakOperationSequence()
305 myLastOperationId = "";
306 myLastFeature = FeaturePtr();
307 myRestartingMode = RM_None;
310 void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation)
312 breakOperationSequence();
315 void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
317 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
318 mySketchMgr->startSketch(theOperation);
320 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
321 mySketchMgr->startNestedSketch(theOperation);
324 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
326 myCustomPrs->activate(aFOperation->feature(), true);
329 void PartSet_Module::onOperationResumed(ModuleBase_Operation* theOperation)
331 ModuleBase_IModule::onOperationResumed(theOperation);
333 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
335 myCustomPrs->activate(aFOperation->feature(), true);
338 void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
340 bool isModified = myCustomPrs->deactivate(false);
342 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
343 mySketchMgr->stopSketch(theOperation);
345 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
346 mySketchMgr->stopNestedSketch(theOperation);
349 //VSV: Viewer is updated on feature update and redisplay
351 // XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
352 // XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
353 // aDisplayer->updateViewer();
355 mySketchMgr->onShowConstraintsToggle(myHasConstraintShown);
358 ModuleBase_Operation* PartSet_Module::currentOperation() const
360 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
361 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
362 return anOpMgr->currentOperation();
365 bool PartSet_Module::canUndo() const
367 bool aCanUndo = false;
368 SessionPtr aMgr = ModelAPI_Session::get();
369 if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
370 aCanUndo = !aMgr->isOperation();
371 if (!aCanUndo) // check the enable state additionally by sketch manager
372 aCanUndo = aMgr->canUndo();
377 bool PartSet_Module::canRedo() const
379 bool aCanRedo = false;
380 SessionPtr aMgr = ModelAPI_Session::get();
381 if (aMgr->hasModuleDocument() && aMgr->canRedo()) {
382 aCanRedo = !aMgr->isOperation();
383 if (!aCanRedo) // check the enable state additionally by sketch manager
384 aCanRedo = aMgr->canRedo();
389 bool PartSet_Module::canApplyAction(const ObjectPtr& theObject, const QString& theActionId) const
392 if (theActionId == "DELETE_CMD" || theActionId == "MOVE_CMD") {
393 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
395 // part features are removed in the PartSet module only.
396 if (aFeature->getKind() == PartSetPlugin_Part::ID())
403 bool PartSet_Module::canCommitOperation() const
405 return mySketchMgr->canCommitOperation();
408 bool PartSet_Module::canEraseObject(const ObjectPtr& theObject) const
410 // the sketch manager put the restriction to the objects erase
411 return mySketchMgr->canEraseObject(theObject);
414 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
416 // the sketch manager put the restriction to the objects display
417 return mySketchMgr->canDisplayObject(theObject);
420 bool PartSet_Module::canActivateSelection(const ObjectPtr& theObject) const
422 bool aCanActivate = ModuleBase_IModule::canActivateSelection(theObject);
424 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
425 bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
426 isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
427 if (isSketchOp || isNestedOp) {
428 // in active sketch operation it is possible to activate operation object in selection
429 // in the edit operation, e.g. points of the line can be moved when the line is edited
430 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
431 aCanActivate = aCanActivate || (aFOperation && aFOperation->isEditOperation());
436 bool PartSet_Module::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
438 return myMenuMgr->addViewerMenu(theMenu, theStdActions);
441 void PartSet_Module::updateViewerMenu(const QMap<QString, QAction*>& theStdActions)
443 myMenuMgr->updateViewerMenu(theStdActions);
446 QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature)
448 QString anError = ModuleBase_IModule::getFeatureError(theFeature);
450 if (anError.isEmpty())
451 anError = sketchMgr()->getFeatureError(theFeature);
453 if (anError.isEmpty()) {
454 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
455 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
457 if (anOpMgr->isValidationLocked()) {
458 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
459 (anOpMgr->currentOperation());
460 if (!aFOperation || theFeature == aFOperation->feature())
461 anError = "Validation is locked by the current operation";
467 void PartSet_Module::grantedOperationIds(ModuleBase_Operation* theOperation,
468 QStringList& theIds) const
470 myMenuMgr->grantedOperationIds(theOperation, theIds);
472 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
473 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
474 XGUI_Workshop* aWorkshop = aConnector->workshop();
476 theIds.append(aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text());
480 void PartSet_Module::activeSelectionModes(QIntList& theModes)
483 if (mySketchMgr->activeSketch().get())
484 PartSet_SketcherMgr::sketchSelectionModes(theModes);
487 bool PartSet_Module::isMouseOverWindow()
489 return mySketchMgr->isMouseOverWindow();
492 void PartSet_Module::closeDocument()
497 void PartSet_Module::clearViewer()
499 myCustomPrs->clearPrs();
501 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
502 XGUI_Workshop* aWorkshop = aConnector->workshop();
503 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
504 aDisplayer->deactivateSelectionFilters();
507 void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
509 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
513 ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
514 if (PartSet_SketcherMgr::isSketchOperation(aFOperation) && (aFOperation->isEditOperation())) {
515 // we have to manually activate the sketch label in edit mode
516 aPanel->activateWidget(aPanel->modelWidgets().first());
520 // Restart last operation type
521 if ((aFOperation->id() == myLastOperationId) && myLastFeature) {
522 ModuleBase_ModelWidget* aWgt = aPanel->activeWidget();
523 if (aFOperation->id().toStdString() == SketchPlugin_Line::ID()) {
524 // Initialise new line with first point equal to end of previous
525 PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
527 std::shared_ptr<ModelAPI_Data> aData = myLastFeature->data();
528 std::shared_ptr<GeomDataAPI_Point2D> aPoint =
529 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
531 aPnt2dWgt->setPoint(aPoint->x(), aPoint->y());
532 PartSet_Tools::setConstraints(mySketchMgr->activeSketch(), aFOperation->feature(),
533 aWgt->attributeID(), aPoint->x(), aPoint->y());
534 aPanel->activateNextWidget(aPnt2dWgt);
542 void PartSet_Module::onSelectionChanged()
544 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
548 bool isSketcherOp = false;
549 // An edit operation is enable only if the current opeation is the sketch operation
550 if (mySketchMgr->activeSketch()) {
551 if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch()))
552 isSketcherOp = PartSet_SketcherMgr::isSketchOperation(aOperation);
555 // Editing of constraints can be done on selection
556 ModuleBase_ISelection* aSelect = myWorkshop->selection();
557 QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
558 if (aSelected.size() == 1) {
559 ModuleBase_ViewerPrs aPrs = aSelected.first();
560 ObjectPtr aObject = aPrs.object();
561 FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
563 std::string aId = aFeature->getKind();
564 if ((aId == SketchPlugin_ConstraintRadius::ID()) ||
565 (aId == SketchPlugin_ConstraintLength::ID()) ||
566 (aId == SketchPlugin_ConstraintDistance::ID()) ||
567 (aId == SketchPlugin_ConstraintAngle::ID())) {
568 editFeature(aFeature);
575 void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent)
577 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
578 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
579 anOpMgr->onKeyReleased(theEvent);
582 void PartSet_Module::onEnterReleased()
584 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
585 (currentOperation());
586 if (!aFOperation->isEditOperation())
587 myRestartingMode = RM_EmptyFeatureUsed;
590 void PartSet_Module::onOperationActivatedByPreselection()
592 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
593 if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
594 // Set final definitions if they are necessary
595 //propertyPanelDefined(aOperation);
597 /// Commit sketcher operations automatically
598 anOperation->commit();
602 void PartSet_Module::onNoMoreWidgets(const std::string& thePreviousAttributeID)
604 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
606 if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
607 if (myRestartingMode != RM_Forbided) {
608 myRestartingMode = RM_LastFeatureUsed;
609 myPreviousAttributeID = thePreviousAttributeID;
611 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
612 XGUI_Workshop* aWorkshop = aConnector->workshop();
613 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
614 // do nothing if the feature can not be applyed
615 if (anOpMgr->isApplyEnabled())
616 anOperation->commit();
621 void PartSet_Module::onVertexSelected()
623 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
624 if (aOperation->id().toStdString() == SketchPlugin_Line::ID()) {
625 /// If last line finished on vertex the lines creation sequence has to be break
626 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
627 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
628 const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
629 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
630 bool aFoundWidget = false;
631 bool aFoundObligatory = false;
632 for (; anIt != aLast && !aFoundObligatory; anIt++) {
634 aFoundWidget = *anIt == anActiveWidget;
636 aFoundObligatory = (*anIt)->isObligatory();
638 if (!aFoundObligatory)
639 myRestartingMode = RM_Forbided;
643 ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
644 Config_WidgetAPI* theWidgetApi, std::string theParentId)
646 ModuleBase_IWorkshop* aWorkshop = workshop();
647 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
648 XGUI_Workshop* aXUIWorkshop = aConnector->workshop();
649 ModuleBase_ModelWidget* aWgt = NULL;
650 if (theType == "sketch-start-label") {
651 PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent, aWorkshop,
652 theWidgetApi, theParentId, mySketchMgr->isConstraintsShown());
653 connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr<GeomAPI_Pln>&)),
654 mySketchMgr, SLOT(onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>&)));
655 connect(aLabelWgt, SIGNAL(showConstraintToggled(bool)),
656 mySketchMgr, SLOT(onShowConstraintsToggle(bool)));
658 } else if (theType == "sketch-2dpoint_selector") {
659 PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, aWorkshop,
660 theWidgetApi, theParentId);
661 aPointWgt->setSketch(mySketchMgr->activeSketch());
662 connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
664 } else if (theType == "sketch-2dpoint_flyout_selector") {
665 PartSet_WidgetPoint2DFlyout* aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop,
666 theWidgetApi, theParentId);
667 aPointWgt->setSketch(mySketchMgr->activeSketch());
668 connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
670 } else if (theType == "point2ddistance") {
671 PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent,
672 aWorkshop, theWidgetApi, theParentId);
673 aDistanceWgt->setSketch(mySketchMgr->activeSketch());
675 } else if(theType == "point2dangle") {
676 PartSet_WidgetPoint2dAngle* anAngleWgt = new PartSet_WidgetPoint2dAngle(theParent,
677 aWorkshop, theWidgetApi, theParentId);
678 anAngleWgt->setSketch(mySketchMgr->activeSketch());
680 } else if (theType == "sketch_shape_selector") {
681 PartSet_WidgetShapeSelector* aShapeSelectorWgt =
682 new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi, theParentId);
683 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
684 aWgt = aShapeSelectorWgt;
685 } else if (theType == "sketch_multi_selector") {
686 PartSet_WidgetMultiSelector* aShapeSelectorWgt =
687 new PartSet_WidgetMultiSelector(theParent, aWorkshop, theWidgetApi, theParentId);
688 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
689 aWgt = aShapeSelectorWgt;
690 } else if (theType == WDG_DOUBLEVALUE_EDITOR) {
691 aWgt = new PartSet_WidgetEditor(theParent, aWorkshop, theWidgetApi, theParentId);
692 } else if (theType == "export_file_selector") {
693 aWgt = new PartSet_WidgetFileSelector(theParent, aWorkshop, theWidgetApi, theParentId);
694 } else if (theType == "sketch_launcher") {
695 aWgt = new PartSet_WidgetSketchCreator(theParent, this, theWidgetApi, theParentId);
701 bool PartSet_Module::deleteObjects()
703 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
704 XGUI_Workshop* aWorkshop = aConnector->workshop();
705 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
707 //SessionPtr aMgr = ModelAPI_Session::get();
708 // 1. check whether the delete should be processed in the module
709 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
710 bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
711 isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
712 if (isSketchOp || isNestedOp) {
713 // 2. find selected presentations
714 // selected objects should be collected before the current operation abort because
715 // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
716 ModuleBase_ISelection* aSel = workshop()->selection();
717 QObjectPtrList aSelectedObj = aSel->selectedPresentations();
718 // if there are no selected objects in the viewer, that means that the selection in another
719 // place cased this method. It is necessary to return the false value to understande in above
720 // method that delete is not processed
721 if (aSelectedObj.count() == 0)
724 // avoid delete of the objects, which are not belong to the current sketch
725 // in order to do not delete results of other sketches
726 QObjectPtrList aSketchObjects;
727 QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), aLast = aSelectedObj.end();
728 for ( ; anIt != aLast; anIt++) {
729 ObjectPtr anObject = *anIt;
730 if (mySketchMgr->isObjectOfSketch(anObject)) {
731 // sketch feature should be used in this list because workshop deletes features only
732 // results are skipped
733 FeaturePtr aSketchFeature = ModelAPI_Feature::feature(anObject);
734 aSketchObjects.append(aSketchFeature);
737 // if the selection contains only local selected presentations from other sketches,
738 // the Delete operation should not be done at all
739 if (aSketchObjects.size() == 0)
742 // 3. start operation
743 QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
744 ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, this);
746 // the active nested sketch operation should be aborted unconditionally
747 // the Delete action should be additionally granted for the Sketch operation
748 // in order to do not abort/commit it
749 if (!anOpMgr->canStartOperation(anOpAction->id()))
750 return true; // the objects are processed but can not be deleted
752 anOpMgr->startOperation(anOpAction);
754 // 4. delete features
755 // sketch feature should be skipped, only sub-features can be removed
756 // when sketch operation is active
757 aWorkshop->deleteFeatures(aSketchObjects);
759 anOpMgr->commitOperation();
762 bool isPartRemoved = false;
763 // Delete part with help of PartSet plugin
764 // TODO: the deleted objects has to be processed by multiselection
765 QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
766 if (aObjects.size() == 1) {
767 ObjectPtr aObj = aObjects.first();
768 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
769 if (aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID())) {
770 // Remove feature should be created in the document of the part results
771 ResultPtr aPartResult = aFeature->firstResult();
772 if (aPartResult.get()) {
773 std::shared_ptr<ModelAPI_ResultPart> aPart =
774 std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPartResult);
775 DocumentPtr aPartDoc = aPart->partDoc();
776 if (aPartDoc.get()) {
777 ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction
778 (PartSetPlugin_Remove::ID().c_str(), this);
779 if (!anOpMgr->canStartOperation(anOpAction->id()))
780 return true; // the objects are processed but can not be deleted
782 anOpMgr->startOperation(anOpAction);
784 FeaturePtr aFeature = aPartDoc->addFeature(PartSetPlugin_Remove::ID());
787 anOpMgr->commitOperation();
788 isPartRemoved = true;
793 return isPartRemoved;
798 void PartSet_Module::onFeatureTriggered()
800 QAction* aCmd = dynamic_cast<QAction*>(sender());
801 if (aCmd->isCheckable() && aCmd->isChecked()) {
802 // 1. check whether the delete should be processed in the module
803 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
804 bool isNestedOp = PartSet_SketcherMgr::isNestedCreateOperation(anOperation);
806 // in case if in the viewer nothing is displayed, the create operation should not be
807 // comitted even if all values of the feature are initialized
808 if (!mySketchMgr->canDisplayCurrentCreatedFeature()) {
809 // the action information should be saved before the operation is aborted
810 // because this abort leads to update command status, which unchecks this action
811 anOperation->abort();
812 launchOperation(aCmd->data().toString());
816 ModuleBase_IModule::onFeatureTriggered();
819 void PartSet_Module::launchOperation(const QString& theCmdId)
821 if (PartSet_SketcherMgr::constraintsIdList().contains(theCmdId)) {
822 // Show constraints if a constraint was anOperation
823 myHasConstraintShown = mySketchMgr->isConstraintsShown();
824 mySketchMgr->onShowConstraintsToggle(true);
826 ModuleBase_IModule::launchOperation(theCmdId);
830 void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
832 Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
833 if (!anAIS.IsNull()) {
834 Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
835 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
836 if (!aDim.IsNull()) {
837 aCtx->SetZLayer(aDim, myVisualLayerId);
839 Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
841 aCtx->SetZLayer(aCons, myVisualLayerId);
846 void PartSet_Module::onBeforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS)
849 // it should be recomputed in order to disappear in the viewer if the corresponded object
851 //if (myCustomPrs->isActive())
852 // myCustomPrs->redisplay(theObject, false);
855 void PartSet_Module::onViewTransformed(int theTrsfType)
857 // Set length of arrows constant in pixel size
858 // if the operation is panning or rotate or panglobal then do nothing
859 if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4))
861 ModuleBase_IViewer* aViewer = myWorkshop->viewer();
862 Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
863 if (aContext.IsNull())
866 //Handle(V3d_View) aView = aViewer->activeView();
868 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
869 XGUI_Workshop* aWorkshop = aConnector->workshop();
870 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
871 Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer();
872 Handle(V3d_View) aView;
874 for (aV3dViewer->InitDefinedViews();
875 aV3dViewer->MoreDefinedViews();
876 aV3dViewer->NextDefinedViews()) {
877 Handle(V3d_View) aV = aV3dViewer->DefinedView();
878 double aS = aV->Scale();
886 double aLen = aView->Convert(20);
888 double aPrevLen = SketcherPrs_Tools::getArrowSize();
889 SketcherPrs_Tools::setArrowSize(aLen);
890 const double aPrevScale = aViewer->Scale(aViewer->activeView());
891 const double aCurScale = aViewer->activeView()->Camera()->Scale();
892 aViewer->SetScale(aViewer->activeView(), aCurScale);
893 SketcherPrs_Tools::setTextHeight (aCurScale / aPrevScale * SketcherPrs_Tools::getTextHeight());
894 bool isModified = false;
895 QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
896 foreach (AISObjectPtr aAIS, aPrsList) {
897 Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
899 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
900 if (!aDim.IsNull()) {
901 aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
902 aContext->Redisplay(aDim, false);
907 aDisplayer->updateViewer();
910 bool PartSet_Module::customizeObject(ObjectPtr theObject, const bool theUpdateViewer)
912 bool isRedisplayed = false;
913 if (myCustomPrs->isActive())
914 isRedisplayed = myCustomPrs->redisplay(theObject, theUpdateViewer);
916 return isRedisplayed;
919 void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser)
921 XGUI_ObjectsBrowser* aOB = dynamic_cast<XGUI_ObjectsBrowser*>(theObjectBrowser);
923 //QLineEdit* aLabel = aOB->activeDocLabel();
924 //QPalette aPalet = aLabel->palette();
925 //aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
926 //aLabel->setPalette(aPalet);
927 aOB->treeView()->setExpandsOnDoubleClick(false);
928 connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
929 SLOT(onTreeViewDoubleClick(const QModelIndex&)));
933 ObjectPtr PartSet_Module::findPresentedObject(const AISObjectPtr& theAIS) const
936 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
938 /// If last line finished on vertex the lines creation sequence has to be break
939 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
940 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
941 // if there is an active widget, find the presented object in it
943 anActiveWidget = aPanel->preselectionWidget();
945 ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
947 if (aWidgetValidated)
948 anObject = aWidgetValidated->findPresentedObject(theAIS);
953 void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
955 QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
956 int aSelected = aObjects.size();
957 SessionPtr aMgr = ModelAPI_Session::get();
958 QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD");
959 QAction* aActivatePartSetAction = myMenuMgr->action("ACTIVATE_PARTSET_CMD");
961 ModuleBase_Operation* aCurrentOp = myWorkshop->currentOperation();
962 if (aSelected == 1) {
963 bool hasResult = false;
964 bool hasFeature = false;
965 bool hasParameter = false;
966 bool hasSubFeature = false;
967 ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
969 ObjectPtr aObject = aObjects.first();
971 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
972 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
973 bool isPart = aPart.get() ||
974 (aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID()));
976 DocumentPtr aPartDoc;
978 aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFeature->firstResult());
980 if (aPart.get()) // this may be null is Part feature is disabled
981 aPartDoc = aPart->partDoc();
983 theMenu->addAction(aActivatePartAction);
984 aActivatePartAction->setEnabled((aMgr->activeDocument() != aPartDoc));
986 } else if (aObject->document() == aMgr->activeDocument()) {
987 if (hasParameter || hasFeature) {
988 myMenuMgr->action("EDIT_CMD")->setEnabled(true);
989 theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
990 if (aCurrentOp && aFeature.get()) {
991 if (aCurrentOp->id().toStdString() == aFeature->getKind())
992 myMenuMgr->action("EDIT_CMD")->setEnabled(false);
997 ResultBodyPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObject);
999 theMenu->addAction(myMenuMgr->action("SELECT_PARENT_CMD"));
1000 } else { // If feature is 0 the it means that selected root object (document)
1001 theMenu->addAction(aActivatePartSetAction);
1002 aActivatePartSetAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument()));
1004 } else if (aSelected == 0) {
1005 // if there is no selection then it means that upper label is selected
1006 QModelIndexList aIndexes = myWorkshop->selection()->selectedIndexes();
1007 if (aIndexes.size() == 0) // it means that selection happens in top label outside of tree view
1008 theMenu->addAction(aActivatePartSetAction);
1009 aActivatePartSetAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument()));
1011 bool aNotDeactivate = (aCurrentOp == 0);
1012 if (!aNotDeactivate) {
1013 aActivatePartAction->setEnabled(false);
1014 aActivatePartSetAction->setEnabled(false);
1018 void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMessage)
1020 if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
1021 // Do not change activation of parts if an operation active
1022 static QStringList aAllowActivationList;
1023 if (aAllowActivationList.isEmpty())
1024 aAllowActivationList <<
1025 QString(PartSetPlugin_Part::ID().c_str()) <<
1026 QString(PartSetPlugin_Duplicate::ID().c_str()) <<
1027 QString(PartSetPlugin_Remove::ID().c_str());
1028 if (myWorkshop->currentOperation() &&
1029 (!aAllowActivationList.contains(myWorkshop->currentOperation()->id())))
1031 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
1032 XGUI_Workshop* aWorkshop = aConnector->workshop();
1033 XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView();
1034 QLineEdit* aLabel = aWorkshop->objectBrowser()->activeDocLabel();
1035 QPalette aPalet = aLabel->palette();
1037 SessionPtr aMgr = ModelAPI_Session::get();
1038 DocumentPtr aActiveDoc = aMgr->activeDocument();
1039 if (aActivePartIndex.isValid())
1040 aTreeView->setExpanded(aActivePartIndex, false);
1041 XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
1042 aActivePartIndex = aDataModel->documentRootIndex(aActiveDoc);
1043 if (aActivePartIndex.isValid())
1044 aTreeView->setExpanded(aActivePartIndex, true);
1046 aLabel->setPalette(aPalet);
1047 aWorkshop->updateCommandStatus();
1049 // Update displayed objects in order to update active color
1050 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
1051 QObjectPtrList aObjects = aDisplayer->displayedObjects();
1053 foreach(ObjectPtr aObj, aObjects) {
1054 //TODO: replace by redisplay event.
1055 aHidden = !aObj->data() || !aObj->data()->isValid() ||
1056 aObj->isDisabled() || (!aObj->isDisplayed());
1058 aDisplayer->redisplay(aObj, false);
1060 aDisplayer->updateViewer();
1064 void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex)
1066 if (myWorkshop->currentOperation()) // Do not change activation of parts if an operation active
1068 SessionPtr aMgr = ModelAPI_Session::get();
1069 if (!theIndex.isValid()) {
1070 aMgr->setActiveDocument(aMgr->moduleDocument());
1073 if (theIndex.column() != 0) // Use only first column
1076 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
1077 XGUI_Workshop* aWorkshop = aConnector->workshop();
1078 XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
1079 // De not use non editable Indexes
1080 if ((aDataModel->flags(theIndex) & Qt::ItemIsSelectable) == 0)
1082 ObjectPtr aObj = aDataModel->object(theIndex);
1084 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
1085 if (!aPart.get()) { // Probably this is Feature
1086 FeaturePtr aPartFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
1087 if (aPartFeature.get() && (aPartFeature->getKind() == PartSetPlugin_Part::ID())) {
1088 aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPartFeature->firstResult());
1091 if (aPart.get()) { // if this is a part
1092 if (aPart->partDoc() == aMgr->activeDocument()) {
1093 myMenuMgr->activatePartSet();
1101 void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*)
1103 // z layer is created for all started operations in order to visualize operation AIS presentation
1105 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
1106 if (aContext.IsNull())
1109 Handle(V3d_Viewer) aViewer = aContext->CurrentViewer();
1110 if (myVisualLayerId == 0) {
1111 if (myVisualLayerId == 0)
1112 aViewer->AddZLayer(myVisualLayerId);
1114 TColStd_SequenceOfInteger aZList;
1115 aViewer->GetAllZLayers(aZList);
1116 bool aFound = false;
1117 for (int i = 1; i <= aZList.Length(); i++) {
1118 if (aZList(i) == myVisualLayerId) {
1124 aViewer->AddZLayer(myVisualLayerId);
1126 // if there is an active operation with validated widget,
1127 // the filters of this widget should be activated in the created view
1128 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
1130 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
1131 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
1132 if (anActiveWidget) {
1133 ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
1135 if (aWidgetValidated)
1136 aWidgetValidated->activateFilters(true);