]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_Tools.cpp
Salome HOME
Add tools
[modules/shaper.git] / src / ModuleBase / ModuleBase_Tools.cpp
index cf6f70d9b66a044db4055c6a806889884acdbc1b..d2009ac41fc63f31006a51439d9916eb51e71362 100755 (executable)
@@ -18,6 +18,8 @@
 #include <GeomDataAPI_Point2D.h>
 #include <Events_Error.h>
 
+#include <Config_PropManager.h>
+
 #include <QWidget>
 #include <QLayout>
 #include <QPainter>
@@ -26,6 +28,9 @@
 
 #include <sstream>
 
+const double tolerance = 1e-7;
+
+
 namespace ModuleBase_Tools {
 
 //******************************************************************
@@ -126,7 +131,7 @@ void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText)
 
 void setSpinValue(QDoubleSpinBox* theSpin, double theValue)
 {
-  if (theSpin->value() == theValue)
+  if (fabs(theSpin->value() - theValue) < tolerance)
     return;
   bool isBlocked = theSpin->blockSignals(true);
   theSpin->setValue(theValue);
@@ -135,8 +140,8 @@ void setSpinValue(QDoubleSpinBox* theSpin, double theValue)
 
 void setSpinValue(ModuleBase_ParamSpinBox* theSpin, double theValue)
 {
-  //if (theSpin->value() == theValue)
-  //  return;
+  if (fabs(theSpin->value() - theValue) < tolerance)
+    return;
   bool isBlocked = theSpin->blockSignals(true);
   theSpin->setValue(theValue);
   theSpin->blockSignals(isBlocked);
@@ -159,6 +164,8 @@ QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo)
       aFeatureStr.append("[disabled]");
     if (aRes->isConcealed())
       aFeatureStr.append("[concealed]");
+    if (ModelAPI_Tools::hasSubResults(aRes))
+      aFeatureStr.append("[hasSubResults]");
 
     aFeature = ModelAPI_Feature::feature(aRes);
   }
@@ -214,6 +221,7 @@ TopAbs_ShapeEnum shapeType(const QString& theType)
     MyShapeTypes["shell"] = TopAbs_SHELL;
     MyShapeTypes["solid"] = TopAbs_SOLID;
     MyShapeTypes["solids"] = TopAbs_SOLID;
+    MyShapeTypes["objects"] = TopAbs_SHAPE;
   }
   QString aType = theType.toLower();
   if (MyShapeTypes.contains(aType))
@@ -250,6 +258,14 @@ void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape,
     theDrawer->SetDeviationCoefficient(1.e-4);
 }
 
+Quantity_Color color(const std::string& theSection,
+                     const std::string& theName,
+                     const std::string& theDefault)
+{
+  std::vector<int> aColor = Config_PropManager::color(theSection, theName, theDefault);
+  return Quantity_Color(aColor[0] / 255., aColor[1] / 255., aColor[2] / 255., Quantity_TOC_RGB);
+}
+
 }