Table of Contents

Class GeoVectorProperty

Namespace
CADability.UserInterface
Assembly
CADability.dll

Property entry for the control center that displays and edits a GeoVector, e.g. the direction of a line or the axis of an ellipse. The vector 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 vector in the global coordinate system. It is displayed either by its x, y and z components (in the drawing plane of the active view when the "Formatting.System" setting selects the local system) or, when IsAngle is set, as an angle in degrees in PlaneForAngle. The entry can be expanded to sub entries for the single components (or for longitude and latitude). Its context menu ("MenuId.Vector") offers to modify the vector with the mouse, to take the direction of a curve or a surface, to define it by two points, to store it as a named value and to open the format settings; FilterCommandEvent lets the owner take part in these commands. Number format and digits are taken from the formatting settings of the IFrame. A GeoVectorHotSpot shows the entry as a draggable handle in the drawing area.

public class GeoVectorProperty : EditableProperty<GeoVector>, IPropertyEntry, IShowProperty, IConstructProperty, ICommandHandler
Inheritance
GeoVectorProperty
Implements
Inherited Members

Constructors

GeoVectorProperty(IFrame, string)

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

public GeoVectorProperty(IFrame frame, string resourceId = null)

Parameters

frame IFrame

The frame whose formatting settings (coordinate system, digits, decimal separator, vector and angle mode) are used for the display

resourceId string

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

GeoVectorProperty(GetValueDelegate, SetValueDelegate, IFrame, string)

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

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

Parameters

getValueDelegate EditableProperty<GeoVector>.GetValueDelegate

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

setValueDelegate EditableProperty<GeoVector>.SetValueDelegate

