]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Color preferences for the constraints
authornds <natalia.donis@opencascade.com>
Fri, 20 Feb 2015 09:37:13 +0000 (12:37 +0300)
committernds <natalia.donis@opencascade.com>
Fri, 20 Feb 2015 09:37:13 +0000 (12:37 +0300)
src/ConstructionPlugin/CMakeLists.txt
src/ConstructionPlugin/ConstructionPlugin_Axis.cpp
src/ConstructionPlugin/ConstructionPlugin_Axis.h
src/ConstructionPlugin/ConstructionPlugin_Plane.cpp
src/ConstructionPlugin/ConstructionPlugin_Plane.h
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.h

index 0a1847283a9633002b259e4444b6920be189c3c9..302e08bb3323aceb00162d45fe3a0f584b63a147 100644 (file)
@@ -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
index f0e45a5bf0bb9bc8cedc988e6cc0a6612ec6ca6b..11fd775dd86f5b05e9e88c25da855f15bd4ed950 100644 (file)
@@ -6,6 +6,8 @@
 
 #include "ConstructionPlugin_Axis.h"
 
+#include <Config_PropManager.h>
+
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_ResultConstruction.h>
 
@@ -50,7 +52,9 @@ void ConstructionPlugin_Axis::execute()
 
 void ConstructionPlugin_Axis::customisePresentation(AISObjectPtr thePrs)
 {
-  thePrs->setColor(0, 0, 0);
+  std::vector<int> 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
index 87ab72be5b709825ffc7b42bc0246dd3a8d90832..81e1b02b3749144fa9cea3a76c977110708efa4a 100644 (file)
@@ -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.
index 5475402437a3a707cf5e5dbb3ef90dc55be4f413..5b347354cc1677b513a931cbdcf0dfec0310b590 100644 (file)
@@ -6,6 +6,8 @@
 
 #include "ConstructionPlugin_Plane.h"
 
+#include <Config_PropManager.h>
+
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_ResultConstruction.h>
@@ -73,6 +75,8 @@ void ConstructionPlugin_Plane::execute()
 
 void ConstructionPlugin_Plane::customisePresentation(AISObjectPtr thePrs)
 {
-  thePrs->setColor(50, 255, 50);
+  std::vector<int> 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
index 9697654e54d6aee54f04241b7dc941206f0dafbb..aedaff7f8e037e2c137d4ebbb322a39edf0b0ca8 100644 (file)
@@ -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:
index 4ce70ae037c789ce3e0e7aa0cf788c3589355543..8c025dd5405fa7748c9cd6f20c21288701ca55ad 100644 (file)
@@ -5,6 +5,8 @@
 #include "ConstructionPlugin_Axis.h"
 #include "ConstructionPlugin_Plane.h"
 
+#include <Config_PropManager.h>
+
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Document.h>
 
@@ -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)
index 9539004b7645ed5ff075cfa952fb4f46fc82753c..ab915408cac8c9834bd38101bd4ff8643f682d72 100644 (file)
@@ -13,6 +13,8 @@
 #include <GeomAlgoAPI_PointBuilder.h>
 #include <GeomAPI_Pnt.h>
 
+#include <Config_PropManager.h>
+
 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<int> 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
index cbab9d1ce5253dd0a3ede6a12430b6df6fac6022..03f9d3a9f2b5d11bc172aeb99cd34d891c074424 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "ConstructionPlugin.h"
 #include <ModelAPI_Feature.h>
+#include <GeomAPI_ICustomPrs.h>
+
 
 /// 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