Table of Contents

Class GeoPointProperty

Namespace
CADability.UserInterface
Assembly
CADability.dll

Property entry for the control center that displays and edits a GeoPoint, e.g. the start point of a line or the center of a circle. The point is connected to its owner via the base class mechanisms of EditableProperty<T>: a get/set delegate pair, reflection on a named property of the owning object, or OnGetValue and OnSetValue. The value is always a point in the global coordinate system. It is displayed as "x y z" (or "x y" when DisplayZComponent is false), in the drawing plane of the active view when UseLocalSystem is set, and can be expanded to sub entries for the single coordinates. The entry is itself an IHotSpot, so a selected object can show it as a draggable handle in the drawing area. Its context menu ("MenuId.Point") offers to modify the point with the mouse and to construct it as a midpoint, a point on an object, an intersection point, a polar point or a point offset by a vector; FilterCommandEvent lets the owner intercept these commands. Number format and digits are taken from the formatting settings of the IFrame.

public class GeoPointProperty : EditableProperty<GeoPoint>, IPropertyEntry, IShowProperty, IConstructProperty, ICommandHandler, IHotSpot
Inheritance
GeoPointProperty
Implements
Inherited Members

Constructors

GeoPointProperty(IFrame, string)

Creates a point property entry that is not yet connected to a value. Set OnGetValue and OnSetValue before the entry is used.

public GeoPointProperty(IFrame frame, string resourceId = null)

Parameters

frame IFrame

The frame whose formatting settings (digits, decimal separator) are used for the display

resourceId string

Resource id of the label text and the tooltip, or null

GeoPointProperty(GetValueDelegate, SetValueDelegate, IFrame, string)

Creates a point property entry that reads and writes the value through the given delegates.

public GeoPointProperty(EditableProperty<GeoPoint>.GetValueDelegate getValueDelegate, EditableProperty<GeoPoint>.SetValueDelegate setValueDelegate, IFrame frame, string resourceId = null)

Parameters

getValueDelegate EditableProperty<GeoPoint>.GetValueDelegate

Returns the current point (in global coordinates) from the object that owns it

setValueDelegate EditableProperty<GeoPoint>.SetValueDelegate

Transfers a new point (in global coordinates) to the owning object

frame IFrame

The frame whose formatting settings are used for the display

resourceId string

Resource id of the label text and the tooltip, or null

GeoPointProperty(object, string, string, IFrame, bool)

Creates a point property entry that reads and writes the value through reflection on a property of the owning object.

public GeoPointProperty(object ObjectWithGeoPoint, string PropertyName, string resourceId, IFrame frame, bool autoModifyWithMouse = true)

Parameters

ObjectWithGeoPoint object

The object that owns the value, e.g. a line or a block reference

PropertyName string

Name of a (public or non-public) instance property of type GeoPoint on ObjectWithGeoPoint

resourceId string

Resource id of the label text and the tooltip

frame IFrame

The frame whose formatting settings are used for the display

autoModifyWithMouse bool

Not evaluated by this constructor; kept for compatibility with older code

GeoPointProperty(string, IFrame, bool)

Obsolete: creates the entry like GeoPointProperty(IFrame, string). When autoModifyWithMouse is true and no ModifyWithMouse delegate is set, the context menu command "modify with mouse" starts a GeneralGeoPointAction on this entry.

[Obsolete("Parameter autoModifyWithMouse no longer supported, use GeoPointProperty(IFrame frame, string resourceId) instead")]
public GeoPointProperty(string resourceId, IFrame frame, bool autoModifyWithMouse)

Parameters

resourceId string

Resource id of the label text and the tooltip

frame IFrame

The frame whose formatting settings are used for the display

autoModifyWithMouse bool

true to let the context menu start a GeneralGeoPointAction when no delegate is set

Fields

InputFromSubEntries

Records which coordinates the user has entered through the sub entries (the flags are set by the sub entries and not cleared by this class). A construct action reads it in its set-value handler: when single coordinates have been typed in, the input is only partially fixed and the remaining coordinates still follow the mouse; when all three flags are set, or none because the whole point was typed in, the input counts as fixed.

