Salome HOME
Define color for part result
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 26 Jun 2015 09:25:24 +0000 (12:25 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Fri, 26 Jun 2015 09:25:36 +0000 (12:25 +0300)
src/Model/Model_ResultPart.cpp
src/Model/Model_ResultPart.h
src/ModelAPI/ModelAPI_ResultPart.h
src/XGUI/XGUI_Workshop.cpp

index bdae260d67d2a865c8496a275504b7530f138609..10e884ff3c4ed4ff939d1b650b2fef54c0dbf481 100644 (file)
@@ -114,3 +114,12 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shape()
   }
   return std::shared_ptr<GeomAPI_Shape>();
 }
+
+
+void Model_ResultPart::colorConfigInfo(std::string& theSection, std::string& theName,
+  std::string& theDefault)
+{
+  theSection = "Visualization";
+  theName = "result_part_color";
+  theDefault = DEFAULT_COLOR();
+}
index 2afb017ee7f7a2869916de6ace0204a800604f4d..57e13023931b62e017e2379fac005567853e7868 100644 (file)
@@ -35,6 +35,10 @@ class Model_ResultPart : public ModelAPI_ResultPart
   /// Result shape of part document is compound of bodies inside of this part
   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
 
+  /// Returns the parameters of color definition in the resources config manager
+  MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
+                                            std::string& theDefault);
+
 protected:
   /// makes a result on a temporary feature (an action)
   Model_ResultPart();
index 11cae2bae8135e5063b311774cab7ecce8795003..131af613f772498b0398e2e3e88f215c0e659294 100644 (file)
@@ -38,6 +38,13 @@ class ModelAPI_ResultPart : public ModelAPI_Result
     return MY_DOC_REF;
   }
 
+  /// default color for a result body
+  inline static const std::string& DEFAULT_COLOR()
+  {
+    static const std::string RESULT_BODY_COLOR("96,157,255");
+    return RESULT_BODY_COLOR;
+  }
+
   /// Returns the part-document of this result
   virtual std::shared_ptr<ModelAPI_Document> partDoc() = 0;
 
index cfc79f6b7ed0d171ee4667cdea03a1130b438f04..0f6cd8c773be3290069b876b37757c29c288d54b 100644 (file)
@@ -164,6 +164,8 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
                                    Config_Prop::Color, ModelAPI_ResultGroup::DEFAULT_COLOR());
   Config_PropManager::registerProp("Visualization", "result_construction_color", "Construction color",
                                    Config_Prop::Color, ModelAPI_ResultConstruction::DEFAULT_COLOR());
+  Config_PropManager::registerProp("Visualization", "result_part_color", "Part color",
+                                   Config_Prop::Color, ModelAPI_ResultPart::DEFAULT_COLOR());
 }
 
 //******************************************************