#include <ModelAPI_ResultBody.h>
#include <ModelAPI_Tools.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_Events.h>
#include <ModuleBase_Operation.h>
#include <ModuleBase_ViewerPrs.h>
aLayout->addWidget(myShowPoints);
myAutoConstraints = new QCheckBox(tr("Automatic constraints"), this);
+ myAutoConstraints->setToolTip(tr("Automatic vertical and horizontal constraints"));
connect(myAutoConstraints, SIGNAL(toggled(bool)), this, SIGNAL(autoConstraints(bool)));
aLayout->addWidget(myAutoConstraints);
connect(aPlaneBtn, SIGNAL(clicked(bool)), SLOT(onChangePlane()));
aLayout->addWidget(aPlaneBtn);
+ aLayout->addSpacing(15);
+
+ myDoFLabel = new QLabel("", aSecondWgt);
+ aLayout->addWidget(myDoFLabel);
+
+ myShowDOFBtn = new QPushButton(tr("Show remaining DoFs"), aSecondWgt);
+ aLayout->addWidget(myShowDOFBtn);
+ myShowDOFBtn->hide();
+ connect(myShowDOFBtn, SIGNAL(clicked(bool)), SLOT(onShowDOF()));
+
myStackWidget->addWidget(aSecondWgt);
//setLayout(aLayout);
myShowPoints->setChecked(theState);
myShowPoints->blockSignals(aBlock);
}
+
+bool PartSet_WidgetSketchLabel::restoreValueCustom()
+{
+ if (myFeature.get()) {
+ CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
+ if (aSketch.get() && (aSketch->numberOfSubs() > 0)) {
+ AttributeStringPtr aDOFStr = aSketch->string("SolverDOF");
+ if (aDOFStr.get()) {
+ QString aVal(aDOFStr->value().c_str());
+ if (aVal.contains('=')) {
+ // to support old data
+ aVal = aVal.right(aVal.length() - aVal.lastIndexOf('='));
+ }
+ int aDoF = aVal.toInt();
+ if (aDoF == 0) {
+ myDoFLabel->setText(tr("Sketch is fully fixed (DoF = 0)"));
+ myShowDOFBtn->hide();
+ } else {
+ myDoFLabel->setText(tr("DoF (degrees of freedom) = ") + aVal);
+ CompositeFeaturePtr aCompFeature = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
+ if (aCompFeature.get() && aCompFeature->numberOfSubs() > 1)
+ myShowDOFBtn->show();
+ }
+ }
+ }
+ else {
+ myDoFLabel->setText("");
+ myShowDOFBtn->hide();
+ }
+ }
+ return true;
+}
+
+
+void PartSet_WidgetSketchLabel::onShowDOF()
+{
+ CompositeFeaturePtr aCompFeature = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
+ if (aCompFeature.get() && aCompFeature->numberOfSubs() > 1) {
+ static const Events_ID anEvent = Events_Loop::eventByName(EVENT_GET_DOF_OBJECTS);
+ ModelAPI_EventCreator::get()->sendUpdated(aCompFeature->subFeature(0), anEvent);
+ Events_Loop::loop()->flush(anEvent);
+ }
+}