ArcGisEngine图层操作(随笔,不全)

时间:2023-03-08 23:46:30
ArcGisEngine图层操作(随笔,不全)

1.加载图层:

1.1 object.AddLayer(Layer[,toindex=0])

Layer表示ILayer对象,必选,toIndex参数表示图层索引(长整型),没需求可以忽略。

1.2 object.AddLayerFromFIle(lyrPath[,toindex=0])

lyrPath为*.lyr的物理路径,后面参数属性同上

1.3 object.AddShapFile(Path,fileName)

Path为文件路径,fileName为shape文件名,都为必选参数。

2.图层的选择

// ILayer pLayer=this.axMapControl1.get_Layer(index);

index为图层索引值(在MapControl中,索引号小的图层在索引号较大的图层的上卖弄,最上面图层的索引号为0)

3.图层的选择

object.MoveLayerTo(fromIndex,toIndex)

// axMapControl1.MoveLayerT0(1,0);

fromIndex为要进行移动操作的图层索引

toIndex为移动操作后的图层索引

4. 图层属性可见性

object.Visible=value

value:bool类型

5.删除图层(非对原数据操作)

object.DeleteLayer(index) //删除指定图层

object.ClearLayers //所有图层

6. 图层可见时比例尺范围

主要确定MaximumScale和MinimumScale属性

直接代码示范:

axMapControl1.GetLayer(0).MaximumScale=1000;

axMapControl1.GetLayer(0).MinimumScale=10000;