Back to Devexpress

MapLine Class

windowsforms-devexpress-dot-xtramap-2026eb04.md

latest4.5 KB
Original Source

MapLine Class

Contains map line settings.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public class MapLine :
    MapShape,
    ISupportCoordPoints,
    ISupportIntermediatePoints,
    IEditableItem,
    IMapLineCore,
    IRenderItemContainer,
    IRenderItem,
    ISupportRenderLineCap,
    ISupportMarkerElements,
    IHitTestableOwner,
    IHitTestableElement
vb
Public Class MapLine
    Inherits MapShape
    Implements ISupportCoordPoints,
               ISupportIntermediatePoints,
               IEditableItem,
               IMapLineCore,
               IRenderItemContainer,
               IRenderItem,
               ISupportRenderLineCap,
               ISupportMarkerElements,
               IHitTestableOwner,
               IHitTestableElement

The following members return MapLine objects:

Remarks

Create a Map Line

The following example creates a map line:

View Example

csharp
ItemStorage.Items.Add(new MapLine { Point1 = new GeoPoint(-30, 20), Point2 = new GeoPoint(-35, 25), Stroke = Color.Red, StrokeWidth = 4 });
vb
ItemStorage.Items.Add(New MapLine With {.Point1 = New GeoPoint(-30, 20), .Point2 = New GeoPoint(-35, 25), .Stroke = Color.Red, .StrokeWidth = 4})

Add Map Line Caps

You can display shapes at the beginning and at the end of map lines. Use the StartLineCap and EndLineCap properties for this purpose.

The following example specifies the end cap template and shows the default arrow for the MapLine start cap:

csharp
MapLine line = new MapLine() { Point1 = new GeoPoint(0, 0), 
                               Point2 = new GeoPoint(-10, -30), 
                               StrokeWidth = 2, 
                               Stroke = System.Drawing.Color.Blue };
line.StartLineCap.Visible = true;
line.StartLineCap.Length = 20;
line.StartLineCap.Width = 10;

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

mapItemStorage1.Items.Add(line);
vb
Dim line As MapLine = New MapLine() With {
     .Point1 = New GeoPoint(0, 0),
     .Point2 = New GeoPoint(-10, -30),
     .StrokeWidth = 2,
     .Stroke = Drawing.Color.Blue
}
line.StartLineCap.Visible = True
line.StartLineCap.Length = 20
line.StartLineCap.Width = 10

line.EndLineCap.Visible = True
line.EndLineCap.Template = New MapUnit() {New MapUnit(-0.5, 0),
                                         New MapUnit(0, 0.5), 
                                         New MapUnit(0.5, 0), 
                                         New MapUnit(0, -0.5)}
line.EndLineCap.Length = 10
line.EndLineCap.Width = 10
mapItemStorage1.Items.Add(line)

Implements

IColorizerElement

IEditableItem

Inheritance

Object MapItem MapShape MapLine

See Also

MapLine Members

Set Map Shape Coordinates to Cross the 180th Meridian

Circular Scrolling

Vector Items

DevExpress.XtraMap Namespace