]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Color preferences for the sketch entities.
authornds <natalia.donis@opencascade.com>
Fri, 20 Feb 2015 10:23:53 +0000 (13:23 +0300)
committernds <natalia.donis@opencascade.com>
Fri, 20 Feb 2015 10:23:53 +0000 (13:23 +0300)
19 files changed:
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/SketchPlugin/SketchPlugin_ConstraintBase.h
src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp
src/SketchPlugin/SketchPlugin_ConstraintDistance.h
src/SketchPlugin/SketchPlugin_ConstraintLength.cpp
src/SketchPlugin/SketchPlugin_ConstraintLength.h
src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp
src/SketchPlugin/SketchPlugin_ConstraintParallel.h
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h
src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp
src/SketchPlugin/SketchPlugin_ConstraintRadius.h
src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp
src/SketchPlugin/SketchPlugin_ConstraintRigid.h
src/SketchPlugin/SketchPlugin_Feature.h
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_Sketch.h
src/SketchSolver/CMakeLists.txt

index 8c025dd5405fa7748c9cd6f20c21288701ca55ad..dff14b5b63453d8468fe84c4680144a13f3215f2 100644 (file)
@@ -21,13 +21,12 @@ ConstructionPlugin_Plugin::ConstructionPlugin_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);
+  Config_PropManager::registerProp("Visualization", "construction_plane_color", "Construction plane color",
+                                   Config_Prop::Color, CONSTRUCTION_PLANE_COLOR);
 }
 
 FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID)
index 1e9d79070eb5a41837512e6b5ede0469edba7144..f3001c881b3325eeb4f240d2d84406c932a83ccd 100644 (file)
@@ -191,9 +191,16 @@ void PartSet_WidgetSketchLabel::showPreviewPlanes()
     std::shared_ptr<GeomAPI_Dir> aXZDir(new GeomAPI_Dir(0, 1, 0));
     std::shared_ptr<GeomAPI_Dir> aXYDir(new GeomAPI_Dir(0, 0, 1));
 
-    int aR[] = {255, 0, 0};
-    int aG[] = {0, 255, 0};
-    int aB[] = {0, 0, 255};
+    std::vector<int> aYZRGB, aXZRGB, aXYRGB;
+    aYZRGB = Config_PropManager::color("Visualization", "yz_plane_color",
+                                                        YZ_PLANE_COLOR);
+    aXZRGB = Config_PropManager::color("Visualization", "xz_plane_color",
+                                                        XZ_PLANE_COLOR);
+    aXYRGB = Config_PropManager::color("Visualization", "xy_plane_color",
+                                                        XY_PLANE_COLOR);
+    int aR[] = {aYZRGB[0], aYZRGB[1], aYZRGB[2]};
+    int aG[] = {aXZRGB[0], aXZRGB[1], aXZRGB[2]};
+    int aB[] = {aXYRGB[0], aXYRGB[1], aXYRGB[2]};
 
     myYZPlane = createPreviewPlane(anOrigin, aYZDir, aR);
     myXZPlane = createPreviewPlane(anOrigin, aXZDir, aG);
index 8636d3948ceae139a9db792ec92836340fbf2b76..ddf0cbf7fff2f6a9dff2f5a0f5e32da590c82c6a 100644 (file)
@@ -30,6 +30,9 @@
  *    Also the list of possible attributes is provided to simplify assignment.
  */
 
