From 7d14a8dcb15197fb67509112e7d9a62cce03b1c0 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 22 May 2015 07:53:11 +0300 Subject: [PATCH] The default colors in preferences for sketch elements and features. --- .../ConstructionPlugin_Plane.h | 2 +- src/ExchangePlugin/ExchangePlugin_Plugin.cpp | 4 ---- src/Model/Model_ResultBody.h | 2 +- src/Model/Model_ResultConstruction.h | 2 +- src/Model/Model_ResultGroup.h | 2 +- src/ModuleBase/ModuleBase_Preferences.cpp | 2 +- .../SketchPlugin_ConstraintBase.h | 4 ++-- src/SketchPlugin/SketchPlugin_Sketch.h | 24 +++++++++++++++---- src/SketchPlugin/SketchPlugin_SketchEntity.h | 6 ++--- 9 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.h b/src/ConstructionPlugin/ConstructionPlugin_Plane.h index 317d6f348..546577b44 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.h @@ -31,7 +31,7 @@ class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustom /// default color for a plane inline static const std::string& DEFAULT_COLOR() { - static const std::string CONSTRUCTION_PLANE_COLOR("#32FF32"); + static const std::string CONSTRUCTION_PLANE_COLOR("150,150,180"); return CONSTRUCTION_PLANE_COLOR; } diff --git a/src/ExchangePlugin/ExchangePlugin_Plugin.cpp b/src/ExchangePlugin/ExchangePlugin_Plugin.cpp index c843f6cc1..2b8cb8b48 100644 --- a/src/ExchangePlugin/ExchangePlugin_Plugin.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Plugin.cpp @@ -31,10 +31,6 @@ ExchangePlugin_Plugin::ExchangePlugin_Plugin() new ExchangePlugin_ImportFormatValidator); aFactory->registerValidator("ExchangePlugin_ExportFormat", new ExchangePlugin_ExportFormatValidator); - - // register construction properties - //Config_PropManager::registerProp("Visualization", "import_feature_color", "Imported feature color", - // Config_Prop::Color, ExchangePlugin_ImportFeature::DEFAULT_COLOR()); } FeaturePtr ExchangePlugin_Plugin::createFeature(string theFeatureID) diff --git a/src/Model/Model_ResultBody.h b/src/Model/Model_ResultBody.h index befed5622..cafa56517 100644 --- a/src/Model/Model_ResultBody.h +++ b/src/Model/Model_ResultBody.h @@ -32,7 +32,7 @@ public: /// default color for a result body inline static const std::string& DEFAULT_COLOR() { - static const std::string RESULT_BODY_COLOR("#E0A01B"); + static const std::string RESULT_BODY_COLOR("150,150,180"); return RESULT_BODY_COLOR; } diff --git a/src/Model/Model_ResultConstruction.h b/src/Model/Model_ResultConstruction.h index 9c7ccd57d..e50812409 100644 --- a/src/Model/Model_ResultConstruction.h +++ b/src/Model/Model_ResultConstruction.h @@ -29,7 +29,7 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction /// default color for a result construction inline static const std::string& DEFAULT_COLOR() { - static const std::string RESULT_CONSTRUCTION_COLOR("#000000"); + static const std::string RESULT_CONSTRUCTION_COLOR("120,120,120"); return RESULT_CONSTRUCTION_COLOR; } diff --git a/src/Model/Model_ResultGroup.h b/src/Model/Model_ResultGroup.h index 63e8368f4..be220052f 100644 --- a/src/Model/Model_ResultGroup.h +++ b/src/Model/Model_ResultGroup.h @@ -23,7 +23,7 @@ public: /// default color for a result body inline static const std::string& DEFAULT_COLOR() { - static const std::string RESULT_GROUP_COLOR("#E0A01B"); + static const std::string RESULT_GROUP_COLOR("150,150,180"); return RESULT_GROUP_COLOR; } /// Request for initialization of data model of the result: adding all attributes diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index f97a9ed7f..c4a8fa2ef 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -262,7 +262,7 @@ void ModuleBase_PreferencesDlg::createViewerPage(int thePageId) myPreferences->setItemProperty("image_formats", aImgFiles, bgId); //Config_PropManager::registerProp("Visualization", "object_default_color", "Object color", - // Config_Prop::Color, "#ffffff"); + // Config_Prop::Color, "225,225,225"); Config_PropManager::registerProp("Visualization", "result_body_color", "Body color", Config_Prop::Color, Model_ResultBody::DEFAULT_COLOR()); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintBase.h b/src/SketchPlugin/SketchPlugin_ConstraintBase.h index ddf0cbf7f..cd7155409 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintBase.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintBase.h @@ -30,8 +30,8 @@ * Also the list of possible attributes is provided to simplify assignment. */ -#define SKETCH_CONSTRAINT_COLOR "#ffff00" -#define SKETCH_DIMENSION_COLOR "#ff00ff" +#define SKETCH_CONSTRAINT_COLOR "225,225,0" +#define SKETCH_DIMENSION_COLOR "64,128,225" /** \class SketchPlugin_ConstraintBase * \ingroup Plugins diff --git a/src/SketchPlugin/SketchPlugin_Sketch.h b/src/SketchPlugin/SketchPlugin_Sketch.h index 920ec399b..9f5f4a458 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.h +++ b/src/SketchPlugin/SketchPlugin_Sketch.h @@ -12,21 +12,23 @@ #include #include #include +#include + #include #include #include #include #include -#define YZ_PLANE_COLOR "#ff0000" -#define XZ_PLANE_COLOR "#00ff00" -#define XY_PLANE_COLOR "#0000ff" +#define YZ_PLANE_COLOR "225,0,0" +#define XZ_PLANE_COLOR "0,225,0" +#define XY_PLANE_COLOR "0,0,225" /**\class SketchPlugin_Sketch * \ingroup Plugins * \brief Feature for creation of the new part in PartSet. */ -class SketchPlugin_Sketch : public ModelAPI_CompositeFeature//, public GeomAPI_IPresentable +class SketchPlugin_Sketch : public ModelAPI_CompositeFeature, public GeomAPI_ICustomPrs//, public GeomAPI_IPresentable { public: /// Sketch feature kind @@ -201,6 +203,20 @@ class SketchPlugin_Sketch : public ModelAPI_CompositeFeature//, public GeomAPI_I static void createPoint2DResult(ModelAPI_Feature* theFeature, SketchPlugin_Sketch* theSketch, const std::string& theAttributeID, const int theIndex); + /// Customize presentation of the feature + virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, + std::shared_ptr theDefaultPrs) + { + bool isCustomized = false; + // apply the color of the result to the presentation + if (theDefaultPrs.get()) + isCustomized = theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs); + // set the sketch presentation bold + isCustomized = thePrs->setWidth(2) || isCustomized; + + return isCustomized; + } + }; #endif diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.h b/src/SketchPlugin/SketchPlugin_SketchEntity.h index 8f716c79f..95c4505b6 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.h +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.h @@ -20,9 +20,9 @@ #include -#define SKETCH_ENTITY_COLOR "#ff0000" -#define SKETCH_EXTERNAL_COLOR "#00ff00" -#define SKETCH_AUXILIARY_COLOR "#000000" +#define SKETCH_ENTITY_COLOR "225,0,0" +#define SKETCH_EXTERNAL_COLOR "170,0,225" +#define SKETCH_AUXILIARY_COLOR "0,85,0" /**\class SketchPlugin_SketchEntity * \ingroup Plugins -- 2.39.2