Table of Contents

Class LineWidthList

Namespace
CADability.Attribute
Assembly
CADability.dll

The list of the LineWidth attributes available in a Project or in the global Settings. Line widths are addressed by their unique name; the list keeps track of the current (default) line width, can be edited interactively in the property grid and raises the DidModifyEvent when it changes.

public class LineWidthList : IShowPropertyImpl, IShowProperty, IPropertyEntry, IAttributeList, ISerializable, ICommandHandler, IDeserializationCallback
Inheritance
LineWidthList
Implements
Inherited Members

Constructors

LineWidthList()

Constructs an empty LineWidthList. Usually you dont have to construct a LineWidthList since on construction of a new Project the global LineWidthList is cloned and set as the projects LineWidthList.

public LineWidthList()

LineWidthList(SerializationInfo, StreamingContext)

Constructor required by deserialization

protected LineWidthList(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

Gets the number of entities in this list.

public int Count { get; }

Property Value

int

Current

Gets or sets the current LineWidth. The current LineWidth is used when a new GeoObject is constructed interactively.

public LineWidth Current { get; set; }

Property Value

LineWidth

EntryType

Overrides EntryType, returns GroupTitle.

public override ShowPropertyEntryType EntryType { get; }

Property Value

ShowPropertyEntryType

this[int]

Gets the LineWidth with the given index.

public LineWidth this[int index] { get; }

Parameters

index int

Property Value

LineWidth

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

Add(LineWidth)

Adds an LineWidth object to the list. Throws a NameAlreadyExistsException if there is a LineWidth with the given name in the list. This also prevents the same object added twice to the list.

public void Add(LineWidth lineWidthToAdd)

Parameters

lineWidthToAdd LineWidth

LineWidth to Add

Added(IPropertyPage)

public override void Added(IPropertyPage pp)

Parameters

pp IPropertyPage

the IPropertyPage to which it was added

Clone()

Returns a copy of this LineWidthList. The entries are cloned so the copy is independant.

public LineWidthList Clone()

Returns

LineWidthList

CreateOrFind(string, double)

Returns the line width with the given name; when there is none, a new LineWidth with that name and width is created (see LineWidth(string, double); its scaling is Device), added to the list and returned. The width of an existing entry is left as it is, see CreateOrModify(string, double).

public LineWidth CreateOrFind(string Name, double width)

Parameters

Name string

the name of the line width

width double

the width for a newly created entry

Returns

LineWidth

the existing or newly created LineWidth

CreateOrModify(string, double)

Returns the line width with the given name, setting its Width to width; when there is none, a new LineWidth with that name and width (see LineWidth(string, double)) is added to the list and returned.

public LineWidth CreateOrModify(string Name, double width)

Parameters

Name string

the name of the line width

width double

the width

Returns

LineWidth

the existing (modified) or newly created LineWidth

Find(string)

Returns the LineWidth with the given name or null if not found.

public LineWidth Find(string name)

Parameters

name string

Name of the requsetd LineWidth

Returns

LineWidth

FindIndex(LineWidth)

Returns the index of the given linewidth in this list

public int FindIndex(LineWidth lw)

Parameters

lw LineWidth

linewidth for which the index is requested

Returns

int

the index found or -1 if this list does not contain lw

GetDefault()

Creates a default LineWidthList.

public static LineWidthList GetDefault()

Returns

LineWidthList

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

Read(string, SerializationInfo, StreamingContext)

Reads the LineWidthList stored under the given name from the legacy binary serialization data (ISerializable); missing or incompatible entries yield null instead of an exception, so that older files can be read.

public static LineWidthList Read(string name, SerializationInfo info, StreamingContext context)

Parameters

name string

the name the list was stored under

info SerializationInfo

the serialization data

context StreamingContext

the source of the serialization

Returns

LineWidthList

the list, or null when there is no entry with that name or it is not a LineWidthList

Remove(LineWidth)

Removes an entry from the LineWidth list. Depending on the context and global settings there might be a warning if the LineWidth is beeing used by an IGeoObject belonging to the Project. If the LineWidth is not in the list, nothing happens.

public void Remove(LineWidth lineWidthToRemove)

Parameters

lineWidthToRemove LineWidth

LineWidth 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

DidModifyEvent

Raised when a line width is added to or removed from the list. Changes of the properties of a line width are forwarded to the owner of the list (the project) instead.

public event DidModifyDelegate DidModifyEvent

Event Type

DidModifyDelegate