+#define SKETCH_CONSTRAINT_COLOR "#ffff00"
+#define SKETCH_DIMENSION_COLOR "#ff00ff"
+
 /** \class SketchPlugin_ConstraintBase
  *  \ingroup Plugins
  *  \brief Feature for creation of a new constraint between other features.
index db309bae3b9fb51ff85e20311f3508236029ed28..190665560738fe40d32815a7d238e5e61277ba96 100644 (file)
@@ -169,8 +169,8 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi
   anAIS->createDistance(aPoint1, aPoint2, aFlyoutPnt, aPlane, aValue);
 
   // Set color from preferences
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "distance_color",
-                                                    DISTANCE_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
+                                                    SKETCH_DIMENSION_COLOR);
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
index 99281efdb4ed724a4e7d065174e552ff5f2a8c66..9bc3d5d06cfe07cabe52ddb9e8c220ba7f13ecf2 100644 (file)
@@ -17,8 +17,6 @@
 class SketchPlugin_Line;
 class GeomDataAPI_Point2D;
 
-#define DISTANCE_COLOR "#ff00ff"
-
 /** \class SketchPlugin_ConstraintDistance
  *  \ingroup Plugins
  *  \brief Feature for creation of a new constraint which defines a distance
index f0ac2e41d7b908cc4bf09ec044dc1befeed91ea1..da91dc5835cbead17fa834bec2c063fc18536912 100644 (file)
@@ -141,8 +141,8 @@ AISObjectPtr SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePreviou
   anAIS->createDistance(aPoint1, aPoint2, aFlyoutPnt, aPlane, aValue);
 
   // Set color from preferences
-  std::vector<int> aRGB = 
-    Config_PropManager::color("Visualization", "length_color", LENGTH_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
+                                                    SKETCH_DIMENSION_COLOR);
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
index 5d36f051e99eabdcd2e2cdd8e12de635914a2d35..b3954b6fadb246b0908bc902947436a830839b2a 100644 (file)
@@ -14,8 +14,6 @@
 
 class GeomDataAPI_Point2D;
 
-#define LENGTH_COLOR "#ff00ff"
-
 /** \class SketchPlugin_ConstraintLength
  *  \ingroup Plugins
  *  \brief Feature for creation of a new constraint which defines a length of a line segment
index 6997f4f0a36fbb8b30a8caa4edabe8573e0a49d0..ae26fc1c2d41218454c5c7432032e4be0a8b0947 100644 (file)
@@ -5,6 +5,7 @@
 // Author:  Artem ZHIDKOV
 
 #include "SketchPlugin_ConstraintParallel.h"
+#include "SketchPlugin_ConstraintPerpendicular.h"
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
@@ -86,8 +87,8 @@ AISObjectPtr SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevi
   anAIS->createParallel(aLine1, aLine2, aFlyoutPnt, aPlane);
 
   // Set color from preferences
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "parallel_color",
-                                                    PARALLEL_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_parallel_color",
+                                                    SKETCH_CONSTRAINT_COLOR);
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
index 4f3969073e2d2a0efa67c546aa5d3ecaedf36902..87f69fe70ee76b2506e25abe546325ef607856b4 100644 (file)
@@ -11,8 +11,6 @@
 #include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_ConstraintBase.h"
 
-#define PARALLEL_COLOR "#ffff00"
-
 /** \class SketchPlugin_ConstraintParallel
  *  \ingroup Plugins
  *  \brief Feature for creation of a new constraint parallelism of two lines
index c63555da559034615fbe754dc73a63acd7cc3e17..770eac2efe531b974aab0e1dacfa437141db53d1 100644 (file)
@@ -5,6 +5,7 @@
 // Author:  Artem ZHIDKOV
 
 #include "SketchPlugin_ConstraintPerpendicular.h"
+#include "SketchPlugin_ConstraintParallel.h"
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
@@ -78,8 +79,8 @@ AISObjectPtr SketchPlugin_ConstraintPerpendicular::getAISObject(AISObjectPtr the
   anAIS->createPerpendicular(aLine1, aLine2, aPlane);
 
   // Set color from preferences
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "perpendicular_color",
-                                                    PERPENDICULAR_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_parallel_color",
+                                                    SKETCH_CONSTRAINT_COLOR);
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
index f0998fa14204781386987a92e4e54628a9ed2b20..fa5eaacecc9d716a5d3430177939de7ef497def5 100644 (file)
@@ -11,8 +11,6 @@
 #include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_ConstraintBase.h"
 
-#define PERPENDICULAR_COLOR "#ffff00"
-
 /** \class SketchPlugin_ConstraintPerpendicular
  *  \ingroup Plugins
  *  \brief Feature for creation of a new constraint for perpendicularity of two lines
index 17e16655aa13419a405c4b74a986ee08be346284..528d636ae9160d295624c811a77c473a70a1fe12 100644 (file)
@@ -173,7 +173,8 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou
   anAIS->createRadius(aCircle, aFlyoutPnt, aRadius);
 
   // Set color from preferences
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "radius_color", RADIUS_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
+                                                    SKETCH_DIMENSION_COLOR);
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
index 4d6b9a3be763140fdb3f60e6cf49fa7784c7ff31..5400bc443188de718808239569a561b9aa6db7eb 100644 (file)
@@ -11,8 +11,6 @@
 #include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_ConstraintBase.h"
 
-#define RADIUS_COLOR "#ff00ff"
-
 /** \class SketchPlugin_ConstraintRadius
  *  \ingroup Plugins
  *  \brief Feature for creation of a new constraint which defines 
index 00e973d1a0a04923945d885946fec94b6c1f5951..cd1aa6e73af6b86ad6483ff6cd319f96a2f0493b 100644 (file)
@@ -5,6 +5,7 @@
 // Author:  Artem ZHIDKOV
 
 #include "SketchPlugin_ConstraintRigid.h"
+#include "SketchPlugin_ConstraintParallel.h"
 
 #include <ModelAPI_ResultConstruction.h>
 #include <Config_PropManager.h>
@@ -70,8 +71,9 @@ AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious
   anAIS->createFixed(aShape, aPlane);
 
   // Set color from preferences
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "fixing_color",
-                                                    FIXING_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_parallel_color",
+                                                    SKETCH_CONSTRAINT_COLOR);
+
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
 
   return anAIS;
index 5c94bcba6a1cee438cf174ddd098807ce146d3ab..619a8bbd9d0c857365f21830ce0273ce45f0a7d2 100644 (file)
@@ -12,8 +12,6 @@
 #include <SketchPlugin_Sketch.h>
 #include <list>
 
-#define FIXING_COLOR "#ffff00"
-
 /** \class SketchPlugin_ConstraintRigid
  *  \ingroup Plugins
  *  \brief Feature for creation of a new constraint which defines immovable object
index 7a50ef4e3369b1cc7b372a6ff1c36be91012851e..248f19c7b8db3f747478b18fc9194377c2935024 100644 (file)
 #include <ModelAPI_AttributeSelection.h>
 #include <GeomAPI_ICustomPrs.h>
 
+#include <Config_PropManager.h>
+
+#define SKETCH_EDGE_COLOR "#ff0000"
+#define SKETCH_POINT_COLOR "#ff0000"
+#define SKETCH_EXTERNAL_EDGE_COLOR "#00ff00"
+
 class SketchPlugin_Sketch;
 class GeomAPI_Pnt2d;
 class Handle_AIS_InteractiveObject;
@@ -67,15 +73,31 @@ class SketchPlugin_Feature : public ModelAPI_Feature, public GeomAPI_ICustomPrs
   /// Customize presentation of the feature
   virtual void customisePresentation(AISObjectPtr thePrs)
   {
+    std::vector<int> aRGB;
     // if this is an edge
     if (thePrs->getShapeType() == 6) {
       thePrs->setWidth(3);
-      if (isExternal())
-        thePrs->setColor(0,255,0);
+      if (isExternal()) {
+        // Set color from preferences
+        aRGB = Config_PropManager::color("Visualization", "sketch_external_color",
+                                         SKETCH_EXTERNAL_EDGE_COLOR);
+      }
+      else {
+        // Set color from preferences
+        aRGB = Config_PropManager::color("Visualization", "sketch_edge_color",
+                                         SKETCH_EDGE_COLOR);
+      }
+    }
+    else if (thePrs->getShapeType() == 7) { // otherwise this is a vertex
+      // Set color from preferences
+      aRGB = Config_PropManager::color("Visualization", "sketch_point_color",
+                                       SKETCH_POINT_COLOR);
     }
     // if this is a vertex
     //else if (thePrs->getShapeType() == 7)
     //  thePrs->setPointMarker(6, 2.);
+    if (!aRGB.empty())
+      thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]);
   }
 
   /// removes also all sub-sketch elements
index 030f786f18b1d78d2e5d0f218b0dd3e0d98ebb85..c486acf65ee2f6898fa02caa30bb51c4b0174c70 100644 (file)
@@ -32,6 +32,8 @@
 #include <iostream>
 #endif
 
+//#define SET_PLANES_COLOR_IN_PREFERENCES
+
 using namespace std;
 
 // the only created instance of this plugin
@@ -52,21 +54,29 @@ SketchPlugin_Plugin::SketchPlugin_Plugin()
   // register this plugin
   ModelAPI_Session::get()->registerPlugin(this);
 
-  // register sketcher properties
+  Config_PropManager::registerProp("Visualization", "sketch_edge_color", "Sketch edge color",
+                                   Config_Prop::Color, SKETCH_EDGE_COLOR);
+
+  Config_PropManager::registerProp("Visualization", "sketch_point_color", "Sketch point color",
+                                   Config_Prop::Color, SKETCH_POINT_COLOR);
+
+  Config_PropManager::registerProp("Visualization", "sketch_external_color", "Sketch external edge color",
+                                   Config_Prop::Color, SKETCH_EXTERNAL_EDGE_COLOR);
 
-  Config_PropManager::registerProp("Visualization", "parallel_color", "Parallel constraint color",
-                                   Config_Prop::Color, PARALLEL_COLOR);
-  Config_PropManager::registerProp("Visualization", "perpendicular_color",
-                                   "Perpendicular constraint color", Config_Prop::Color,
-                                   PERPENDICULAR_COLOR);
-  Config_PropManager::registerProp("Visualization", "distance_color", "Distance color",
-                                   Config_Prop::Color, DISTANCE_COLOR);
-  Config_PropManager::registerProp("Visualization", "length_color", "Length color",
-                                   Config_Prop::Color, LENGTH_COLOR);
-  Config_PropManager::registerProp("Visualization", "radius_color", "Radius color",
-                                   Config_Prop::Color, RADIUS_COLOR);
-  Config_PropManager::registerProp("Visualization", "fixing_color", "Fixing color",
-                                   Config_Prop::Color, FIXING_COLOR);
+  Config_PropManager::registerProp("Visualization", "sketch_parallel_color", "Sketch constraint color",
+                                   Config_Prop::Color, SKETCH_CONSTRAINT_COLOR);
+  Config_PropManager::registerProp("Visualization", "sketch_dimension_color", "Sketch dimension color",
+                                   Config_Prop::Color, SKETCH_DIMENSION_COLOR);
+
+  // register sketcher properties
+#ifdef SET_PLANES_COLOR_IN_PREFERENCES
+  Config_PropManager::registerProp("Visualization", "yz_plane_color", "YZ plane color",
+                                   Config_Prop::Color, YZ_PLANE_COLOR);
+  Config_PropManager::registerProp("Visualization", "xz_plane_color", "XZ plane color",
+                                   Config_Prop::Color, XZ_PLANE_COLOR);
+  Config_PropManager::registerProp("Visualization", "xy_plane_color", "XY plane color",
+                                   Config_Prop::Color, XY_PLANE_COLOR);
+#endif
 }
 
 FeaturePtr SketchPlugin_Plugin::createFeature(string theFeatureID)
index cb3efbea6864f5cdc90751c99b056ed842421587..f6978b6ab16b1f15045f6d8c8ba2750e98bb3fd5 100644 (file)
 #include <GeomAPI_IPresentable.h>
 #include <list>
 
+#define YZ_PLANE_COLOR "#ff0000"
+#define XZ_PLANE_COLOR "#00ff00"
+#define XY_PLANE_COLOR "#0000ff"
+
 /**\class SketchPlugin_Sketch
  * \ingroup Plugins
  * \brief Feature for creation of the new part in PartSet.
index cd1ca4297d6a27317a1040fb48077cf30f0ebfe9..572c8b0c797aec82193cc5bfea5242b5bdc1fbff 100644 (file)
@@ -21,12 +21,14 @@ SET(PROJECT_SOURCES
 SET(PROJECT_LIBRARIES
     ${SLVS_LIBRARIES}
     ${CAS_SHAPE}
+    Config
     Events
     ModelAPI
     GeomAPI
 )
 
 INCLUDE_DIRECTORIES(
+    ${PROJECT_SOURCE_DIR}/src/Config
     ${PROJECT_SOURCE_DIR}/src/SketchPlugin
     ${PROJECT_SOURCE_DIR}/src/ModelAPI
     ${PROJECT_SOURCE_DIR}/src/GeomAPI