From: sbh Date: Tue, 24 Feb 2015 15:02:10 +0000 (+0300) Subject: Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0 X-Git-Tag: V_1.1.0~158^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=26eb9df03b20bbec3ecafbda1a1b1fcfe5f06bbc;p=modules%2Fshaper.git Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0 Defines a re-factored as static methods of corresponding classes Conflicts: src/ConstructionPlugin/ConstructionPlugin_Axis.h src/ConstructionPlugin/ConstructionPlugin_Point.h --- 26eb9df03b20bbec3ecafbda1a1b1fcfe5f06bbc diff --cc src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index 570a3a3b8,11fd775dd..4f3fae9db --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@@ -50,7 -52,9 +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); ++ ConstructionPlugin_Axis::DEFAULT_COLOR()); + thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); thePrs->setLineStyle(3); thePrs->redisplay(); -} +} diff --cc src/ConstructionPlugin/ConstructionPlugin_Axis.h index 2b968ba59,81e1b02b3..ef021ba50 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.h @@@ -11,7 -11,18 +11,6 @@@ #include #include - -/// Point kind -const std::string CONSTRUCTION_AXIS_KIND("Axis"); - -/// attribute name for first point -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. @@@ -26,27 -37,6 +25,33 @@@ class ConstructionPlugin_Axis : public return MY_KIND; } + /// Axis kind + inline static const std::string& ID() + { + static const std::string CONSTRUCTION_AXIS_KIND("Axis"); + return CONSTRUCTION_AXIS_KIND; + } + /// attribute name for first point + inline static const std::string& POINT_FIRST() + { + static const std::string POINT_ATTR_FIRST("firstPoint"); + return POINT_ATTR_FIRST; + } + /// attribute name for second point + inline static const std::string& POINT_SECOND() + { + static const std::string POINT_ATTR_SECOND("secondPoint"); + return POINT_ATTR_SECOND; + } ++ /// default color for an axis ++ inline static const std::string& DEFAULT_COLOR() ++ { ++ static const std::string CONSTRUCTION_AXIS_COLOR("#000000"); ++ return CONSTRUCTION_AXIS_COLOR; ++ } + + inline static const double MINIMAL_LENGTH() { return 1.e-5; } + /// Creates a new part document if needed CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); diff --cc src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 39fa27ed9,5b347354c..d0ecc4d7e --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@@ -73,6 -75,8 +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); ++ ConstructionPlugin_Plane::DEFAULT_COLOR()); + thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); thePrs->setTransparensy(0.6); -} +} diff --cc src/ConstructionPlugin/ConstructionPlugin_Plane.h index fd73f263e,aedaff7f8..f57ff1eb1 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.h @@@ -27,50 -37,6 +27,57 @@@ class ConstructionPlugin_Plane : publi return MY_KIND; } ++ /// default color for a plane ++ inline static const std::string& DEFAULT_COLOR() ++ { ++ static const std::string CONSTRUCTION_PLANE_COLOR("#32FF32"); ++ return CONSTRUCTION_PLANE_COLOR; ++ } ++ + /// Plane kind + inline static const std::string& ID() + { + static const std::string CONSTRUCTION_PLANE_KIND("Plane"); + return CONSTRUCTION_PLANE_KIND; + } + /// attribute name for base face + inline static const std::string& FACE() + { + static const std::string FACE_ATTR("planeFace"); + return FACE_ATTR; + } + /// attribute name for distance + inline static const std::string& DISTANCE() + { + static const std::string DISTANCE_ATTR("distance"); + return DISTANCE_ATTR; + } + + /// the a parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& A() + { + static const std::string PARAM_A_ATTR("A"); + return PARAM_A_ATTR; + } + /// the b parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& B() + { + static const std::string PARAM_B_ATTR("B"); + return PARAM_B_ATTR; + } + /// the c parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& C() + { + static const std::string PARAM_C_ATTR("C"); + return PARAM_C_ATTR; + } + /// the d parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& D() + { + static const std::string PARAM_D_ATTR("D"); + return PARAM_D_ATTR; + } + /// Creates a new part document if needed CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); diff --cc src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp index f06bd7635,dff14b5b6..4731cc4c8 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp @@@ -17,6 -19,14 +19,14 @@@ ConstructionPlugin_Plugin::Construction { // register this plugin ModelAPI_Session::get()->registerPlugin(this); + + // register construction properties + Config_PropManager::registerProp("Visualization", "construction_point_color", "Construction point color", - Config_Prop::Color, CONSTRUCTION_POINT_COLOR); ++ Config_Prop::Color, ConstructionPlugin_Point::DEFAULT_COLOR()); + Config_PropManager::registerProp("Visualization", "construction_axis_color", "Construction axis color", - Config_Prop::Color, CONSTRUCTION_AXIS_COLOR); ++ Config_Prop::Color, ConstructionPlugin_Axis::DEFAULT_COLOR()); + Config_PropManager::registerProp("Visualization", "construction_plane_color", "Construction plane color", - Config_Prop::Color, CONSTRUCTION_PLANE_COLOR); ++ Config_Prop::Color, ConstructionPlugin_Plane::DEFAULT_COLOR()); } FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID) diff --cc src/ConstructionPlugin/ConstructionPlugin_Point.cpp index 4c13dba49,ab915408c..231e54fb2 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@@ -43,3 -38,11 +45,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); ++ ConstructionPlugin_Point::DEFAULT_COLOR()); + thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); + thePrs->redisplay(); -} ++} diff --cc src/ConstructionPlugin/ConstructionPlugin_Point.h index b0504698d,03f9d3a9f..f4bf39a11 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.h @@@ -9,7 -9,21 +9,8 @@@ #include "ConstructionPlugin.h" #include + #include - -/// Point kind -const std::string CONSTRUCTION_POINT_KIND("Point"); - -/// attribute name for X coordinate -const std::string POINT_ATTR_X = "x"; -/// attribute name for Y coordinate -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. @@@ -18,31 -32,10 +19,38 @@@ class ConstructionPlugin_Point : publi { public: /// Returns the kind of a feature - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() + CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind(); + + inline static const std::string& ID() + { + static const std::string CONSTRUCTION_POINT_KIND("Point"); + return CONSTRUCTION_POINT_KIND; + } + ++ /// default color for a point ++ inline static const std::string& DEFAULT_COLOR() ++ { ++ static const std::string CONSTRUCTION_POINT_COLOR("#ffff00"); ++ return CONSTRUCTION_POINT_COLOR; ++ } ++ + /// attribute name for X coordinate + inline static const std::string& X() + { + static const std::string POINT_ATTR_X("x"); + return POINT_ATTR_X; + } + /// attribute name for Y coordinate + inline static const std::string& Y() + { + static const std::string POINT_ATTR_Y("y"); + return POINT_ATTR_Y; + } + /// attribute name for Z coordinate + inline static const std::string& Z() { - static std::string MY_KIND = CONSTRUCTION_POINT_KIND; - return MY_KIND; + static const std::string POINT_ATTR_Z("z"); + return POINT_ATTR_Z; } /// Creates a new part document if needed