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
infoSerializationInfoSerializationInfo
contextStreamingContextStreamingContext
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
Count
Gets the number of entities in this list.
public int Count { get; }
Property Value
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
EntryType
Overrides EntryType, returns GroupTitle.
public override ShowPropertyEntryType EntryType { get; }
Property Value
this[int]
Gets the LineWidth with the given index.
public LineWidth this[int index] { get; }
Parameters
indexint
Property Value
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
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
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
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
lineWidthToAddLineWidthLineWidth to Add
Added(IPropertyPage)
Overrides Added(IPropertyPage)
public override void Added(IPropertyPage pp)
Parameters
ppIPropertyPagethe 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
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
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
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
namestringName of the requsetd LineWidth
Returns
FindIndex(LineWidth)
Returns the index of the given linewidth in this list
public int FindIndex(LineWidth lw)
Parameters
lwLineWidthlinewidth 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
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
infoSerializationInforeceives the data
contextStreamingContextthe 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
namestringthe name the list was stored under
infoSerializationInfothe serialization data
contextStreamingContextthe 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
lineWidthToRemoveLineWidthLineWidth 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
ppIPropertyPagethe 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