Table of Contents

Class GeneralGeoPointAction

Namespace
CADability.Actions
Assembly
CADability.dll

Simple Action to modify a GeoPoint by moving the mouse. The modification will start imediately after the action is set and will terminate when the mouse button is released or enter or escape is pressed.

public class GeneralGeoPointAction : Action, ICommandHandler
Inheritance
GeneralGeoPointAction
Implements
Inherited Members

Constructors

GeneralGeoPointAction(GeoPoint)

Constructs a GeneralGeoPointAction giving the initial Value of the point. This value will be used in the SetGeoPointEvent when the user presses ESC

public GeneralGeoPointAction(GeoPoint initialGeoPointValue)

Parameters

initialGeoPointValue GeoPoint

initial value of the GeoPoint

GeneralGeoPointAction(GeoPoint, IGeoObject)

Constructs a GeneralGeoPointAction giving the initial value of the point (see GeneralGeoPointAction(GeoPoint)) and excludes ignoreSnap from the snapping, which is usually the object that is being modified.

public GeneralGeoPointAction(GeoPoint initialGeoPointValue, IGeoObject ignoreSnap)

Parameters

initialGeoPointValue GeoPoint

initial value of the GeoPoint

ignoreSnap IGeoObject

object not to snap to, may be null

GeneralGeoPointAction(GeoPointProperty)

Constructs a GeneralGeoPointAction that modifies the point shown by GeoPointProperty: the point is read from the property and written back to it on each mouse move, so no SetGeoPointEvent handler is needed. Typically used when the user drags the hotspot of such a property.

public GeneralGeoPointAction(GeoPointProperty GeoPointProperty)

Parameters

GeoPointProperty GeoPointProperty

the property to modify

GeneralGeoPointAction(GeoPointProperty, IGeoObject)

Constructs a GeneralGeoPointAction that modifies the point shown by GeoPointProperty (see GeneralGeoPointAction(GeoPointProperty)) and excludes ignoreSnap from the snapping, which is usually the object that is being modified.

public GeneralGeoPointAction(GeoPointProperty GeoPointProperty, IGeoObject ignoreSnap)

Parameters

GeoPointProperty GeoPointProperty

the property to modify

ignoreSnap IGeoObject

object not to snap to, may be null

Fields

GeoPointProperty

The property entry whose point is modified, when the action was created for a GeoPointProperty; null when it was created with an initial point, in which case the point is delivered by SetGeoPointEvent.

public GeoPointProperty GeoPointProperty

Field Value

GeoPointProperty

UserData

Free data the creator of the action may attach to identify it in the event handlers, e.g. the index of the point being modified. Only created by the constructors that take an initial point; null otherwise.

public UserData UserData

Field Value

UserData

basePoint

The point the modification started from (the initial value of the point). It is the base point for the snapping and the location of the plane returned by GetMousePlane(IView).

protected GeoPoint basePoint

Field Value

GeoPoint

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

GetMousePlane(IView)

Returns the plane in which the mouse position is interpreted when it does not snap to anything: by default the plane through basePoint parallel to the drawing plane of the view, so that the point keeps its height above the drawing plane. Override to move the point in a different plane.

protected virtual Plane GetMousePlane(IView vw)

Parameters

vw IView

The view the mouse is in

Returns

Plane

The plane onto which the mouse position is projected

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

OldActiveAction Action
SettingAction bool

OnEnter()

This method will be called when the user presses the enter key. The default implementation does nothing.

public override bool OnEnter()

Returns

bool

OnEscape()

This method will be called when the user presses the escape key. The default implementation does nothing.

public override bool OnEscape()

Returns

bool

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

NewActiveAction Action

the action that will become active

RemovingAction bool

true: if called because the action is removed, false: if called when a new action is set on top of this action

OnMouseDown(MouseEventArgs, IView)

Implements OnMouseDown(MouseEventArgs, IView). If you override this method don't forget to call the bas implementation.

public override void OnMouseDown(MouseEventArgs e, IView vw)

Parameters

e MouseEventArgs

MouseEventArgs of the call

vw IView

the IView which contains the mouse

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

e MouseEventArgs

MouseEventArgs of the call

vw IView

the 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

e MouseEventArgs

MouseEventArgs of the call

vw IView

the 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()

Events

ActionDoneEvent

Raised when the action is removed from the action stack, i.e. after the point was accepted with a mouse click or Enter, or the action was cancelled.

public event GeneralGeoPointAction.ActionDoneDelegate ActionDoneEvent

Event Type

GeneralGeoPointAction.ActionDoneDelegate

SetGeoPointEvent

Raised with the new point on every mouse move and on the final click, and with the initial point when the user cancels with Escape or another action takes over. If a handler is attached it is responsible for applying the point; otherwise the point is written to GeoPointProperty. Without either, a GeneralGeoPointActionException is thrown.

public event GeneralGeoPointAction.SetGeoPointDelegate SetGeoPointEvent

Event Type

GeneralGeoPointAction.SetGeoPointDelegate