public GeoPointProperty.EInputFromSubEntries InputFromSubEntries

Field Value

GeoPointProperty.EInputFromSubEntries

Properties

AlwaysZComponent

When true, the z coordinate is displayed even if DisplayZComponent is false.

public bool AlwaysZComponent { get; set; }

Property Value

bool

ContextMenuId

The menu id (from the menu resource) of the context menu of this entry, "MenuId.Point" by default. Setting it replaces the context menu by the menu with the given id and makes this entry the ICommandHandler of that menu (e.g. "MenuId.IndexedPoint" for the vertices of a MultiGeoPointProperty). Prefer SetContextMenu(string, ICommandHandler) with an own command handler.

public string ContextMenuId { get; set; }

Property Value

string

DisplayZComponent

When true (the default), the point is displayed as "x y z", otherwise as "x y" only (unless AlwaysZComponent is set). Entered text may always consist of one, two or three numbers, missing coordinates are 0. Set to false e.g. by MultiGeoPointProperty for the vertices of planar objects.

public bool DisplayZComponent { get; set; }

Property Value

bool

Flags

Override for more functionality. Only returns PropertyEntryType.ValueEditable and PropertyEntryType.LabelEditable if apropriate

public override PropertyEntryType Flags { get; }

Property Value

PropertyEntryType

ForceAbsolute

Intended to force the display in absolute coordinates regardless of the formatting settings; set by DrawingPlaneProperty for the origin of the drawing plane, but currently not evaluated by this class. Can only be set from within CADability.

public bool ForceAbsolute { get; }

Property Value

bool

IsModifyingWithMouse

Obsolete and without functionality.

[Obsolete("has no funtionality")]
public bool IsModifyingWithMouse { get; }

Property Value

bool

SubItems

Must be overridden, when Flags contains PropertyEntryType.HasSubEntries. See SubItems

public override IPropertyEntry[] SubItems { get; }

Property Value

IPropertyEntry[]

TabIsSpecialKeyEvent

Obsolete and without functionality.

[Obsolete("has no funtionality")]
public bool TabIsSpecialKeyEvent { get; }

Property Value

bool

UseLocalSystem

When true, the coordinates are displayed and entered in the local system of the drawing plane of the active view (DrawingPlane); the value of the property itself remains a point in the global system. When false (the default), global coordinates are shown.

public bool UseLocalSystem { get; set; }

Property Value

bool

X

The x component of the value in the coordinate system used for the display (see UseLocalSystem). The "X" sub entry reads and writes it by reflection. Setting it transfers the modified value to the owning object and records the component in InputFromSubEntries.

protected double X { get; set; }

Property Value

double

Y

The y component of the value in the coordinate system used for the display (see UseLocalSystem). The "Y" sub entry reads and writes it by reflection. Setting it transfers the modified value to the owning object and records the component in InputFromSubEntries.

protected double Y { get; set; }

Property Value

double

Z

The z component of the value in the coordinate system used for the display (see UseLocalSystem). The "Z" sub entry reads and writes it by reflection. Setting it transfers the modified value to the owning object and records the component in InputFromSubEntries.

protected double Z { get; set; }

Property Value

double

Methods

CheckMouseButton(bool)

Obsolete and without functionality; the call can be removed.

[Obsolete("method has no functionality, remove this call")]
public void CheckMouseButton(bool Check)

Parameters

Check bool

Ignored

GeoPointChanged()

Must be called by the owner when the point has been changed from outside (not through this entry), so that the displayed value is refreshed. Has no effect while the entry is not on a property page.

public void GeoPointChanged()

GetGeoPoint()

Returns the current point as read from the owning object (or the value held by this entry when no object is connected).

public GeoPoint GetGeoPoint()

Returns

GeoPoint

The point in the global coordinate system

Selected(IPropertyEntry)

Implementation of Selected(IPropertyEntry): reports Selected.

public override void Selected(IPropertyEntry previousSelected)

