#include <SketchPlugin_Arc.h>
*/
-#include <PartSet_ConstraintLengthPrs.h>
-#include <PartSet_ConstraintDistancePrs.h>
#include <PartSet_ConstraintRadiusPrs.h>
#include <SketchPlugin_Constraint.h>
bool PartSet_OperationCreateConstraint::canProcessKind(const std::string& theId)
{
// changed
- return theId == PartSet_ConstraintLengthPrs::getKind() ||
- theId == PartSet_ConstraintDistancePrs::getKind() ||
- theId == PartSet_ConstraintRadiusPrs::getKind();
+ return PartSet_Tools::isConstraintFeature(theId);
}
bool PartSet_OperationCreateConstraint::canBeCommitted() const
#include <PartSet_OperationSketch.h>
#include <PartSet_EditLine.h>
#include <PartSet_FeaturePrs.h>
-#include <SketchPlugin_ConstraintLength.h>
+#include <PartSet_ConstraintRadiusPrs.h>
+
+#include <SketchPlugin_Constraint.h>
#include <ModuleBase_OperationDescription.h>
#include <Model_Events.h>
double aDeltaY = anY - aCurY;
PartSet_Tools::moveFeature(feature(), aDeltaX, aDeltaY);*/
+ if (feature()->getKind() == PartSet_ConstraintRadiusPrs::getKind()) {
+ boost::shared_ptr<PartSet_ConstraintRadiusPrs> anArcPrs =
+ boost::dynamic_pointer_cast<PartSet_ConstraintRadiusPrs>(myFeaturePrs);
+ if (anArcPrs) {
+ anArcPrs->projectPointOnFeature(feature(), sketch(), aPoint, theView, aX, anY);
+ }
+ }
myFeaturePrs->setPoint(aX, anY, SM_SecondPoint);
{
std::string aType = PartSet_OperationEditFeature::Type();
- if (theFeature->getKind() == SKETCH_CONSTRAINT_LENGTH_KIND)
+ if (PartSet_Tools::isConstraintFeature(theFeature->getKind())) {
aType = PartSet_OperationEditConstraint::Type();
-
+ }
return aType;
}
// Author: Natalia ERMOLAEVA
#include <PartSet_OperationSketchBase.h>
+#include <PartSet_Tools.h>
#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_ConstraintLength.h>
-
#include <V3d_View.hxx>
#include <AIS_Shape.hxx>
#include <AIS_DimensionSelectionMode.hxx>
std::list<int> PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const
{
std::list<int> aModes;
- if (theFeature->getKind() == SKETCH_CONSTRAINT_LENGTH_KIND) {
+ if (PartSet_Tools::isConstraintFeature(theFeature->getKind())) {
aModes.clear();
aModes.push_back(AIS_DSM_Text);
aModes.push_back(AIS_DSM_Line);
return thePoint2D->to3D(aC->pnt(), aX->dir(), aY->dir());
}
+
+bool PartSet_Tools::isConstraintFeature(const std::string& theKind)
+{
+ return theKind == PartSet_ConstraintLengthPrs::getKind() ||
+ theKind == PartSet_ConstraintDistancePrs::getKind() ||
+ theKind == PartSet_ConstraintRadiusPrs::getKind();
+}
\ No newline at end of file
/// \return API object of point 3D
static boost::shared_ptr<GeomAPI_Pnt> point3D(boost::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
FeaturePtr theSketch);
+ /// Check whether there is a constraint with the feature kind given
+ /// \param theKind a feature kind
+ /// \return the boolean value
+ static bool isConstraintFeature(const std::string& theKind);
+
private:
/// Return the distance between the feature and the point
/// \param theFeature feature object