
1 设置图层可选状态
/**//// <summary>
/// 改变层的可选择状态
/// </summary>
/// <param></param>
/// <returns></returns>
public bool LayerSelectableStatusUpdate(string tableAlias,bool selectableStatus)
{
if(mapControl1.Map.Layers[tableAlias]==null)
return false;
MapInfo.Mapping.LayerHelper.SetSelectable(mapControl1.Map.Layers[tableAlias],selectableStatu
s);
return true;
}
2 设置层的可用状态
/**//// <summary>
/// 改变层的可用状态为status
/// </summary>
/// <param></param>
/// <param></param>
public void LayerEnableStatusUpdate(string layerName,bool status)
{
if(mapControl1.Map.Layers[layerName]!=null && mapControl1.Map.Layers[layerName].Enabled!
=status)
{
mapControl1.Map.Layers[layerName].Enabled=status;
}
}
3 层居中,看全图
/**//// <summary>
/// 使指定层全部呈现在地图的可见范围中
/// </summary>
/// <param>层别名</param>
public void LayerCenter(string layerName)
{
MapInfo.Data.Table[] tables=new MapInfo.Data.Table[1];
tables[0] = MapInfo.Engine.Session.Current.Catalog.GetTable(layerName);
if(tables[0]==null)
return;
if(mapControl1.Map.Layers[layerName]==null)
return;
if(mapControl1.Map.Layers[layerName].Enabled == false)
mapControl1.Map.Layers[layerName].Enabled = true;
MapInfo.Mapping.IMapLayerFilter iMapLayerFilter =
MapInfo.Mapping.MapLayerFilterFactory.FilterByTable(tables);
MapInfo.Mapping.MapLayerEnumerator mapLayerEnumerator =
mapControl1.Map.Layers.GetMapLayerEnumerator(iMapLayerFilter);
mapControl1.Map.SetView(mapLayerEnumerator);
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-28065-1.html
台湾人现在不信蒋介石