Back to Devexpress

MapPie.Segments Property

windowsforms-devexpress-dot-xtramap-dot-mappie.md

latest3.4 KB
Original Source

MapPie.Segments Property

Gets or sets segments of a map pie.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(null)]
public PieSegmentCollection Segments { get; set; }
vb
<DefaultValue(Nothing)>
Public Property Segments As PieSegmentCollection

Property Value

TypeDefaultDescription
PieSegmentCollectionnull

A PieSegmentCollection object that is a collection of map path segments.

|

Example

csharp
char letter = 'A';
double defaultValue = 10;
MapPie pie;

private void Form1_Load(object sender, EventArgs e) {
    MapItemStorage storage = new MapItemStorage();
    pie = new MapPie() {
        Location = new GeoPoint(51.507222, -0.1275),
        Size = 100,
        Argument = "pie",
    };
    pie.Segments.Add(new PieSegment() { Argument = NextLetter(), Value = defaultValue });
    pie.Segments.Add(new PieSegment() { Argument = NextLetter(), Value = defaultValue });
    pie.Segments.Add(new PieSegment() { Argument = NextLetter(), Value = defaultValue });

    storage.Items.Add(pie);

    mapControl1.Layers.Add(new VectorItemsLayer() {
        Data = storage,
        Colorizer = new KeyColorColorizer() {
            ItemKeyProvider = new ArgumentItemKeyProvider(),
            PredefinedColorSchema = PredefinedColorSchema.Palette
        }
    });

    lbRotationDirection.DataSource = Enum.GetValues(typeof(RotationDirection));
    lbSegments.DataSource = pie.Segments;
}

string NextLetter() {
    return letter++.ToString();
}
vb
Private letter As Char = "A"c
Private defaultValue As Double = 10
Private pie As MapPie

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    Dim storage As New MapItemStorage()
    pie = New MapPie() With {.Location = New GeoPoint(51.507222, -0.1275), .Size = 100, .Argument = "pie"}
    pie.Segments.Add(New PieSegment() With {.Argument = NextLetter(), .Value = defaultValue})
    pie.Segments.Add(New PieSegment() With {.Argument = NextLetter(), .Value = defaultValue})
    pie.Segments.Add(New PieSegment() With {.Argument = NextLetter(), .Value = defaultValue})

    storage.Items.Add(pie)

    mapControl1.Layers.Add(New VectorItemsLayer() With { _
        .Data = storage, .Colorizer = New KeyColorColorizer() With {.ItemKeyProvider = New ArgumentItemKeyProvider(), .PredefinedColorSchema = PredefinedColorSchema.Palette} _
    })

    lbRotationDirection.DataSource = System.Enum.GetValues(GetType(RotationDirection))
    lbSegments.DataSource = pie.Segments
End Sub

Private Function NextLetter() As String
    Dim tempVar As Char = letter
    letter = ChrW(AscW(letter) + 1)
    Return tempVar.ToString()
End Function

See Also

MapPie Class

MapPie Members

DevExpress.XtraMap Namespace