From 2e4a932b26ac2a7539c1b787d77956828ffd8f82 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 26 Jun 2015 12:25:24 +0300 Subject: [PATCH] Define color for part result --- src/Model/Model_ResultPart.cpp | 9 +++++++++ src/Model/Model_ResultPart.h | 4 ++++ src/ModelAPI/ModelAPI_ResultPart.h | 7 +++++++ src/XGUI/XGUI_Workshop.cpp | 2 ++ 4 files changed, 22 insertions(+) diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index bdae260d6..10e884ff3 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -114,3 +114,12 @@ std::shared_ptr Model_ResultPart::shape() } return std::shared_ptr(); } + + +void Model_ResultPart::colorConfigInfo(std::string& theSection, std::string& theName, + std::string& theDefault) +{ + theSection = "Visualization"; + theName = "result_part_color"; + theDefault = DEFAULT_COLOR(); +} diff --git a/src/Model/Model_ResultPart.h b/src/Model/Model_ResultPart.h index 2afb017ee..57e130239 100644 --- a/src/Model/Model_ResultPart.h +++ b/src/Model/Model_ResultPart.h @@ -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 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(); diff --git a/src/ModelAPI/ModelAPI_ResultPart.h b/src/ModelAPI/ModelAPI_ResultPart.h index 11cae2bae..131af613f 100644 --- a/src/ModelAPI/ModelAPI_ResultPart.h +++ b/src/ModelAPI/ModelAPI_ResultPart.h @@ -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 partDoc() = 0; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index cfc79f6b7..0f6cd8c77 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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()); } //****************************************************** -- 2.39.2