You can add shapes on the map using zipped KML files (KMZ). The following code uses a KMZ file to add shapes on the map:
C# |
Copy Code
|
---|---|
var vl = MapReader.LoadKmlFile("WorldMap.kmz", (vector, data) => { var name = data["name"] as string; vector.Tag = name; // customizing the vector data var fillColor = data[KmlReader.StyleFillColor] as string; if (fillColor != null) { vector.Style.BackColor = MapReader.GetKmlStyleColor(fillColor); } var placemark = vector as C1.Win.Map.VectorPlacemark; if (placemark != null) { placemark.Marker.Caption = name; placemark.Lod = new LOD(0, 0, 2, 20); } }); vl.LabelVisibility = LabelVisibility.AutoHide; // can set default style for vectors and labels, instead of set the style through each vector vl.Style.Stroke.Color = Color.Blue; vl.Style.Stroke.Width = 1; vl.LabelStyle.ForeColor = Color.Green; c1Map1.Layers.Add(vl); |
In the above code, we have referred a class named MapReader that we have created. This class reads the vector data from the KMZ file.
On adding shapes from a KMZ file, the map will look similar to the image given below: