]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_Module.cpp
Salome HOME
5358b23b1eb8df63241fd900b716c811c3fdc31e
[modules/shaper.git] / src / PartSet / PartSet_Module.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
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_SketcherReetntrantMgr.h"
18 #include "PartSet_MenuMgr.h"
19 #include "PartSet_CustomPrs.h"
20 #include "PartSet_IconFactory.h"
21
22 #include "PartSet_Filters.h"
23 #include "PartSet_FilterInfinite.h"
24
25 #include <PartSetPlugin_Remove.h>
26 #include <PartSetPlugin_Part.h>
27 #include <PartSetPlugin_Duplicate.h>
28
29 #include <ModuleBase_Operation.h>
30 #include <ModuleBase_OperationAction.h>
31 #include <ModuleBase_IViewer.h>
32 #include <ModuleBase_IViewWindow.h>
33 #include <ModuleBase_IPropertyPanel.h>
34 #include <ModuleBase_WidgetEditor.h>
35 #include <ModuleBase_WidgetValidated.h>
36 #include <ModuleBase_FilterFactory.h>
37 #include <ModuleBase_Tools.h>
38 #include <ModuleBase_OperationFeature.h>
39
40 #include <GeomValidators_ShapeType.h>
41 #include <GeomValidators_Finite.h>
42 #include <GeomValidators_Face.h>
43 #include <GeomValidators_ConstructionComposite.h>
44 #include <GeomValidators_ZeroOffset.h>
45 #include <GeomValidators_BooleanArguments.h>
46 #include <GeomValidators_Different.h>
47 #include <GeomValidators_PartitionArguments.h>
48
49
50 #include <ModelAPI_Object.h>
51 #include <ModelAPI_Events.h>
52 #include <ModelAPI_Validator.h>
53 #include <ModelAPI_Data.h>
54 #include <ModelAPI_Session.h>
55 #include <GeomValidators_DifferentShapes.h>
56 #include <ModelAPI_ResultBody.h>
57 #include <ModelAPI_AttributeString.h>
58
59 #include <GeomDataAPI_Point2D.h>
60 #include <GeomDataAPI_Point.h>
61 #include <GeomDataAPI_Dir.h>
62
63 #include <XGUI_Displayer.h>
64 #include <XGUI_Workshop.h>
65 #include <XGUI_OperationMgr.h>
66 #include <XGUI_PropertyPanel.h>
67 #include <XGUI_ModuleConnector.h>
68 #include <XGUI_ContextMenuMgr.h>
69 #include <XGUI_Tools.h>
70 #include <XGUI_ObjectsBrowser.h>
71 #include <XGUI_SelectionMgr.h>
72 #include <XGUI_DataModel.h>
73 #include <XGUI_ErrorMgr.h>
74
75 #include <SketchPlugin_Feature.h>
76 #include <SketchPlugin_Sketch.h>
77 #include <SketchPlugin_ConstraintAngle.h>
78 #include <SketchPlugin_ConstraintLength.h>
79 #include <SketchPlugin_ConstraintDistance.h>
80 #include <SketchPlugin_ConstraintParallel.h>
81 #include <SketchPlugin_ConstraintPerpendicular.h>
82 #include <SketchPlugin_ConstraintRadius.h>
83
84 #include <SketcherPrs_SymbolPrs.h>
85 #include <SketcherPrs_Tools.h>
86
87 #include <Events_Loop.h>
88 #include <Config_PropManager.h>
89 #include <Config_Keywords.h>
90
91 #include <StdSelect_TypeOfFace.hxx>
92 #include <TopoDS_Vertex.hxx>
93 #include <TopoDS.hxx>
94 #include <TopoDS_Shape.hxx>
95 #include <BRep_Tool.hxx>
96 #include <AIS_Dimension.hxx>
97
98 #include <QObject>
99 #include <QMouseEvent>
100 #include <QString>
101 #include <QTimer>
102 #include <QApplication>
103 #include <QMessageBox>
104 #include <QMainWindow>
105 #include <QLineEdit>
106
107 #include <GeomAlgoAPI_FaceBuilder.h>
108 #include <GeomDataAPI_Dir.h>
109
110 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
111
112 #ifdef _DEBUG
113 #include <QDebug>
114 #endif
115
116 /*!Create and return new instance of XGUI_Module*/
117 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
118 {
119   return new PartSet_Module(theWshop);
120 }
121
122 PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
123 : ModuleBase_IModule(theWshop),
124   myVisualLayerId(0), myHasConstraintShown(true)
125 {
126   new PartSet_IconFactory();
127
128   mySketchMgr = new PartSet_SketcherMgr(this);
129   mySketchReentrantMgr = new PartSet_SketcherReetntrantMgr(theWshop);
130
131   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
132   XGUI_Workshop* aWorkshop = aConnector->workshop();
133
134   XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
135   connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
136           this, SLOT(onOperationActivatedByPreselection()));
137
138   ModuleBase_IViewer* aViewer = theWshop->viewer();
139   connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
140           this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
141   connect(aViewer, SIGNAL(viewTransformed(int)),
142           SLOT(onViewTransformed(int)));
143   connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)),
144           SLOT(onViewCreated(ModuleBase_IViewWindow*)));
145
146   myMenuMgr = new PartSet_MenuMgr(this);
147   myCustomPrs = new PartSet_CustomPrs(theWshop);
148
149   Events_Loop* aLoop = Events_Loop::loop();
150   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
151
152   mySelectionFilters.Append(new PartSet_GlobalFilter(myWorkshop));
153   mySelectionFilters.Append(new PartSet_FilterInfinite(myWorkshop));
154 }
155
156 PartSet_Module::~PartSet_Module()
157 {
158   SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
159   for (; aIt.More(); aIt.Next()) {
160     Handle(SelectMgr_Filter) aFilter = aIt.Value();
161     if (!aFilter.IsNull())
162       aFilter.Nullify();
163   }
164   delete myCustomPrs;
165 }
166
167 void PartSet_Module::activateSelectionFilters()
168 {
169   SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
170   for (; aIt.More(); aIt.Next()) {
171     Handle(SelectMgr_Filter) aFilter = aIt.Value();
172     if (!aFilter.IsNull())
173       myWorkshop->viewer()->addSelectionFilter(aFilter);
174   }
175 }
176
177 void PartSet_Module::deactivateSelectionFilters()
178 {
179   SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
180   for (; aIt.More(); aIt.Next()) {
181     Handle(SelectMgr_Filter) aFilter = aIt.Value();
182     if (!aFilter.IsNull())
183       myWorkshop->viewer()->removeSelectionFilter(aFilter);
184   }
185 }
186
187 void PartSet_Module::registerValidators()
188 {
189   //Registering of validators
190   SessionPtr aMgr = ModelAPI_Session::get();
191   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
192   aFactory->registerValidator("PartSet_DistanceSelection", new PartSet_DistanceSelection);
193   aFactory->registerValidator("PartSet_LengthSelection", new PartSet_LengthSelection);
194   aFactory->registerValidator("PartSet_PerpendicularSelection", new PartSet_PerpendicularSelection);
195   aFactory->registerValidator("PartSet_ParallelSelection", new PartSet_ParallelSelection);
196   aFactory->registerValidator("PartSet_RadiusSelection", new PartSet_RadiusSelection);
197   aFactory->registerValidator("PartSet_RigidSelection", new PartSet_RigidSelection);
198   aFactory->registerValidator("PartSet_CoincidentSelection", new PartSet_CoincidentSelection);
199   aFactory->registerValidator("PartSet_HVDirSelection", new PartSet_HVDirSelection);
200   aFactory->registerValidator("PartSet_TangentSelection", new PartSet_TangentSelection);
201   aFactory->registerValidator("PartSet_FilletSelection", new PartSet_FilletSelection);
202   aFactory->registerValidator("PartSet_AngleSelection", new PartSet_AngleSelection);
203   aFactory->registerValidator("PartSet_EqualSelection", new PartSet_EqualSelection);
204   aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
205   aFactory->registerValidator("PartSet_CoincidentAttr", new PartSet_CoincidentAttr);
206
207   aFactory->registerValidator("GeomValidators_DifferentShapes", new GeomValidators_DifferentShapes);
208   aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
209   aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
210   aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite);
211
212   aFactory->registerValidator("GeomValidators_ConstructionComposite",
213                               new GeomValidators_ConstructionComposite);
214
215   aFactory->registerValidator("GeomValidators_ZeroOffset",
216                               new GeomValidators_ZeroOffset);
217
218   aFactory->registerValidator("GeomValidators_BooleanArguments",
219                               new GeomValidators_BooleanArguments);
220
221   aFactory->registerValidator("PartSet_SketchEntityValidator",
222                               new PartSet_SketchEntityValidator);
223
224   aFactory->registerValidator("GeomValidators_Different",
225                               new GeomValidators_Different);
226
227   aFactory->registerValidator("GeomValidators_PartitionArguments",
228                               new GeomValidators_PartitionArguments);
229 }
230
231 void PartSet_Module::registerFilters()
232 {
233   //Registering of selection filters
234   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
235   ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
236 }
237
238 void PartSet_Module::registerProperties()
239 {
240   Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
241                                    PLANE_SIZE);
242   Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness",
243                                    Config_Prop::Integer, SKETCH_WIDTH);
244 }
245
246 void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
247 {
248   mySketchMgr->connectToPropertyPanel(theWidget, isToConnect);
249 }
250
251 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) 
252 {
253   if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
254     mySketchMgr->commitNestedSketch(theOperation);
255   }
256
257   /// Restart sketcher operations automatically
258   if (!mySketchReentrantMgr->operationCommitted(theOperation)) {
259     // the selection is cleared after commit the create operation
260     // in order to do not use the same selected objects in the restarted operation
261     // for common behaviour, the selection is cleared even if the operation is not restarted
262     XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
263     XGUI_Workshop* aWorkshop = aConnector->workshop();
264     aWorkshop->selector()->clearSelection();
265   }
266 }
267
268 void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation)
269 {
270   /// Restart sketcher operations automatically
271   mySketchReentrantMgr->operationAborted(theOperation);
272 }
273
274 void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation)
275 {
276   /// Restart sketcher operations automatically
277   mySketchReentrantMgr->operationStarted(theOperation);
278
279   if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
280     mySketchMgr->startSketch(theOperation);
281   }
282   else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
283     mySketchMgr->startNestedSketch(theOperation);
284   }
285
286   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
287   if (aFOperation)
288     myCustomPrs->activate(aFOperation->feature(), true);
289 }
290
291 void PartSet_Module::operationResumed(ModuleBase_Operation* theOperation)
292 {
293   ModuleBase_IModule::operationResumed(theOperation);
294
295   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
296   if (aFOperation)
297     myCustomPrs->activate(aFOperation->feature(), true);
298 }
299
300 void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
301 {
302   bool isModified = myCustomPrs->deactivate(false);
303
304   if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
305     mySketchMgr->stopSketch(theOperation);
306   }
307   else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
308     mySketchMgr->stopNestedSketch(theOperation);
309   }
310
311   //VSV: Viewer is updated on feature update and redisplay
312   //if (isModified) {
313   //  XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
314   //  XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
315   //  aDisplayer->updateViewer();
316   //}
317   mySketchMgr->onShowConstraintsToggle(myHasConstraintShown);
318 }
319
320 ModuleBase_Operation* PartSet_Module::currentOperation() const
321 {
322   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
323   XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
324   return anOpMgr->currentOperation();
325 }
326
327 bool PartSet_Module::canUndo() const
328 {
329   bool aCanUndo = false;
330   SessionPtr aMgr = ModelAPI_Session::get();
331   if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
332     aCanUndo = !aMgr->isOperation();
333     if (!aCanUndo) // check the enable state additionally by sketch manager
334       aCanUndo = aMgr->canUndo();
335   }
336   return aCanUndo;
337 }
338
339 bool PartSet_Module::canRedo() const
340 {
341   bool aCanRedo = false;
342   SessionPtr aMgr = ModelAPI_Session::get();
343   if (aMgr->hasModuleDocument() && aMgr->canRedo()) {
344     aCanRedo = !aMgr->isOperation();
345     if (!aCanRedo) // check the enable state additionally by sketch manager
346       aCanRedo = aMgr->canRedo();
347   }
348   return aCanRedo;
349 }
350
351 bool PartSet_Module::canApplyAction(const ObjectPtr& theObject, const QString& theActionId) const
352 {
353   bool aValid = true;
354   if (theActionId == "DELETE_CMD" || theActionId == "MOVE_CMD") {
355     FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
356     if (aFeature) {
357       // part features are removed in the PartSet module only.
358       if (aFeature->getKind() == PartSetPlugin_Part::ID())
359         aValid = false;
360     }
361   }
362   return aValid;
363 }
364
365 bool PartSet_Module::canEraseObject(const ObjectPtr& theObject) const
366 {
367   // the sketch manager put the restriction to the objects erase
368   return mySketchMgr->canEraseObject(theObject);
369 }
370
371 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
372 {
373   // the sketch manager put the restriction to the objects display
374   return mySketchMgr->canDisplayObject(theObject);
375 }
376
377 bool PartSet_Module::canActivateSelection(const ObjectPtr& theObject) const
378 {
379   bool aCanActivate = ModuleBase_IModule::canActivateSelection(theObject);
380
381   ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
382   bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
383        isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
384   if (isSketchOp || isNestedOp) {
385     // in active sketch operation it is possible to activate operation object in selection
386     // in the edit operation, e.g. points of the line can be moved when the line is edited
387     ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
388     aCanActivate = aCanActivate || (aFOperation && aFOperation->isEditOperation());
389   }
390   return aCanActivate;
391 }
392
393 bool PartSet_Module::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
394 {
395   return myMenuMgr->addViewerMenu(theMenu, theStdActions);
396 }
397
398 void PartSet_Module::updateViewerMenu(const QMap<QString, QAction*>& theStdActions)
399 {
400   myMenuMgr->updateViewerMenu(theStdActions);
401 }
402
403 QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI)
404 {
405   QString anError = ModuleBase_IModule::getFeatureError(theFeature, isCheckGUI);
406   if (anError.isEmpty())
407     anError = sketchMgr()->getFeatureError(theFeature, isCheckGUI);
408
409   return anError;
410 }
411
412 void PartSet_Module::grantedOperationIds(ModuleBase_Operation* theOperation,
413                                          QStringList& theIds) const
414 {
415   myMenuMgr->grantedOperationIds(theOperation, theIds);
416
417   if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
418     XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
419     XGUI_Workshop* aWorkshop = aConnector->workshop();
420
421     theIds.append(aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text());
422   }
423 }
424
425 void PartSet_Module::activeSelectionModes(QIntList& theModes)
426 {
427   theModes.clear();
428   if (mySketchMgr->activeSketch().get())
429     PartSet_SketcherMgr::sketchSelectionModes(theModes);
430 }
431
432 bool PartSet_Module::isMouseOverWindow()
433 {
434   return mySketchMgr->isMouseOverWindow();
435 }
436
437 void PartSet_Module::closeDocument()
438 {
439   clearViewer();
440 }
441
442 void PartSet_Module::clearViewer()
443 {
444   myCustomPrs->clearPrs();
445
446   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
447   XGUI_Workshop* aWorkshop = aConnector->workshop();
448   XGUI_Displayer* aDisplayer = aWorkshop->displayer();
449   aDisplayer->deactivateSelectionFilters();
450 }
451
452 void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
453 {
454   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
455   if (!aFOperation)
456     return;
457
458   ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
459   // we have to manually activate the sketch label in edit mode
460   if (PartSet_SketcherMgr::isSketchOperation(aFOperation) &&  (aFOperation->isEditOperation()))
461     aPanel->activateWidget(aPanel->modelWidgets().first());
462 }
463
464
465 void PartSet_Module::onSelectionChanged()
466 {
467   ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
468   if (!aOperation)
469     return;
470
471   bool isSketcherOp = false;
472   // An edit operation is enable only if the current opeation is the sketch operation
473   if (mySketchMgr->activeSketch()) {
474     if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch()))
475       isSketcherOp = PartSet_SketcherMgr::isSketchOperation(aOperation);
476   }
477   if (isSketcherOp) {
478     // Editing of constraints can be done on selection
479     ModuleBase_ISelection* aSelect = myWorkshop->selection();
480     QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
481     if (aSelected.size() == 1) {
482       ModuleBase_ViewerPrs aPrs = aSelected.first();
483       ObjectPtr aObject = aPrs.object();
484       FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
485       if (aFeature) {
486         std::string aId = aFeature->getKind();
487         if ((aId == SketchPlugin_ConstraintRadius::ID()) ||
488             (aId == SketchPlugin_ConstraintLength::ID()) || 
489             (aId == SketchPlugin_ConstraintDistance::ID()) ||
490             (aId == SketchPlugin_ConstraintAngle::ID())) {
491           editFeature(aFeature);
492         }
493       }
494     }
495   } 
496 }
497
498 void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent)
499 {
500   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
501   XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
502   anOpMgr->onKeyReleased(theEvent);
503 }
504
505 void PartSet_Module::onOperationActivatedByPreselection()
506 {
507   if (!mySketchReentrantMgr->canBeCommittedByPreselection())
508     return;
509
510   ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
511   if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
512     // Set final definitions if they are necessary
513     //propertyPanelDefined(aOperation);
514
515     /// Commit sketcher operations automatically
516     anOperation->commit();
517   }
518 }
519
520 ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
521                                             Config_WidgetAPI* theWidgetApi, std::string theParentId)
522 {
523   ModuleBase_IWorkshop* aWorkshop = workshop();
524   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
525   XGUI_Workshop* aXUIWorkshop = aConnector->workshop();
526   ModuleBase_ModelWidget* aWgt = NULL;
527   if (theType == "sketch-start-label") {
528     PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent, aWorkshop,
529       theWidgetApi, theParentId, mySketchMgr->isConstraintsShown());
530     connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr<GeomAPI_Pln>&)),
531       mySketchMgr, SLOT(onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>&)));
532     connect(aLabelWgt, SIGNAL(showConstraintToggled(bool)),
533       mySketchMgr, SLOT(onShowConstraintsToggle(bool)));
534     aWgt = aLabelWgt;
535   } else if (theType == "sketch-2dpoint_selector") {
536     PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, aWorkshop,
537                                                                  theWidgetApi, theParentId);
538     aPointWgt->setSketch(mySketchMgr->activeSketch());
539     connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
540     aWgt = aPointWgt;
541   } else if (theType == "sketch-2dpoint_flyout_selector") {
542     PartSet_WidgetPoint2DFlyout* aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop,
543                                                                  theWidgetApi, theParentId);
544     aPointWgt->setSketch(mySketchMgr->activeSketch());
545     connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
546     aWgt = aPointWgt;
547   } else if (theType == "point2ddistance") {
548     PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent,
549                                                         aWorkshop, theWidgetApi, theParentId);
550     aDistanceWgt->setSketch(mySketchMgr->activeSketch());
551     aWgt = aDistanceWgt;
552   } else if(theType == "point2dangle") {
553     PartSet_WidgetPoint2dAngle* anAngleWgt = new PartSet_WidgetPoint2dAngle(theParent,
554                                                            aWorkshop, theWidgetApi, theParentId);
555     anAngleWgt->setSketch(mySketchMgr->activeSketch());
556     aWgt = anAngleWgt;
557   } else if (theType == "sketch_shape_selector") {
558     PartSet_WidgetShapeSelector* aShapeSelectorWgt =
559       new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi, theParentId);
560     aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
561     aWgt = aShapeSelectorWgt;
562   } else if (theType == "sketch_multi_selector") {
563     PartSet_WidgetMultiSelector* aShapeSelectorWgt =
564       new PartSet_WidgetMultiSelector(theParent, aWorkshop, theWidgetApi, theParentId);
565     aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
566     aWgt = aShapeSelectorWgt;
567   } else if (theType == WDG_DOUBLEVALUE_EDITOR) {
568     aWgt = new PartSet_WidgetEditor(theParent, aWorkshop, theWidgetApi, theParentId);
569   } else if (theType == "export_file_selector") {
570     aWgt = new PartSet_WidgetFileSelector(theParent, aWorkshop, theWidgetApi, theParentId);
571   } else if (theType == "sketch_launcher") {
572     aWgt = new PartSet_WidgetSketchCreator(theParent, this, theWidgetApi, theParentId);
573   }
574   return aWgt;
575 }
576
577 ModuleBase_ModelWidget* PartSet_Module::activeWidget() const
578 {
579   ModuleBase_ModelWidget* anActiveWidget = 0;
580
581   anActiveWidget = mySketchReentrantMgr->internalActiveWidget();
582   if (!anActiveWidget) {
583     ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
584     if (aOperation) {
585       ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
586       anActiveWidget = aPanel->activeWidget();
587     }
588   }
589   return anActiveWidget;
590 }
591
592 bool PartSet_Module::deleteObjects()
593 {
594   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
595   XGUI_Workshop* aWorkshop = aConnector->workshop();
596   XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
597
598   //SessionPtr aMgr = ModelAPI_Session::get();
599   // 1. check whether the delete should be processed in the module
600   ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
601   bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
602        isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
603   if (isSketchOp || isNestedOp) {
604     // 2. find selected presentations
605     // selected objects should be collected before the current operation abort because
606     // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
607     ModuleBase_ISelection* aSel = workshop()->selection();
608     QObjectPtrList aSelectedObj = aSel->selectedPresentations();
609     // if there are no selected objects in the viewer, that means that the selection in another
610     // place cased this method. It is necessary to return the false value to understande in above
611     // method that delete is not processed
612     if (aSelectedObj.count() == 0)
613       return false;
614
615     // avoid delete of the objects, which are not belong to the current sketch
616     // in order to do not delete results of other sketches
617     QObjectPtrList aSketchObjects;
618     QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), aLast = aSelectedObj.end();
619     for ( ; anIt != aLast; anIt++) {
620       ObjectPtr anObject = *anIt;
621       if (mySketchMgr->isObjectOfSketch(anObject)) {
622         // sketch feature should be used in this list because workshop deletes features only
623         // results are skipped
624         FeaturePtr aSketchFeature = ModelAPI_Feature::feature(anObject);
625         aSketchObjects.append(aSketchFeature);
626       }
627     }
628     // if the selection contains only local selected presentations from other sketches,
629     // the Delete operation should not be done at all
630     if (aSketchObjects.size() == 0)
631       return true;
632
633     // 3. start operation
634     QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
635     ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, this);
636
637     // the active nested sketch operation should be aborted unconditionally
638     // the Delete action should be additionally granted for the Sketch operation
639     // in order to do not abort/commit it
640     if (!anOpMgr->canStartOperation(anOpAction->id()))
641       return true; // the objects are processed but can not be deleted
642
643     anOpMgr->startOperation(anOpAction);
644
645     // 4. delete features
646     // sketch feature should be skipped, only sub-features can be removed
647     // when sketch operation is active
648     aWorkshop->deleteFeatures(aSketchObjects);
649     // 5. stop operation
650     anOpMgr->commitOperation();
651   }
652   else {
653     bool isPartRemoved = false;
654     // Delete part with help of PartSet plugin
655     // TODO: the deleted objects has to be processed by multiselection
656     QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
657     if (aObjects.size() == 1) {
658       ObjectPtr aObj = aObjects.first();
659       FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
660       if (aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID())) {
661         // Remove feature should be created in the document of the part results
662         ResultPtr aPartResult = aFeature->firstResult();
663         if (aPartResult.get()) {
664           std::shared_ptr<ModelAPI_ResultPart> aPart =
665                        std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPartResult);
666           DocumentPtr aPartDoc = aPart->partDoc();
667           if (aPartDoc.get()) {
668             ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction
669                                               (PartSetPlugin_Remove::ID().c_str(), this);
670             if (!anOpMgr->canStartOperation(anOpAction->id()))
671               return true; // the objects are processed but can not be deleted
672
673             anOpMgr->startOperation(anOpAction);
674
675             FeaturePtr aFeature = aPartDoc->addFeature(PartSetPlugin_Remove::ID());
676             aFeature->execute();
677
678             anOpMgr->commitOperation();
679             isPartRemoved = true;
680           }
681         }
682       }
683     }
684     return isPartRemoved;
685   }
686   return true;
687 }
688
689 void PartSet_Module::onFeatureTriggered()
690 {
691   QAction* aCmd = dynamic_cast<QAction*>(sender());
692   if (aCmd->isCheckable() && aCmd->isChecked()) {
693     // 1. check whether the delete should be processed in the module
694     ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
695     bool isNestedOp = PartSet_SketcherMgr::isNestedCreateOperation(anOperation);
696     if (isNestedOp) {
697       // in case if in the viewer nothing is displayed, the create operation should not be
698       // comitted even if all values of the feature are initialized
699       if (!mySketchMgr->canDisplayCurrentCreatedFeature()) {
700         // the action information should be saved before the operation is aborted
701         // because this abort leads to update command status, which unchecks this action
702         anOperation->abort();
703         launchOperation(aCmd->data().toString());
704       }
705     }
706   }
707   ModuleBase_IModule::onFeatureTriggered();
708 }
709
710 void PartSet_Module::launchOperation(const QString& theCmdId)
711 {
712   if (PartSet_SketcherMgr::constraintsIdList().contains(theCmdId)) {
713     // Show constraints if a constraint was anOperation
714     myHasConstraintShown = mySketchMgr->isConstraintsShown();
715     mySketchMgr->onShowConstraintsToggle(true);
716   }
717   ModuleBase_IModule::launchOperation(theCmdId);
718 }
719
720
721 void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS) 
722 {
723   Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
724   if (!anAIS.IsNull()) {
725     Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
726     Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
727     if (!aDim.IsNull()) {
728       aCtx->SetZLayer(aDim, myVisualLayerId);
729     } else {
730       Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
731       if (!aCons.IsNull())
732         aCtx->SetZLayer(aCons, myVisualLayerId);
733     }
734   }
735 }
736
737 void PartSet_Module::onBeforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS)
738 {
739   // this is obsolete
740   // it should be recomputed in order to disappear in the viewer if the corresponded object
741   // is erased
742   //if (myCustomPrs->isActive())
743   //  myCustomPrs->redisplay(theObject, false);
744 }
745
746 void PartSet_Module::onViewTransformed(int theTrsfType)
747 {
748   // Set length of arrows constant in pixel size
749   // if the operation is panning or rotate or panglobal then do nothing
750   if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4))
751     return;
752   ModuleBase_IViewer* aViewer = myWorkshop->viewer();
753   Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
754   if (aContext.IsNull())
755     return;
756
757   //Handle(V3d_View) aView = aViewer->activeView();
758
759   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
760   XGUI_Workshop* aWorkshop = aConnector->workshop();
761   XGUI_Displayer* aDisplayer = aWorkshop->displayer();
762   Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer();
763   Handle(V3d_View) aView;
764   double aScale = 0;
765   for (aV3dViewer->InitDefinedViews(); 
766        aV3dViewer->MoreDefinedViews(); 
767        aV3dViewer->NextDefinedViews()) {
768     Handle(V3d_View) aV = aV3dViewer->DefinedView();
769     double aS = aV->Scale();
770     if (aS > aScale) {
771       aScale = aS;
772       aView = aV;
773     }
774   }
775   if (aView.IsNull())
776     return;
777   double aLen = aView->Convert(20);
778
779   double aPrevLen = SketcherPrs_Tools::getArrowSize();
780   SketcherPrs_Tools::setArrowSize(aLen);
781   const double aPrevScale = aViewer->Scale(aViewer->activeView());
782   const double aCurScale = aViewer->activeView()->Camera()->Scale();
783   aViewer->SetScale(aViewer->activeView(), aCurScale);
784   SketcherPrs_Tools::setTextHeight (aCurScale / aPrevScale * SketcherPrs_Tools::getTextHeight());
785   bool isModified = false;
786   QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
787   foreach (AISObjectPtr aAIS, aPrsList) {
788     Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
789
790     Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
791     if (!aDim.IsNull()) {
792       aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
793       aContext->Redisplay(aDim, false);
794       isModified = true;
795     }
796   }
797   if (isModified)
798     aDisplayer->updateViewer();
799 }
800
801 bool PartSet_Module::customizeObject(ObjectPtr theObject, const bool theUpdateViewer)
802 {
803   bool isRedisplayed = false;
804   if (myCustomPrs->isActive())
805     isRedisplayed = myCustomPrs->redisplay(theObject, theUpdateViewer);
806
807   return isRedisplayed;
808 }
809
810 void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser)
811 {
812   XGUI_ObjectsBrowser* aOB = dynamic_cast<XGUI_ObjectsBrowser*>(theObjectBrowser);
813   if (aOB) {
814     QLineEdit* aLabel = aOB->activeDocLabel();
815     connect(aLabel, SIGNAL(customContextMenuRequested(const QPoint&)), 
816           SLOT(onActiveDocPopup(const QPoint&)));
817     //QPalette aPalet = aLabel->palette();
818     //aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
819     //aLabel->setPalette(aPalet);
820     aOB->treeView()->setExpandsOnDoubleClick(false);
821     connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)), 
822       SLOT(onTreeViewDoubleClick(const QModelIndex&)));
823   }
824 }
825
826 void PartSet_Module::onActiveDocPopup(const QPoint& thePnt)
827 {
828   SessionPtr aMgr = ModelAPI_Session::get();
829   QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PARTSET_CMD");
830
831   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
832   XGUI_Workshop* aWorkshop = aConnector->workshop();
833   QLineEdit* aHeader = aWorkshop->objectBrowser()->activeDocLabel();
834
835   aActivatePartAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument()));
836
837   QMenu aMenu;
838   aMenu.addAction(aActivatePartAction);
839   aMenu.exec(aHeader->mapToGlobal(thePnt));
840 }
841
842
843 ObjectPtr PartSet_Module::findPresentedObject(const AISObjectPtr& theAIS) const
844 {
845   ObjectPtr anObject;
846   ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
847   if (aOperation) {
848     /// If last line finished on vertex the lines creation sequence has to be break
849     ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
850     ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
851     // if there is an active widget, find the presented object in it
852     if (!anActiveWidget)
853       anActiveWidget = aPanel->preselectionWidget();
854     
855     ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
856                                                                            (anActiveWidget);
857     if (aWidgetValidated)
858       anObject = aWidgetValidated->findPresentedObject(theAIS);
859   }
860   return anObject;
861 }
862
863 void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
864 {
865   QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
866   int aSelected = aObjects.size();
867   SessionPtr aMgr = ModelAPI_Session::get();
868   QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD");
869
870   ModuleBase_Operation* aCurrentOp = myWorkshop->currentOperation();
871   if (aSelected == 1) {
872     bool hasResult = false;
873     bool hasFeature = false;
874     bool hasParameter = false;
875     bool hasSubFeature = false;
876     ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
877
878     ObjectPtr aObject = aObjects.first();
879     if (aObject) {
880       ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
881       FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
882       bool isPart = aPart.get() || 
883         (aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID()));
884       if (isPart) {
885         DocumentPtr aPartDoc;
886         if (!aPart.get()) {
887           aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFeature->firstResult());
888         }
889         if (aPart.get()) // this may be null is Part feature is disabled
890           aPartDoc = aPart->partDoc();
891           
892         theMenu->addAction(aActivatePartAction);
893         aActivatePartAction->setEnabled((aMgr->activeDocument() != aPartDoc));
894
895       } else if (aObject->document() == aMgr->activeDocument()) {
896         if (hasParameter || hasFeature) {
897           myMenuMgr->action("EDIT_CMD")->setEnabled(true);
898           theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
899           if (aCurrentOp && aFeature.get()) {
900             if (aCurrentOp->id().toStdString() == aFeature->getKind())
901               myMenuMgr->action("EDIT_CMD")->setEnabled(false);
902           }
903         }
904       }
905
906       ResultBodyPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObject);
907       if( aResult.get() )
908         theMenu->addAction(myMenuMgr->action("SELECT_PARENT_CMD"));
909     }
910   }
911   bool aNotDeactivate = (aCurrentOp == 0);
912   if (!aNotDeactivate) {
913     aActivatePartAction->setEnabled(false);
914   }
915 }
916
917 void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMessage)
918 {
919   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
920     // Do not change activation of parts if an operation active
921     static QStringList aAllowActivationList;
922     if (aAllowActivationList.isEmpty())
923       aAllowActivationList << 
924       QString(PartSetPlugin_Part::ID().c_str()) << 
925       QString(PartSetPlugin_Duplicate::ID().c_str()) <<
926       QString(PartSetPlugin_Remove::ID().c_str());
927     if (myWorkshop->currentOperation() && 
928       (!aAllowActivationList.contains(myWorkshop->currentOperation()->id())))
929       return;
930     XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
931     XGUI_Workshop* aWorkshop = aConnector->workshop();
932     XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView();
933     QLineEdit* aLabel = aWorkshop->objectBrowser()->activeDocLabel();
934     QPalette aPalet = aLabel->palette();
935
936     SessionPtr aMgr = ModelAPI_Session::get();
937     DocumentPtr aActiveDoc = aMgr->activeDocument();
938     if (aActivePartIndex.isValid())
939       aTreeView->setExpanded(aActivePartIndex, false);
940     XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
941     aActivePartIndex = aDataModel->documentRootIndex(aActiveDoc);
942     if (aActivePartIndex.isValid())
943       aTreeView->setExpanded(aActivePartIndex, true);
944
945     aLabel->setPalette(aPalet);
946     aWorkshop->updateCommandStatus();
947
948     // Update displayed objects in order to update active color
949     XGUI_Displayer* aDisplayer = aWorkshop->displayer();
950     QObjectPtrList aObjects = aDisplayer->displayedObjects();
951     bool aHidden;
952     foreach(ObjectPtr aObj, aObjects) {
953       //TODO: replace by redisplay event.
954       aHidden = !aObj->data() || !aObj->data()->isValid() || 
955         aObj->isDisabled() || (!aObj->isDisplayed());
956       if (!aHidden)
957         aDisplayer->redisplay(aObj, false);
958     }
959     aDisplayer->updateViewer();
960   }
961 }
962
963 void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex)
964 {
965   if (myWorkshop->currentOperation()) // Do not change activation of parts if an operation active
966     return;
967   SessionPtr aMgr = ModelAPI_Session::get();
968   if (!theIndex.isValid()) {
969     aMgr->setActiveDocument(aMgr->moduleDocument());
970     return;
971   }
972   if (theIndex.column() != 0) // Use only first column
973     return;
974
975   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
976   XGUI_Workshop* aWorkshop = aConnector->workshop();
977   XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
978   // De not use non editable Indexes
979   if ((aDataModel->flags(theIndex) & Qt::ItemIsSelectable) == 0)
980     return;
981   ObjectPtr aObj = aDataModel->object(theIndex);
982
983   ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
984   if (!aPart.get()) { // Probably this is Feature
985     FeaturePtr aPartFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
986     if (aPartFeature.get() && (aPartFeature->getKind() == PartSetPlugin_Part::ID())) {
987       aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPartFeature->firstResult());
988     }
989   }
990   if (aPart.get()) { // if this is a part
991     if (aPart->partDoc() == aMgr->activeDocument()) {
992       myMenuMgr->activatePartSet();
993     } else {
994       aPart->activate();
995     }
996   }
997 }
998
999
1000 void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*)
1001 {
1002   // z layer is created for all started operations in order to visualize operation AIS presentation
1003   // over the object
1004   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
1005   if (aContext.IsNull())
1006     return;
1007
1008   Handle(V3d_Viewer) aViewer = aContext->CurrentViewer();
1009   if (myVisualLayerId == 0) {
1010     if (myVisualLayerId == 0)
1011       aViewer->AddZLayer(myVisualLayerId);
1012   } else {
1013     TColStd_SequenceOfInteger aZList;
1014     aViewer->GetAllZLayers(aZList);
1015     bool aFound = false;
1016     for (int i = 1; i <= aZList.Length(); i++) {
1017       if (aZList(i) == myVisualLayerId) {
1018         aFound = true;
1019         break;
1020       }
1021     }
1022     if (!aFound)
1023       aViewer->AddZLayer(myVisualLayerId);
1024   }
1025   // if there is an active operation with validated widget,
1026   // the filters of this widget should be activated in the created view
1027   ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
1028   if (aOperation) {
1029     ModuleBase_ModelWidget* anActiveWidget = activeWidget();
1030     if (anActiveWidget) {
1031       ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(anActiveWidget);
1032       if (aWSelector)
1033         aWSelector->activateSelectionAndFilters(true);
1034     }
1035   }
1036 }
1037
1038 //******************************************************
1039 void PartSet_Module::widgetStateChanged(int thePreviousState)
1040 {
1041   mySketchMgr->widgetStateChanged(thePreviousState);
1042 }
1043
1044 bool PartSet_Module::processEnter(const std::string& thePreviousAttributeID)
1045 {
1046   return mySketchReentrantMgr->processEnter(thePreviousAttributeID);
1047 }