Parameters

previousSelected IPropertyEntry

the entry that was selected before, may be null

SetGeoPoint(GeoPoint)

Sets the point: transfers it to the owning object (through the set delegate or the reflected property) and refreshes the display. Used by the owner and by actions that construct the value.

public void SetGeoPoint(GeoPoint l)

Parameters

l GeoPoint

The new point in the global coordinate system

TextToValue(string, out GeoPoint)

Converts the text to a value. Returns true if possible, false otherwise (maybe invalid characters or outside the limit)

protected override bool TextToValue(string text, out GeoPoint val)

Parameters

text string
val GeoPoint

Returns

bool

ValueToText(GeoPoint)

Returns the text representation of the value.

protected override string ValueToText(GeoPoint p)

Parameters

p GeoPoint

Returns

string

Events

FilterCommandEvent

When a context menue is selected or about to popup this event is raised to allow a consumer to process the command instead of this GeoPointProperty object itself. Provide a handler here if you want to process some or all menu commands.

public event GeoPointProperty.FilterCommandDelegate FilterCommandEvent

Event Type

GeoPointProperty.FilterCommandDelegate

GetGeoPointEvent

Obsolete: adding a handler installs it as OnGetValue, so it is asked for the current value whenever the entry needs it. Only one handler is kept (adding replaces the previous one), removing clears the delegate.

[Obsolete("use delegate GeoPointProperty.OnGetValue instead")]
public event GeoPointProperty.GetGeoPointDelegate GetGeoPointEvent

Event Type

GeoPointProperty.GetGeoPointDelegate

LabelChangedEvent

Obsolete: adding a handler installs it as LabelTextChanged, which is called when the user has edited the label text of the entry. Only one handler is kept, removing clears the delegate.

[Obsolete("use delegate GeoPointProperty.LabelTextChanged instead")]
public event EditableProperty<GeoPoint>.LabelChangedDelegate LabelChangedEvent

Event Type

EditableProperty<GeoPoint>.LabelChangedDelegate

LockedChangedEvent

Obsolete: adding a handler installs it as LockedChanged, which is called with the new state whenever Locked changes. Only one handler is kept, removing clears the delegate.

[Obsolete("use delegate GeoPointProperty.LockedChanged instead")]
public event EditableProperty<GeoPoint>.LockedChangedDelegate LockedChangedEvent

Event Type

EditableProperty<GeoPoint>.LockedChangedDelegate

ModifiedByActionEvent

This GeoPointProperty.ModifiedByActionDelegate event will be raised when the GeoPoint was modified by some Action. ( The SetGeoPointEvent will also be raised or the property will be set)

public event GeoPointProperty.ModifiedByActionDelegate ModifiedByActionEvent

Event Type

GeoPointProperty.ModifiedByActionDelegate

ModifyWithMouseEvent

Obsolete: adding a handler installs it as ModifyWithMouse. The handler is called with true when the user starts dragging the hotspot of this entry and with false when the "modify with mouse" command of the context menu is selected. Only one handler is kept, removing clears the delegate.

[Obsolete("use delegate GeoPointProperty.ModifyWithMouse instead")]
public event ModifyWithMouseDelegate ModifyWithMouseEvent

Event Type

ModifyWithMouseDelegate

SelectionChangedEvent

This GeoPointProperty.SelectionChangedDelegate event will be raised when this GeoPointProperty gets selected (the user clicks on the label or forwards the focus by pressing the tab key) or unselected.

public event GeoPointProperty.SelectionChangedDelegate SelectionChangedEvent

Event Type

GeoPointProperty.SelectionChangedDelegate

SetGeoPointEvent

Obsolete: adding a handler installs it as OnSetValue, so it is called whenever a new value is to be transferred to the owner. Only one handler is kept (adding replaces the previous one), removing clears the delegate.

[Obsolete("use delegate GeoPointProperty.OnSetValue instead")]
public event GeoPointProperty.SetGeoPointDelegate SetGeoPointEvent

Event Type

GeoPointProperty.SetGeoPointDelegate