+ bool aDone = false;
+ if (!startSketchOperation(theValues)) {
+ myIsCustomAttribute = true;
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator
+ anIt = theValues.begin(), aLast = theValues.end();
+ bool aProcessed = false;
+ for (; anIt != aLast; anIt++) {
+ ModuleBase_ViewerPrsPtr aValue = *anIt;
+ if (!theToValidate || isValidInFilters(aValue))
+ aProcessed = setSelectionCustom(aValue) || aProcessed;
+ }
+ myIsCustomAttribute = false;
+ aDone = aProcessed;
+ if (aProcessed) {
+ emit valuesChanged();
+ updateObject(myFeature);
+ setVisibleSelectionControl(false);
+ // manually deactivation because the widget was
+ // not activated as has no focus acceptin controls
+ deactivate();
+ emit focusOutWidget(this);
+ }
+ }
+ return aDone;
+}
+
+//********************************************************************
+bool PartSet_WidgetSketchCreator::processSelection()
+{
+ QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
+ bool isDone = setSelection(aSelected, true/*false*/);
+
+ return isDone;
+}
+
+//********************************************************************
+void PartSet_WidgetSketchCreator::updateOnSelectionChanged(const bool theDone)
+{
+}
+
+bool PartSet_WidgetSketchCreator::startSketchOperation(
+ const QList<ModuleBase_ViewerPrsPtr>& theValues)
+{
+ bool aSketchStarted = false;
+
+ if (theValues.size() != 1)
+ return aSketchStarted;
+
+ ModuleBase_ViewerPrsPtr aValue = theValues.front();
+ if (!aValue.get() || !PartSet_WidgetSketchLabel::canFillSketch(aValue))
+ return aSketchStarted;
+
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aValue->object());
+ /// sketch should not started by object(face) selected as global. If Local face is selected,
+ /// sketch is started
+ if (aResult.get() && aValue->shape().get() && aResult->shape()->isEqual(aValue->shape())) {
+ ResultConstructionPtr aConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
+ if (!aConstruction.get() || !aConstruction->isInfinite())
+ return aSketchStarted;
+ }
+ aSketchStarted = true;
+ // Set View size if a plane is selected
+ if (myPreviewPlanes->isPreviewDisplayed() &&
+ myPreviewPlanes->isPreviewShape(aValue->shape())) {
+ // set default plane size
+ bool isSetSizeOfView = false;
+ double aSizeOfView = 0;
+ QString aSizeOfViewStr = mySizeOfView->text();
+ if (!aSizeOfViewStr.isEmpty()) {
+ aSizeOfView = aSizeOfViewStr.toDouble(&isSetSizeOfView);
+ if (isSetSizeOfView && aSizeOfView <= 0) {
+ isSetSizeOfView = false;
+ }
+ }
+ if (isSetSizeOfView)
+ myModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, true);
+ }
+ // manually deactivation because the widget was not activated as has no focus acceptin controls
+ deactivate();
+ bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
+ myPreviewPlanes->erasePreviewPlanes(myWorkshop);
+
+ // Launch Sketch operation
+ CompositeFeaturePtr aCompFeature =