1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_SketcherMgr.cpp
4 // Created: 19 Dec 2014
5 // Author: Vitaly SMETANNIKOV
7 #include "PartSet_SketcherMgr.h"
8 #include "PartSet_SketcherReetntrantMgr.h"
9 #include "PartSet_Module.h"
10 #include "PartSet_WidgetPoint2d.h"
11 #include "PartSet_WidgetPoint2dDistance.h"
12 #include "PartSet_Tools.h"
13 #include "PartSet_WidgetSketchLabel.h"
14 #include "PartSet_WidgetEditor.h"
15 #include "PartSet_ResultSketchPrs.h"
17 #include <XGUI_ModuleConnector.h>
18 #include <XGUI_Displayer.h>
19 #include <XGUI_Workshop.h>
20 #include <XGUI_ContextMenuMgr.h>
21 #include <XGUI_Selection.h>
22 #include <XGUI_SelectionMgr.h>
23 #include <XGUI_ModuleConnector.h>
24 #include <XGUI_PropertyPanel.h>
25 #include <XGUI_ViewerProxy.h>
26 #include <XGUI_OperationMgr.h>
27 #include <XGUI_Tools.h>
29 #include <ModuleBase_IPropertyPanel.h>
30 #include <ModuleBase_ISelection.h>
31 #include <ModuleBase_IViewer.h>
32 #include <ModuleBase_IWorkshop.h>
33 #include <ModuleBase_IViewWindow.h>
34 #include <ModuleBase_ModelWidget.h>
35 #include <ModuleBase_Operation.h>
36 #include <ModuleBase_OperationFeature.h>
37 #include <ModuleBase_Operation.h>
38 #include <ModuleBase_WidgetEditor.h>
39 #include <ModuleBase_ViewerPrs.h>
40 #include <ModuleBase_Tools.h>
42 #include <GeomDataAPI_Point2D.h>
44 #include <Events_Loop.h>
46 #include <SketchPlugin_Line.h>
47 #include <SketchPlugin_Sketch.h>
48 #include <SketchPlugin_Point.h>
49 #include <SketchPlugin_Arc.h>
50 #include <SketchPlugin_Circle.h>
51 #include <SketchPlugin_ConstraintLength.h>
52 #include <SketchPlugin_ConstraintDistance.h>
53 #include <SketchPlugin_ConstraintParallel.h>
54 #include <SketchPlugin_ConstraintPerpendicular.h>
55 #include <SketchPlugin_ConstraintRadius.h>
56 #include <SketchPlugin_ConstraintRigid.h>
57 #include <SketchPlugin_ConstraintHorizontal.h>
58 #include <SketchPlugin_ConstraintVertical.h>
59 #include <SketchPlugin_ConstraintEqual.h>
60 #include <SketchPlugin_ConstraintTangent.h>
61 #include <SketchPlugin_ConstraintCoincidence.h>
62 #include <SketchPlugin_ConstraintFillet.h>
63 #include <SketchPlugin_ConstraintMirror.h>
64 #include <SketchPlugin_ConstraintAngle.h>
65 #include <SketchPlugin_ConstraintCollinear.h>
66 #include <SketchPlugin_ConstraintMiddle.h>
67 #include <SketchPlugin_MultiRotation.h>
68 #include <SketchPlugin_MultiTranslation.h>
69 #include <SketchPlugin_IntersectionPoint.h>
71 #include <SketcherPrs_Tools.h>
73 #include <SelectMgr_IndexedMapOfOwner.hxx>
74 #include <StdSelect_BRepOwner.hxx>
76 //#include <AIS_DimensionSelectionMode.hxx>
77 #include <AIS_Shape.hxx>
78 #include <AIS_Dimension.hxx>
80 #include <ModelAPI_Events.h>
81 #include <ModelAPI_Session.h>
82 #include <ModelAPI_AttributeString.h>
84 #include <QMouseEvent>
85 #include <QApplication>
87 #include <QMessageBox>
89 //#define DEBUG_DO_NOT_BY_ENTER
91 //#define DEBUG_CURSOR
93 /// Returns list of unique objects by sum of objects from List1 and List2
94 /*QList<ModuleBase_ViewerPrsPtr> getSumList(const QList<ModuleBase_ViewerPrsPtr>& theList1,
95 const QList<ModuleBase_ViewerPrsPtr>& theList2)
97 QList<ModuleBase_ViewerPrsPtr> aRes;
98 foreach (ModuleBase_ViewerPrsPtr aPrs, theList1) {
99 if (!aRes.contains(aPrs))
102 foreach (ModuleBase_ViewerPrsPtr aPrs, theList2) {
103 if (!aRes.contains(aPrs))
109 // Fills the list of features the list of selected presentations.
110 // \param theList a list of selected presentations
111 // \param theSketch a sketch to project a vertex shape of a presentation to the plane
112 // and find the corresponded attribute
113 // \param theFeatureList an output list of features
114 void fillFeatureList(const QList<ModuleBase_ViewerPrsPtr>& theList,
115 const FeaturePtr theSketch,
116 QList<FeaturePtr>& theFeatureList)
118 QList<ModuleBase_ViewerPrsPtr> aRes;
120 QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theList.begin(),
121 aLast = theList.end();
122 for (; anIt != aLast; anIt++)
124 ModuleBase_ViewerPrsPtr aPrs = *anIt;
125 FeaturePtr aFeature = ModelAPI_Feature::feature(aPrs->object());
126 if (aFeature.get() && !theFeatureList.contains(aFeature))
127 theFeatureList.append(aFeature);
131 /// Fills attribute and result lists by the selected owner. In case if the attribute is found,
132 /// by the owner shape, it is put to the list. Otherwise if type of owner shape is edge, put the function
133 /// result as is to the list of results.
134 /// \param theOwner a viewer selected owner
135 /// \param theFeature a feature, where the attribute is searched
136 /// \param theSketch a current sketch
137 /// \param theSelectedAttribute an output list of attributes
138 /// \param theSelectedResults an output list of edge results
139 void getAttributesOrResults(const Handle(SelectMgr_EntityOwner)& theOwner,
140 const FeaturePtr& theFeature, const FeaturePtr& theSketch,
141 const ResultPtr& theResult,
142 std::set<AttributePtr>& aSelectedAttributes,
143 std::set<ResultPtr>& aSelectedResults)
145 Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
146 if (aBRepOwner.IsNull())
148 Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(
149 aBRepOwner->Selectable());
150 if (aBRepOwner->HasShape()) {
151 const TopoDS_Shape& aShape = aBRepOwner->Shape();
152 TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
153 if (aShapeType == TopAbs_VERTEX) {
154 AttributePtr aPntAttr = PartSet_Tools::findAttributeBy2dPoint(theFeature,
156 if (aPntAttr.get() != NULL)
157 aSelectedAttributes.insert(aPntAttr);
159 else if (aShapeType == TopAbs_EDGE &&
160 aSelectedResults.find(theResult) == aSelectedResults.end()) {
161 aSelectedResults.insert(theResult);
166 PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule)
167 : QObject(theModule), myModule(theModule), myIsDragging(false), myDragDone(false),
168 myIsMouseOverWindow(false),
169 myIsMouseOverViewProcessed(true), myPreviousUpdateViewerEnabled(true),
170 myIsPopupMenuActive(false)
172 ModuleBase_IWorkshop* anIWorkshop = myModule->workshop();
173 ModuleBase_IViewer* aViewer = anIWorkshop->viewer();
175 myPreviousDrawModeEnabled = true;//aViewer->isSelectionEnabled();
177 connect(aViewer, SIGNAL(mousePress(ModuleBase_IViewWindow*, QMouseEvent*)),
178 this, SLOT(onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*)));
180 connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)),
181 this, SLOT(onMouseReleased(ModuleBase_IViewWindow*, QMouseEvent*)));
183 connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
184 this, SLOT(onMouseMoved(ModuleBase_IViewWindow*, QMouseEvent*)));
186 connect(aViewer, SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*)),
187 this, SLOT(onMouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*)));
189 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(anIWorkshop);
190 XGUI_Workshop* aWorkshop = aConnector->workshop();
191 connect(aWorkshop, SIGNAL(applicationStarted()), this, SLOT(onApplicationStarted()));
193 myIsConstraintsShown[PartSet_Tools::Geometrical] = true;
194 myIsConstraintsShown[PartSet_Tools::Dimensional] = true;
195 myIsConstraintsShown[PartSet_Tools::Expressions] = false;
198 PartSet_SketcherMgr::~PartSet_SketcherMgr()
200 if (!myPlaneFilter.IsNull())
201 myPlaneFilter.Nullify();
204 void PartSet_SketcherMgr::onEnterViewPort()
206 // 1. if the mouse over window, update the next flag. Do not perform update visibility of
207 // created feature because it should be done in onMouseMove(). Some widgets watch
208 // the mouse move and use the cursor position to update own values. If the presentaion is
209 // redisplayed before this update, the feature presentation jumps from reset value to current.
210 myIsMouseOverWindow = true;
212 #ifdef DEBUG_DO_NOT_BY_ENTER
216 if (canChangeCursor(getCurrentOperation())) {
217 QCursor* aCurrentCursor = QApplication::overrideCursor();
218 if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) {
219 QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
221 qDebug("onEnterViewPort() : Qt::CrossCursor");
226 if (!isNestedCreateOperation(getCurrentOperation()))
229 operationMgr()->onValidateOperation();
231 // we need change displayed state of the current operation feature
232 // if the feature is presentable, e.g. distance construction. It has no results, so workshop does
233 // not accept a signal about the result created. Nothing is shown until mouse is moved out/in view
234 // port. If the isDisplayed flag is true, the presentable feature is displayed as soon as the
235 // presentation becomes valid and redisplay happens
236 //ModuleBase_Operation* aOperation = getCurrentOperation();
237 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
238 (getCurrentOperation());
240 FeaturePtr aFeature = aFOperation->feature();
241 if (aFeature.get() && aFeature->data()->isValid()) {
242 visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature), false);
247 void PartSet_SketcherMgr::onLeaveViewPort()
249 myIsMouseOverViewProcessed = false;
250 myIsMouseOverWindow = false;
252 #ifdef DEBUG_DO_NOT_BY_ENTER
256 if (canChangeCursor(getCurrentOperation())) {
257 QApplication::restoreOverrideCursor();
259 qDebug("onLeaveViewPort() : None");
263 if (!isNestedCreateOperation(getCurrentOperation()))
266 // the method should be performed if the popup menu is called,
267 // the reset of the current widget should not happen
268 if (myIsPopupMenuActive)
271 // it is important to validate operation here only if sketch entity create operation is active
272 // because at this operation we reacts to the mouse leave/enter view port
273 operationMgr()->onValidateOperation();
275 // 2. if the mouse IS NOT over window, reset the active widget value and hide the presentation
276 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
277 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
278 XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
279 // disable the viewer update in order to avoid visualization of redisplayed feature in viewer
280 // obtained after reset value
281 bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false);
282 ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
284 anActiveWidget->reset();
286 // hides the presentation of the current operation feature
287 // the feature is to be erased here, but it is correct to call canDisplayObject because
288 // there can be additional check (e.g. editor widget in distance constraint)
289 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
290 (getCurrentOperation());
292 FeaturePtr aFeature = aFOperation->feature();
293 visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature));
295 // we should update viewer after the presentation are hidden in the viewer
296 // otherwise the reset presentation(line) appears in the viewer(by quick move from viewer to PP)
297 aDisplayer->enableUpdateViewer(isEnableUpdateViewer);
300 void PartSet_SketcherMgr::onBeforeValuesChangedInPropertyPanel()
302 if (!isNestedEditOperation(getCurrentOperation()) ||
303 myModule->sketchReentranceMgr()->isInternalEditActive())
305 // it is necessary to save current selection in order to restore it after the values are modifed
308 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
309 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
310 XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
311 myPreviousUpdateViewerEnabled = aDisplayer->enableUpdateViewer(false);
314 void PartSet_SketcherMgr::onAfterValuesChangedInPropertyPanel()
316 if (!isNestedEditOperation(getCurrentOperation()) ||
317 myModule->sketchReentranceMgr()->isInternalEditActive()) {
318 myModule->sketchReentranceMgr()->updateInternalEditActiveState();
321 // it is necessary to restore current selection in order to restore it after the values are modified
323 myCurrentSelection.clear();
325 // 3. the flag to disable the update viewer should be set in order to avoid blinking in the
326 // viewer happens by deselect/select the modified objects. The flag should be restored after
327 // the selection processing. The update viewer should be also called.
328 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
329 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
330 XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
331 aDisplayer->enableUpdateViewer(myPreviousUpdateViewerEnabled);
332 aDisplayer->updateViewer();
337 void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
339 if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent))
342 //get2dPoint(theWnd, theEvent, myClickedPoint);
344 if (!(theEvent->buttons() & Qt::LeftButton))
347 // Clear dragging mode
348 myIsDragging = false;
350 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
351 ModuleBase_IViewer* aViewer = aWorkshop->viewer();
352 if (!aViewer->canDragByMouse())
355 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
356 (getCurrentOperation());
360 if (aFOperation->isEditOperation()) {
361 // If the current widget is a selector, do nothing, it processes the mouse press
362 ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
363 if(anActiveWidget && anActiveWidget->isViewerSelector()) {
368 // Use only for sketch operations
369 if (myCurrentSketch) {
370 if (!PartSet_Tools::sketchPlane(myCurrentSketch))
373 bool isSketcher = isSketchOperation(aFOperation);
374 bool isSketchOpe = isNestedSketchOperation(aFOperation);
376 // Avoid non-sketch operations
377 if ((!isSketchOpe) && (!isSketcher))
380 bool isEditing = aFOperation->isEditOperation();
382 // Ignore creation sketch operation
383 if ((!isSketcher) && (!isEditing))
386 Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
387 if (!aContext.IsNull()) {
388 // MoveTo in order to highlight current object
389 aContext->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
390 ModuleBase_Tools::selectionInfo(aContext, "PartSet_SketcherMgr::onMousePressed -- MoveTo");
392 // Remember highlighted objects for editing
393 ModuleBase_ISelection* aSelect = aWorkshop->selection();
395 bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
396 storeSelection(!aHasShift);
398 if (myCurrentSelection.empty()) {
399 if (isSketchOpe && (!isSketcher))
400 // commit previous operation
401 if (!aFOperation->commit())
402 aFOperation->abort();
405 // Init flyout point for radius rotation
406 FeaturePtr aFeature = myCurrentSelection.begin().key();
410 get2dPoint(theWnd, theEvent, myCurrentPoint);
413 myPreviousDrawModeEnabled = aViewer->enableDrawMode(false);
415 if (aFeature.get() != NULL) {
416 std::shared_ptr<SketchPlugin_Feature> aSPFeature =
417 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
418 if (aSPFeature.get() && aSPFeature->getKind() == SketchPlugin_ConstraintRadius::ID()) {
419 DataPtr aData = aSPFeature->data();
420 AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
421 std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
422 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
423 aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY);
426 } else if (isSketchOpe && isEditing) {
427 // If selected another object commit current result
428 aFOperation->commit();
431 get2dPoint(theWnd, theEvent, myCurrentPoint);
434 myPreviousDrawModeEnabled = aViewer->enableDrawMode(false);
436 // this is temporary commented in order to avoid the following wrong case:
437 // Distance constraint is under edition, double click on the digit -> nothing happens
438 // because QApplication::processEvents() calls onMouseDoubleClick, which try to show editor
439 // but as the prev edit is commited an new one is not started, editor is not shown.
440 // This is necessary in order to finalize previous operation
441 //QApplication::processEvents();
447 void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
449 if (myModule->sketchReentranceMgr()->processMouseReleased(theWnd, theEvent))
452 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
453 ModuleBase_IViewer* aViewer = aWorkshop->viewer();
454 if (!aViewer->canDragByMouse())
456 ModuleBase_Operation* aOp = getCurrentOperation();
458 if (isNestedSketchOperation(aOp)) {
459 //get2dPoint(theWnd, theEvent, myClickedPoint);
461 // Only for sketcher operations
465 myCurrentSelection.clear();
466 /*Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
467 if (!aContext.IsNull()) {
468 // Reselect edited object
469 aContext->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
470 if (theEvent->modifiers() & Qt::ShiftModifier)
471 aContext->ShiftSelect();
480 aWorkshop->viewer()->enableDrawMode(myPreviousDrawModeEnabled);
481 myIsDragging = false;
484 void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
486 if (myModule->sketchReentranceMgr()->processMouseMoved(theWnd, theEvent))
489 if (isNestedCreateOperation(getCurrentOperation()) && !myIsMouseOverViewProcessed) {
490 myIsMouseOverViewProcessed = true;
491 // 1. perform the widget mouse move functionality and display the presentation
492 // the mouse move should be processed in the widget, if it can in order to visualize correct
493 // presentation. These widgets correct the feature attribute according to the mouse position
494 ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
495 PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(anActiveWidget);
497 aPoint2DWdg->onMouseMove(theWnd, theEvent);
499 PartSet_WidgetPoint2dDistance* aDistanceWdg = dynamic_cast<PartSet_WidgetPoint2dDistance*>
502 aDistanceWdg->onMouseMove(theWnd, theEvent);
504 // the feature is to be erased here, but it is correct to call canDisplayObject because
505 // there can be additional check (e.g. editor widget in distance constraint)
506 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
507 (getCurrentOperation());
509 FeaturePtr aFeature = aFOperation->feature();
510 visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature));
514 //myClickedPoint.clear();
517 // 1. the current selection is saved in the mouse press method in order to restore it after moving
518 // 2. the enable selection in the viewer should be temporary switched off in order to ignore
519 // mouse press signal in the viewer(it call Select for AIS context and the dragged objects are
520 // deselected). This flag should be restored in the slot, processed the mouse release signal.
522 ModuleBase_Operation* aCurrentOperation = getCurrentOperation();
523 if (!aCurrentOperation)
525 if (isSketchOperation(aCurrentOperation))
526 return; // No edit operation activated
528 Handle(V3d_View) aView = theWnd->v3dView();
529 gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
531 PartSet_Tools::convertTo2D(aPoint, myCurrentSketch, aView, aX, aY);
532 double dX = aX - myCurrentPoint.myCurX;
533 double dY = aY - myCurrentPoint.myCurY;
535 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
536 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
537 XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
538 // 3. the flag to disable the update viewer should be set in order to avoid blinking in the
539 // viewer happens by deselect/select the modified objects. The flag should be restored after
540 // the selection processing. The update viewer should be also called.
541 bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false);
543 static Events_ID aMoveEvent = Events_Loop::eventByName(EVENT_OBJECT_MOVED);
544 //static Events_ID aUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
545 FeatureToSelectionMap::const_iterator anIt = myCurrentSelection.begin(),
546 aLast = myCurrentSelection.end();
547 // 4. the features and attributes modification(move)
548 bool isModified = false;
549 for (; anIt != aLast; anIt++) {
550 FeaturePtr aFeature = anIt.key();
552 std::set<AttributePtr> anAttributes = anIt.value().first;
553 // Process selection by attribute: the priority to the attribute
554 if (!anAttributes.empty()) {
555 std::set<AttributePtr>::const_iterator anAttIt = anAttributes.begin(),
556 anAttLast = anAttributes.end();
557 for (; anAttIt != anAttLast; anAttIt++) {
558 AttributePtr anAttr = *anAttIt;
559 if (anAttr.get() == NULL)
561 std::string aAttrId = anAttr->id();
562 DataPtr aData = aFeature->data();
563 if (aData->isValid()) {
564 std::shared_ptr<GeomDataAPI_Point2D> aPoint =
565 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(aAttrId));
566 if (aPoint.get() != NULL) {
567 bool isImmutable = aPoint->setImmutable(true);
568 aPoint->move(dX, dY);
570 ModelAPI_EventCreator::get()->sendUpdated(aFeature, aMoveEvent);
571 aPoint->setImmutable(isImmutable);
576 // Process selection by feature
577 std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
578 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
579 if (aSketchFeature) {
580 aSketchFeature->move(dX, dY);
582 ModelAPI_EventCreator::get()->sendUpdated(aSketchFeature, aMoveEvent);
586 // the modified state of the current operation should be updated if there are features, which
589 aCurrentOperation->onValuesChanged();
591 Events_Loop::loop()->flush(aMoveEvent); // up all move events - to be processed in the solver
592 //Events_Loop::loop()->flush(aUpdateEvent); // up update events - to redisplay presentations
594 // 5. it is necessary to save current selection in order to restore it after the features moving
596 // 6. restore the update viewer flag and call this update
597 aDisplayer->enableUpdateViewer(isEnableUpdateViewer);
598 aDisplayer->updateViewer();
601 myCurrentPoint.setValue(aX, aY);
605 void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
607 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
608 (getCurrentOperation());
609 if (aFOperation && aFOperation->isEditOperation()) {
610 std::string aId = aFOperation->id().toStdString();
611 if (isDistanceOperation(aFOperation))
613 // Activate dimension value editing on double click
614 ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
615 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
616 // Find corresponded widget to activate value editing
617 foreach (ModuleBase_ModelWidget* aWgt, aWidgets) {
618 if (aWgt->attributeID() == SketchPlugin_Constraint::VALUE() ||
619 aWgt->attributeID() == SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()) {
620 PartSet_WidgetEditor* anEditor = dynamic_cast<PartSet_WidgetEditor*>(aWgt);
622 anEditor->showPopupEditor();
630 void PartSet_SketcherMgr::onApplicationStarted()
632 ModuleBase_IWorkshop* anIWorkshop = myModule->workshop();
633 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(anIWorkshop);
634 XGUI_Workshop* aWorkshop = aConnector->workshop();
635 PartSet_SketcherReetntrantMgr* aReentranceMgr = myModule->sketchReentranceMgr();
637 XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
638 if (aPropertyPanel) {
639 //connect(aPropertyPanel, SIGNAL(beforeWidgetActivated(ModuleBase_ModelWidget*)),
640 // this, SLOT(onBeforeWidgetActivated(ModuleBase_ModelWidget*)));
642 connect(aPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)),
643 aReentranceMgr, SLOT(onNoMoreWidgets(const std::string&)));
644 connect(aPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)),
645 aReentranceMgr, SLOT(onWidgetActivated()));
648 XGUI_ViewerProxy* aViewerProxy = aWorkshop->viewer();
649 connect(aViewerProxy, SIGNAL(enterViewPort()), this, SLOT(onEnterViewPort()));
650 connect(aViewerProxy, SIGNAL(leaveViewPort()), this, SLOT(onLeaveViewPort()));
652 XGUI_ContextMenuMgr* aContextMenuMgr = aWorkshop->contextMenuMgr();
653 connect(aContextMenuMgr, SIGNAL(beforeContextMenu()), this, SLOT(onBeforeContextMenu()));
654 connect(aContextMenuMgr, SIGNAL(afterContextMenu()), this, SLOT(onAfterContextMenu()));
657 //void PartSet_SketcherMgr::onBeforeWidgetActivated(ModuleBase_ModelWidget* theWidget)
659 //if (!myClickedPoint.myIsInitialized)
662 //ModuleBase_Operation* aOperation = getCurrentOperation();
663 // the distance constraint feature should not use the clickedd point
664 // this is workaround in order to don't throw down the flyout point value,
665 // set by execute() method of these type of features
666 //if (isDistanceOperation(aOperation))
669 //PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast<PartSet_WidgetPoint2D*>(theWidget);
671 // aPnt2dWgt->setPoint(myClickedPoint.myCurX, myClickedPoint.myCurY);
675 void PartSet_SketcherMgr::onBeforeContextMenu()
677 myIsPopupMenuActive = true;
680 void PartSet_SketcherMgr::onAfterContextMenu()
682 myIsPopupMenuActive = false;
685 void PartSet_SketcherMgr::get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
688 Handle(V3d_View) aView = theWnd->v3dView();
689 gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
691 PartSet_Tools::convertTo2D(aPoint, myCurrentSketch, aView, aX, anY);
692 thePoint.setValue(aX, anY);
695 void PartSet_SketcherMgr::launchEditing()
697 if (!myCurrentSelection.empty()) {
698 FeaturePtr aFeature = myCurrentSelection.begin().key();
699 std::shared_ptr<SketchPlugin_Feature> aSPFeature =
700 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
701 if (aSPFeature && (!aSPFeature->isExternal())) {
702 myModule->editFeature(aSPFeature);
707 bool PartSet_SketcherMgr::sketchSolverError()
709 bool anError = false;
710 CompositeFeaturePtr aSketch = activeSketch();
712 AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
713 anError = !aAttributeString->value().empty();
718 QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature)
720 QString anError = "";
721 if (!theFeature.get() || !theFeature->data()->isValid())
724 CompositeFeaturePtr aSketch = activeSketch();
725 if (aSketch.get() && aSketch == theFeature) {
726 AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
727 anError = aAttributeString->value().c_str();
732 void PartSet_SketcherMgr::clearClickedFlags()
734 //myClickedPoint.clear();
735 myCurrentPoint.clear();
738 const QStringList& PartSet_SketcherMgr::sketchOperationIdList()
740 static QStringList aIds;
741 if (aIds.size() == 0) {
742 aIds << SketchPlugin_Line::ID().c_str();
743 aIds << SketchPlugin_Point::ID().c_str();
744 aIds << SketchPlugin_Arc::ID().c_str();
745 aIds << SketchPlugin_Circle::ID().c_str();
746 aIds << SketchPlugin_ConstraintFillet::ID().c_str();
747 aIds << SketchPlugin_IntersectionPoint::ID().c_str();
749 // SketchRectangle is a python feature, so its ID is passed just as a string
750 aIds << "SketchRectangle";
751 aIds.append(replicationsIdList());
752 aIds.append(constraintsIdList());
757 const QStringList& PartSet_SketcherMgr::replicationsIdList()
759 static QStringList aReplicationIds;
760 if (aReplicationIds.size() == 0) {
761 aReplicationIds << SketchPlugin_ConstraintMirror::ID().c_str();
762 aReplicationIds << SketchPlugin_MultiRotation::ID().c_str();
763 aReplicationIds << SketchPlugin_MultiTranslation::ID().c_str();
765 return aReplicationIds;
768 const QStringList& PartSet_SketcherMgr::constraintsIdList()
770 static QStringList aConstraintIds;
771 if (aConstraintIds.size() == 0) {
772 aConstraintIds << SketchPlugin_ConstraintLength::ID().c_str();
773 aConstraintIds << SketchPlugin_ConstraintDistance::ID().c_str();
774 aConstraintIds << SketchPlugin_ConstraintRigid::ID().c_str();
775 aConstraintIds << SketchPlugin_ConstraintRadius::ID().c_str();
776 aConstraintIds << SketchPlugin_ConstraintPerpendicular::ID().c_str();
777 aConstraintIds << SketchPlugin_ConstraintParallel::ID().c_str();
778 aConstraintIds << SketchPlugin_ConstraintHorizontal::ID().c_str();
779 aConstraintIds << SketchPlugin_ConstraintVertical::ID().c_str();
780 aConstraintIds << SketchPlugin_ConstraintEqual::ID().c_str();
781 aConstraintIds << SketchPlugin_ConstraintTangent::ID().c_str();
782 aConstraintIds << SketchPlugin_ConstraintCoincidence::ID().c_str();
783 aConstraintIds << SketchPlugin_ConstraintAngle::ID().c_str();
784 aConstraintIds << SketchPlugin_ConstraintCollinear::ID().c_str();
785 aConstraintIds << SketchPlugin_ConstraintMiddle::ID().c_str();
787 return aConstraintIds;
790 void PartSet_SketcherMgr::sketchSelectionModes(QIntList& theModes)
794 theModes.append(SketcherPrs_Tools::Sel_Dimension_Text);
795 theModes.append(SketcherPrs_Tools::Sel_Dimension_Line);
796 theModes.append(SketcherPrs_Tools::Sel_Constraint);
797 theModes.append(TopAbs_VERTEX);
798 theModes.append(TopAbs_EDGE);
801 Handle(AIS_InteractiveObject) PartSet_SketcherMgr::createPresentation(const ResultPtr& theResult)
803 Handle(AIS_InteractiveObject) aPrs;
805 FeaturePtr aFeature = ModelAPI_Feature::feature(theResult);
806 if (aFeature.get() && aFeature->getKind() == SketchPlugin_Sketch::ID()) {
807 aPrs = new PartSet_ResultSketchPrs(theResult);
812 bool PartSet_SketcherMgr::isSketchOperation(ModuleBase_Operation* theOperation)
814 return theOperation && theOperation->id().toStdString() == SketchPlugin_Sketch::ID();
817 bool PartSet_SketcherMgr::isNestedSketchOperation(ModuleBase_Operation* theOperation)
819 return theOperation &&
820 PartSet_SketcherMgr::sketchOperationIdList().contains(theOperation->id());
823 bool PartSet_SketcherMgr::isNestedCreateOperation(ModuleBase_Operation* theOperation)
825 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
827 return aFOperation && !aFOperation->isEditOperation() && isNestedSketchOperation(aFOperation);
830 bool PartSet_SketcherMgr::isNestedEditOperation(ModuleBase_Operation* theOperation)
832 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
834 return aFOperation && aFOperation->isEditOperation() && isNestedSketchOperation(aFOperation);
837 bool PartSet_SketcherMgr::isEntity(const std::string& theId)
839 return (theId == SketchPlugin_Line::ID()) ||
840 (theId == SketchPlugin_Point::ID()) ||
841 (theId == SketchPlugin_Arc::ID()) ||
842 (theId == SketchPlugin_Circle::ID());
845 bool PartSet_SketcherMgr::isDistanceOperation(ModuleBase_Operation* theOperation)
847 std::string anId = theOperation ? theOperation->id().toStdString() : "";
849 return isDistanceKind(anId);
852 bool PartSet_SketcherMgr::isDistanceKind(std::string& theKind)
854 return (theKind == SketchPlugin_ConstraintLength::ID()) ||
855 (theKind == SketchPlugin_ConstraintDistance::ID()) ||
856 (theKind == SketchPlugin_ConstraintRadius::ID()) ||
857 (theKind == SketchPlugin_ConstraintAngle::ID());
860 void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
862 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
863 (getCurrentOperation());
867 myModule->onViewTransformed();
869 // Display all sketcher sub-Objects
870 myCurrentSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFOperation->feature());
871 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
873 // Hide sketcher result
874 std::list<ResultPtr> aResults = myCurrentSketch->results();
875 std::list<ResultPtr>::const_iterator aIt;
876 for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
877 (*aIt)->setDisplayed(false);
879 myCurrentSketch->setDisplayed(false);
881 // Display sketcher objects
882 for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
883 FeaturePtr aFeature = myCurrentSketch->subFeature(i);
884 std::list<ResultPtr> aResults = aFeature->results();
885 std::list<ResultPtr>::const_iterator aIt;
886 for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
887 (*aIt)->setDisplayed(true);
889 aFeature->setDisplayed(true);
892 if(myCirclePointFilter.IsNull()) {
893 myCirclePointFilter = new PartSet_CirclePointFilter(myModule->workshop());
896 myModule->workshop()->viewer()->addSelectionFilter(myCirclePointFilter);
898 if (myPlaneFilter.IsNull())
899 myPlaneFilter = new ModuleBase_ShapeInPlaneFilter();
901 myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter);
902 bool aHasPlane = false;
903 std::shared_ptr<GeomAPI_Pln> aPln;
904 aPln = PartSet_Tools::sketchPlane(myCurrentSketch);
905 myPlaneFilter->setPlane(aPln);
907 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
908 // all displayed objects should be activated in current selection modes according to switched
911 aConnector->activateModuleSelectionModes();
914 void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
916 myIsMouseOverWindow = false;
917 myIsConstraintsShown[PartSet_Tools::Geometrical] = true;
918 myIsConstraintsShown[PartSet_Tools::Dimensional] = true;
919 myIsConstraintsShown[PartSet_Tools::Expressions] = false;
921 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
923 DataPtr aData = myCurrentSketch->data();
924 if (!aData->isValid()) {
925 XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
926 // The sketch was aborted
927 myCurrentSketch = CompositeFeaturePtr();
928 // TODO: move this outside of if-else
929 myModule->workshop()->viewer()->removeSelectionFilter(myCirclePointFilter);
930 myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
932 // Erase all sketcher objects
933 QStringList aSketchIds = sketchOperationIdList();
934 QObjectPtrList aObjects = aDisplayer->displayedObjects();
935 foreach (ObjectPtr aObj, aObjects) {
936 DataPtr aObjData = aObj->data();
937 if (!aObjData->isValid())
938 aObj->setDisplayed(false);
942 // Hide all sketcher sub-Objects
943 for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
944 FeaturePtr aFeature = myCurrentSketch->subFeature(i);
945 std::list<ResultPtr> aResults = aFeature->results();
946 std::list<ResultPtr>::const_iterator aIt;
947 for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
948 (*aIt)->setDisplayed(false);
950 aFeature->setDisplayed(false);
952 // Display sketcher result
953 std::list<ResultPtr> aResults = myCurrentSketch->results();
954 std::list<ResultPtr>::const_iterator aIt;
955 Events_Loop* aLoop = Events_Loop::loop();
956 static Events_ID aDispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
958 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
960 for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
961 if (!aFOperation->isDisplayedOnStart(*aIt)) {
962 (*aIt)->setDisplayed(true);
963 // this display event is needed because sketch already may have "displayed" state,
964 // but not displayed while it is still active (issue 613, abort of existing sketch)
965 ModelAPI_EventCreator::get()->sendUpdated(*aIt, aDispEvent);
968 if (!aFOperation->isDisplayedOnStart(myCurrentSketch))
969 myCurrentSketch->setDisplayed(true);
971 myCurrentSketch = CompositeFeaturePtr();
973 myModule->workshop()->viewer()->removeSelectionFilter(myCirclePointFilter);
974 myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
976 Events_Loop::loop()->flush(aDispEvent);
978 // restore the module selection modes, which were changed on startSketch
979 aConnector->activateModuleSelectionModes();
982 void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
984 if (canChangeCursor(theOperation) && myIsMouseOverWindow) {
985 QCursor* aCurrentCursor = QApplication::overrideCursor();
986 if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) {
987 QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
989 qDebug("startNestedSketch() : Qt::CrossCursor");
995 void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation)
997 myIsMouseOverViewProcessed = true;
998 operationMgr()->onValidateOperation();
999 if (canChangeCursor(theOperation)) {
1000 QApplication::restoreOverrideCursor();
1002 qDebug("stopNestedSketch() : None");
1007 void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation)
1009 if (isNestedCreateOperation(theOperation)) {
1010 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
1013 FeaturePtr aFeature = aFOperation->feature();
1014 // it is necessary to check the the feature data validity because
1015 // some kind of features are removed by an operation commit(the macro state of a feature)
1016 if (aFeature.get() && aFeature->data()->isValid()) {
1017 visualizeFeature(aFeature, aFOperation->isEditOperation(), true);
1023 void PartSet_SketcherMgr::activatePlaneFilter(const bool& toActivate)
1026 myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter);
1028 myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
1031 bool PartSet_SketcherMgr::operationActivatedByPreselection()
1033 bool isOperationStopped = false;
1034 ModuleBase_Operation* anOperation = getCurrentOperation();
1035 if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
1036 // Set final definitions if they are necessary
1037 //propertyPanelDefined(aOperation);
1038 /// Commit sketcher operations automatically
1039 /// distance operation are able to show popup editor to modify the distance value
1040 /// after entering the value, the operation should be committed/aborted(by Esc key)
1041 bool aCanCommitOperation = true;
1042 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
1044 if (aFOperation && PartSet_SketcherMgr::isDistanceOperation(aFOperation)) {
1045 bool aValueAccepted = setDistanceValueByPreselection(anOperation, myModule->workshop(),
1046 aCanCommitOperation);
1047 if (!aValueAccepted)
1048 return isOperationStopped;
1051 if (aCanCommitOperation)
1052 isOperationStopped = anOperation->commit();
1054 anOperation->abort();
1055 isOperationStopped = true;
1058 return isOperationStopped;
1061 bool PartSet_SketcherMgr::canUndo() const
1063 return isNestedCreateOperation(getCurrentOperation());
1066 bool PartSet_SketcherMgr::canRedo() const
1068 return isNestedCreateOperation(getCurrentOperation());
1071 bool PartSet_SketcherMgr::canEraseObject(const ObjectPtr& theObject) const
1073 bool aCanErase = true;
1074 // when the sketch operation is active, results of sketch sub-feature can not be hidden
1075 if (myCurrentSketch.get()) {
1076 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
1077 if (aResult.get()) {
1078 // Display sketcher objects
1079 for (int i = 0; i < myCurrentSketch->numberOfSubs() && aCanErase; i++) {
1081 FeaturePtr aFeature = myCurrentSketch->subFeature(i);
1082 std::list<ResultPtr> aResults = aFeature->results();
1083 std::list<ResultPtr>::const_iterator anIt;
1084 for (anIt = aResults.begin(); anIt != aResults.end() && aCanErase; ++anIt) {
1085 aCanErase = *anIt != aResult;
1093 bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const
1095 bool aCanDisplay = true;
1097 bool aHasActiveSketch = activeSketch().get() != NULL;
1098 if (aHasActiveSketch) {
1099 // 1. the sketch feature should not be displayed during the sketch active operation
1100 // it is hidden by a sketch operation start and shown by a sketch stop, just the sketch
1101 // nested features can be visualized
1102 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
1103 if (aFeature.get() != NULL && aFeature == activeSketch()) {
1104 aCanDisplay = false;
1106 std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
1107 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
1108 /// some sketch entities should be never shown, e.g. projection feature
1109 if (aSketchFeature.get())
1110 aCanDisplay = aSketchFeature->canBeDisplayed();
1112 else { // there are no an active sketch
1113 // 2. sketch sub-features should not be visualized if the sketch operation is not active
1114 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
1115 if (aFeature.get() != NULL) {
1116 std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
1117 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
1118 if (aSketchFeature.get()) {
1119 aCanDisplay = false;
1124 // 3. the method should not filter the objects, which are not related to the current operation.
1125 // The object is filtered just if it is a current operation feature or this feature result
1127 bool isObjectFound = false;
1128 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
1129 (getCurrentOperation());
1131 FeaturePtr aFeature = aFOperation->feature();
1132 if (aFeature.get()) {
1133 std::list<ResultPtr> aResults = aFeature->results();
1134 if (theObject == aFeature)
1135 isObjectFound = true;
1137 std::list<ResultPtr>::const_iterator anIt = aResults.begin(), aLast = aResults.end();
1138 for (; anIt != aLast && !isObjectFound; anIt++) {
1139 isObjectFound = *anIt == theObject;
1144 if (isObjectFound) {
1145 // 4. For created nested feature operation do not display the created feature if
1146 // the mouse curstor leaves the OCC window.
1147 // The correction cases, which ignores this condition:
1148 // a. the property panel values modification
1149 // b. the popup menu activated
1150 // c. widget editor control
1151 #ifndef DEBUG_DO_NOT_BY_ENTER
1152 if (isNestedCreateOperation(getCurrentOperation())) {
1153 ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
1154 ModuleBase_WidgetEditor* anEditorWdg = anActiveWidget ? dynamic_cast<ModuleBase_WidgetEditor*>(anActiveWidget) : 0;
1155 // the active widget editor should not influence here. The presentation should be visible always
1156 // when this widget is active.
1157 if (!anEditorWdg && !myIsPopupMenuActive) {
1158 // during a nested create operation, the feature is redisplayed only if the mouse over view
1159 // of there was a value modified in the property panel after the mouse left the view
1160 aCanDisplay = canDisplayCurrentCreatedFeature();
1167 // checks the sketcher constraints visibility according to active sketch check box states
1169 bool aProcessed = false;
1170 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
1171 if (aFeature.get()) {
1172 bool aConstraintDisplayed = canDisplayConstraint(aFeature, PartSet_Tools::Any, aProcessed);
1174 aCanDisplay = aConstraintDisplayed;
1181 bool PartSet_SketcherMgr::canDisplayConstraint(const FeaturePtr& theFeature,
1182 const PartSet_Tools::ConstraintVisibleState& theState,
1183 bool& isProcessed) const
1185 bool aSwitchedOn = true;
1187 const QStringList& aConstrIds = constraintsIdList();
1189 std::string aKind = theFeature->getKind();
1190 if (aConstrIds.contains(QString(aKind.c_str()))) {
1191 bool isTypedConstraint = false;
1194 case PartSet_Tools::Dimensional: {
1195 bool isDistance = isDistanceKind(aKind);
1198 aSwitchedOn = myIsConstraintsShown[theState];
1202 case PartSet_Tools::Geometrical: {
1203 bool isGeometrical = !isDistanceKind(aKind);
1204 if (isGeometrical) {
1206 aSwitchedOn = myIsConstraintsShown[theState];
1210 case PartSet_Tools::Any: {
1212 bool isDistance = isDistanceKind(aKind);
1214 aSwitchedOn = myIsConstraintsShown[PartSet_Tools::Dimensional];
1216 aSwitchedOn = myIsConstraintsShown[PartSet_Tools::Geometrical];
1226 /*void PartSet_SketcherMgr::processHiddenObject(const std::list<ObjectPtr>& theObjects)
1228 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
1229 (getCurrentOperation());
1230 if (aFOperation && myCurrentSketch.get()) {
1231 // find results of the current operation
1232 // these results should not be proposed to be deleted
1233 FeaturePtr anOperationFeature = aFOperation->feature();
1234 std::list<ResultPtr> anOperationResultList = anOperationFeature->results();
1235 std::set<ResultPtr> anOperationResults;
1236 std::list<ResultPtr>::const_iterator aRIt = anOperationResultList.begin(),
1237 aRLast = anOperationResultList.end();
1238 for (; aRIt != aRLast; aRIt++)
1239 anOperationResults.insert(*aRIt);
1241 std::set<FeaturePtr> anObjectsToBeDeleted;
1242 QStringList anObjectsToBeDeletedNames;
1243 std::list<ObjectPtr>::const_iterator anIt = theObjects.begin(), aLast = theObjects.end();
1244 for (; anIt != aLast; anIt++) {
1245 ObjectPtr anObject = *anIt;
1246 bool aCanErase = true;
1247 // when the sketch operation is active, results of sketch sub-feature can not be hidden
1248 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
1249 // the result is found between current feature results
1250 if (anOperationResults.find(aResult) != anOperationResults.end())
1253 if (aResult.get()) {
1254 // Display sketcher objects
1255 for (int i = 0; i < myCurrentSketch->numberOfSubs() && aCanErase; i++) {
1256 FeaturePtr aFeature = myCurrentSketch->subFeature(i);
1257 std::list<ResultPtr> aResults = aFeature->results();
1258 std::list<ResultPtr>::const_iterator anIt;
1259 for (anIt = aResults.begin(); anIt != aResults.end() && aCanErase; ++anIt) {
1260 aCanErase = *anIt != aResult;
1265 FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
1266 if (aFeature.get() && anObjectsToBeDeleted.find(aFeature) == anObjectsToBeDeleted.end()) {
1267 anObjectsToBeDeleted.insert(aFeature);
1268 anObjectsToBeDeletedNames.append(aFeature->name().c_str());
1272 if (!anObjectsToBeDeleted.empty()) {
1273 QString aFeatureNames = anObjectsToBeDeletedNames.join(", ");
1274 QString aMessage = tr("The following features have incorrect presentation and \
1275 will be hidden: %1. Would you like to delete them?")
1276 .arg(aFeatureNames);
1277 int anAnswer = QMessageBox::question(qApp->activeWindow(), tr("Features hide"),
1278 aMessage, QMessageBox::Ok | QMessageBox::Cancel,
1279 QMessageBox::Cancel);
1280 if (anAnswer == QMessageBox::Ok) {
1281 QObjectPtrList anObjects;
1282 std::set<FeaturePtr>::const_iterator anIt = anObjectsToBeDeleted.begin(),
1283 aLast = anObjectsToBeDeleted.end();
1284 for (; anIt != aLast; anIt++)
1285 anObjects.append(*anIt);
1286 SessionPtr aMgr = ModelAPI_Session::get();
1287 DocumentPtr aDoc = aMgr->activeDocument();
1288 bool aIsOp = aMgr->isOperation();
1290 aMgr->startOperation();
1291 workshop()->deleteFeatures(anObjects);
1292 //static Events_ID aDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
1293 //static Events_ID aRedispEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
1294 //Events_Loop::loop()->flush(aDeletedEvent);
1295 //Events_Loop::loop()->flush(aRedispEvent);
1298 aMgr->finishOperation();
1304 bool PartSet_SketcherMgr::canDisplayCurrentCreatedFeature() const
1306 bool aCanDisplay = myIsMouseOverWindow;
1308 ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
1310 aCanDisplay = anActiveWidget->getValueState() == ModuleBase_ModelWidget::Stored;
1315 bool PartSet_SketcherMgr::canChangeCursor(ModuleBase_Operation* theOperation) const
1317 return isNestedCreateOperation(theOperation) ||
1318 myModule->sketchReentranceMgr()->isInternalEditActive();
1321 const QMap<PartSet_Tools::ConstraintVisibleState, bool>& PartSet_SketcherMgr::showConstraintStates()
1323 return myIsConstraintsShown;
1326 bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const
1328 bool isFoundObject = false;
1330 FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObject);
1331 if (anObjectFeature.get()) {
1332 int aSize = myCurrentSketch->numberOfSubs();
1333 for (int i = 0; i < myCurrentSketch->numberOfSubs() && !isFoundObject; i++) {
1334 FeaturePtr aCurrentFeature = myCurrentSketch->subFeature(i);
1335 isFoundObject = myCurrentSketch->subFeature(i) == anObjectFeature;
1338 return isFoundObject;
1341 void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln)
1343 if (myPlaneFilter.IsNull())
1344 myPlaneFilter = new ModuleBase_ShapeInPlaneFilter();
1346 myPlaneFilter->setPlane(thePln);
1349 bool PartSet_SketcherMgr::setDistanceValueByPreselection(ModuleBase_Operation* theOperation,
1350 ModuleBase_IWorkshop* theWorkshop,
1351 bool& theCanCommitOperation)
1353 bool isValueAccepted = false;
1354 theCanCommitOperation = false;
1356 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
1358 FeaturePtr aFeature = aFOperation->feature();
1359 // editor is shown only if all attribute references are filled by preseletion
1360 bool anAllRefAttrInitialized = true;
1362 std::list<AttributePtr> aRefAttrs = aFeature->data()->attributes(
1363 ModelAPI_AttributeRefAttr::typeId());
1364 std::list<AttributePtr>::const_iterator anIt = aRefAttrs.begin(), aLast = aRefAttrs.end();
1365 for (; anIt != aLast && anAllRefAttrInitialized; anIt++) {
1366 anAllRefAttrInitialized = (*anIt)->isInitialized();
1368 if (anAllRefAttrInitialized) {
1369 // Activate dimension value editing on double click
1370 ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
1371 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
1372 // Find corresponded widget to activate value editing
1373 foreach (ModuleBase_ModelWidget* aWgt, aWidgets) {
1374 if (aWgt->attributeID() == "ConstraintValue") {
1375 // the featue should be displayed in order to find the AIS text position,
1376 // the place where the editor will be shown
1377 aFeature->setDisplayed(true);
1378 /// the execute is necessary to perform in the feature compute for flyout position
1379 aFeature->execute();
1381 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
1382 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
1384 PartSet_WidgetEditor* anEditor = dynamic_cast<PartSet_WidgetEditor*>(aWgt);
1386 int aX = 0, anY = 0;
1388 XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(theWorkshop);
1389 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
1390 AISObjectPtr anAIS = aDisplayer->getAISObject(aFeature);
1391 Handle(AIS_InteractiveObject) anAISIO;
1392 if (anAIS.get() != NULL) {
1393 anAISIO = anAIS->impl<Handle(AIS_InteractiveObject)>();
1395 if (anAIS.get() != NULL) {
1396 Handle(AIS_InteractiveObject) anAISIO = anAIS->impl<Handle(AIS_InteractiveObject)>();
1398 if (!anAISIO.IsNull()) {
1399 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAISIO);
1400 if (!aDim.IsNull()) {
1401 gp_Pnt aPosition = aDim->GetTextPosition();
1403 ModuleBase_IViewer* aViewer = aWorkshop->viewer();
1404 Handle(V3d_View) aView = aViewer->activeView();
1406 aView->Convert(aPosition.X(), aPosition.Y(), aPosition.Z(), aCX, aCY);
1408 QWidget* aViewPort = aViewer->activeViewPort();
1409 QPoint aGlPoint = aViewPort->mapToGlobal(QPoint(aCX, aCY));
1414 anEditor->setCursorPosition(aX, anY);
1415 isValueAccepted = anEditor->showPopupEditor(false);
1416 theCanCommitOperation = true;
1422 return isValueAccepted;
1425 void PartSet_SketcherMgr::getCurrentSelection(const FeaturePtr& theFeature,
1426 const FeaturePtr& theSketch,
1427 ModuleBase_IWorkshop* theWorkshop,
1428 FeatureToSelectionMap& theSelection)
1430 if (theFeature.get() == NULL)
1433 std::set<AttributePtr> aSelectedAttributes;
1434 std::set<ResultPtr> aSelectedResults;
1436 ModuleBase_IViewer* aViewer = theWorkshop->viewer();
1437 Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
1438 if (!aContext.IsNull()) {
1439 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWorkshop);
1440 XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
1442 std::list<ResultPtr> aResults = theFeature->results();
1443 std::list<ResultPtr>::const_iterator aIt;
1444 for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
1446 ResultPtr aResult = *aIt;
1447 AISObjectPtr aAISObj = aDisplayer->getAISObject(aResult);
1448 if (aAISObj.get() == NULL)
1450 Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
1451 for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
1453 Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
1454 if (anOwner->Selectable() != anAISIO)
1456 getAttributesOrResults(anOwner, theFeature, theSketch, aResult,
1457 aSelectedAttributes, aSelectedResults);
1459 for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) {
1460 Handle(SelectMgr_EntityOwner) anOwner = aContext->DetectedOwner();
1461 if (anOwner.IsNull())
1463 if (anOwner->Selectable() != anAISIO)
1465 getAttributesOrResults(anOwner, theFeature, theSketch, aResult,
1466 aSelectedAttributes, aSelectedResults);
1470 theSelection[theFeature] = std::make_pair(aSelectedAttributes, aSelectedResults);
1473 void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature,
1474 const FeaturePtr& theSketch,
1475 ModuleBase_IWorkshop* theWorkshop,
1476 const FeatureToSelectionMap& theSelection,
1477 SelectMgr_IndexedMapOfOwner& theOwnersToSelect)
1479 if (theFeature.get() == NULL)
1482 FeatureToSelectionMap::const_iterator anIt = theSelection.find(theFeature);
1483 std::set<AttributePtr> aSelectedAttributes = anIt.value().first;
1484 std::set<ResultPtr> aSelectedResults = anIt.value().second;
1486 ModuleBase_IViewer* aViewer = theWorkshop->viewer();
1488 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWorkshop);
1489 XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
1491 // 1. found the feature's owners. Check the AIS objects of the constructions
1492 AISObjectPtr aAISObj = aDisplayer->getAISObject(theFeature);
1493 if (aAISObj.get() != NULL && aSelectedAttributes.empty() && aSelectedResults.empty()) {
1494 Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
1496 SelectMgr_IndexedMapOfOwner aSelectedOwners;
1497 aConnector->workshop()->selector()->selection()->entityOwners(anAISIO, aSelectedOwners);
1498 for (Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++) {
1499 Handle(SelectMgr_EntityOwner) anOwner = aSelectedOwners(i);
1500 if (!anOwner.IsNull())
1501 theOwnersToSelect.Add(anOwner);
1505 // 2. found the feature results's owners
1506 std::list<ResultPtr> aResults = theFeature->results();
1507 std::list<ResultPtr>::const_iterator aIt;
1508 for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
1510 ResultPtr aResult = *aIt;
1511 AISObjectPtr aAISObj = aDisplayer->getAISObject(aResult);
1512 if (aAISObj.get() == NULL)
1514 Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
1516 SelectMgr_IndexedMapOfOwner aSelectedOwners;
1517 aConnector->workshop()->selector()->selection()->entityOwners(anAISIO, aSelectedOwners);
1518 for ( Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++ ) {
1519 Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i));
1520 if ( anOwner.IsNull() || !anOwner->HasShape() )
1522 const TopoDS_Shape& aShape = anOwner->Shape();
1523 TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
1524 if (aShapeType == TopAbs_VERTEX) {
1525 AttributePtr aPntAttr = PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch);
1526 if (aPntAttr.get() != NULL &&
1527 aSelectedAttributes.find(aPntAttr) != aSelectedAttributes.end()) {
1528 theOwnersToSelect.Add(anOwner);
1531 else if (aShapeType == TopAbs_EDGE) {
1532 bool aFound = aSelectedResults.find(aResult) != aSelectedResults.end();
1533 if (aSelectedResults.find(aResult) != aSelectedResults.end() &&
1534 theOwnersToSelect.FindIndex(anOwner) <= 0)
1535 theOwnersToSelect.Add(anOwner);
1541 void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
1544 connect(theWidget, SIGNAL(beforeValuesChanged()),
1545 this, SLOT(onBeforeValuesChangedInPropertyPanel()));
1546 connect(theWidget, SIGNAL(afterValuesChanged()),
1547 this, SLOT(onAfterValuesChangedInPropertyPanel()));
1550 disconnect(theWidget, SIGNAL(beforeValuesChanged()),
1551 this, SLOT(onBeforeValuesChangedInPropertyPanel()));
1552 disconnect(theWidget, SIGNAL(afterValuesChanged()),
1553 this, SLOT(onAfterValuesChangedInPropertyPanel()));
1557 void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState)
1559 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
1560 (getCurrentOperation());
1562 if (PartSet_SketcherMgr::isSketchOperation(aFOperation) ||
1563 PartSet_SketcherMgr::isNestedSketchOperation(aFOperation) &&
1564 thePreviousState == ModuleBase_ModelWidget::ModifiedInPP) {
1565 FeaturePtr aFeature = aFOperation->feature();
1566 visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature));
1571 void PartSet_SketcherMgr::customizePresentation(const ObjectPtr& theObject)
1573 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
1574 (getCurrentOperation());
1575 if (aFOperation && (PartSet_SketcherMgr::isSketchOperation(aFOperation) ||
1576 PartSet_SketcherMgr::isNestedSketchOperation(aFOperation)))
1577 SketcherPrs_Tools::sendExpressionShownEvent(myIsConstraintsShown[PartSet_Tools::Expressions]);
1580 ModuleBase_Operation* PartSet_SketcherMgr::getCurrentOperation() const
1582 return myModule->workshop()->currentOperation();
1585 //**************************************************************
1586 ModuleBase_ModelWidget* PartSet_SketcherMgr::getActiveWidget() const
1588 ModuleBase_ModelWidget* aWidget = 0;
1589 ModuleBase_Operation* anOperation = getCurrentOperation();
1591 ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
1593 aWidget = aPanel->activeWidget();
1598 void PartSet_SketcherMgr::visualizeFeature(const FeaturePtr& theFeature,
1599 const bool isEditOperation,
1600 const bool isToDisplay,
1601 const bool isFlushRedisplay)
1603 #ifdef DEBUG_DO_NOT_BY_ENTER
1607 if (isEditOperation || !theFeature.get())
1610 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
1611 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
1613 // 1. change visibility of the object itself, here the presentable object is processed,
1614 // e.g. constraints features
1615 //FeaturePtr aFeature = aFOperation->feature();
1616 std::list<ResultPtr> aResults = theFeature->results();
1618 theFeature->setDisplayed(true);
1620 theFeature->setDisplayed(false);
1622 // change visibility of the object results, e.g. non-constraint features
1623 std::list<ResultPtr>::const_iterator aIt;
1624 for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
1626 (*aIt)->setDisplayed(true);
1629 (*aIt)->setDisplayed(false);
1632 if (isFlushRedisplay)
1633 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
1636 void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
1638 if (!myCurrentSketch.get())
1641 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
1642 ModuleBase_ISelection* aSelect = aWorkshop->selection();
1643 QList<ModuleBase_ViewerPrsPtr> aHighlighted = aSelect->getHighlighted();
1645 QList<FeaturePtr> aFeatureList;
1646 if (theHighlightedOnly) {
1647 fillFeatureList(aHighlighted, myCurrentSketch, aFeatureList);
1650 fillFeatureList(aHighlighted, myCurrentSketch, aFeatureList);
1652 QList<ModuleBase_ViewerPrsPtr> aSelected = aSelect->getSelected(ModuleBase_ISelection::AllControls);
1653 fillFeatureList(aSelected, myCurrentSketch, aFeatureList);
1656 // 1. it is necessary to save current selection in order to restore it after the features moving
1657 myCurrentSelection.clear();
1658 QList<FeaturePtr>::const_iterator anIt = aFeatureList.begin(), aLast = aFeatureList.end();
1659 for (; anIt != aLast; anIt++) {
1660 getCurrentSelection(*anIt, myCurrentSketch, aWorkshop, myCurrentSelection);
1662 //qDebug(QString(" storeSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());
1665 void PartSet_SketcherMgr::restoreSelection()
1667 if (!myCurrentSketch.get())
1670 //qDebug(QString("restoreSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());
1671 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
1672 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
1673 FeatureToSelectionMap::const_iterator aSIt = myCurrentSelection.begin(),
1674 aSLast = myCurrentSelection.end();
1675 SelectMgr_IndexedMapOfOwner anOwnersToSelect;
1676 for (; aSIt != aSLast; aSIt++) {
1677 anOwnersToSelect.Clear();
1678 getSelectionOwners(aSIt.key(), myCurrentSketch, aWorkshop, myCurrentSelection,
1680 aConnector->workshop()->selector()->setSelectedOwners(anOwnersToSelect, false);
1684 void PartSet_SketcherMgr::onShowConstraintsToggle(int theType, bool theState)
1686 PartSet_Tools::ConstraintVisibleState aType = (PartSet_Tools::ConstraintVisibleState)theType;
1688 updateBySketchParameters(aType, theState);
1691 void PartSet_SketcherMgr::updateBySketchParameters(
1692 const PartSet_Tools::ConstraintVisibleState& theType,
1695 if (myCurrentSketch.get() == NULL)
1698 bool aPrevState = myIsConstraintsShown[theType];
1699 myIsConstraintsShown[theType] = theState;
1702 case PartSet_Tools::Geometrical:
1703 case PartSet_Tools::Dimensional: {
1704 if (aPrevState != theState) {
1705 ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
1706 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
1707 for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
1708 FeaturePtr aSubFeature = myCurrentSketch->subFeature(i);
1709 bool aProcessed = false;
1710 bool aConstraintDisplayed = canDisplayConstraint(aSubFeature, theType, aProcessed);
1712 aSubFeature->setDisplayed(aConstraintDisplayed);
1714 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
1718 case PartSet_Tools::Expressions: {
1719 if (aPrevState != theState) {
1720 /// call all sketch features redisplay, the expression state will be corrected in customize
1721 /// of distance presentation
1722 Events_ID anEventId = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
1723 PartSet_Tools::sendSubFeaturesEvent(myCurrentSketch, anEventId);
1730 XGUI_Workshop* PartSet_SketcherMgr::workshop() const
1732 ModuleBase_IWorkshop* anIWorkshop = myModule->workshop();
1733 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(anIWorkshop);
1734 return aConnector->workshop();
1737 XGUI_OperationMgr* PartSet_SketcherMgr::operationMgr() const
1739 return workshop()->operationMgr();