Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
authorsbh <sergey.belash@opencascade.com>
Tue, 24 Feb 2015 15:02:10 +0000 (18:02 +0300)
committersbh <sergey.belash@opencascade.com>
Tue, 24 Feb 2015 15:02:10 +0000 (18:02 +0300)
Defines a re-factored as static methods of corresponding classes
Conflicts:
src/ConstructionPlugin/ConstructionPlugin_Axis.h
src/ConstructionPlugin/ConstructionPlugin_Point.h

1  2 
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 570a3a3b8edb2b58a4a19ff02b5c39e0f59dacd7,11fd775dd86f5b05e9e88c25da855f15bd4ed950..4f3fae9dbdd66352d6b8713368fea1c43ee7ef7e
@@@ -50,7 -52,9 +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);
++                                                    ConstructionPlugin_Axis::DEFAULT_COLOR());
+   thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]);
    thePrs->setLineStyle(3);
    thePrs->redisplay();
 -}
 +}
index 2b968ba593553a229efbc52ef920111993e57583,81e1b02b3749144fa9cea3a76c977110708efa4a..ef021ba50eb7caad950ef1202ffabed4c5a3aca0
  #include <ModelAPI_Feature.h>
  #include <GeomAPI_ICustomPrs.h>
  
 -
 -/// 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();
  
index 39fa27ed966998a30a1eef0955e2aff5ee762a1e,5b347354cc1677b513a931cbdcf0dfec0310b590..d0ecc4d7ee88012e5f239c892402f118851862a1
@@@ -73,6 -75,8 +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);
++                                                    ConstructionPlugin_Plane::DEFAULT_COLOR());
+   thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]);
    thePrs->setTransparensy(0.6);
 -}
 +}
index fd73f263e2fdbf2a1f770d15de9f4226aa75aea2,aedaff7f8e037e2c137d4ebbb322a39edf0b0ca8..f57ff1eb10099565f71d87486d4da7465c0ccb85
@@@ -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();
  
index f06bd7635440f443c99e3bb42532f58711b33bb4,dff14b5b63453d8468fe84c4680144a13f3215f2..4731cc4c8c766fea1a5e00d6398838618711dd49
@@@ -17,6 -19,14 +19,14 @@@ ConstructionPlugin_Plugin::Construction
  {
    // register this plugin
    ModelAPI_Session::get()->registerPlugin(this);
 -                                   Config_Prop::Color, CONSTRUCTION_POINT_COLOR);
+   // register construction properties
+   Config_PropManager::registerProp("Visualization", "construction_point_color", "Construction point color",
 -                                   Config_Prop::Color, CONSTRUCTION_AXIS_COLOR);
++                                   Config_Prop::Color, ConstructionPlugin_Point::DEFAULT_COLOR());
+   Config_PropManager::registerProp("Visualization", "construction_axis_color", "Construction axis color",
 -                                   Config_Prop::Color, CONSTRUCTION_PLANE_COLOR);
++                                   Config_Prop::Color, ConstructionPlugin_Axis::DEFAULT_COLOR());
+   Config_PropManager::registerProp("Visualization", "construction_plane_color", "Construction plane color",
++                                   Config_Prop::Color, ConstructionPlugin_Plane::DEFAULT_COLOR());
  }
  
  FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID)
index 4c13dba4958abb832558f62db3d307c557470e4e,ab915408cac8c9834bd38101bd4ff8643f682d72..231e54fb2cddaa70bbcfbeb0b7d9f0adfe269791
@@@ -43,3 -38,11 +45,11 @@@ void ConstructionPlugin_Point::execute(
    aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt));
    setResult(aConstr);
  }
 -                                                    CONSTRUCTION_POINT_COLOR);
+ void ConstructionPlugin_Point::customisePresentation(AISObjectPtr thePrs)
+ {
+   std::vector<int> aRGB = Config_PropManager::color("Visualization", "construction_point_color",
 -}
++                                                    ConstructionPlugin_Point::DEFAULT_COLOR());
+   thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]);
+   thePrs->redisplay();
++}
index b0504698d93c7f9017edc73ad1ab98b925c45a9f,03f9d3a9f2b5d11bc172aeb99cd34d891c074424..f4bf39a1186fdc61b3ee35e42f3665a8b7a609fa
@@@ -9,7 -9,21 +9,8 @@@
  
  #include "ConstructionPlugin.h"
  #include <ModelAPI_Feature.h>
+ #include <GeomAPI_ICustomPrs.h>
  
 -
 -/// 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