Transfers a new vector (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

GeoVectorProperty(object, string, string, IFrame, bool)

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

public GeoVectorProperty(object ObjectWithGeoVector, string PropertyName, string resourceId, IFrame frame, bool autoModifyWithMouse = true)

Parameters

ObjectWithGeoVector object

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

PropertyName string

Name of a (public or non-public) instance property of type GeoVector on ObjectWithGeoVector

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

GeoVectorProperty(string, IFrame, bool)

Obsolete: creates the entry like GeoVectorProperty(IFrame, string); autoModifyWithMouse is ignored.

[Obsolete("Parameter autoModifyWithMouse no longer supported, use GeoVectorProperty(IFrame frame, string resourceId) instead")]
public GeoVectorProperty(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

Ignored

Fields

InputFromSubEntries

Records which components of the vector the user has entered through the sub entries (the flags are set by the sub entries and not cleared by this class). The counterpart InputFromSubEntries is evaluated by construct actions to recognize partially fixed input; for a vector the value is currently not evaluated.

public GeoVectorProperty.EInputFromSubEntries InputFromSubEntries

Field Value

GeoVectorProperty.EInputFromSubEntries

Properties

AlwaysZComponent

Counterpart of AlwaysZComponent; currently without effect, see DisplayZComponent.

public bool AlwaysZComponent { get; set; }

Property Value

bool

ContextMenuId

The menu id (from the menu resource) of the context menu of this entry, "MenuId.Vector" 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.Projection.Direction" for the projection direction of a view). Prefer SetContextMenu(string, ICommandHandler) with an own command handler.

public string ContextMenuId { get; set; }

Property Value

string

DisplayZComponent

Counterpart of DisplayZComponent. A vector is currently always displayed with all three components, so this value has no effect on the display.

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 the absolute coordinate system regardless of the "Formatting.System" setting; currently not evaluated by this class. Can only be set from within CADability.

public bool ForceAbsolute { get; }

Property Value

bool

IsAngle

When true, the vector is a direction that is displayed and entered as an angle in degrees, measured in PlaneForAngle (or in the drawing plane of the active view when no valid plane is set): a single number is the angle in the plane, two numbers are longitude and latitude. The sub entries then show the angle(s) instead of the x, y and z components. When false (the default), the vector is displayed by its components. Construct actions set it for direction inputs, e.g. the direction of a line. Setting the value refreshes the entry on the property page.

public bool IsAngle { get; set; }

Property Value

bool

IsModifyingWithMouse

Obsolete and without functionality.

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

Property Value

bool

IsNormedVector

Marks the vector as a pure direction whose length is irrelevant (e.g. the direction of a line); owners set it together with IsAngle. The display currently does not depend on it, setting it only refreshes the entry on the property page.

public bool IsNormedVector { get; set; }

Property Value

bool

PlaneForAngle

The plane in which the angle is measured when IsAngle is true: the displayed angle is the angle between the x-axis of the plane and the projection of the vector onto the plane. When the plane is not valid (the default), the drawing plane of the active view is used. Setting the value refreshes the entry on the property page.

public Plane PlaneForAngle { get; set; }

Property Value

Plane

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

Counterpart of UseLocalSystem. For a vector the coordinate system of the display is chosen by the "Formatting.System" setting of the frame, this value is currently not evaluated.

public bool UseLocalSystem { get; set; }

Property Value

bool

X

The x component of the value in the coordinate system used for the display (the drawing plane of the active view when the "Formatting.System" setting selects the local system, the global system otherwise). Not used by the sub entries of this class, which work with delegates; available to derived classes. 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 (the drawing plane of the active view when the "Formatting.System" setting selects the local system, the global system otherwise). Not used by the sub entries of this class, which work with delegates; available to derived classes. 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 (the drawing plane of the active view when the "Formatting.System" setting selects the local system, the global system otherwise). Not used by the sub entries of this class, which work with delegates; available to derived classes. 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

GeoVectorChanged()

Must be called by the owner when the vector 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 GeoVectorChanged()

GetGeoVector()

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

public GeoVector GetGeoVector()

Returns

GeoVector

The vector 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

SetGeoVector(GeoVector)

Sets the vector: 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 SetGeoVector(GeoVector l)

Parameters

l GeoVector

The new vector in the global coordinate system

TextToValue(string, out GeoVector)

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 GeoVector val)

Parameters

text string
val GeoVector

Returns

bool

ValueToText(GeoVector)

Returns the text representation of the value.

protected override string ValueToText(GeoVector p)

Parameters

p GeoVector

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 GeoVectorProperty object itself. Provide a handler here if you want to process some or all menu commands.

public event GeoVectorProperty.FilterCommandDelegate FilterCommandEvent

Event Type

GeoVectorProperty.FilterCommandDelegate

GetGeoVectorEvent

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 GeoVectorProperty.OnGetValue instead")]
public event GeoVectorProperty.GetGeoVectorDelegate GetGeoVectorEvent

Event Type

GeoVectorProperty.GetGeoVectorDelegate

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 GeoVectorProperty.LabelTextChanged instead")]
public event EditableProperty<GeoVector>.LabelChangedDelegate LabelChangedEvent

Event Type

EditableProperty<GeoVector>.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 GeoVectorProperty.LockedChanged instead")]
public event EditableProperty<GeoVector>.LockedChangedDelegate LockedChangedEvent

Event Type

EditableProperty<GeoVector>.LockedChangedDelegate

ModifiedByActionEvent

This GeoVectorProperty.ModifiedByActionDelegate event will be raised when the GeoVector was modified by some Action. ( The SetGeoVectorEvent will also be raised or the property will be set)

public event GeoVectorProperty.ModifiedByActionDelegate ModifiedByActionEvent

Event Type

GeoVectorProperty.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 GeoVectorProperty.ModifyWithMouse instead")]
public event ModifyWithMouseDelegate ModifyWithMouseEvent

Event Type

ModifyWithMouseDelegate

SelectionChangedEvent

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

public event GeoVectorProperty.SelectionChangedDelegate SelectionChangedEvent

Event Type

GeoVectorProperty.SelectionChangedDelegate

SetGeoVectorEvent

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 GeoVectorProperty.OnSetValue instead")]
public event GeoVectorProperty.SetGeoVectorDelegate SetGeoVectorEvent

Event Type

GeoVectorProperty.SetGeoVectorDelegate