Class Layer
The Layer Class is an modified wrapper for the System.Collections.Generic.Dictionary`2 class. The layer class has a dictionary backing field with custom functionality.
Inheritance
Inherited Members
Namespace: Dxflib.AcadEntities
Assembly: Dxflib.dll
Syntax
public class Layer
Constructors
| Improve this Doc View SourceLayer(String)
Layer Constructor: Create a layer and give it a name. This constructor will create a new blank System.Collections.Generic.Dictionary`2 backing field.
Declaration
public Layer(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The Layer Name |
Properties
| Improve this Doc View SourceCount
The Number of layers in the dictionary
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
The Layer's Name
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceAddEntity(String, Entity)
Adds an Entity to the dictionary
Declaration
public void AddEntity(string handle, Entity entity)
Parameters
Type | Name | Description |
---|---|---|
System.String | handle | The entity's handle |
Entity | entity | The entity reference |
Remarks
Always make sure that the entity
is not already
a member of the dictionary
Exceptions
Type | Condition |
---|---|
LayerException | Will throw a new exception
if the |
ContainsEntity(String)
Returns true if the layer contains the entity with the provided handle
Declaration
public bool ContainsEntity(string handle)
Parameters
Type | Name | Description |
---|---|---|
System.String | handle | Handle of the Entity |
Returns
Type | Description |
---|---|
System.Boolean | True: The entity is contained, False: the entity is not contained |
GetAllEntities()
Get all of the entities on the layer
Declaration
public List<Entity> GetAllEntities()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Entity> | a list of all of the entities on the layer |
GetAllHandles()
Gets all of the handles from the dictionary
Declaration
public List<string> GetAllHandles()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | A list of handles |
GetEntity(String)
Gets a layer from it's handle
Declaration
public Entity GetEntity(string handle)
Parameters
Type | Name | Description |
---|---|---|
System.String | handle | The handle of the entity |
Returns
Type | Description |
---|---|
Entity | The entity that corresponds to the handle |
Exceptions
Type | Condition |
---|---|
LayerException | Thrown when the layer does not contain the entity |
RemoveEntity(String)
Removes the entity from the dictionary
Declaration
public void RemoveEntity(string handle)
Parameters
Type | Name | Description |
---|---|---|
System.String | handle |
Remarks
Always check to see if the entity is a member of the layer
Exceptions
Type | Condition |
---|---|
LayerException | Will throw exception if the entity is not found to be a member of this layer |