[C#] public
void
AddLayers (
IEnumLayer
Layers,
bool
autoArrange );
The
AddLayers method adds all of the layers in the IEnumLayer enumeration to the Map. Use the
LayerCount property to get the total number of layers in the map. The
autoArrange parameter controls the ordering of the layers. If autoArrange is set to TRUE, the layers are added in the proper position as by their weight specified via
ILayerPosition::LayerWeight. By default, this means that the layers are sorted by layer type - Annotation layers on top, followed by Point geometry layers, Polyline geometry layers, and at the bottom Polygon geometry layers. If autoArrange is true for this method, the position passed in is ignored as the position is determined by the auto arrange logic.
AddLayers automatically attempts to set the Map's
SpatialReference property if a coordinate system has not yet been defined for the map. When the SpatialReference property is set, the Map's
MapUnits and
DistanceUnits properties are additionally set. AddLayers also sets the spatial reference for each layer (
ILayer::SpatialReference).
If no layers have a spatial reference, AddLayer checks the extent of the first layer (ILayer::AreaOfInterest) and if it has coordinates that look like geographic coordinates (XMin >= -180 and XMax <= 180 and YMin >= -90 and YMax <= 90), ArcMap assumes the data is in decimal degrees and sets the MapUnits to
esriDecimalDegrees and DistanceUnits to
esriMiles.
The full extent is recalculated each time a layer added.
Provides access to members that control a layer's default position in the map interface
The LayerWeight property defines the weight of the layer in the auto arrange order. During auto arrange, the higher weight layers are added to the map first, which means they draw lower in the draw order.
higher weight layers先被添加到地图中,这意味着它们后画.
Default weights for layers are these values: Annotation layers = 97 Points layers = 98 Polyline layers = 99 Polygon Layers = 100