Table of Contents

Class FilterList

Namespace
CADability.Attribute
Assembly
CADability.dll

A FilterList is a list of Filters. The Project owns a FilterList which is used by the SelectObjectsAction to decide which IGeoObjects may be selected or must be rejected. You may add a handler to the PreFilterEvent event to do your own filtering or use the default filtering machanism (or both). The FilterList of the project is displayed in the ControlCenter and may be interactively manipulated.

public class FilterList : IShowPropertyImpl, IShowProperty, IPropertyEntry, ISerializable, ICommandHandler, INameChange, IDeserializationCallback
Inheritance
FilterList
Implements
Inherited Members

Constructors

FilterList()

Constructs a empty FilterList

public FilterList()

FilterList(SerializationInfo, StreamingContext)

Constructor required by deserialization

protected FilterList(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

SerializationInfo

context StreamingContext

StreamingContext

Properties

ContextMenu

Implementation of ContextMenu: the default returns null. An entry whose LabelType contains ContextMenu must override it.

public override MenuWithHandler[] ContextMenu { get; }

Property Value

MenuWithHandler[]

Count

Returns the number of Filters in this list.

public int Count { get; }

Property Value

int

EntryType

Overrides EntryType, returns GroupTitle.

public override ShowPropertyEntryType EntryType { get; }

Property Value

ShowPropertyEntryType

this[int]

Indexer to access individual Filters by index

public Filter this[int index] { get; }

Parameters

index int

index of the required Filter

Property Value

Filter

The Filter

LabelType

How the label of this entry behaves (see ShowPropertyLabelFlags): whether it can be selected or edited, is bold or has a context menu. The default implementation returns Selectable.

public override ShowPropertyLabelFlags LabelType { get; }

Property Value

ShowPropertyLabelFlags

SubEntries

The sub entries shown below this entry when it is opened in the property page. The default implementation has none and returns an empty array.

public override IShowProperty[] SubEntries { get; }

Property Value

IShowProperty[]

SubEntriesCount

The number of SubEntries, 0 for an entry that cannot be opened. The default implementation returns 0.

public override int SubEntriesCount { get; }

Property Value

int

Methods

Accept(IGeoObject)

Use all active filters in this list to check whether an object is accepted or not. If there is a PreFilterEvent the this event will be called.

public bool Accept(IGeoObject go)

Parameters

go IGeoObject

Object to check

Returns

bool

true: accepted, false: rejected

Add(Filter)

Add the provided Filter to the list

public void Add(Filter f)

Parameters

f Filter

Filter to add

AddNewFilter()

Creates a new, active filter (via Construct(), so an application-defined filter class is used when one is registered) with a unique name made of the "Filter.NewFilter.Prefix" string and the first free number, and adds it to the list. In the control center the list is expanded and the user can type the name of the new filter right away. Used by the context menu of the list and by the select action.

public Filter AddNewFilter()

Returns

Filter

the new filter

Added(IPropertyPage)

Implementation of Added(IPropertyPage): memorizes the property page in propertyPage. Unlike Added(IPropertyTreeView) it does not raise the state changed event. Override it to subscribe to events while the entry is displayed, and call the base implementation.

public override void Added(IPropertyPage pp)

Parameters

pp IPropertyPage

the property page the entry was added to

FindFilter(string)

Returns the filter with the given name.

public Filter FindFilter(string name)

Parameters

name string

the name of the filter

Returns

Filter

the filter, or null when there is no filter with that name

GetObjectData(SerializationInfo, StreamingContext)

Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.

public void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

receives the data

context StreamingContext

the destination of the serialization

MayChangeName(object, string)

Checks whether a filter of this list may take the given name: a name is only accepted when no other filter of the list has it. The Name setter calls it and throws a NameAlreadyExistsException when it returns false.

public bool MayChangeName(object namedObject, string newName)

Parameters

namedObject object

the Filter that is about to be renamed

newName string

the desired name

Returns

bool

true when the name may be used (or is unchanged), false when another filter already has it

NameChanged(object, string)

Called by the Name setter after a filter was renamed: re-sorts the filter under its new name, refreshes the control center and selects the renamed filter there.

public void NameChanged(object namedObject, string oldName)

Parameters

namedObject object

the Filter that was renamed; it already has its new name

oldName string

the name under which the filter was listed before

Remove(Filter)

Remove the provided Filter from the list

public void Remove(Filter f)

Parameters

f Filter

Filter to remove

Removed(IPropertyPage)

Implementation of Removed(IPropertyPage): forgets the property page. Override it to unsubscribe from events, and call the base implementation.

public override void Removed(IPropertyPage pp)

Parameters

pp IPropertyPage

the property page the entry was removed from

Events

PreFilterEvent

Event to add custom filter.

public event FilterList.PreFilterDelegate PreFilterEvent

Event Type

FilterList.PreFilterDelegate