+ QCheckBox* aSenderCheckBox = qobject_cast<QCheckBox*>(sender());
+
+ QMap<PartSet_Tools::ConstraintVisibleState, QCheckBox*>::const_iterator
+ anIt = myShowConstraints.begin(), aLast = myShowConstraints.end();
+
+ PartSet_Tools::ConstraintVisibleState aState = PartSet_Tools::Geometrical;
+ bool aFound = false;
+ for (; anIt != aLast && !aFound; anIt++) {
+ aFound = anIt.value() == aSenderCheckBox;
+ if (aFound)
+ aState = anIt.key();
+ }
+ if (aFound)
+ emit showConstraintToggled(aState, theOn);
+}
+
+void PartSet_WidgetSketchLabel::blockAttribute(const AttributePtr& theAttribute,
+ const bool& theToBlock, bool& isFlushesActived,
+ bool& isAttributeSetInitializedBlocked,
+ bool& isAttributeSendUpdatedBlocked)
+{
+ ModuleBase_WidgetValidated::blockAttribute(theAttribute, theToBlock, isFlushesActived,
+ isAttributeSetInitializedBlocked,
+ isAttributeSendUpdatedBlocked);
+ // We do not restore the previous state of isAttributeSetInitializedBlocked for each of
+ // attributes. It it is necessary, these states should be append to the method attributes
+ // or stored in the widget
+
+ std::list<AttributePtr> anAttributes = myFeature->data()->attributes("");
+ std::list<AttributePtr>::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end();
+ QStringList aValues;
+ for(; anIt != aLast; anIt++) {
+ AttributePtr anAttribute = *anIt;
+ if (theToBlock)
+ anAttribute->blockSetInitialized(true);
+ else
+ anAttribute->blockSetInitialized(isAttributeSetInitializedBlocked);
+ }
+}
+
+bool PartSet_WidgetSketchLabel::setSelectionInternal(
+ const QList<ModuleBase_ViewerPrsPtr>& theValues,
+ const bool theToValidate)
+{
+ bool aDone = false;
+ if (theValues.empty()) {
+ // In order to make reselection possible, set empty object and shape should be done
+ setSelectionCustom(std::shared_ptr<ModuleBase_ViewerPrs>(
+ new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL)));
+ aDone = false;
+ }
+ else {
+ // it removes the processed value from the parameters list
+ ModuleBase_ViewerPrsPtr aValue = theValues.first();//.takeFirst();
+ if (!theToValidate || isValidInFilters(aValue))
+ aDone = setSelectionCustom(aValue);
+ }
+
+ return aDone;
+}
+
+void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrsPtr& thePrs)
+{
+ // 1. hide main planes if they have been displayed and display sketch preview plane
+ myPreviewPlanes->erasePreviewPlanes(myWorkshop);
+
+ PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+ if (aModule) {
+ CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
+ 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)
+ aModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, true);
+ aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop);
+ if (isSetSizeOfView)
+ aModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, false);
+ }