Salome HOME
Constriction type for all sketch entities
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Plugin.cpp
index 030f786f18b1d78d2e5d0f218b0dd3e0d98ebb85..88f062b69fb069f6c5aa1d797bf413070123b8e1 100644 (file)
@@ -15,6 +15,7 @@
 #include <SketchPlugin_ConstraintRigid.h>
 #include <SketchPlugin_Validators.h>
 #include <SketchPlugin_ResultValidators.h>
+#include <SketchPlugin_ShapeValidator.h>
 
 #include <Events_Loop.h>
 #include <GeomDataAPI_Dir.h>
@@ -32,6 +33,8 @@
 #include <iostream>
 #endif
 
+//#define SET_PLANES_COLOR_IN_PREFERENCES
+
 using namespace std;
 
 // the only created instance of this plugin
@@ -43,30 +46,43 @@ SketchPlugin_Plugin::SketchPlugin_Plugin()
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
   aFactory->registerValidator("SketchPlugin_DistanceAttr",
                               new SketchPlugin_DistanceAttrValidator);  
-  aFactory->registerValidator("SketchPlugin_DifferentObjects",
-                              new SketchPlugin_DifferentObjectsValidator);
+  //aFactory->registerValidator("SketchPlugin_DifferentObjects",
+  //                            new SketchPlugin_DifferentObjectsValidator);
   aFactory->registerValidator("SketchPlugin_ResultPoint", new SketchPlugin_ResultPointValidator);
   aFactory->registerValidator("SketchPlugin_ResultLine", new SketchPlugin_ResultLineValidator);
   aFactory->registerValidator("SketchPlugin_ResultArc", new SketchPlugin_ResultArcValidator);
+  aFactory->registerValidator("SketchPlugin_ShapeValidator",
+                              new SketchPlugin_ShapeValidator);
 
   // 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_construction_color", "Sketch construction color",
+                                   Config_Prop::Color, SKETCH_CONSTRUCTION_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)