Class Layer
A layer is a collection of nodes that share a common set of default properties and the same Z-order relative to other layers.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Diagram
Assembly: Syncfusion.Diagram.Base.dll
Syntax
public class Layer : PropertyContainer, IServiceReferenceHolder, IServiceReferenceProvider, IPropertyObserver, IPropertyContainer, ICloneable, ISerializable, IDisposable, IServiceProvider
Remarks
A layer contains zero or more nodes and is responsible for rendering those nodes. Since the nodes in a layer are rendered as a group, their Z-order is the same relative to other layers in the diagram. For example, if layer A has a higher Z-order than layer B, then all nodes in layer B will be rendered behind those in layer A. If the Visible flag on a layer is set to False, none of the nodes in the layer will be rendered.
The nodes in the layer can inherit properties from the layer. If a property is not explicitly set in a node, the node inherits the property from the layer. If the layer does not have the property set, then the layer chains up to the model to get the property. This allows all nodes in a layer to share the same defaults.
All nodes in the layer can be hidden by setting the Visible flag to False.
Constructors
Layer()
Initializes a new instance of the Layer class.
Declaration
public Layer()
Layer(ILayerContainer, String)
Initializes a new instance of the Layer class.
Declaration
public Layer(ILayerContainer owner, string strLayerName)
Parameters
Type | Name | Description |
---|---|---|
ILayerContainer | owner | Container to attach the layer to. |
System.String | strLayerName | Name to give the layer. |
Layer(Layer)
Initializes a new instance of the Layer class.
Declaration
public Layer(Layer src)
Parameters
Type | Name | Description |
---|---|---|
Layer | src | The SRC. |
Layer(SerializationInfo, StreamingContext)
Initializes a new instance of the Layer class. Serialization constructor for layers.
Declaration
protected Layer(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | Serialization state information. |
System.Runtime.Serialization.StreamingContext | context | Streaming context information. |
Properties
Constraints
To set Constraints for Layer
Declaration
public Constraints Constraints { get; set; }
Property Value
Type |
---|
Constraints |
Container
Gets or sets object that contains the layer.
Declaration
public ILayerContainer Container { get; set; }
Property Value
Type |
---|
ILayerContainer |
Remarks
Each layer has a reference to a container object for the purpose of synchronizing changes in layers. This is necessary because a node can only belong to a single layer at a time. When a node is added to one layer, it must be removed from any other layer it might already belong to. ILayerContainer LayerCollection
Count
Gets the number of nodes in the layer.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
Enabled
Gets or sets a value indicating whether the layer is enabled or disabled.
Declaration
public bool Enabled { get; set; }
Property Value
Type |
---|
System.Boolean |
IsSynchronized
Gets a value indicating whether the collection is thread-safe.
Declaration
public bool IsSynchronized { get; }
Property Value
Type |
---|
System.Boolean |
Name
Gets or sets name of the layer.
Declaration
public string Name { get; set; }
Property Value
Type |
---|
System.String |
Nodes
Gets typed collection of nodes belonging to layer
Declaration
public NodeCollection Nodes { get; }
Property Value
Type |
---|
NodeCollection |
SyncRoot
Gets the object that can be used to synchronize access to the collection.
Declaration
public object SyncRoot { get; }
Property Value
Type |
---|
System.Object |
Visible
Gets or sets a value indicating whether the layer is visible.
Declaration
public bool Visible { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
If this flag is set to False, none of the nodes belonging to the layer will be rendered.
Methods
Add(Node)
Adds a node the layer.
Declaration
public void Add(Node node)
Parameters
Type | Name | Description |
---|---|---|
Node | node | Node to add. |
Remarks
If the node already belongs to this layer, this method does nothing. Before adding the node to this layer, this method adds this layer to adding node's LayerCollection
Remove(Node)Add(NodeCollection)
Adds a collection of nodes to the layer.
Declaration
public void Add(NodeCollection nodes)
Parameters
Type | Name | Description |
---|---|---|
NodeCollection | nodes | Nodes to add. |
Remarks
If the node already belongs to this layer, this method does nothing. Before adding the node to this layer, this method adds this layer to adding node's LayerCollection
Remove(Node)Clone()
Creates a new object that is a copy of the current instance.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
Overrides
Contains(Node)
Determines if the specified node belongs to the layer.
Declaration
public bool Contains(Node node)
Parameters
Type | Name | Description |
---|---|---|
Node | node | Node to search for. |
Returns
Type | Description |
---|---|
System.Boolean | True if the node belongs to the layer; otherwise False. |
CopyTo(Array, Int32)
Copies the list or a portion of the list to an array.
Declaration
public void CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | Array in which to copy the items in the list. |
System.Int32 | index | Index at which to start copying in target array. |
GetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo with the data needed to serialize the target object.
Declaration
protected override void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | SerializationInfo object to populate. |
System.Runtime.Serialization.StreamingContext | context | Destination streaming context. |
Overrides
GetPropertyContainerName()
Gets the name of the property container.
Declaration
protected override string GetPropertyContainerName()
Returns
Type | Description |
---|---|
System.String | The property container name. |
Overrides
GetService(Type)
Returns the specified type of service object to the caller.
Declaration
protected virtual object GetService(Type svcType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | svcType | Type of service requested. |
Returns
Type | Description |
---|---|
System.Object | The object matching the service type requested or NULL if the service is not supported. |
Remarks
This method is similar to COM's IUnknown::QueryInterface method, although more generic. Instead of just returning interfaces, this method can return any type of object.
The following services are supported: IPropertyContainer
OnPropertyChanged(String)
Called when property changed.
Declaration
protected override void OnPropertyChanged(string strPropertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyName | Name of the property. |
Overrides
OnPropertyChanging(String, Object)
Called when property changing.
Declaration
protected override bool OnPropertyChanging(string strPropertyName, object newValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyName | Name of the property. |
System.Object | newValue | The new value. |
Returns
Type | Description |
---|---|
System.Boolean | true, if property changing otherwise false. |
Overrides
RecordPropertyChanged(String)
Records the property changed.
Declaration
protected override void RecordPropertyChanged(string strPropertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyName | Name of the property. |
Overrides
Remove(Node)
Removes the specified node from this layer.
Declaration
public void Remove(Node node)
Parameters
Type | Name | Description |
---|---|---|
Node | node | Node to remove. |
RemoveAll()
Removes all nodes from this layer.
Declaration
public void RemoveAll()
UpdateServiceReferences(IServiceReferenceProvider)
Updates the service references.
Declaration
public override void UpdateServiceReferences(IServiceReferenceProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IServiceReferenceProvider | provider | The provider. |
Overrides
Explicit Interface Implementations
IServiceProvider.GetService(Type)
Gets the specified type of service object the caller.
Declaration
object IServiceProvider.GetService(Type svcType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | svcType | Type of service requested. |
Returns
Type | Description |
---|---|
System.Object | The object matching the service type requested or NULL if the service is not supported. |