Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchCreator.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include "PartSet_WidgetSketchCreator.h"
22 #include "PartSet_Module.h"
23 #include "PartSet_WidgetSketchLabel.h"
24 #include "PartSet_PreviewPlanes.h"
25
26 #include <Config_Keywords.h>
27
28 #include <XGUI_ModuleConnector.h>
29 #include <XGUI_Workshop.h>
30 #include <XGUI_Displayer.h>
31 #include <XGUI_SelectionMgr.h>
32 #include <XGUI_OperationMgr.h>
33 #include <XGUI_PropertyPanel.h>
34 #include <XGUI_Tools.h>
35 #include <XGUI_ViewerProxy.h>
36
37 #include <GeomAPI_Face.h>
38
39 #include <Events_InfoMessage.h>
40
41 #include <ModelAPI_Session.h>
42 #include <ModelAPI_ResultBody.h>
43 #include <ModelAPI_AttributeSelection.h>
44 #include <ModelAPI_AttributeSelectionList.h>
45 #include <ModelAPI_Validator.h>
46 #include <ModelAPI_Events.h>
47 #include <ModelAPI_ResultConstruction.h>
48
49 #include <SketchPlugin_SketchEntity.h>
50 #include <FeaturesPlugin_CompositeBoolean.h>
51
52 #include <ModuleBase_Tools.h>
53 #include <ModuleBase_Operation.h>
54 #include <ModuleBase_IPropertyPanel.h>
55 #include <ModuleBase_OperationFeature.h>
56 #include <ModuleBase_ViewerPrs.h>
57
58 #include <Config_WidgetAPI.h>
59
60 #include <Events_Loop.h>
61
62 #include <QLabel>
63 #include <QLineEdit>
64 #include <QDoubleValidator>
65 //#include <QFormLayout>
66 #include <QVBoxLayout>
67 #include <QMessageBox>
68 #include <QMainWindow>
69
70 #define DEBUG_UNDO_INVALID_SKETCH
71
72 PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent,
73                                                          PartSet_Module* theModule,
74                                                          const Config_WidgetAPI* theData)
75 : ModuleBase_WidgetSelector(theParent, theModule->workshop(), theData),
76   myModule(theModule), myIsCustomAttribute(false)
77 {
78   myAttributeListID = theData->getProperty("attribute_list_id");
79
80   //QFormLayout* aLayout = new QFormLayout(this);
81   QVBoxLayout* aLayout = new QVBoxLayout(this);
82   ModuleBase_Tools::zeroMargins(aLayout);
83
84   ModuleBase_Tools::adjustMargins(aLayout);
85
86   QString aLabelText = QString::fromStdString(theData->widgetLabel());
87   QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
88
89   // Size of the View control
90   mySizeOfViewWidget = new QWidget(this);
91   QHBoxLayout* aSizeLayout = new QHBoxLayout(mySizeOfViewWidget);
92   aSizeLayout->addWidget(new QLabel("Size of the view", mySizeOfViewWidget));
93   mySizeOfView = new QLineEdit(mySizeOfViewWidget);
94
95   QDoubleValidator* aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView);
96   aValidator->setLocale(ModuleBase_Tools::doubleLocale());
97   aValidator->setNotation(QDoubleValidator::StandardNotation);
98   mySizeOfView->setValidator(aValidator);
99   aSizeLayout->addWidget(mySizeOfView);
100
101   myLabel = new QLabel(aLabelText, this);
102   myLabel->setWordWrap(true);
103
104   aLayout->addWidget(mySizeOfViewWidget);
105   aLayout->addWidget(myLabel);
106   aLayout->addStretch(1);
107
108   std::string aTypes = theData->getProperty("shape_types");
109   myShapeTypes = QString(aTypes.c_str()).split(' ', QString::SkipEmptyParts);
110
111   myPreviewPlanes = new PartSet_PreviewPlanes();
112 }
113
114 PartSet_WidgetSketchCreator::~PartSet_WidgetSketchCreator()
115 {
116   // we need to deactivate here in order to hide preview planes if the selection mode is
117   // active
118   deactivate();
119 }
120
121 QList<QWidget*> PartSet_WidgetSketchCreator::getControls() const
122 {
123   QList<QWidget*> aControls;
124   aControls.append(myLabel);
125   return aControls;
126 }
127
128 bool PartSet_WidgetSketchCreator::restoreValueCustom()
129 {
130   return true;
131 }
132
133 bool PartSet_WidgetSketchCreator::storeValueCustom()
134 {
135   return true;
136 }
137
138 AttributePtr PartSet_WidgetSketchCreator::attribute() const
139 {
140   AttributePtr anAttribute;
141   if (myIsCustomAttribute)
142     anAttribute = myFeature->attribute(myAttributeListID);
143   else
144     anAttribute = ModuleBase_WidgetSelector::attribute();
145
146   return anAttribute;
147 }
148
149 //********************************************************************
150 void PartSet_WidgetSketchCreator::openExtrusionTransaction()
151 {
152   SessionPtr aMgr = ModelAPI_Session::get();
153   bool aIsOp = aMgr->isOperation();
154   if (!aIsOp) {
155     const static std::string aNestedOpID("Parameters modification");
156     aMgr->startOperation(aNestedOpID, true);
157   }
158 }
159
160 //********************************************************************
161 bool PartSet_WidgetSketchCreator::isValidSelection(const ModuleBase_ViewerPrsPtr& theValue)
162 {
163   bool aValid = false;
164   if (myIsCustomAttribute) {
165     // check only suiting of the value to custom attribute (myAttributeListID)
166     // do not cash of validation to avoid using states, stored for XML attribute
167     // there is an alternative is to call clearValidatedCash() in setSelection()
168     aValid = isValidSelectionForAttribute(theValue, attribute());
169   }
170   else { /// if the validated attribute is already custom
171     if (getValidState(theValue, aValid)) {
172       return aValid;
173     }
174     aValid = isValidSelectionCustom(theValue);
175     if (!aValid)
176       // check selection to create new sketh (XML current attribute)
177       aValid = isValidSelectionForAttribute(theValue, attribute());
178     if (!aValid) {
179       // check selection to fill list attribute (myAttributeListID)
180       bool isCustomAttribute = myIsCustomAttribute;
181       myIsCustomAttribute = true;
182       aValid = isValidSelectionForAttribute(theValue, attribute());
183       myIsCustomAttribute = isCustomAttribute;
184     }
185   }
186   storeValidState(theValue, aValid);
187   return aValid;
188 }
189
190 //********************************************************************
191 bool PartSet_WidgetSketchCreator::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue)
192 {
193   return PartSet_WidgetSketchLabel::canFillSketch(theValue);
194 }
195
196 void PartSet_WidgetSketchCreator::activateSelectionControl()
197 {
198   // we need to call activate here as the widget has no focus accepted controls
199   // if these controls are added here, activate will happens automatically after focusIn()
200   XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
201   XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
202   aPanel->activateWidget(this, false);
203 }
204
205 void PartSet_WidgetSketchCreator::setVisibleSelectionControl(const bool theSelectionControl)
206 {
207   // hide current widget, activate the next widget
208   XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
209   XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
210   const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
211   foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
212     if (theSelectionControl) { // hide other controls
213       if (aWidget != this)
214         aWidget->setVisible(false);
215     }
216     else { // hide current control
217       if (aWidget == this)
218         aWidget->setVisible(false);
219       else {
220         aWidget->setVisible(true);
221         if (aWidget->attributeID() == myAttributeListID)
222           setEnabledModelWidget(aWidget, !hasSubObjects());
223       }
224     }
225   }
226
227   if (theSelectionControl) {
228     bool aBodyIsVisualized = myPreviewPlanes->hasVisualizedBodies(myWorkshop);
229     bool aSketchIsVisualized = myPreviewPlanes->hasVisualizedSketch(myWorkshop);
230     if (!aBodyIsVisualized && !aSketchIsVisualized) {
231       // We have to select a plane before any operation
232       myPreviewPlanes->showPreviewPlanes(myWorkshop);
233       mySizeOfViewWidget->setVisible(true);
234     }
235     else {
236       mySizeOfViewWidget->setVisible(false);
237     }
238
239   } else {
240     bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
241     myPreviewPlanes->erasePreviewPlanes(myWorkshop);
242     if (aHidePreview)
243       aWorkshop->viewer()->update();
244   }
245 }
246
247 QIntList PartSet_WidgetSketchCreator::shapeTypes() const
248 {
249   QIntList aShapeTypes;
250   foreach(QString aType, myShapeTypes) {
251     aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
252   }
253   return aShapeTypes;
254 }
255
256 void PartSet_WidgetSketchCreator::setEditingMode(bool isEditing)
257 {
258   ModuleBase_ModelWidget::setEditingMode(isEditing);
259   if (isEditing) {
260     setVisibleSelectionControl(false);
261
262     ModuleBase_ModelWidget* anAttributeListWidget = 0;
263     XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
264     XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
265     const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
266     foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
267       if (aWidget->attributeID() == myAttributeListID) {
268         anAttributeListWidget = aWidget;
269         break;
270       }
271     }
272     if (anAttributeListWidget)
273       setEnabledModelWidget(anAttributeListWidget, !hasSubObjects());
274   }
275 }
276
277 bool PartSet_WidgetSketchCreator::isSelectionMode() const
278 {
279   AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID);
280   bool aHasValueInList = anAttrList.get() && anAttrList->size() > 0;
281
282   return !aHasValueInList;
283 }
284
285 bool PartSet_WidgetSketchCreator::hasSubObjects() const
286 {
287   bool aHasSubObjects = false;
288
289   bool aCanSetFocus = true;
290   CompositeFeaturePtr aComposite = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
291   if (aComposite.get())
292     aHasSubObjects = aComposite->numberOfSubs() > 0;
293   return aHasSubObjects;
294 }
295
296 bool PartSet_WidgetSketchCreator::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
297                                                const bool theToValidate)
298 {
299   bool aDone = false;
300   if (!startSketchOperation(theValues)) {
301     myIsCustomAttribute = true;
302     QList<ModuleBase_ViewerPrsPtr>::const_iterator
303       anIt = theValues.begin(), aLast = theValues.end();
304     bool aProcessed = false;
305     for (; anIt != aLast; anIt++) {
306       ModuleBase_ViewerPrsPtr aValue = *anIt;
307       if (!theToValidate || isValidInFilters(aValue))
308         aProcessed = setSelectionCustom(aValue) || aProcessed;
309     }
310     myIsCustomAttribute = false;
311     aDone = aProcessed;
312     if (aProcessed) {
313       emit valuesChanged();
314       updateObject(myFeature);
315       setVisibleSelectionControl(false);
316       // manually deactivation because the widget was
317       // not activated as has no focus acceptin controls
318       deactivate();
319       emit focusOutWidget(this);
320     }
321   }
322   return aDone;
323 }
324
325 //********************************************************************
326 void PartSet_WidgetSketchCreator::onSelectionChanged()
327 {
328   QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
329   bool isDone = setSelection(aSelected, true/*false*/);
330 }
331
332 //********************************************************************
333 void PartSet_WidgetSketchCreator::updateOnSelectionChanged(const bool theDone)
334 {
335 }
336
337 bool PartSet_WidgetSketchCreator::startSketchOperation(
338                               const QList<ModuleBase_ViewerPrsPtr>& theValues)
339 {
340   bool aSketchStarted = false;
341
342   if (theValues.size() != 1)
343     return aSketchStarted;
344
345   ModuleBase_ViewerPrsPtr aValue = theValues.front();
346   if (!aValue.get() || !PartSet_WidgetSketchLabel::canFillSketch(aValue))
347     return aSketchStarted;
348
349   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aValue->object());
350   /// sketch should not started by object(face) selected as global. If Local face is selected,
351   /// sketch is started
352   if (aResult.get() && aValue->shape().get() && aResult->shape()->isEqual(aValue->shape())) {
353     ResultConstructionPtr aConstruction =
354       std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
355     if (!aConstruction.get() || !aConstruction->isInfinite())
356       return aSketchStarted;
357   }
358   aSketchStarted = true;
359   // Set View size if a plane is selected
360   if (myPreviewPlanes->isPreviewDisplayed() &&
361       myPreviewPlanes->isPreviewShape(aValue->shape())) {
362     QString aSizeOfViewStr = mySizeOfView->text();
363     if (!aSizeOfViewStr.isEmpty()) {
364       bool isOk;
365       double aSizeOfView = aSizeOfViewStr.toDouble(&isOk);
366       if (isOk && aSizeOfView > 0) {
367         Handle(V3d_View) aView3d = myWorkshop->viewer()->activeView();
368         if (!aView3d.IsNull()) {
369           Bnd_Box aBndBox;
370           double aHalfSize = aSizeOfView/2.0;
371           aBndBox.Update(-aHalfSize, -aHalfSize, -aHalfSize, aHalfSize, aHalfSize, aHalfSize);
372           aView3d->FitAll(aBndBox, 0.01, false);
373         }
374       }
375     }
376   }
377   // manually deactivation because the widget was not activated as has no focus acceptin controls
378   deactivate();
379   bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
380   myPreviewPlanes->erasePreviewPlanes(myWorkshop);
381
382   // Launch Sketch operation
383   CompositeFeaturePtr aCompFeature =
384     std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
385
386   // start edit operation for the sketch
387   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
388                                                             (myModule->createOperation("Sketch"));
389   QList<ModuleBase_ViewerPrsPtr> aValues;
390   aValues.push_back(aValue);
391   aFOperation->setPreselection(aValues);
392
393   myWorkshop->processLaunchOperation(aFOperation);
394
395   return aSketchStarted;
396 }
397
398 bool PartSet_WidgetSketchCreator::focusTo()
399 {
400   // this method is called only in creation mode. In Edition mode this widget is hidden
401   if (isSelectionMode() && !hasSubObjects()) {
402     setVisibleSelectionControl(true);
403     activateSelectionControl();
404     openExtrusionTransaction();
405     return true;
406   }
407   else
408     connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)),
409             SLOT(onResumed(ModuleBase_Operation*)));
410
411   return true;
412 }
413
414 void PartSet_WidgetSketchCreator::deactivate()
415 {
416   ModuleBase_WidgetSelector::deactivate();
417
418   bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
419   myPreviewPlanes->erasePreviewPlanes(myWorkshop);
420   if (aHidePreview)
421     XGUI_Tools::workshop(myWorkshop)->viewer()->update();
422
423 }
424
425 void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp)
426 {
427   SessionPtr aMgr = ModelAPI_Session::get();
428   bool aIsOp = aMgr->isOperation();
429   if (aIsOp) {
430     // in current implementation, all transactions are closed when resume happens
431     // so, this is a wrong case, which is not checked.
432     // To provide it, make correction in later rows about abort/undo transactions
433     return;
434   }
435   // Set visible only selection control
436   setVisibleSelectionControl(true);
437
438   // Validate the created sketch. If it is valid, it is set into the composite feature selection
439   // list, otherwise it is removed
440   CompositeFeaturePtr aCompFeature =
441     std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
442   AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID);
443   if (aCompFeature->numberOfSubs() > 0) {
444     // set the sub feature to attribute selection list and check whether sketch is valid
445     SessionPtr aMgr = ModelAPI_Session::get();
446     const static std::string aNestedOpID("Set Sketch result into Selection list");
447     aMgr->startOperation(aNestedOpID, false); // false to not attach to Extrusion operation
448     setSketchObjectToList(aCompFeature, anAttrList);
449     aMgr->finishOperation();
450
451     if (!validateSelectionList()) {
452 #ifdef DEBUG_UNDO_INVALID_SKETCH
453       aMgr->undo(); // Extrusion modification parameters: setSketchObjectToList()
454       aMgr->undo(); /// Sketch creation
455 #else
456       aMgr->startOperation("Delete invalid Sketch feature", false);
457
458       // delete invalid sketch
459       CompositeFeaturePtr aSketchFeature =
460               std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
461       QObjectPtrList anObjects;
462       anObjects.append(aSketchFeature);
463
464       XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
465       aWorkshop->deleteFeatures(anObjects);
466
467       aMgr->finishOperation();
468 #endif
469     }
470   }
471   openExtrusionTransaction();
472
473   if (aCompFeature->numberOfSubs() == 0) {
474     // call activateWidget() of the parent to connect to the viewer seleciton
475     activateSelectionControl();
476   }
477   else {
478     // check if the created sketch is valid. If it is invalid, it will be deleted with warning else
479     /// the attribute selection list will be filled by result of this sketch.
480     setVisibleSelectionControl(false);
481
482     // Update value in attribute selection list
483     XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
484     XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
485     const QList<ModuleBase_ModelWidget*>& aWidgets = aPropertyPanel->modelWidgets();
486     ModuleBase_ModelWidget* aListWidget = 0;
487     foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
488       if (aWidget->attributeID() == myAttributeListID) {
489         aListWidget = aWidget;
490         break;
491       }
492     }
493     if (aListWidget) {
494       aListWidget->restoreValue();
495       aPropertyPanel->activateNextWidget(aListWidget);
496     }
497
498     // Hide sketcher result
499     CompositeFeaturePtr aSketchFeature =
500       std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
501     std::list<ResultPtr> aResults = aSketchFeature->results();
502     std::list<ResultPtr>::const_iterator aIt;
503     for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
504       (*aIt)->setDisplayed(false);
505     }
506     aSketchFeature->setDisplayed(false);
507     static Events_Loop* aLoop = Events_Loop::loop();
508     aLoop->flush(aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY));
509
510     // Add Selected body were created the sketcher to list of selected objects
511     std::string anObjectsAttribute = FeaturesPlugin_CompositeBoolean::OBJECTS_ID();
512     AttributeSelectionListPtr aSelList = aCompFeature->data()->selectionList(anObjectsAttribute);
513     if (aSelList.get()) {
514       DataPtr aData = aSketchFeature->data();
515       AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
516                                     (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
517       ResultPtr aRes = aSelAttr.get() ? aSelAttr->context() : ResultPtr();
518       if (aRes.get()) {
519         SessionPtr aMgr = ModelAPI_Session::get();
520         ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
521         AttributePtr anAttribute = myFeature->attribute(anObjectsAttribute);
522         std::string aValidatorID;
523         Events_InfoMessage anError;
524         aSelList->append(aRes, GeomShapePtr());
525         if (aFactory->validate(anAttribute, aValidatorID, anError))
526           updateObject(aCompFeature);
527         else
528           aSelList->clear();
529       }
530     }
531   }
532   restoreValue();
533 }
534
535 bool PartSet_WidgetSketchCreator::validateSelectionList() const
536 {
537   AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID);
538
539   SessionPtr aMgr = ModelAPI_Session::get();
540   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
541   std::string aValidatorID;
542   Events_InfoMessage anError;
543   bool isValidPComposite = aFactory->validate(anAttrList, aValidatorID, anError);
544   if (!isValidPComposite) {
545     XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
546     // TODO(spo): translate
547     QMessageBox::question(aWorkshop->desktop(), tr("Apply current feature"),
548                   tr("Sketch is invalid and will be deleted.\nError: %1")
549                   .arg(anError.messageString().c_str()),
550                   QMessageBox::Ok);
551   }
552   return isValidPComposite;
553 }
554
555 void PartSet_WidgetSketchCreator::setSketchObjectToList(
556                             const CompositeFeaturePtr& theCompositeFeature,
557                             const AttributePtr& theAttribute)
558 {
559   if (!theCompositeFeature.get() || theCompositeFeature->numberOfSubs() != 1)
560     return;
561
562   AttributeSelectionListPtr aBaseObjectsSelectionList =
563                      std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
564   if(!aBaseObjectsSelectionList.get() || aBaseObjectsSelectionList->isInitialized()) {
565     return;
566   }
567
568   FeaturePtr aSketchFeature = theCompositeFeature->subFeature(0);
569   if(!aSketchFeature.get() || aSketchFeature->results().empty()) {
570     return;
571   }
572
573   ResultPtr aSketchRes = aSketchFeature->results().front();
574   ResultConstructionPtr aConstruction =
575     std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSketchRes);
576   if(!aConstruction.get()) {
577     return;
578   }
579
580   if(aBaseObjectsSelectionList->size() == 0) {
581     aBaseObjectsSelectionList->append(aSketchRes, GeomShapePtr());
582   }
583 }
584
585 void PartSet_WidgetSketchCreator::setEnabledModelWidget(ModuleBase_ModelWidget* theModelWidget,
586                                                         const bool theEnabled)
587 {
588   QList<QWidget*> aMyControls = theModelWidget->getControls();
589   foreach(QWidget*  eachControl, aMyControls) {
590     eachControl->setEnabled(theEnabled);
591   }
592 }