From: nds Date: Fri, 20 Feb 2015 09:37:13 +0000 (+0300) Subject: Color preferences for the constraints X-Git-Tag: V_1.1.0~178 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0887f6ca0aa6d2f2d5e2e31e175b1aed470c02e9;p=modules%2Fshaper.git Color preferences for the constraints --- diff --git a/src/ConstructionPlugin/CMakeLists.txt b/src/ConstructionPlugin/CMakeLists.txt index 0a1847283..302e08bb3 100644 --- a/src/ConstructionPlugin/CMakeLists.txt +++ b/src/ConstructionPlugin/CMakeLists.txt @@ -26,6 +26,7 @@ SET(XML_RESOURCES ) SET(PROJECT_LIBRARIES + Config ModelAPI GeomAPI GeomAlgoAPI @@ -41,6 +42,7 @@ INSTALL(TARGETS ConstructionPlugin DESTINATION plugins) INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins) INCLUDE_DIRECTORIES( + ../Config ../ModelAPI ../GeomAPI ../GeomAlgoAPI diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index f0e45a5bf..11fd775dd 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -6,6 +6,8 @@ #include "ConstructionPlugin_Axis.h" +#include + #include #include @@ -50,7 +52,9 @@ void ConstructionPlugin_Axis::execute() void ConstructionPlugin_Axis::customisePresentation(AISObjectPtr thePrs) { - thePrs->setColor(0, 0, 0); + std::vector aRGB = Config_PropManager::color("Visualization", "construction_axis_color", + CONSTRUCTION_AXIS_COLOR); + thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); thePrs->setLineStyle(3); thePrs->redisplay(); } \ No newline at end of file diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.h b/src/ConstructionPlugin/ConstructionPlugin_Axis.h index 87ab72be5..81e1b02b3 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.h @@ -21,6 +21,8 @@ const std::string POINT_ATTR_FIRST = "firstPoint"; /// attribute name for second point const std::string POINT_ATTR_SECOND = "secondPoint"; +#define CONSTRUCTION_AXIS_COLOR "#000000" + /**\class ConstructionPlugin_Axis * \ingroup Plugins * \brief Feature for creation of the new axis in PartSet. diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 547540243..5b347354c 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -6,6 +6,8 @@ #include "ConstructionPlugin_Plane.h" +#include + #include #include #include @@ -73,6 +75,8 @@ void ConstructionPlugin_Plane::execute() void ConstructionPlugin_Plane::customisePresentation(AISObjectPtr thePrs) { - thePrs->setColor(50, 255, 50); + std::vector aRGB = Config_PropManager::color("Visualization", "construction_plane_color", + CONSTRUCTION_PLANE_COLOR); + thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); thePrs->setTransparensy(0.6); } \ No newline at end of file diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.h b/src/ConstructionPlugin/ConstructionPlugin_Plane.h index 9697654e5..aedaff7f8 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.h @@ -24,6 +24,9 @@ const std::string DISTANCE_ATTR = "distance"; * \ingroup Plugins * \brief Feature for creation of the new planar surface in PartSet. */ +#define CONSTRUCTION_PLANE_COLOR "#32FF32" + + class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs { public: diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp index 4ce70ae03..8c025dd54 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp @@ -5,6 +5,8 @@ #include "ConstructionPlugin_Axis.h" #include "ConstructionPlugin_Plane.h" +#include + #include #include @@ -17,6 +19,15 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() { // register this plugin ModelAPI_Session::get()->registerPlugin(this); + + // register construction properties + Config_PropManager::registerProp("Visualization", "construction_plane_color", "Construction plane color", + Config_Prop::Color, CONSTRUCTION_PLANE_COLOR); + + Config_PropManager::registerProp("Visualization", "construction_point_color", "Construction point color", + Config_Prop::Color, CONSTRUCTION_POINT_COLOR); + Config_PropManager::registerProp("Visualization", "construction_axis_color", "Construction axis color", + Config_Prop::Color, CONSTRUCTION_AXIS_COLOR); } FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID) diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp index 9539004b7..ab915408c 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@ -13,6 +13,8 @@ #include #include +#include + using namespace std; ConstructionPlugin_Point::ConstructionPlugin_Point() @@ -36,3 +38,11 @@ void ConstructionPlugin_Point::execute() aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt)); setResult(aConstr); } + +void ConstructionPlugin_Point::customisePresentation(AISObjectPtr thePrs) +{ + std::vector aRGB = Config_PropManager::color("Visualization", "construction_point_color", + CONSTRUCTION_POINT_COLOR); + thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); + thePrs->redisplay(); +} \ No newline at end of file diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.h b/src/ConstructionPlugin/ConstructionPlugin_Point.h index cbab9d1ce..03f9d3a9f 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.h @@ -9,6 +9,8 @@ #include "ConstructionPlugin.h" #include +#include + /// Point kind const std::string CONSTRUCTION_POINT_KIND("Point"); @@ -20,11 +22,13 @@ const std::string POINT_ATTR_Y = "y"; /// attribute name for Z coordinate const std::string POINT_ATTR_Z = "z"; +#define CONSTRUCTION_POINT_COLOR "#ffff00" + /**\class ConstructionPlugin_Point * \ingroup Plugins * \brief Feature for creation of the new part in PartSet. */ -class ConstructionPlugin_Point : public ModelAPI_Feature +class ConstructionPlugin_Point : public ModelAPI_Feature, public GeomAPI_ICustomPrs { public: /// Returns the kind of a feature @@ -45,6 +49,10 @@ class ConstructionPlugin_Point : public ModelAPI_Feature /// Use plugin manager for features creation ConstructionPlugin_Point(); + + /// Modifies the given presentation in the custom way. + virtual void customisePresentation(AISObjectPtr thePrs); + }; #endif