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)
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);
* 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.
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;
}
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
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;
}
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
// Author: Artem ZHIDKOV
#include "SketchPlugin_ConstraintParallel.h"
+#include "SketchPlugin_ConstraintPerpendicular.h"
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_Data.h>
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;
}
#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
// Author: Artem ZHIDKOV
#include "SketchPlugin_ConstraintPerpendicular.h"
+#include "SketchPlugin_ConstraintParallel.h"
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_Data.h>
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;
}
#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
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;
}
#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
// Author: Artem ZHIDKOV
#include "SketchPlugin_ConstraintRigid.h"
+#include "SketchPlugin_ConstraintParallel.h"
#include <ModelAPI_ResultConstruction.h>
#include <Config_PropManager.h>
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;
#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
#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;
/// 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
#include <iostream>
#endif
+//#define SET_PLANES_COLOR_IN_PREFERENCES
+
using namespace std;
// the only created instance of this 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)
#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.
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