aDisplayer->getAISObject(theFeature));
int aSelectionMode = -1;
- if (theFeature->getKind() == "SketchConstraintLength") {
+ if (theFeature->getKind() == SKETCH_CONSTRAINT_LENGTH_KIND) {
aSelectionMode = AIS_DSM_Text;
}
aDisplayer->redisplay(theFeature, anAIS, aSelectionMode, false);
#include "PartSet.h"
#include <PartSet_OperationSketchBase.h>
+
+#include <SketchPlugin_ConstraintLength.h>
+
#include <QObject>
/*!
public:
/// Returns the operation type key
- static std::string Type() { return "SketchConstraintLength"; }
+ static std::string Type() { return SKETCH_CONSTRAINT_LENGTH_KIND; }
public:
/// Constructor
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Sketch.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
#include <GeomDataAPI_Point2D.h>
boost::shared_ptr<GeomDataAPI_Point2D> thePoint2)
{
boost::shared_ptr<ModelAPI_Document> aDoc = document();
- boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature("SketchConstraintCoincidence");
+ boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature(SKETCH_CONSTRAINT_COINCIDENCE_KIND);
if (sketch()) {
boost::shared_ptr<SketchPlugin_Feature> aSketch =
#include <SketchPlugin_Sketch.h>
#include <SketchPlugin_Line.h>
#include <SketchPlugin_Constraint.h>
+#include <SketchPlugin_ConstraintLength.h>
#include <AIS_InteractiveObject.hxx>
#include <AIS_LengthDimension.hxx>
{
Handle(AIS_InteractiveObject) anAIS;
- if (theFeature->getKind() == "SketchConstraintLength")
+ if (theFeature->getKind() == SKETCH_CONSTRAINT_LENGTH_KIND)
anAIS = createSketchConstraintLength(theFeature, theSketch, thePrevPrs);
else {
anAIS = createFeature(theFeature, theShape, thePrevPrs);
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Sketch.h>
+/// Arc feature kind
+const std::string SKETCH_ARC_KIND("SketchArc");
+
/// Central 2D point of the circle which contains the arc
const std::string ARC_ATTR_CENTER("ArcCenter");
/// Start 2D point of the arc
public:
/// Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "SketchArc"; return MY_KIND;}
+ {static std::string MY_KIND = SKETCH_ARC_KIND; return MY_KIND;}
/// Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
class SketchPlugin_Constraint: public SketchPlugin_Feature
{
public:
- /// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "SketchConstraint"; return MY_KIND;}
-
/// \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_KIND; return MY_GROUP;}
#include <SketchPlugin_Sketch.h>
#include <list>
+/// Coincidence constraint kind
+const std::string SKETCH_CONSTRAINT_COINCIDENCE_KIND("SketchConstraintCoincidence");
/** \class SketchPlugin_ConstraintCoincidence
* \ingroup DataModel
public:
/// \brief Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "SketchConstraintCoincidence"; return MY_KIND;}
+ {static std::string MY_KIND = SKETCH_CONSTRAINT_COINCIDENCE_KIND; return MY_KIND;}
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
#include <SketchPlugin_Sketch.h>
#include <list>
+/// Distance constraint kind
+const std::string SKETCH_CONSTRAINT_DISTANCE_KIND("SketchConstraintDistance");
/** \class SketchPlugin_ConstraintDistance
* \ingroup DataModel
public:
/// \brief Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "SketchConstraintDistance"; return MY_KIND;}
+ {static std::string MY_KIND = SKETCH_CONSTRAINT_DISTANCE_KIND; return MY_KIND;}
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
#include <SketchPlugin_Sketch.h>
#include <list>
+/// Length constraint kind
+const std::string SKETCH_CONSTRAINT_LENGTH_KIND("SketchConstraintLength");
/** \class SketchPlugin_ConstraintLength
* \ingroup DataModel
public:
/// \brief Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "SketchConstraintLength"; return MY_KIND;}
+ {static std::string MY_KIND = SKETCH_CONSTRAINT_LENGTH_KIND; return MY_KIND;}
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
#include <SketchPlugin_Sketch.h>
#include "SketchPlugin_Constraint.h"
+/// Parallel constraint kind
+const std::string SKETCH_CONSTRAINT_PARALLEL_KIND("SketchConstraintParallel");
/** \class SketchPlugin_ConstraintParallel
* \ingroup DataModel
public:
/// \brief Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "SketchConstraintParallel"; return MY_KIND;}
+ {static std::string MY_KIND = SKETCH_CONSTRAINT_PARALLEL_KIND; return MY_KIND;}
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
#include <SketchPlugin_Sketch.h>
#include "SketchPlugin_Constraint.h"
+/// Perpendicular constraint kind
+const std::string SKETCH_CONSTRAINT_PERPENDICULAR_KIND("SketchConstraintPerpendicular");
/** \class SketchPlugin_ConstraintPerpendicular
* \ingroup DataModel
public:
/// \brief Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "SketchConstraintPerpendicular"; return MY_KIND;}
+ {static std::string MY_KIND = SKETCH_CONSTRAINT_PERPENDICULAR_KIND; return MY_KIND;}
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
#include <SketchPlugin_Sketch.h>
#include "SketchPlugin_Constraint.h"
+/// Radius constraint kind
+const std::string SKETCH_CONSTRAINT_RADIUS_KIND("SketchConstraintRadius");
+
/** \class SketchPlugin_ConstraintRadius
* \ingroup DataModel
public:
/// \brief Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
- {static std::string MY_KIND = "SketchConstraintRadius"; return MY_KIND;}
+ {static std::string MY_KIND = SKETCH_CONSTRAINT_RADIUS_KIND; return MY_KIND;}
/// \brief Returns to which group in the document must be added feature
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
else if (theFeatureID == SKETCH_CIRCLE_KIND) {
return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Circle);
}
- else if (theFeatureID == "SketchConstraintCoincidence") {
+ else if (theFeatureID == SKETCH_CONSTRAINT_COINCIDENCE_KIND) {
return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintCoincidence);
}
- else if (theFeatureID == "SketchConstraintDistance") {
+ else if (theFeatureID == SKETCH_CONSTRAINT_DISTANCE_KIND) {
return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintDistance);
}
- else if (theFeatureID == "SketchConstraintLength") {
+ else if (theFeatureID == SKETCH_CONSTRAINT_LENGTH_KIND) {
return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintLength);
}
- else if (theFeatureID == "SketchConstraintParallel") {
+ else if (theFeatureID == SKETCH_CONSTRAINT_PARALLEL_KIND) {
return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintParallel);
}
- else if (theFeatureID == "SketchConstraintPerpendicular") {
+ else if (theFeatureID == SKETCH_CONSTRAINT_PERPENDICULAR_KIND) {
return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintPerpendicular);
}
- else if (theFeatureID == "SketchConstraintRadius") {
+ else if (theFeatureID == SKETCH_CONSTRAINT_RADIUS_KIND) {
return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintRadius);
}
// feature of such kind is not found
#include <SketchPlugin_Line.h>
#include <SketchPlugin_Point.h>
#include <SketchPlugin_Circle.h>
+#include <SketchPlugin_Arc.h>
+#include <SketchPlugin_ConstraintDistance.h>
+#include <SketchPlugin_ConstraintLength.h>
+#include <SketchPlugin_ConstraintParallel.h>
+#include <SketchPlugin_ConstraintPerpendicular.h>
+#include <SketchPlugin_ConstraintRadius.h>
#include <ModelAPI_AttributeRefAttr.h>
#include <ModelAPI_Data.h>
}
// Constraint for distance between point and another entity
- if (aConstraintKind.compare("SketchConstraintDistance") == 0)
+ if (aConstraintKind.compare(SKETCH_CONSTRAINT_DISTANCE_KIND) == 0)
{
int aNbPoints = 0;
int aNbEntities = 0;
}
// Constraint for the given length of a line
- if (aConstraintKind.compare("SketchConstraintLength") == 0)
+ if (aConstraintKind.compare(SKETCH_CONSTRAINT_LENGTH_KIND) == 0)
{
int aNbLines = 0;
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++)
}
// Constraint for two parallel/perpendicular lines
- bool isParallel = (aConstraintKind.compare("SketchConstraintParallel") == 0);
- bool isPerpendicular = (aConstraintKind.compare("SketchConstraintPerpendicular") == 0);
+ bool isParallel = (aConstraintKind.compare(SKETCH_CONSTRAINT_PARALLEL_KIND) == 0);
+ bool isPerpendicular = (aConstraintKind.compare(SKETCH_CONSTRAINT_PERPENDICULAR_KIND) == 0);
if (isParallel || isPerpendicular)
{
int aNbEntities = 2; // lines in SolveSpace constraints should started from CONSTRAINT_ATTR_ENTITY_C attribute
}
// Constraint for radius of a circle or an arc of circle
- if (aConstraintKind.compare("SketchConstraintRadius") == 0)
+ if (aConstraintKind.compare(SKETCH_CONSTRAINT_RADIUS_KIND) == 0)
{
int aNbEntities = 2; // lines in SolveSpace constraints should started from CONSTRAINT_ATTR_ENTITY_C attribute
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++)
);
if (!anAttr || !anAttr->isFeature()) continue;
const std::string& aKind = anAttr->feature()->getKind();
- if (aKind.compare(SKETCH_CIRCLE_KIND) == 0 || aKind.compare("SketchArc") == 0)
+ if (aKind.compare(SKETCH_CIRCLE_KIND) == 0 || aKind.compare(SKETCH_ARC_KIND) == 0)
{
myAttributesList[aNbEntities++] = CONSTRAINT_ATTRIBUTES[indAttr];
continue;
#include <Model_Events.h>
#include <SketchPlugin_Constraint.h>
+#include <SketchPlugin_ConstraintLength.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
#include <SketchPlugin_Arc.h>
#include <SketchPlugin_Circle.h>
if (!aConstrAttr) continue;
// For the length constraint the start and end points of the line should be added to the entities list instead of line
- if (aConstrType == SLVS_C_PT_PT_DISTANCE && theConstraint->getKind().compare("SketchConstraintLength") == 0)
+ if (aConstrType == SLVS_C_PT_PT_DISTANCE && theConstraint->getKind().compare(SKETCH_CONSTRAINT_LENGTH_KIND) == 0)
{
boost::shared_ptr<ModelAPI_Data> aData = aConstrAttr->feature()->data();
aConstrEnt[indAttr] = changeEntity(aData->attribute(LINE_ATTR_START));
return aCircleEntity.h;
}
// Arc
- else if (aFeatureKind.compare("SketchArc") == 0)
+ else if (aFeatureKind.compare(SKETCH_ARC_KIND) == 0)
{
Slvs_hEntity aCenter = changeEntity(aFeature->data()->attribute(ARC_ATTR_CENTER));
Slvs_hEntity aStart = changeEntity(aFeature->data()->attribute(ARC_ATTR_START));
{
if (!aConstrIter->first->data()->isValid())
{
- if (aConstrIter->first->getKind().compare("SketchConstraintCoincidence") == 0)
+ if (aConstrIter->first->getKind().compare(SKETCH_CONSTRAINT_COINCIDENCE_KIND) == 0)
isCCRemoved = true;
std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::reverse_iterator
aCopyIter = aConstrIter++;
anAttrList.push_back(CIRCLE_ATTR_RADIUS);
}
// Arc
- else if (aFeatureKind.compare("SketchArc") == 0)
+ else if (aFeatureKind.compare(SKETCH_ARC_KIND) == 0)
{
anAttrList.push_back(ARC_ATTR_CENTER);
anAttrList.push_back(ARC_ATTR_START);