1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #include "PartSet_Module.h"
4 #include "PartSet_WidgetSketchLabel.h"
5 #include "PartSet_Validators.h"
6 #include "PartSet_Tools.h"
7 #include "PartSet_WidgetPoint2d.h"
8 #include "PartSet_WidgetPoint2dDistance.h"
9 #include "PartSet_WidgetPoint2DFlyout.h"
10 #include "PartSet_WidgetShapeSelector.h"
11 #include "PartSet_WidgetMultiSelector.h"
12 #include "PartSet_WidgetEditor.h"
13 #include "PartSet_WidgetFileSelector.h"
14 #include "PartSet_WidgetSketchCreator.h"
15 #include "PartSet_SketcherMgr.h"
16 #include "PartSet_SketcherReetntrantMgr.h"
17 #include "PartSet_MenuMgr.h"
18 #include "PartSet_CustomPrs.h"
19 #include "PartSet_IconFactory.h"
20 #include "PartSet_WidgetChoice.h"
21 #include "PartSet_OverconstraintListener.h"
23 #include "PartSet_Filters.h"
24 #include "PartSet_FilterInfinite.h"
26 #include <PartSetPlugin_Remove.h>
27 #include <PartSetPlugin_Part.h>
28 #include <PartSetPlugin_Duplicate.h>
30 #include <ModuleBase_Operation.h>
31 #include <ModuleBase_OperationAction.h>
32 #include <ModuleBase_IViewer.h>
33 #include <ModuleBase_IViewWindow.h>
34 #include <ModuleBase_IPropertyPanel.h>
35 #include <ModuleBase_WidgetEditor.h>
36 #include <ModuleBase_WidgetValidated.h>
37 #include <ModuleBase_FilterFactory.h>
38 #include <ModuleBase_Tools.h>
39 #include <ModuleBase_OperationFeature.h>
40 #include <ModuleBase_WidgetFactory.h>
41 #include <ModuleBase_OperationDescription.h>
43 #include <ModelAPI_Object.h>
44 #include <ModelAPI_Events.h>
45 #include <ModelAPI_Validator.h>
46 #include <ModelAPI_Data.h>
47 #include <ModelAPI_Session.h>
48 #include <ModelAPI_ResultBody.h>
49 #include <ModelAPI_AttributeString.h>
51 #include <GeomDataAPI_Point2D.h>
52 #include <GeomDataAPI_Point.h>
53 #include <GeomDataAPI_Dir.h>
55 #include <XGUI_Displayer.h>
56 #include <XGUI_Workshop.h>
57 #include <XGUI_OperationMgr.h>
58 #include <XGUI_PropertyPanel.h>
59 #include <XGUI_ModuleConnector.h>
60 #include <XGUI_ContextMenuMgr.h>
61 #include <XGUI_Tools.h>
62 #include <XGUI_ObjectsBrowser.h>
63 #include <XGUI_SelectionMgr.h>
64 #include <XGUI_DataModel.h>
65 #include <XGUI_ErrorMgr.h>
66 #include <XGUI_CustomPrs.h>
68 #include <SketchPlugin_Feature.h>
69 #include <SketchPlugin_Sketch.h>
70 #include <SketchPlugin_ConstraintAngle.h>
71 #include <SketchPlugin_ConstraintLength.h>
72 #include <SketchPlugin_ConstraintDistance.h>
73 #include <SketchPlugin_ConstraintParallel.h>
74 #include <SketchPlugin_ConstraintPerpendicular.h>
75 #include <SketchPlugin_ConstraintRadius.h>
77 #include <SketcherPrs_SymbolPrs.h>
78 #include <SketcherPrs_Tools.h>
80 #include <Events_Loop.h>
81 #include <Config_PropManager.h>
82 #include <Config_Keywords.h>
84 #include <StdSelect_TypeOfFace.hxx>
85 #include <TopoDS_Vertex.hxx>
87 #include <TopoDS_Shape.hxx>
88 #include <BRep_Tool.hxx>
89 #include <AIS_Dimension.hxx>
92 #include <QMouseEvent>
95 #include <QApplication>
96 #include <QMessageBox>
97 #include <QMainWindow>
101 #include <GeomAlgoAPI_FaceBuilder.h>
102 #include <GeomDataAPI_Dir.h>
104 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
110 /*!Create and return new instance of XGUI_Module*/
111 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
113 return new PartSet_Module(theWshop);
116 PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
117 : ModuleBase_IModule(theWshop),
120 new PartSet_IconFactory();
122 mySketchMgr = new PartSet_SketcherMgr(this);
123 mySketchReentrantMgr = new PartSet_SketcherReetntrantMgr(theWshop);
125 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
126 XGUI_Workshop* aWorkshop = aConnector->workshop();
128 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
129 connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
130 this, SLOT(onOperationActivatedByPreselection()));
132 ModuleBase_IViewer* aViewer = theWshop->viewer();
133 connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
134 this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
135 connect(aViewer, SIGNAL(viewTransformed(int)),
136 SLOT(onViewTransformed(int)));
137 connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)),
138 SLOT(onViewCreated(ModuleBase_IViewWindow*)));
139 myMenuMgr = new PartSet_MenuMgr(this);
140 myCustomPrs = new PartSet_CustomPrs(theWshop);
142 myOverconstraintListener = new PartSet_OverconstraintListener(theWshop);
144 Events_Loop* aLoop = Events_Loop::loop();
145 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
147 mySelectionFilters.Append(new PartSet_GlobalFilter(myWorkshop));
148 mySelectionFilters.Append(new PartSet_FilterInfinite(myWorkshop));
150 myHasConstraintShown[PartSet_Tools::Geometrical] = true;
151 myHasConstraintShown[PartSet_Tools::Dimensional] = true;
153 Config_PropManager::registerProp("Visualization", "operation_parameter_color",
154 "Reference shape wireframe color in operation", Config_Prop::Color,
155 PartSet_CustomPrs::OPERATION_PARAMETER_COLOR());
156 Config_PropManager::registerProp("Visualization", "operation_result_color",
157 "Result shape wireframe color in operation", Config_Prop::Color,
158 PartSet_CustomPrs::OPERATION_RESULT_COLOR());
159 Config_PropManager::registerProp("Visualization", "operation_highlight_color",
160 "Multi selector item color in operation", Config_Prop::Color,
161 PartSet_CustomPrs::OPERATION_HIGHLIGHT_COLOR());
164 PartSet_Module::~PartSet_Module()
166 SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
167 for (; aIt.More(); aIt.Next()) {
168 Handle(SelectMgr_Filter) aFilter = aIt.Value();
169 if (!aFilter.IsNull())
173 delete myOverconstraintListener;
176 void PartSet_Module::activateSelectionFilters()
178 SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
179 for (; aIt.More(); aIt.Next()) {
180 Handle(SelectMgr_Filter) aFilter = aIt.Value();
181 if (!aFilter.IsNull())
182 myWorkshop->viewer()->addSelectionFilter(aFilter);
186 void PartSet_Module::deactivateSelectionFilters()
188 SelectMgr_ListIteratorOfListOfFilter aIt(mySelectionFilters);
189 for (; aIt.More(); aIt.Next()) {
190 Handle(SelectMgr_Filter) aFilter = aIt.Value();
191 if (!aFilter.IsNull())
192 myWorkshop->viewer()->removeSelectionFilter(aFilter);
196 void PartSet_Module::storeSelection()
198 sketchMgr()->storeSelection();
201 void PartSet_Module::restoreSelection()
203 sketchMgr()->restoreSelection();
206 void PartSet_Module::registerValidators()
208 //Registering of validators
209 SessionPtr aMgr = ModelAPI_Session::get();
210 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
211 aFactory->registerValidator("PartSet_DistanceSelection", new PartSet_DistanceSelection);
212 aFactory->registerValidator("PartSet_LengthSelection", new PartSet_LengthSelection);
213 aFactory->registerValidator("PartSet_PerpendicularSelection", new PartSet_PerpendicularSelection);
214 aFactory->registerValidator("PartSet_ParallelSelection", new PartSet_ParallelSelection);
215 aFactory->registerValidator("PartSet_RadiusSelection", new PartSet_RadiusSelection);
216 aFactory->registerValidator("PartSet_RigidSelection", new PartSet_RigidSelection);
217 aFactory->registerValidator("PartSet_CoincidentSelection", new PartSet_CoincidentSelection);
218 aFactory->registerValidator("PartSet_HVDirSelection", new PartSet_HVDirSelection);
219 aFactory->registerValidator("PartSet_TangentSelection", new PartSet_TangentSelection);
220 aFactory->registerValidator("PartSet_FilletSelection", new PartSet_FilletSelection);
221 aFactory->registerValidator("PartSet_AngleSelection", new PartSet_AngleSelection);
222 aFactory->registerValidator("PartSet_EqualSelection", new PartSet_EqualSelection);
223 aFactory->registerValidator("PartSet_CollinearSelection", new PartSet_CollinearSelection);
224 aFactory->registerValidator("PartSet_MiddlePointSelection", new PartSet_MiddlePointSelection);
225 aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
226 aFactory->registerValidator("PartSet_CoincidentAttr", new PartSet_CoincidentAttr);
227 aFactory->registerValidator("PartSet_SketchEntityValidator", new PartSet_SketchEntityValidator);
230 void PartSet_Module::registerFilters()
232 //Registering of selection filters
233 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
234 ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
237 void PartSet_Module::registerProperties()
239 Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
241 Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness",
242 Config_Prop::Integer, SKETCH_WIDTH);
243 Config_PropManager::registerProp("Sketch planes", "rotate_to_plane", "Rotate to plane when selected",
244 Config_Prop::Boolean, "false");
247 void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
249 mySketchMgr->connectToPropertyPanel(theWidget, isToConnect);
252 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
254 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
255 mySketchMgr->commitNestedSketch(theOperation);
258 /// Restart sketcher operations automatically
259 if (!mySketchReentrantMgr->operationCommitted(theOperation)) {
261 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
262 if (aFOperation && !aFOperation->isEditOperation()) {
263 // the selection is cleared after commit the create operation
264 // in order to do not use the same selected objects in the restarted operation
265 // for common behaviour, the selection is cleared even if the operation is not restarted
266 getWorkshop()->selector()->clearSelection();
271 void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation)
273 /// Restart sketcher operations automatically
274 mySketchReentrantMgr->operationAborted(theOperation);
277 void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation)
279 /// Restart sketcher operations automatically
280 mySketchReentrantMgr->operationStarted(theOperation);
282 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
283 mySketchMgr->startSketch(theOperation);
285 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
286 mySketchMgr->startNestedSketch(theOperation);
289 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
291 myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true);
292 myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, true);
296 void PartSet_Module::operationResumed(ModuleBase_Operation* theOperation)
298 ModuleBase_IModule::operationResumed(theOperation);
300 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
302 myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true);
303 myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, true);
307 void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
309 bool isModifiedArgs = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeArguments, false);
310 bool isModifiedResults = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeResults, false);
311 bool isModified = isModifiedArgs || isModifiedResults;
313 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
314 mySketchMgr->stopNestedSketch(theOperation);
317 //VSV: Viewer is updated on feature update and redisplay
319 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
320 XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
321 aDisplayer->updateViewer();
324 QMap<PartSet_Tools::ConstraintVisibleState, bool>::const_iterator anIt = myHasConstraintShown.begin(),
325 aLast = myHasConstraintShown.end();
326 for (; anIt != aLast; anIt++) {
327 myHasConstraintShown[anIt.key()];
328 mySketchMgr->onShowConstraintsToggle(anIt.key(), anIt.value());
332 ModuleBase_Operation* PartSet_Module::currentOperation() const
334 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
335 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
336 return anOpMgr->currentOperation();
339 bool PartSet_Module::canUndo() const
341 bool aCanUndo = false;
342 SessionPtr aMgr = ModelAPI_Session::get();
343 if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
344 aCanUndo = !aMgr->isOperation();
345 if (!aCanUndo) // check the enable state additionally by sketch manager
346 aCanUndo = aMgr->canUndo();
351 bool PartSet_Module::canRedo() const
353 bool aCanRedo = false;
354 SessionPtr aMgr = ModelAPI_Session::get();
355 if (aMgr->hasModuleDocument() && aMgr->canRedo()) {
356 aCanRedo = !aMgr->isOperation();
357 if (!aCanRedo) // check the enable state additionally by sketch manager
358 aCanRedo = aMgr->canRedo();
363 bool PartSet_Module::canApplyAction(const ObjectPtr& theObject, const QString& theActionId) const
366 if (theActionId == "MOVE_CMD") {
367 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
369 // part features can not be moved in the history.
370 if (aFeature->getKind() == PartSetPlugin_Part::ID())
377 bool PartSet_Module::canEraseObject(const ObjectPtr& theObject) const
379 // the sketch manager put the restriction to the objects erase
380 return mySketchMgr->canEraseObject(theObject);
383 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
385 // the sketch manager put the restriction to the objects display
386 return mySketchMgr->canDisplayObject(theObject);
389 void PartSet_Module::processHiddenObject(const std::list<ObjectPtr>& theObjects)
391 mySketchMgr->processHiddenObject(theObjects);
394 bool PartSet_Module::canActivateSelection(const ObjectPtr& theObject) const
396 bool aCanActivate = ModuleBase_IModule::canActivateSelection(theObject);
398 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
399 bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
400 isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
401 if (isSketchOp || isNestedOp) {
402 // in active sketch operation it is possible to activate operation object in selection
403 // in the edit operation, e.g. points of the line can be moved when the line is edited
404 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
405 aCanActivate = aCanActivate || (aFOperation && aFOperation->isEditOperation());
410 bool PartSet_Module::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
412 return myMenuMgr->addViewerMenu(theMenu, theStdActions);
415 void PartSet_Module::updateViewerMenu(const QMap<QString, QAction*>& theStdActions)
417 myMenuMgr->updateViewerMenu(theStdActions);
420 QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature)
422 QString anError = ModuleBase_IModule::getFeatureError(theFeature);
423 if (anError.isEmpty())
424 anError = sketchMgr()->getFeatureError(theFeature);
429 void PartSet_Module::grantedOperationIds(ModuleBase_Operation* theOperation,
430 QStringList& theIds) const
432 myMenuMgr->grantedOperationIds(theOperation, theIds);
434 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
435 XGUI_Workshop* aWorkshop = getWorkshop();
436 theIds.append(aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text());
440 void PartSet_Module::activeSelectionModes(QIntList& theModes)
443 if (mySketchMgr->activeSketch().get())
444 PartSet_SketcherMgr::sketchSelectionModes(theModes);
447 bool PartSet_Module::isMouseOverWindow()
449 return mySketchMgr->isMouseOverWindow();
452 void PartSet_Module::closeDocument()
457 void PartSet_Module::clearViewer()
459 myCustomPrs->clearPrs();
461 XGUI_Workshop* aWorkshop = getWorkshop();
462 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
463 aDisplayer->deactivateSelectionFilters();
466 void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
468 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
472 ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
473 // we have to manually activate the sketch label in edit mode
474 if (PartSet_SketcherMgr::isSketchOperation(aFOperation) && (aFOperation->isEditOperation()))
475 aPanel->activateWidget(aPanel->modelWidgets().first());
478 bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation,
479 QList<ModuleBase_ModelWidget*>& theWidgets) const
481 bool aProcessed = false;
483 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
484 XGUI_Workshop* aWorkshop = getWorkshop();
485 XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
486 if (mySketchMgr->activeSketch().get() && aFOperation && aPropertyPanel) {
487 ModuleBase_ISelection* aSelection = workshop()->selection();
488 // click on a point in sketch leads here with the point is highlighted, not yet selected
489 QList<ModuleBase_ViewerPrs> aPreselection = aSelection->getHighlighted();
490 if (aPreselection.size() == 1) {
491 ModuleBase_ViewerPrs aSelectedPrs = aPreselection[0];
492 ObjectPtr anObject = aSelectedPrs.object();
494 FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
495 FeaturePtr anOpFeature = aFOperation->feature();
496 TopoDS_Shape aShape = aSelectedPrs.shape();
497 // click on the digit of dimension constrain comes here with an empty shape, so we need the check
498 if (aFeature == anOpFeature && !aShape.IsNull()) {
499 AttributePtr anAttribute = PartSet_Tools::findAttributeBy2dPoint(anObject, aShape,
500 mySketchMgr->activeSketch());
501 if (anAttribute.get()) {
502 QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
503 ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), workshop());
505 const std::string anAttributeId = anAttribute->id();
506 aFactory.createWidget(aPropertyPanel->contentWidget(), anAttributeId);
508 theWidgets = aFactory.getModelWidgets();
509 // it is possible that the point does not present in XML definition,
510 // in this case, we assume that it is not processed by this module
511 // e.g. "Intersection point" feature
512 aProcessed = !theWidgets.isEmpty();
520 void PartSet_Module::onSelectionChanged()
522 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
526 bool isSketcherOp = false;
527 // An edit operation is enable only if the current opeation is the sketch operation
528 if (mySketchMgr->activeSketch()) {
529 if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch()))
530 isSketcherOp = PartSet_SketcherMgr::isSketchOperation(aOperation);
533 // Editing of constraints can be done on selection
534 ModuleBase_ISelection* aSelect = myWorkshop->selection();
535 QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
536 if (aSelected.size() == 1) {
537 ModuleBase_ViewerPrs aPrs = aSelected.first();
538 ObjectPtr aObject = aPrs.object();
539 FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
541 std::string aId = aFeature->getKind();
542 if ((aId == SketchPlugin_ConstraintRadius::ID()) ||
543 (aId == SketchPlugin_ConstraintLength::ID()) ||
544 (aId == SketchPlugin_ConstraintDistance::ID()) ||
545 (aId == SketchPlugin_ConstraintAngle::ID())) {
546 editFeature(aFeature);
553 void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent)
555 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
556 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
557 anOpMgr->onKeyReleased(theWnd->viewPort(), theEvent);
560 void PartSet_Module::onOperationActivatedByPreselection()
562 if (!mySketchReentrantMgr->canBeCommittedByPreselection())
564 mySketchMgr->operationActivatedByPreselection();
567 ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType,
569 Config_WidgetAPI* theWidgetApi)
571 ModuleBase_IWorkshop* aWorkshop = workshop();
572 XGUI_Workshop* aXUIWorkshop = getWorkshop();
573 ModuleBase_ModelWidget* aWgt = NULL;
574 if (theType == "sketch-start-label") {
575 PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent, aWorkshop,
576 theWidgetApi, myHasConstraintShown);
577 connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr<GeomAPI_Pln>&)),
578 mySketchMgr, SLOT(onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>&)));
579 connect(aLabelWgt, SIGNAL(showConstraintToggled(int, bool)),
580 mySketchMgr, SLOT(onShowConstraintsToggle(int, bool)));
582 } else if (theType == "sketch-2dpoint_selector") {
583 PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, aWorkshop,
585 aPointWgt->setSketch(mySketchMgr->activeSketch());
586 connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
588 }else if (theType == "sketch-2dpoint_flyout_selector") {
589 PartSet_WidgetPoint2DFlyout* aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop,
591 aPointWgt->setSketch(mySketchMgr->activeSketch());
592 connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
594 } else if (theType == "point2ddistance") {
595 PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent,
596 aWorkshop, theWidgetApi);
597 aDistanceWgt->setSketch(mySketchMgr->activeSketch());
599 } else if (theType == "sketch_shape_selector") {
600 PartSet_WidgetShapeSelector* aShapeSelectorWgt =
601 new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi);
602 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
603 aWgt = aShapeSelectorWgt;
604 } else if (theType == "sketch_multi_selector") {
605 PartSet_WidgetMultiSelector* aShapeSelectorWgt =
606 new PartSet_WidgetMultiSelector(theParent, aWorkshop, theWidgetApi);
607 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
608 aWgt = aShapeSelectorWgt;
609 } else if (theType == WDG_DOUBLEVALUE_EDITOR) {
610 aWgt = new PartSet_WidgetEditor(theParent, aWorkshop, theWidgetApi);
611 } else if (theType == "export_file_selector") {
612 aWgt = new PartSet_WidgetFileSelector(theParent, aWorkshop, theWidgetApi);
613 } else if (theType == "sketch_launcher") {
614 aWgt = new PartSet_WidgetSketchCreator(theParent, this, theWidgetApi);
615 } else if (theType == "module_choice") {
616 aWgt = new PartSet_WidgetChoice(theParent, theWidgetApi);
617 connect(aWgt, SIGNAL(itemSelected(int)), SLOT(onBooleanOperationChange(int)));
622 ModuleBase_ModelWidget* PartSet_Module::activeWidget() const
624 ModuleBase_ModelWidget* anActiveWidget = 0;
626 anActiveWidget = mySketchReentrantMgr->internalActiveWidget();
627 if (!anActiveWidget) {
628 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
630 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
631 anActiveWidget = aPanel->activeWidget();
634 return anActiveWidget;
637 bool PartSet_Module::deleteObjects()
639 bool isProcessed = false;
641 XGUI_Workshop* aWorkshop = getWorkshop();
642 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
644 //SessionPtr aMgr = ModelAPI_Session::get();
645 // 1. check whether the delete should be processed in the module
646 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
647 bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
648 isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
649 if (isSketchOp || isNestedOp) {
651 // 2. find selected presentations
652 // selected objects should be collected before the current operation abort because
653 // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
654 ModuleBase_ISelection* aSel = workshop()->selection();
655 QObjectPtrList aSelectedObj = aSel->selectedPresentations();
656 // if there are no selected objects in the viewer, that means that the selection in another
657 // place cased this method. It is necessary to return the false value to understande in above
658 // method that delete is not processed
659 if (aSelectedObj.count() == 0)
662 // avoid delete of the objects, which are not belong to the current sketch
663 // in order to do not delete results of other sketches
664 QObjectPtrList aSketchObjects;
665 QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), aLast = aSelectedObj.end();
666 for ( ; anIt != aLast; anIt++) {
667 ObjectPtr anObject = *anIt;
668 if (mySketchMgr->isObjectOfSketch(anObject)) {
669 // sketch feature should be used in this list because workshop deletes features only
670 // results are skipped
671 FeaturePtr aSketchFeature = ModelAPI_Feature::feature(anObject);
672 aSketchObjects.append(aSketchFeature);
675 // if the selection contains only local selected presentations from other sketches,
676 // the Delete operation should not be done at all
677 if (aSketchObjects.size() == 0)
680 // 3. start operation
681 QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
682 ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, this);
684 // the active nested sketch operation should be aborted unconditionally
685 // the Delete action should be additionally granted for the Sketch operation
686 // in order to do not abort/commit it
687 if (!anOpMgr->canStartOperation(anOpAction->id()))
688 return true; // the objects are processed but can not be deleted
690 anOpMgr->startOperation(anOpAction);
692 // 4. delete features
693 // sketch feature should be skipped, only sub-features can be removed
694 // when sketch operation is active
695 aWorkshop->deleteFeatures(aSketchObjects);
697 anOpMgr->commitOperation();
702 void PartSet_Module::onFeatureTriggered()
704 QAction* aCmd = dynamic_cast<QAction*>(sender());
705 if (aCmd->isCheckable() && aCmd->isChecked()) {
706 // 1. check whether the delete should be processed in the module
707 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
708 bool isNestedOp = PartSet_SketcherMgr::isNestedCreateOperation(anOperation);
710 // in case if in the viewer nothing is displayed, the create operation should not be
711 // comitted even if all values of the feature are initialized
712 if (!mySketchMgr->canDisplayCurrentCreatedFeature()) {
713 // the action information should be saved before the operation is aborted
714 // because this abort leads to update command status, which unchecks this action
715 anOperation->abort();
716 launchOperation(aCmd->data().toString());
720 ModuleBase_IModule::onFeatureTriggered();
723 void PartSet_Module::launchOperation(const QString& theCmdId)
725 if (myWorkshop->currentOperation() &&
726 myWorkshop->currentOperation()->id().toStdString() == SketchPlugin_Sketch::ID()) {
727 const QMap<PartSet_Tools::ConstraintVisibleState, bool>& aShownStates =
728 mySketchMgr->showConstraintStates();
729 myHasConstraintShown = aShownStates;
731 if (PartSet_SketcherMgr::constraintsIdList().contains(theCmdId)) {
732 // Show constraints if a constraint was anOperation
733 mySketchMgr->onShowConstraintsToggle(PartSet_Tools::Geometrical, true);
734 mySketchMgr->onShowConstraintsToggle(PartSet_Tools::Dimensional, true);
736 ModuleBase_IModule::launchOperation(theCmdId);
740 void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
742 Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
743 if (!anAIS.IsNull()) {
744 Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
745 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
746 if (!aDim.IsNull()) {
747 aCtx->SetZLayer(aDim, myVisualLayerId);
749 Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
751 aCtx->SetZLayer(aCons, myVisualLayerId);
756 void PartSet_Module::onBeforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS)
759 // it should be recomputed in order to disappear in the viewer if the corresponded object
761 //if (myCustomPrs->isActive())
762 // myCustomPrs->redisplay(theObject, false);
765 void PartSet_Module::onViewTransformed(int theTrsfType)
767 // Set length of arrows constant in pixel size
768 // if the operation is panning or rotate or panglobal then do nothing
769 if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4))
771 ModuleBase_IViewer* aViewer = myWorkshop->viewer();
772 Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
773 if (aContext.IsNull())
776 //Handle(V3d_View) aView = aViewer->activeView();
778 XGUI_Workshop* aWorkshop = getWorkshop();
779 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
780 Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer();
781 Handle(V3d_View) aView;
783 for (aV3dViewer->InitDefinedViews();
784 aV3dViewer->MoreDefinedViews();
785 aV3dViewer->NextDefinedViews()) {
786 Handle(V3d_View) aV = aV3dViewer->DefinedView();
787 double aS = aV->Scale();
795 double aLen = aView->Convert(SketcherPrs_Tools::getDefaultArrowSize());
797 double aPrevLen = SketcherPrs_Tools::getArrowSize();
798 SketcherPrs_Tools::setArrowSize(aLen);
799 const double aPrevScale = aViewer->Scale(aViewer->activeView());
800 const double aCurScale = aViewer->activeView()->Camera()->Scale();
801 aViewer->SetScale(aViewer->activeView(), aCurScale);
802 SketcherPrs_Tools::setTextHeight (aCurScale / aPrevScale * SketcherPrs_Tools::getTextHeight());
803 bool isModified = false;
804 QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
805 foreach (AISObjectPtr aAIS, aPrsList) {
806 Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
808 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
809 if (!aDim.IsNull()) {
810 aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
811 aContext->Redisplay(aDim, false);
816 aDisplayer->updateViewer();
819 void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature, const ModuleBase_CustomizeFlag& theFlag,
820 const bool theUpdateViewer)
822 myCustomPrs->activate(theFeature, theFlag, theUpdateViewer);
825 void PartSet_Module::deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag,
826 const bool theUpdateViewer)
828 myCustomPrs->deactivate(theFlag, theUpdateViewer);
831 bool PartSet_Module::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
832 std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs)
834 bool aCustomized = false;
839 XGUI_Workshop* aWorkshop = getWorkshop();
840 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
841 ObjectPtr anObject = aDisplayer->getObject(thePrs);
842 if (anObject.get()) {
843 bool isConflicting = myOverconstraintListener->isConflictingObject(anObject);
844 // customize sketcy symbol presentation
846 Handle(AIS_InteractiveObject) anAISIO = thePrs->impl<Handle(AIS_InteractiveObject)>();
847 if (!anAISIO.IsNull()) {
848 if (!Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO).IsNull()) {
849 Handle(SketcherPrs_SymbolPrs) aPrs = Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO);
850 if (!aPrs.IsNull()) {
851 std::vector<int> aColor;
852 myOverconstraintListener->getConflictingColor(aColor);
853 aPrs->SetConflictingConstraint(isConflicting, aColor);
859 // customize sketch dimension constraint presentation
861 std::vector<int> aColor;
863 myOverconstraintListener->getConflictingColor(aColor);
866 XGUI_CustomPrs::getDefaultColor(anObject, true, aColor);
867 if (!aColor.empty()) {
868 thePrs->setColor(aColor[0], aColor[1], aColor[2]);
877 bool PartSet_Module::customizeObject(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag,
878 const bool theUpdateViewer)
880 bool isRedisplayed = false;
881 if (myCustomPrs->isActive(theFlag))
882 isRedisplayed = myCustomPrs->redisplay(theObject, theFlag, theUpdateViewer);
884 return isRedisplayed;
887 void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser)
889 XGUI_ObjectsBrowser* aOB = dynamic_cast<XGUI_ObjectsBrowser*>(theObjectBrowser);
891 QLabel* aLabel = aOB->activeDocLabel();
892 aLabel->installEventFilter(myMenuMgr);
893 connect(aLabel, SIGNAL(customContextMenuRequested(const QPoint&)),
894 SLOT(onActiveDocPopup(const QPoint&)));
895 //QPalette aPalet = aLabel->palette();
896 //aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
897 //aLabel->setPalette(aPalet);
898 aOB->treeView()->setExpandsOnDoubleClick(false);
899 connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
900 SLOT(onTreeViewDoubleClick(const QModelIndex&)));
904 void PartSet_Module::onActiveDocPopup(const QPoint& thePnt)
906 SessionPtr aMgr = ModelAPI_Session::get();
907 QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PARTSET_CMD");
909 XGUI_Workshop* aWorkshop = getWorkshop();
910 QLabel* aHeader = aWorkshop->objectBrowser()->activeDocLabel();
912 aActivatePartAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument()));
915 aMenu.addAction(aActivatePartAction);
916 aMenu.exec(aHeader->mapToGlobal(thePnt));
920 ObjectPtr PartSet_Module::findPresentedObject(const AISObjectPtr& theAIS) const
923 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
925 /// If last line finished on vertex the lines creation sequence has to be break
926 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
928 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
929 // if there is an active widget, find the presented object in it
931 anActiveWidget = aPanel->preselectionWidget();
933 ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
935 if (aWidgetValidated)
936 anObject = aWidgetValidated->findPresentedObject(theAIS);
942 void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
944 QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
945 int aSelected = aObjects.size();
946 SessionPtr aMgr = ModelAPI_Session::get();
947 QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD");
949 ModuleBase_Operation* aCurrentOp = myWorkshop->currentOperation();
950 if (aSelected == 1) {
951 bool hasResult = false;
952 bool hasFeature = false;
953 bool hasParameter = false;
954 bool hasSubFeature = false;
955 ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
957 ObjectPtr aObject = aObjects.first();
959 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
960 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
961 bool isPart = aPart.get() ||
962 (aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID()));
964 DocumentPtr aPartDoc;
966 aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFeature->firstResult());
968 if (aPart.get()) // this may be null is Part feature is disabled
969 aPartDoc = aPart->partDoc();
971 theMenu->addAction(aActivatePartAction);
972 aActivatePartAction->setEnabled((aMgr->activeDocument() != aPartDoc));
974 } else if (aObject->document() == aMgr->activeDocument()) {
975 if (hasParameter || hasFeature) {
976 myMenuMgr->action("EDIT_CMD")->setEnabled(true);
977 theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
978 if (aCurrentOp && aFeature.get()) {
979 if (aCurrentOp->id().toStdString() == aFeature->getKind())
980 myMenuMgr->action("EDIT_CMD")->setEnabled(false);
985 ResultBodyPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObject);
987 theMenu->addAction(myMenuMgr->action("SELECT_PARENT_CMD"));
990 bool aNotDeactivate = (aCurrentOp == 0);
991 if (!aNotDeactivate) {
992 aActivatePartAction->setEnabled(false);
996 void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMessage)
998 if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
999 // Do not change activation of parts if an operation active
1000 static QStringList aAllowActivationList;
1001 if (aAllowActivationList.isEmpty())
1002 aAllowActivationList <<
1003 QString(PartSetPlugin_Part::ID().c_str()) <<
1004 QString(PartSetPlugin_Duplicate::ID().c_str()) <<
1005 QString(PartSetPlugin_Remove::ID().c_str());
1006 if (myWorkshop->currentOperation() &&
1007 (!aAllowActivationList.contains(myWorkshop->currentOperation()->id())))
1009 XGUI_Workshop* aWorkshop = getWorkshop();
1010 XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView();
1011 QLabel* aLabel = aWorkshop->objectBrowser()->activeDocLabel();
1012 QPalette aPalet = aLabel->palette();
1014 SessionPtr aMgr = ModelAPI_Session::get();
1015 DocumentPtr aActiveDoc = aMgr->activeDocument();
1016 if (aActivePartIndex.isValid())
1017 aTreeView->setExpanded(aActivePartIndex, false);
1018 XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
1019 aActivePartIndex = aDataModel->documentRootIndex(aActiveDoc);
1020 if (aActivePartIndex.isValid())
1021 aTreeView->setExpanded(aActivePartIndex, true);
1023 aLabel->setPalette(aPalet);
1024 aWorkshop->updateCommandStatus();
1026 // Update displayed objects in order to update active color
1027 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
1028 QObjectPtrList aObjects = aDisplayer->displayedObjects();
1030 foreach(ObjectPtr aObj, aObjects) {
1031 //TODO: replace by redisplay event.
1032 aHidden = !aObj->data() || !aObj->data()->isValid() ||
1033 aObj->isDisabled() || (!aObj->isDisplayed());
1035 aDisplayer->redisplay(aObj, false);
1037 aDisplayer->updateViewer();
1041 void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex)
1043 if (myWorkshop->currentOperation()) // Do not change activation of parts if an operation active
1045 SessionPtr aMgr = ModelAPI_Session::get();
1046 if (!theIndex.isValid()) {
1047 aMgr->setActiveDocument(aMgr->moduleDocument());
1050 if (theIndex.column() != 0) // Use only first column
1053 XGUI_Workshop* aWorkshop = getWorkshop();
1054 XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
1055 // De not use non editable Indexes
1056 if ((aDataModel->flags(theIndex) & Qt::ItemIsSelectable) == 0)
1058 ObjectPtr aObj = aDataModel->object(theIndex);
1060 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
1061 if (!aPart.get()) { // Probably this is Feature
1062 FeaturePtr aPartFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
1063 if (aPartFeature.get() && (aPartFeature->getKind() == PartSetPlugin_Part::ID())) {
1064 aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPartFeature->firstResult());
1067 if (aPart.get()) { // if this is a part
1068 if (aPart->partDoc() == aMgr->activeDocument()) {
1069 myMenuMgr->activatePartSet();
1077 void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*)
1079 // z layer is created for all started operations in order to visualize operation AIS presentation
1081 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
1082 if (aContext.IsNull())
1085 Handle(V3d_Viewer) aViewer = aContext->CurrentViewer();
1086 if (myVisualLayerId == 0) {
1087 if (myVisualLayerId == 0)
1088 aViewer->AddZLayer(myVisualLayerId);
1090 TColStd_SequenceOfInteger aZList;
1091 aViewer->GetAllZLayers(aZList);
1092 bool aFound = false;
1093 for (int i = 1; i <= aZList.Length(); i++) {
1094 if (aZList(i) == myVisualLayerId) {
1100 aViewer->AddZLayer(myVisualLayerId);
1102 // if there is an active operation with validated widget,
1103 // the filters of this widget should be activated in the created view
1104 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
1106 ModuleBase_ModelWidget* anActiveWidget = activeWidget();
1107 if (anActiveWidget) {
1108 ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(anActiveWidget);
1110 aWSelector->activateSelectionAndFilters(true);
1115 //******************************************************
1116 void PartSet_Module::widgetStateChanged(int thePreviousState)
1118 mySketchMgr->widgetStateChanged(thePreviousState);
1121 bool PartSet_Module::processEnter(const std::string& thePreviousAttributeID)
1123 return mySketchReentrantMgr->processEnter(thePreviousAttributeID);
1126 //******************************************************
1127 void PartSet_Module::beforeOperationStarted(ModuleBase_Operation* theOperation)
1131 //******************************************************
1132 void PartSet_Module::beforeOperationStopped(ModuleBase_Operation* theOperation)
1134 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
1135 mySketchMgr->stopSketch(theOperation);
1139 //******************************************************
1140 GeomShapePtr PartSet_Module::findShape(const AttributePtr& theAttribute)
1142 GeomShapePtr aGeomShape;
1144 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
1145 if (anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
1146 aGeomShape = PartSet_Tools::findShapeBy2DPoint(theAttribute, myWorkshop);
1151 //******************************************************
1152 AttributePtr PartSet_Module::findAttribute(const ObjectPtr& theObject,
1153 const GeomShapePtr& theGeomShape)
1155 AttributePtr anAttribute;
1156 GeomShapePtr aGeomShape = theGeomShape;
1157 if (!aGeomShape.get()) {
1158 // processing shape of result, e.g. sketch circle center is selected, this is a result
1159 // the geom shape is empty, the shape of result should be used
1160 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
1161 if (aResult.get()) {
1162 aGeomShape = aResult->shape();
1166 if (aGeomShape.get()) {
1167 TopoDS_Shape aTDSShape = aGeomShape->impl<TopoDS_Shape>();
1168 return PartSet_Tools::findAttributeBy2dPoint(theObject, aTDSShape,
1169 mySketchMgr->activeSketch());
1174 //******************************************************
1175 void PartSet_Module::onBooleanOperationChange(int theOperation)
1177 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
1180 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
1181 switch (theOperation) {
1183 aPanel->setWindowTitle(tr("Cut"));
1186 aPanel->setWindowTitle(tr("Fuse"));
1189 aPanel->setWindowTitle(tr("Common"));
1194 //******************************************************
1195 XGUI_Workshop* PartSet_Module::getWorkshop() const
1197 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
1198 return aConnector->workshop();