IMap.AddLayers Method

来源:互联网 发布:软件测试多长时间学会 编辑:程序博客网 时间:2024/05/22 17:26
[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.

 

autoArrange参数控制着图层的顺序.如果参数是TRUE,则图层按照 ILayerPosition::LayerWeight指定的weight把图层添加倒适当的位置.

默认情况下,图层是按照图层类型来排序的.标注层在嘴上,下面是点层,线层,最下面是面层

 

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

原创粉丝点击