Gets or sets the layers of the current MapView.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As MapView
Dim value As LayerCollection
instance.Layers = value
value = instance.Layers |
Example
The following example gets a reference to the map's layer colleciton, then iterates through the collection, and prints out whether the layer is a feature (vector) layer or image layer. The code assumes an existing MapView object.
C# | Copy Code |
---|
StringBuilder sb = new StringBuilder();
LayerCollection mapLayers = mapView.Layers;
for (int i = 0; i < mapLayers.Count; i++)
{
if (mapLayers[i] is FeatureLayer)
{
FeatureLayer fLyr = (FeatureLayer) mapLayers[i];
sb.Append(fLyr.Name + " is a feature layer, type " + fLyr.Type.ToString() + "<br>");
}
else if (mapLayers[i] is ImageLayer)
{
ImageLayer iLyr = (ImageLayer) mapLayers[i];
sb.Append(iLyr.Name + " is an image layer.<br>");
}
}
Label1.Text = sb.ToString(); |
Visual Basic | Copy Code |
---|
Dim sb As New StringBuilder()
Dim mapLayers As LayerCollection = mapView.Layers
Dim i As Integer
For i = 0 To mapLayers.Count-1
If mapLayers(i) Is FeatureLayer
FeatureLayer fLyr = CType(mapLayers(i), FeatureLayer)
sb.Append(fLyr.Name + " is a feature layer, type " + fLyr.Type.ToString() + "<br>")
Else If mapLayers(i) Is ImageLayer
ImageLayer iLyr = CType(mapLayers(i), ImageLayer)
sb.Append(iLyr.Name + " is an image layer.<br>")
End If
Next
Label1.Text = sb.ToString() |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also