Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

MapImage.MappingPoints Property

Gets or sets a collection of image points whose coordinates are in the [0.0,1.0] range.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.2.dll

NuGet Package: DevExpress.Win.Map

#Declaration

public MapPointCollection MappingPoints { get; set; }

#Property Value

Type Description
DevExpress.XtraMap.MapPointCollection

A collection of MapPoint objects.

#Remarks

Mapping points are image coordinates that should be matched with map polygon vertices (points in the geographic coordinate system). The top-left corner of the image represents the origin of image coordinates.

image

Note that the number of map polygon vertices should be equal to the number of mapping points (see the map polygon’s Points property).

#Example

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

image

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