Skip to main content
A newer version of this page is available. .

MapPolygon.Image Property

Returns options of the image that specifies the map polygon background.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v19.2.dll

Declaration

public MapImage Image { get; }

Property Value

Type Default Description
MapImage *null*

The map image options.

Example

The example below assigns a raster image to a map polygon.

VectorItemsLayer VectorLayer { get { return mapControl.Layers[1] as VectorItemsLayer; } }
MapItemStorage ItemStorage { get { return VectorItemsLayer.Data as MapItemStorage; } }
//...
private void OnFormLoad(object sender, EventArgs e) {
    MapPolygon centralPark = new MapPolygon();

    centralPark.Points.Add(new GeoPoint(40.767809, -73.981249));
    centralPark.Points.Add(new GeoPoint(40.768458, -73.981477));
    centralPark.Points.Add(new GeoPoint(40.800273, -73.958291));
    centralPark.Points.Add(new GeoPoint(40.800396, -73.957846));
    centralPark.Points.Add(new GeoPoint(40.797011, -73.949683));
    centralPark.Points.Add(new GeoPoint(40.796626, -73.949541));
    centralPark.Points.Add(new GeoPoint(40.764918, -73.972547));
    centralPark.Points.Add(new GeoPoint(40.76523,  -73.973245));
    centralPark.Points.Add(new GeoPoint(40.764704, -73.973741));

    centralPark.Image.MappingPoints.Add(new MapPoint(0.056376, 0.998469));
    centralPark.Image.MappingPoints.Add(new MapPoint(0, 0.987196));
    centralPark.Image.MappingPoints.Add(new MapPoint(0, 0.007516));
    centralPark.Image.MappingPoints.Add(new MapPoint(0.033557, 0));
    centralPark.Image.MappingPoints.Add(new MapPoint(0.940268, 0));
    centralPark.Image.MappingPoints.Add(new MapPoint(0.991275, 0.0090466));
    centralPark.Image.MappingPoints.Add(new MapPoint(1, 0.981489));
    centralPark.Image.MappingPoints.Add(new MapPoint(0.910738, 0.981489));
    centralPark.Image.MappingPoints.Add(new MapPoint(0.908054, 1));

    centralPark.Image.Source = new Bitmap("..\\..\\Data\\CentralPark1.png");
    ItemStorage.Items.Add(centralPark);
}

The above code uses the following API members:

Member Description
MapPolygon The class used to draw a polygon on a map.
MapPolygon.Points Gets or sets a collection of points defining the map polygon.
MapPolygon.Image Returns options of the image that specifies the map polygon background.
MapImage.Source Gets or sets a collection of image points whose coordinates are in the [0.0,1.0] range.
MapImage.MappingPoints Gets or sets a collection of image points whose coordinates are in the [0.0,1.0] range.
See Also