Table of Contents

Class LayerSelectionProperty

Namespace
CADability.Attribute
Assembly
CADability.dll

Property entry for the control center which lets the user choose a Layer from a LayerList in a drop-down list. When constructed for an object implementing ILayer, the selection is assigned to that object's Layer and the entry follows changes of the object's layer; in any case the selection is reported through LayerChangedEvent. GeoObjects show it among their attribute properties.

public class LayerSelectionProperty : MultipleChoiceProperty, IPropertyEntry, IShowProperty
Inheritance
LayerSelectionProperty
Implements
Inherited Members

Constructors

LayerSelectionProperty(ILayer, string, LayerList)

Creates a layer selection bound to ObjectWithLayer, without the "undefined" entry. Same as LayerSelectionProperty(ILayer, string, LayerList, bool) with includeUndefined set to false.

public LayerSelectionProperty(ILayer ObjectWithLayer, string resourceId, LayerList ll)

Parameters

ObjectWithLayer ILayer

the object whose layer is shown and set; usually a GeoObject

resourceId string

resource id of the label text (see StringTable)

ll LayerList

the list whose layers are offered

LayerSelectionProperty(ILayer, string, LayerList, bool)

Creates a layer selection bound to ObjectWithLayer: the current layer of the object is preselected, and when the user chooses an entry, the object's Layer is set and LayerChangedEvent is raised. With includeUndefined the list starts with an additional entry (string resource "Layer.Undefined") that stands for "no layer" (null) and is selected when the object has no layer; a Style uses this to leave the layer open.

public LayerSelectionProperty(ILayer ObjectWithLayer, string resourceId, LayerList ll, bool includeUndefined)

Parameters

ObjectWithLayer ILayer

the object whose layer is shown and set; may be null, then the selection is only reported by the event

resourceId string

resource id of the label text (see StringTable)

ll LayerList

the list whose layers are offered

includeUndefined bool

true to offer the additional "undefined" entry

LayerSelectionProperty(string, LayerList, Layer)

Creates a layer selection that is not bound to an object. The choice of the user is only reported via LayerChangedEvent; used e.g. to set the layer of several selected objects at once.

public LayerSelectionProperty(string resourceId, LayerList layerList, Layer select)

Parameters

resourceId string

resource id of the label text (see StringTable)

layerList LayerList

the list whose layers are offered

select Layer

the initially selected layer, or null for no selection

Properties

Connected

The GeoObject whose layer this entry shows and modifies (the object given to the constructor). Setting it redirects the entry to another object, which must implement ILayer: the entry stops watching the previous object and follows the layer changes of the new one. Used when the object under construction is replaced while its properties are displayed.

public IGeoObject Connected { get; set; }

Property Value

IGeoObject

Methods

Added(IPropertyPage)

Implementation of Added(IPropertyPage): memorizes the page in propertyPage and reports Added. Override it to subscribe to events while the entry is displayed, and call the base implementation.

public override void Added(IPropertyPage propertyPage)

Parameters

propertyPage IPropertyPage

OnSelectionChanged(string)

Called when the user has picked a choice. Raises SelectionChangedEvent, stores the text in SelectedText and raises ValueChangedEvent. Derived classes override it to pass the selection on to the object they represent.

protected override void OnSelectionChanged(string selected)

Parameters

selected string

The selected text

Removed(IPropertyPage)

public override void Removed(IPropertyPage propertyPage)

Parameters

propertyPage IPropertyPage

the IPropertyTreeView from which it was removed

Events

LayerChangedEvent

Raised when the user has selected an entry of the drop-down list, after the layer of the connected object (if any) has been set.

public event LayerSelectionProperty.LayerChangedDelegate LayerChangedEvent

Event Type

LayerSelectionProperty.LayerChangedDelegate