Back to Devexpress

MapPolyline Class

windowsforms-devexpress-dot-xtramap-7e1ef51e.md

latest4.7 KB
Original Source

MapPolyline Class

Contains map polyline settings.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public class MapPolyline :
    MapPolylineBase
vb
Public Class MapPolyline
    Inherits MapPolylineBase

The following members return MapPolyline objects:

Remarks

Create a Map Polyline

The following example creates a map polyline:

csharp
var polyline = new MapPolyline() { StrokeWidth = 4, Stroke = Color.Yellow };
polyline.Points.AddRange(new GeoPoint[] {
    new GeoPoint(-29,130),
    new GeoPoint(-40,140),
    new GeoPoint(-20,150)
});
ItemStorage.Items.Add(polyline);
vb
Dim polyline = New MapPolyline() With {.StrokeWidth = 4, .Stroke = Color.Yellow}
polyline.Points.AddRange(New GeoPoint() {New GeoPoint(-29, 130), New GeoPoint(-40, 140), New GeoPoint(-20, 150)})
ItemStorage.Items.Add(polyline)

View Example

Add Polyline Caps

You can display shapes at the beginning and at the end of map polylines. Use StartLineCap and EndLineCap properties for this purpose. The following example specifies the end cap template and shows the default arrow for the polyline start cap:

csharp
MapPolyline polyline = new MapPolyline() { StrokeWidth = 2,
                                           Stroke = System.Drawing.Color.Blue };
polyline.Points.AddRange(new GeoPoint[] { new GeoPoint(-6, -4),
                                          new GeoPoint(-3, -10),
                                          new GeoPoint(-6, -20) });

polyline.StartLineCap.Visible = true;
polyline.StartLineCap.Length = 20;
polyline.StartLineCap.Width = 10;

polyline.EndLineCap.Visible = true;
polyline.EndLineCap.Template = new MapUnit[] { new MapUnit(-0.5, 0),
                                               new MapUnit(0, 0.5),
                                               new MapUnit(0.5, 0),
                                               new MapUnit(0, -0.5)};
polyline.EndLineCap.Length = 10;
polyline.EndLineCap.Width = 10;

ItemStorage.Items.Add(polyline);
vb
Dim polyline As MapPolyline = New MapPolyline() With {.StrokeWidth = 2,
                                                      .Stroke = Drawing.Color.Blue}
polyline.Points.AddRange(New GeoPoint() { New GeoPoint(-6, -4), 
                                          New GeoPoint(-3, -10),
                                          New GeoPoint(-6, -20)})

polyline.StartLineCap.Visible = True
polyline.StartLineCap.Length = 20
polyline.StartLineCap.Width = 10

polyline.EndLineCap.Visible = True
polyline.EndLineCap.Template = New MapUnit() { New MapUnit(-0.5, 0),
                                               New MapUnit(0, 0.5),
                                               New MapUnit(0.5, 0),
                                               New MapUnit(0, -0.5)}
polyline.EndLineCap.Length = 10
polyline.EndLineCap.Width = 10

ItemStorage.Items.Add(polyline)

Implements

IColorizerElement

IEditableItem

Inheritance

Object MapItem MapShape MapPolylineBase MapPolyline

See Also

MapPolyline Members

Set Map Shape Coordinates to Cross the 180th Meridian

Circular Scrolling

Vector Items

DevExpress.XtraMap Namespace