windowsforms-devexpress-dot-xtramap-dot-mapimage-3e598b97.md
Gets or sets a collection of image points whose coordinates are in the [0.0,1.0] range.
Namespace : DevExpress.XtraMap
Assembly : DevExpress.XtraMap.v25.2.dll
NuGet Package : DevExpress.Win.Map
public MapPointCollection MappingPoints { get; set; }
Public Property MappingPoints As MapPointCollection
| Type | Description |
|---|---|
| DevExpress.XtraMap.MapPointCollection |
A collection of MapPoint objects.
|
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.
Note that the number of map polygon vertices should be equal to the number of mapping points (see the map polygon’s Points property).
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);
}
Private ReadOnly Property VectorLayer As VectorItemsLayer
Get
Return TryCast(mapControl.Layers(1), VectorItemsLayer)
End Get
End Property
Private ReadOnly Property ItemStorage As MapItemStorage
Get
Return TryCast(VectorItemsLayer.Data, MapItemStorage)
End Get
End Property
Private Sub OnFormLoad(ByVal sender As Object, ByVal e As EventArgs)
Dim centralPark As MapPolygon = 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)
End Sub
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