1 #include <PartSet_Module.h>
2 #include <PartSet_OperationSketch.h>
3 #include <PartSet_OperationFeatureCreate.h>
4 #include <PartSet_OperationFeatureEditMulti.h>
5 #include <PartSet_OperationFeatureEdit.h>
6 #include <PartSet_Listener.h>
7 #include <PartSet_TestOCC.h>
8 #include <PartSet_WidgetSketchLabel.h>
9 #include <PartSet_Validators.h>
10 #include <PartSet_Tools.h>
12 #include <ModuleBase_Operation.h>
13 #include <ModuleBase_OperationDescription.h>
14 #include <ModuleBase_WidgetFactory.h>
15 #include <ModuleBase_Operation.h>
16 #include <ModuleBase_Tools.h>
18 #include <ModelAPI_Object.h>
19 #include <ModelAPI_Events.h>
20 #include <ModelAPI_Validator.h>
21 #include <ModelAPI_Data.h>
23 #include <GeomDataAPI_Point2D.h>
25 #include <XGUI_MainWindow.h>
26 #include <XGUI_Displayer.h>
27 #include <XGUI_Viewer.h>
28 #include <XGUI_Workshop.h>
29 #include <XGUI_OperationMgr.h>
30 #include <XGUI_SelectionMgr.h>
31 #include <XGUI_Selection.h>
32 #include <XGUI_ViewPort.h>
33 #include <XGUI_ActionsMgr.h>
34 #include <XGUI_ViewerProxy.h>
35 #include <XGUI_ContextMenuMgr.h>
36 #include <XGUI_PropertyPanel.h>
37 #include <XGUI_ModuleConnector.h>
38 #include <XGUI_Tools.h>
40 #include <SketchPlugin_Line.h>
42 #include <Config_PointerMessage.h>
43 #include <Config_ModuleReader.h>
44 #include <Config_WidgetReader.h>
45 #include <Events_Loop.h>
46 #include <Events_Message.h>
47 #include <Events_Error.h>
49 #include <GeomAPI_Shape.h>
50 #include <GeomAPI_AISObject.h>
51 #include <AIS_Shape.hxx>
54 #include <QMouseEvent>
57 #include <GeomAlgoAPI_FaceBuilder.h>
58 #include <GeomDataAPI_Dir.h>
65 /*!Create and return new instance of XGUI_Module*/
66 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(XGUI_Workshop* theWshop)
68 return new PartSet_Module(theWshop);
71 PartSet_Module::PartSet_Module(XGUI_Workshop* theWshop)
73 myWorkshop = theWshop;
74 myListener = new PartSet_Listener(this);
76 XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
78 connect(anOperationMgr, SIGNAL(operationStarted()),
79 this, SLOT(onOperationStarted()));
81 connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
82 this, SLOT(onOperationStopped(ModuleBase_Operation*)));
84 XGUI_ContextMenuMgr* aContextMenuMgr = myWorkshop->contextMenuMgr();
85 connect(aContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)),
86 this, SLOT(onContextMenuCommand(const QString&, bool)));
88 connect(myWorkshop->viewer(), SIGNAL(mousePress(QMouseEvent*)),
89 this, SLOT(onMousePressed(QMouseEvent*)));
90 connect(myWorkshop->viewer(), SIGNAL(mouseRelease(QMouseEvent*)),
91 this, SLOT(onMouseReleased(QMouseEvent*)));
92 connect(myWorkshop->viewer(), SIGNAL(mouseMove(QMouseEvent*)),
93 this, SLOT(onMouseMoved(QMouseEvent*)));
94 connect(myWorkshop->viewer(), SIGNAL(keyRelease(QKeyEvent*)),
95 this, SLOT(onKeyRelease(QKeyEvent*)));
96 connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)),
97 this, SLOT(onMouseDoubleClick(QMouseEvent*)));
100 PartSet_Module::~PartSet_Module()
104 XGUI_Workshop* PartSet_Module::workshop() const
109 void PartSet_Module::createFeatures()
111 //!! Test registering of validators
112 PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
113 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
114 aFactory->registerValidator("PartSet_DistanceValidator", new PartSet_DistanceValidator);
115 aFactory->registerValidator("PartSet_LengthValidator", new PartSet_LengthValidator);
116 aFactory->registerValidator("PartSet_PerpendicularValidator", new PartSet_PerpendicularValidator);
117 aFactory->registerValidator("PartSet_ParallelValidator", new PartSet_ParallelValidator);
118 aFactory->registerValidator("PartSet_RadiusValidator", new PartSet_RadiusValidator);
120 Config_ModuleReader aXMLReader = Config_ModuleReader();
121 aXMLReader.readAll();
122 myFeaturesInFiles = aXMLReader.featuresInFiles();
125 void PartSet_Module::featureCreated(QAction* theFeature)
127 connect(theFeature, SIGNAL(triggered(bool)), this, SLOT(onFeatureTriggered()));
130 QStringList PartSet_Module::nestedFeatures(QString)
132 return QStringList();
135 std::string PartSet_Module::featureFile(const std::string& theFeatureId)
137 return myFeaturesInFiles[theFeatureId];
143 void PartSet_Module::onFeatureTriggered()
145 //PartSet_TestOCC::local_selection_change_shape(myWorkshop->viewer()->AISContext(),
146 // myWorkshop->viewer()->activeView());
148 //PartSet_TestOCC::local_selection_erase(myWorkshop->viewer()->AISContext(),
149 // myWorkshop->viewer()->activeView());
150 QAction* aCmd = dynamic_cast<QAction*>(sender());
151 //Do nothing on uncheck
152 if(aCmd->isCheckable() && !aCmd->isChecked())
154 launchOperation(aCmd->data().toString());
157 void PartSet_Module::launchOperation(const QString& theCmdId)
159 ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
160 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
162 XGUI_Selection* aSelection = myWorkshop->selector()->selection();
163 // Initialise operation with preliminary selection
164 std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
165 std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
166 aPreviewOp->initSelection(aSelected, aHighlighted);
168 sendOperation(anOperation);
171 void PartSet_Module::onOperationStarted()
173 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
174 myWorkshop->operationMgr()->currentOperation());
176 XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
177 connect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)),
178 this, SLOT(onStorePoint2D(ObjectPtr, const std::string&)), Qt::UniqueConnection);
182 void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
186 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(theOperation);
188 XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
189 //disconnect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)),
190 // this, SLOT(onStorePoint2D(ObjectPtr, const std::string&)));
194 void PartSet_Module::onContextMenuCommand(const QString& theId, bool isChecked)
196 QList<ObjectPtr> aFeatures = myWorkshop->selector()->selection()->selectedObjects();
197 if (theId == "EDIT_CMD" && (aFeatures.size() > 0)) {
198 FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aFeatures.first());
200 editFeature(aFeature);
204 void PartSet_Module::onMousePressed(QMouseEvent* theEvent)
206 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
207 myWorkshop->operationMgr()->currentOperation());
209 XGUI_Selection* aSelection = myWorkshop->selector()->selection();
210 // Initialise operation with preliminary selection
211 std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
212 std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
214 aPreviewOp->mousePressed(theEvent, myWorkshop->viewer()->activeView(), aSelected, aHighlighted);
218 void PartSet_Module::onMouseReleased(QMouseEvent* theEvent)
220 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
221 myWorkshop->operationMgr()->currentOperation());
223 XGUI_Selection* aSelection = myWorkshop->selector()->selection();
224 // Initialise operation with preliminary selection
225 std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
226 std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
228 aPreviewOp->mouseReleased(theEvent, myWorkshop->viewer()->activeView(), aSelected, aHighlighted);
232 void PartSet_Module::onMouseMoved(QMouseEvent* theEvent)
234 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
235 myWorkshop->operationMgr()->currentOperation());
237 aPreviewOp->mouseMoved(theEvent, myWorkshop->viewer()->activeView());
240 void PartSet_Module::onKeyRelease(QKeyEvent* theEvent)
242 ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
243 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
245 aPreviewOp->keyReleased(theEvent->key());
249 void PartSet_Module::onMouseDoubleClick(QMouseEvent* theEvent)
251 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
252 myWorkshop->operationMgr()->currentOperation());
255 XGUI_Selection* aSelection = myWorkshop->selector()->selection();
256 // Initialise operation with preliminary selection
257 std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
258 std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
259 aPreviewOp->mouseDoubleClick(theEvent, myWorkshop->viewer()->activeView(), aSelected,
264 void PartSet_Module::onPlaneSelected(double theX, double theY, double theZ)
267 myWorkshop->viewer()->setViewProjection(theX, theY, theZ);
268 myWorkshop->actionsMgr()->update();
270 //PartSet_TestOCC::testSelection(myWorkshop);
273 void PartSet_Module::onFitAllView()
275 myWorkshop->viewer()->fitAll();
278 void PartSet_Module::onLaunchOperation(std::string theName, ObjectPtr theObject)
280 FeaturePtr aFeature = ModuleBase_Tools::feature(theObject);
282 qDebug("Warning! Restart operation without feature!");
285 ModuleBase_Operation* anOperation = createOperation(theName.c_str(),
286 aFeature ? aFeature->getKind() : "");
287 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
290 XGUI_Selection* aSelection = myWorkshop->selector()->selection();
291 // Initialise operation with preliminary selection
292 std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
293 std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
294 aPreviewOp->initFeature(aFeature);
295 aPreviewOp->initSelection(aSelected, aHighlighted);
297 anOperation->setEditingFeature(aFeature);
299 sendOperation(anOperation);
300 myWorkshop->actionsMgr()->updateCheckState();
303 void PartSet_Module::onMultiSelectionEnabled(bool theEnabled)
305 XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
306 aViewer->enableMultiselection(theEnabled);
309 void PartSet_Module::onStopSelection(const QList<ObjectPtr>& theFeatures, const bool isStop)
311 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
313 foreach(ObjectPtr aObject, theFeatures) {
314 activateFeature(aObject, false);
317 //ObjectPtr aResults;
318 //foreach(ObjectPtr aFeature, theFeatures) {
319 /* TODO if (aFeature->results().size() > 0) {
320 const std::list<ResultPtr>& aResList = aFeature->results();
321 std::list<ResultPtr>::const_iterator aIt;
322 for (aIt = aResList.cbegin(); aIt != aResList.cend(); ++aIt)
323 aResults.append(*aIt);
326 aDisplayer->stopSelection(theFeatures, isStop, false);
328 XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
329 aViewer->enableSelection(!isStop);
331 aDisplayer->updateViewer();
334 void PartSet_Module::onSetSelection(const QList<ObjectPtr>& theFeatures)
336 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
337 aDisplayer->setSelected(theFeatures, false);
338 aDisplayer->updateViewer();
341 void PartSet_Module::onCloseLocalContext()
343 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
344 aDisplayer->closeLocalContexts();
347 void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
349 // bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
351 ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
352 PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
354 std::list<FeaturePtr> aList = aPrevOp->subFeatures();
355 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
356 std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
357 std::list<FeaturePtr>::iterator aSFIt;
358 for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
359 std::list<ResultPtr> aResults = (*aSFIt)->results();
360 std::list<ResultPtr>::iterator aIt;
361 for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
362 aDisplayer->activateInLocalContext((*aIt), aModes, false);
366 ModelAPI_EventCreator::get()->sendUpdated(theFeature,
367 Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
370 // ->erase(theFeature->firstResult(), true);
371 /* bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
372 // TODO visualizePreview(theFeature, isDisplay, false);
374 ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
376 PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
378 std::list<FeaturePtr> aList = aPrevOp->subFeatures();
379 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
380 std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
382 std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
384 //TODO for (; anIt != aLast; anIt++)
385 // visualizePreview((*anIt), false, false);
386 //aDisplayer->updateViewer();
390 if (theMode == PartSet_OperationSketchBase::FM_Activation ||
391 theMode == PartSet_OperationSketchBase::FM_Deactivation)
392 activateFeature(theFeature, true);*/
395 ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdId,
396 const std::string& theFeatureKind)
398 // create the operation
399 ModuleBase_Operation* anOperation = 0;
400 if (theCmdId == PartSet_OperationSketch::Type()) {
401 anOperation = new PartSet_OperationSketch(theCmdId.c_str(), this);
404 ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
406 PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
408 aSketch = aPrevOp->sketch();
409 if (PartSet_OperationFeatureCreate::canProcessKind(theCmdId))
410 anOperation = new PartSet_OperationFeatureCreate(theCmdId.c_str(), this, aSketch);
411 else if (theCmdId == PartSet_OperationFeatureEditMulti::Type())
412 anOperation = new PartSet_OperationFeatureEditMulti(theCmdId.c_str(), this, aSketch);
413 else if (theCmdId == PartSet_OperationFeatureEdit::Type())
414 anOperation = new PartSet_OperationFeatureEdit(theCmdId.c_str(), this, aSketch);
418 anOperation = new ModuleBase_Operation(theCmdId.c_str(), this);
421 // set operation description and list of widgets corresponding to the feature xml definition
422 std::string aFeatureKind = theFeatureKind.empty() ? theCmdId : theFeatureKind;
424 std::string aPluginFileName = featureFile(aFeatureKind);
425 Config_WidgetReader aWdgReader = Config_WidgetReader(aPluginFileName);
426 aWdgReader.readAll();
427 std::string aXmlCfg = aWdgReader.featureWidgetCfg(aFeatureKind);
428 std::string aDescription = aWdgReader.featureDescription(aFeatureKind);
430 //QString aXmlRepr = QString::fromStdString(aXmlCfg);
431 //ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(),
432 // myWorkshop->moduleConnector());
433 //QWidget* aContent = myWorkshop->propertyPanel()->contentWidget();
434 //qDeleteAll(aContent->children());
435 //aFactory.createWidget(aContent);
437 anOperation->getDescription()->setDescription(QString::fromStdString(aDescription));
438 anOperation->getDescription()->setXmlRepresentation(QString::fromStdString(aXmlCfg));
440 //anOperation->setModelWidgets(aXmlRepr.toStdString(), aFactory.getModelWidgets());
442 // connect the operation
443 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
445 connect(aPreviewOp, SIGNAL(featureConstructed(FeaturePtr, int)),
446 this, SLOT(onFeatureConstructed(FeaturePtr, int)));
447 connect(aPreviewOp, SIGNAL(launchOperation(std::string, ObjectPtr)),
448 this, SLOT(onLaunchOperation(std::string, ObjectPtr)));
449 connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
450 this, SLOT(onMultiSelectionEnabled(bool)));
452 connect(aPreviewOp, SIGNAL(stopSelection(const QList<ObjectPtr>&, const bool)),
453 this, SLOT(onStopSelection(const QList<ObjectPtr>&, const bool)));
454 connect(aPreviewOp, SIGNAL(setSelection(const QList<ObjectPtr>&)),
455 this, SLOT(onSetSelection(const QList<ObjectPtr>&)));
457 connect(aPreviewOp, SIGNAL(closeLocalContext()),
458 this, SLOT(onCloseLocalContext()));
460 PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
462 connect(aSketchOp, SIGNAL(planeSelected(double, double, double)),
463 this, SLOT(onPlaneSelected(double, double, double)));
464 connect(aSketchOp, SIGNAL(fitAllView()),
465 this, SLOT(onFitAllView()));
472 void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
474 static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
475 Config_PointerMessage aMessage(aModuleEvent, this);
476 aMessage.setPointer(theOperation);
477 Events_Loop::loop()->send(aMessage);
481 /*void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay,
482 const bool isUpdateViewer)
484 ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
488 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
492 ResultPtr aResult = theFeature->firstResult();
493 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
495 boost::shared_ptr<SketchPlugin_Feature> aSPFeature =
496 boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
498 PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
499 if (aSketchOp && !aSketchOp->hasSketchPlane())
504 aDisplayer->erase(aResult, false);
507 aDisplayer->updateViewer();
510 void PartSet_Module::activateFeature(ObjectPtr theFeature, const bool isUpdateViewer)
512 ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
513 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
515 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
516 std::list<int> aModes = aPreviewOp->getSelectionModes(theFeature);
517 aDisplayer->activateInLocalContext(theFeature, aModes, isUpdateViewer);
521 void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
523 ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
527 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
531 FeaturePtr aFeature = aPreviewOp->feature();
532 if (!aFeature || aFeature->getKind() != theCmdId)
535 std::list<FeaturePtr> aList = aPreviewOp->subFeatures();
536 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
537 std::list<int> aModes = aPreviewOp->getSelectionModes(aPreviewOp->feature());
539 std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
541 for (; anIt != aLast; anIt++) {
542 boost::shared_ptr<SketchPlugin_Feature> aSPFeature =
543 boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
546 //visualizePreview((*anIt), true, false);
547 aDisplayer->activateInLocalContext((*anIt), aModes, false);
549 aDisplayer->updateViewer();
552 void PartSet_Module::editFeature(FeaturePtr theFeature)
557 // if (theFeature->getKind() == SKETCH_KIND) {
558 //FeaturePtr aFeature = theFeature;
559 //if (XGUI_Tools::isModelObject(aFeature)) {
560 // ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
561 // aFeature = aObject->featureRef();
565 onLaunchOperation(theFeature->getKind(), theFeature);
566 updateCurrentPreview(theFeature->getKind());
571 void PartSet_Module::onStorePoint2D(ObjectPtr theFeature, const std::string& theAttribute)
573 FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
575 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
576 myWorkshop->operationMgr()->currentOperation());
580 boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
581 boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFeature->data()->attribute(theAttribute));
583 PartSet_Tools::setConstraints(aPreviewOp->sketch(), aFeature, theAttribute,
584 aPoint->x(), aPoint->y());
587 /*bool PartSet_Module::isFeatureEnabled(const QString& theCmdId) const
589 XGUI_OperationMgr* aOpMgr = myWorkshop->operationMgr();
590 XGUI_ActionsMgr* aActMgr = myWorkshop->actionsMgr();
592 ModuleBase_Operation* aOperation = aOpMgr->currentOperation();
594 return !aActMgr->isNested(theCmdId);
596 PartSet_OperationFeatureEdit* aSketchEdtOp = dynamic_cast<PartSet_OperationFeatureEdit*>(aOperation);
598 QStringList aConstraintList;
599 aConstraintList<<"SketchConstraintDistance"<<"SketchConstraintLength"
600 <<"SketchConstraintRadius"<<"SketchConstraintParallel"<<"SketchConstraintPerpendicular";
601 return aConstraintList.contains(theCmdId);
603 QStringList aList = aActMgr->nestedCommands(aOperation->id());
604 return aList.contains(theCmdId);
607 QWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
608 Config_WidgetAPI* theWidgetApi, QList<ModuleBase_ModelWidget*>& theModelWidgets)
610 if (theType == "sketch-start-label") {
611 PartSet_WidgetSketchLabel* aWgt = new PartSet_WidgetSketchLabel(theParent, theWidgetApi, "");
612 aWgt->setOperationsMgr(myWorkshop->operationMgr());
613 theModelWidgets.append(aWgt);
614 return aWgt->getControl();