Class GeneralLengthAction
- Namespace
- CADability.Actions
- Assembly
- CADability.dll
An action that lets the user modify a LengthProperty with the mouse. Depending on the constructor the length is either the distance of the (snapped) mouse position from a fixed point or its distance from a line given by a point and a direction. The length is updated on every mouse move; a mouse click accepts it, ESC (or the activation of another action) restores the initial value and ends the action. Used e.g. by the radius property of a circle or the size property of a text.
public class GeneralLengthAction : Action, ICommandHandler
- Inheritance
-
GeneralLengthAction
- Implements
- Inherited Members
Constructors
GeneralLengthAction(LengthProperty, GeoPoint)
Creates the action for lengthProperty. The length is the distance of the (snapped) mouse
position from fixPoint.
public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint fixPoint)
Parameters
lengthPropertyLengthPropertyThe property to modify
fixPointGeoPointThe point the distance is measured from, e.g. the center of a circle for its radius
GeneralLengthAction(LengthProperty, GeoPoint, IGeoObject)
Creates the action for lengthProperty measuring from fixPoint (see
GeneralLengthAction(LengthProperty, GeoPoint)) and excludes ignoreSnap from the
snapping, which is usually the object that is being modified.
public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint fixPoint, IGeoObject ignoreSnap)
Parameters
lengthPropertyLengthPropertyThe property to modify
fixPointGeoPointThe point the distance is measured from
ignoreSnapIGeoObjectObject not to snap to, may be null
GeneralLengthAction(LengthProperty, GeoPoint, GeoVector)
Creates the action for lengthProperty. The length is the distance of the (snapped) mouse
position from the line through linePoint with direction lineDirection,
e.g. the height of a rectangle measured from its base line.
public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint linePoint, GeoVector lineDirection)
Parameters
lengthPropertyLengthPropertyThe property to modify
linePointGeoPointA point on the line the distance is measured from
lineDirectionGeoVectorThe direction of that line
GeneralLengthAction(LengthProperty, GeoPoint, GeoVector, IGeoObject)
Creates the action for lengthProperty measuring from a line (see
GeneralLengthAction(LengthProperty, GeoPoint, GeoVector)) and excludes ignoreSnap
from the snapping, which is usually the object that is being modified.
public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint linePoint, GeoVector lineDirection, IGeoObject ignoreSnap)
Parameters
lengthPropertyLengthPropertyThe property to modify
linePointGeoPointA point on the line the distance is measured from
lineDirectionGeoVectorThe direction of that line
ignoreSnapIGeoObjectObject not to snap to, may be null
Methods
GetID()
Must be implemented by derived class. Returns an identification string. All CADability actions return the unique strings like "Draw.Line.TwoPoints" or "Zoom"
public override string GetID()
Returns
- string
the identification of the action
OnActivate(Action, bool)
Implements OnActivate(Action, bool). If you override this method don't forget to call the bas implementation.
public override void OnActivate(Action oldActiveAction, bool settingAction)
Parameters
OnEnter()
This method will be called when the user presses the enter key. The default implementation does nothing.
public override bool OnEnter()
Returns
OnEscape()
This method will be called when the user presses the escape key. The default implementation does nothing.
public override bool OnEscape()
Returns
OnInactivate(Action, bool)
Implements OnInactivate(Action, bool). If you override this method don't forget to call the bas implementation.
public override void OnInactivate(Action newActiveAction, bool removingAction)
Parameters
newActiveActionActionthe action that will become active
removingActionbooltrue: if called because the action is removed, false: if called when a new action is set on top of this action
OnMouseMove(MouseEventArgs, IView)
Implements OnMouseMove(MouseEventArgs, IView). If you override this method don't forget to call the bas implementation.
public override void OnMouseMove(MouseEventArgs e, IView vw)
Parameters
eMouseEventArgsMouseEventArgs of the call
vwIViewthe IView which contains the mouse
OnMouseUp(MouseEventArgs, IView)
Implements OnMouseUp(MouseEventArgs, IView). If you override this method don't forget to call the bas implementation.
public override void OnMouseUp(MouseEventArgs e, IView vw)
Parameters
eMouseEventArgsMouseEventArgs of the call
vwIViewthe IView which contains the mouse
OnRemoveAction()
Last event that is called when the action is removed from the action stack.
public override void OnRemoveAction()
OnSetAction()
Implements OnSetAction(). If you override this method don't forget to call the bas implementation.
public override void OnSetAction()