Back to Devexpress

ColorizerKeyItem Class

windowsforms-devexpress-dot-xtramap-fb4b21ed.md

latest4.0 KB
Original Source

ColorizerKeyItem Class

A key for the KeyColorColorizer.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public class ColorizerKeyItem :
    ISupportObjectChanged,
    IKeyItem
vb
Public Class ColorizerKeyItem
    Implements ISupportObjectChanged,
               IKeyItem

Example

To colorize the map using a key-color colorizer, do the following.

csharp
// Create a vector layer and add it to the map.
    VectorItemsLayer hotelLayer = new VectorItemsLayer() {
        Data = CreateData(),
        Colorizer = CreateColorizer()
    };
    map.Layers.Add(hotelLayer);
// Creates a key color colorizer.
private MapColorizer CreateColorizer() {
    KeyColorColorizer colorizer = new KeyColorColorizer() {
        ItemKeyProvider = new AttributeItemKeyProvider() { AttributeName = "CATEGORY" },
        PredefinedColorSchema = PredefinedColorSchema.Palette
    };

    colorizer.Keys.Add(new ColorizerKeyItem() { Key = 1, Name = "Restaurant" });
    colorizer.Keys.Add(new ColorizerKeyItem() { Key = 2, Name = "Business room" });
    colorizer.Keys.Add(new ColorizerKeyItem() { Key = 3, Name = "Bathroom" });
    colorizer.Keys.Add(new ColorizerKeyItem() { Key = 4, Name = "Living room" });
    colorizer.Keys.Add(new ColorizerKeyItem() { Key = 5, Name = "Other" });
    colorizer.Keys.Add(new ColorizerKeyItem() { Key = 6, Name = "Service room" });
    colorizer.Keys.Add(new ColorizerKeyItem() { Key = 7, Name = "Pool" });
    colorizer.Keys.Add(new ColorizerKeyItem() { Key = 8, Name = "Gym" });

    return colorizer;
}
vb
' Create a vector layer and add it to the map.
    Dim hotelLayer As New VectorItemsLayer() With {.Data = CreateData(), .Colorizer = CreateColorizer()}
    map.Layers.Add(hotelLayer)
' Creates a key color colorizer.
Private Function CreateColorizer() As MapColorizer
    Dim colorizer As New KeyColorColorizer() With {.ItemKeyProvider = New AttributeItemKeyProvider() With {.AttributeName = "CATEGORY"}, .PredefinedColorSchema = PredefinedColorSchema.Palette}

    colorizer.Keys.Add(New ColorizerKeyItem() With {.Key = 1, .Name = "Restaurant"})
    colorizer.Keys.Add(New ColorizerKeyItem() With {.Key = 2, .Name = "Business room"})
    colorizer.Keys.Add(New ColorizerKeyItem() With {.Key = 3, .Name = "Bathroom"})
    colorizer.Keys.Add(New ColorizerKeyItem() With {.Key = 4, .Name = "Living room"})
    colorizer.Keys.Add(New ColorizerKeyItem() With {.Key = 5, .Name = "Other"})
    colorizer.Keys.Add(New ColorizerKeyItem() With {.Key = 6, .Name = "Service room"})
    colorizer.Keys.Add(New ColorizerKeyItem() With {.Key = 7, .Name = "Pool"})
    colorizer.Keys.Add(New ColorizerKeyItem() With {.Key = 8, .Name = "Gym"})

    Return colorizer
End Function

Inheritance

Object ColorizerKeyItem

See Also

ColorizerKeyItem Members

DevExpress.XtraMap Namespace