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();
-}
+}
#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.
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();
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);
-}
+}
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();
{
// 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)
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();
++}
#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.
{
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