Salome HOME
Hide "by general equation" case for plane creation
[modules/shaper.git] / src / ModuleBase / ModuleBase_Tools.cpp
index 38357449c906bcafbf50e0f4406af18e662db9ff..6639a548af29b5a294a5a29f05ff89e3db655e71 100644 (file)
@@ -5,6 +5,10 @@
 // Author:      Vitaly Smetannikov
 
 #include "ModuleBase_Tools.h"
+
+#include <ModelAPI_Result.h>
+#include <ModelAPI_Data.h>
+
 #include <QWidget>
 #include <QLayout>
 #include <QPainter>
@@ -28,7 +32,7 @@ void adjustMargins(QLayout* theLayout)
 {
   if(!theLayout)
     return;
-  theLayout->setContentsMargins(2, 5, 5, 2);
+  theLayout->setContentsMargins(2, 5, 2, 5);
   theLayout->setSpacing(4);
 }
 
@@ -105,6 +109,23 @@ void setSpinValue(QDoubleSpinBox* theSpin, double theValue)
   theSpin->blockSignals(isBlocked);
 }
 
+QString objectInfo(const ObjectPtr& theObj)
+{
+  ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObj);
+  FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
+  QString aFeatureStr = "feature";
+  if(aRes.get()) {
+    aFeatureStr.append("(Result)");
+    aFeature = ModelAPI_Feature::feature(aRes);
+  }
+  if (aFeature.get()) {
+    aFeatureStr.append(QString(": %1").arg(aFeature->getKind().c_str()).toStdString().c_str());
+    if (aFeature->data().get() && aFeature->data()->isValid())
+      aFeatureStr.append(QString("(name=%1)").arg(aFeature->data()->name().c_str()).toStdString().c_str());
+  }
+  return aFeatureStr;
+}
+
 }