Edit move for distance.
blockSelection(true);
if (myCurPoint.myIsInitialized) {
- double aCurX, aCurY;
+ /*double aCurX, aCurY;
PartSet_Tools::convertTo2D(myCurPoint.myPoint, sketch(), theView, aCurX, aCurY);
double aX, anY;
anArcPrs->projectPointOnFeature(feature(), sketch(), aPoint, theView, aX, anY);
}
}
- myFeaturePrs->setPoint(aX, anY, SM_LastPoint);
+ myFeaturePrs->setPoint(aX, anY, SM_LastPoint);*/
+ double aCurX, aCurY;
+ PartSet_Tools::convertTo2D(myCurPoint.myPoint, sketch(), theView, aCurX, aCurY);
+
+ double aX, anY;
+ PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+
+ double aDeltaX = aX - aCurX;
+ double aDeltaY = anY - aCurY;
+
+ boost::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
+ aSketchFeature->move(aDeltaX, aDeltaY);
}
sendFeatures();
return anAIS;
}
+void SketchPlugin_ConstraintDistance::move(double theDeltaX, double theDeltaY)
+{
+ boost::shared_ptr<ModelAPI_Data> aData = data();
+ if (!aData->isValid())
+ return;
+
+ boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+ boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
+ aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+}
boost::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
const std::string& theAttribute)
/// Returns the AIS preview
SKETCHPLUGIN_EXPORT virtual Handle_AIS_InteractiveObject getAISShape(Handle_AIS_InteractiveObject thePrevious);
+ /// Moves the feature
+ /// \param theDeltaX the delta for X coordinate is moved
+ /// \param theDeltaY the delta for Y coordinate is moved
+ SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
+
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintDistance();
};
return anAIS;
}
+void SketchPlugin_ConstraintRadius::move(double theDeltaX, double theDeltaY)
+{
+ boost::shared_ptr<ModelAPI_Data> aData = data();
+ if (!aData->isValid())
+ return;
+
+ //boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+ // boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
+ //aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+}
/// Returns the AIS preview
SKETCHPLUGIN_EXPORT virtual Handle_AIS_InteractiveObject getAISShape(Handle_AIS_InteractiveObject thePrevious);
+ /// Moves the feature
+ /// \param theDeltaX the delta for X coordinate is moved
+ /// \param theDeltaY the delta for Y coordinate is moved
+ SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
+
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintRadius();
};