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
frameIFrameThe frame whose formatting settings (coordinate system, digits, decimal separator, vector and angle mode) are used for the display
resourceIdstringResource 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
getValueDelegateEditableProperty<GeoVector>.GetValueDelegateReturns the current vector (in global coordinates) from the object that owns it
setValueDelegateEditableProperty<GeoVector>.SetValueDelegateTransfers a new vector (in global coordinates) to the owning object
frameIFrameThe frame whose formatting settings are used for the display
resourceIdstringResource 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
ObjectWithGeoVectorobjectThe object that owns the value, e.g. a line or a surface
PropertyNamestringName of a (public or non-public) instance property of type GeoVector on
ObjectWithGeoVectorresourceIdstringResource id of the label text and the tooltip
frameIFrameThe frame whose formatting settings are used for the display
autoModifyWithMouseboolNot 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
resourceIdstringResource id of the label text and the tooltip
frameIFrameThe frame whose formatting settings are used for the display
autoModifyWithMouseboolIgnored
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
Properties
AlwaysZComponent
Counterpart of AlwaysZComponent; currently without effect, see DisplayZComponent.
public bool AlwaysZComponent { get; set; }
Property Value
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
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
Flags
Override for more functionality. Only returns PropertyEntryType.ValueEditable and PropertyEntryType.LabelEditable if apropriate
public override PropertyEntryType Flags { get; }
Property Value
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
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
IsModifyingWithMouse
Obsolete and without functionality.
[Obsolete("has no funtionality")]
public bool IsModifyingWithMouse { get; }
Property Value
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
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
SubItems
Must be overridden, when Flags contains PropertyEntryType.HasSubEntries. See SubItems
public override IPropertyEntry[] SubItems { get; }
Property Value
TabIsSpecialKeyEvent
Obsolete and without functionality.
[Obsolete("has no funtionality")]
public bool TabIsSpecialKeyEvent { get; }
Property Value
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
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
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
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
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
CheckboolIgnored
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
previousSelectedIPropertyEntrythe 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
lGeoVectorThe 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
Returns
ValueToText(GeoVector)
Returns the text representation of the value.
protected override string ValueToText(GeoVector p)
Parameters
Returns
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
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
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
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
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
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
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
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