#include <Events_Loop.h>
#include <Model_Events.h>
+#include <SketchPlugin_Sketch.h>
+
#ifdef _DEBUG
#include <QDebug>
#endif
std::set<std::string>::const_iterator anIt = aGroups.begin(), aLast = aGroups.end();
for (; anIt != aLast; anIt++) {
std::string aGroup = *anIt;
- if (aGroup.compare("Sketch") == 0) { // Update only Sketch group
+ if (aGroup.compare(SKETCH_KIND) == 0) { // Update only Sketch group
myModule->workshop()->displayer()->eraseDeletedFeatures();
myModule->updateCurrentPreview(aGroup);
}
if (!theFeature)
return;
-// if (theFeature->getKind() == "Sketch") {
+// if (theFeature->getKind() == SKETCH_KIND) {
FeaturePtr aFeature = theFeature;
if (XGUI_Tools::isModelObject(aFeature)) {
ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
#include "PartSet.h"
#include <PartSet_OperationSketchBase.h>
+
+#include <SketchPlugin_Sketch.h>
+
#include <QObject>
class Handle_AIS_InteractiveObject;
Q_OBJECT
public:
/// Returns the operation type key
- static std::string Type() { return "Sketch"; }
+ static std::string Type() { return SKETCH_KIND; }
public:
/// Constructor
anAIS = createSketchConstraintLength(theFeature, theSketch, thePrevPrs);
else {
anAIS = createFeature(theFeature, theShape, thePrevPrs);
- if (theFeature->getKind() == "Sketch")
+ if (theFeature->getKind() == SKETCH_KIND)
{
Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
aShapeAIS->SetColor(Quantity_Color(SKETCH_PLANE_COLOR));
#include "SketchPlugin.h"
#include <SketchPlugin_Feature.h>
+#include <SketchPlugin_Sketch.h>
/// Central 2D point of the circle which contains the arc
const std::string ARC_ATTR_CENTER("ArcCenter");
/// Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#include "SketchPlugin.h"
#include <SketchPlugin_Feature.h>
+#include <SketchPlugin_Sketch.h>
/// 2D point - center of the circle
const std::string CIRCLE_ATTR_CENTER("CircleCenter");
/// Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#include "SketchPlugin.h"
#include "SketchPlugin_Feature.h"
+#include <SketchPlugin_Sketch.h>
#include <ModelAPI_AttributeReference.h>
#include <ModelAPI_AttributeRefAttr.h>
#include <list>
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
* \param theFeature sub-feature
#include "SketchPlugin.h"
#include "SketchPlugin_Constraint.h"
+#include <SketchPlugin_Sketch.h>
#include <list>
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// \brief Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#include "SketchPlugin.h"
#include "SketchPlugin_Constraint.h"
+#include <SketchPlugin_Sketch.h>
#include <list>
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// \brief Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#include "SketchPlugin.h"
#include "SketchPlugin_Constraint.h"
+#include <SketchPlugin_Sketch.h>
#include <list>
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// \brief Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#define SketchPlugin_ConstraintParallel_HeaderFile
#include "SketchPlugin.h"
+#include <SketchPlugin_Sketch.h>
#include "SketchPlugin_Constraint.h"
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// \brief Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#define SketchPlugin_ConstraintPerpendicular_HeaderFile
#include "SketchPlugin.h"
+#include <SketchPlugin_Sketch.h>
#include "SketchPlugin_Constraint.h"
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// \brief Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#define SketchPlugin_ConstraintRadius_HeaderFile
#include "SketchPlugin.h"
+#include <SketchPlugin_Sketch.h>
#include "SketchPlugin_Constraint.h"
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// \brief Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#include "SketchPlugin.h"
#include <SketchPlugin_Feature.h>
+#include <SketchPlugin_Sketch.h>
#include <list>
/// Start 2D point of the line
/// Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
{
- if (theFeatureID == "Sketch") {
+ if (theFeatureID == SKETCH_KIND) {
return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
}
else if (theFeatureID == "SketchPoint") {
#define SketchPlugin_Point_HeaderFile
#include "SketchPlugin.h"
+#include <SketchPlugin_Sketch.h>
#include "SketchPlugin_Feature.h"
#include <list>
/// Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
- {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+ {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
/// Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#include <GeomAPI_Pnt.h>
#include <list>
+/// All features of this sketch (list of references)
+const std::string SKETCH_KIND("Sketch");
+
/// Origin point of the sketcher in 3D space
const std::string SKETCH_ATTR_ORIGIN("Origin");
/// Vector X inside of the sketch plane
public:
/// Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "Sketch"; return MY_KIND;}
+ {static std::string MY_KIND = SKETCH_KIND; return MY_KIND;}
/// Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
bool SketchSolver_ConstraintGroup::addWorkplane(
boost::shared_ptr<SketchPlugin_Feature> theSketch)
{
- if (myWorkplane.h || theSketch->getKind().compare("Sketch") != 0)
+ if (myWorkplane.h || theSketch->getKind().compare(SKETCH_KIND) != 0)
return false; // the workplane already exists or the function parameter is not Sketch
mySketch = theSketch;
{
// Only sketches and constraints can be added by Create event
const std::string& aFeatureKind = (*aFeatIter)->getKind();
- if (aFeatureKind.compare("Sketch") == 0)
+ if (aFeatureKind.compare(SKETCH_KIND) == 0)
{
boost::shared_ptr<SketchPlugin_Feature> aSketch =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
const Model_FeatureDeletedMessage* aDeleteMsg = dynamic_cast<const Model_FeatureDeletedMessage*>(theMessage);
const std::set<std::string>& aFeatureGroups = aDeleteMsg->groups();
- // Find "Sketch" in groups. The constraint groups should be updated when an object removed from Sketch
+ // Find SKETCH_KIND in groups. The constraint groups should be updated when an object removed from Sketch
std::set<std::string>::const_iterator aFGrIter;
for (aFGrIter = aFeatureGroups.begin(); aFGrIter != aFeatureGroups.end(); aFGrIter++)
- if (aFGrIter->compare("Sketch") == 0)
+ if (aFGrIter->compare(SKETCH_KIND) == 0)
break;
if (aFGrIter != aFeatureGroups.end())