格网设置类。
命名空间:
SuperMap.Mapping程序集: SuperMap.Mapping (in SuperMap.Mapping)
版本: dll
语法
C# |
---|
public class GridSetting |
示例
以下代码示范了如何设置工作空间中地图的格网属性,并将设置后的地图保存至新建的地图中。
假设打开了一个工作空间workspace对象,工作空间中存在一幅地图。
CopyC#
public void GridSettingExamples(Workspace workspace) { //打开地图 Map map = new Map(workspace); String mapName = workspace.Maps[0]; if (map.Open(mapName)) { Console.WriteLine("打开地图成功!"); } //构造一个格网设置对象,并设置其相应属性 GridSetting gridSetting = new GridSetting(); gridSetting.IsSizeFixed = true; gridSetting.IsSnapable = true; gridSetting.IsVisible = true; gridSetting.VerticalSpacing = 50; gridSetting.Type = GridType.Cross; gridSetting.HorizontalSpacing = 50; GeoStyle style1 = new GeoStyle(); style1.LineColor = Color.Gray; gridSetting.DashStyle = style1; GeoStyle style2 = new GeoStyle(); style2.LineColor = Color.Gold; gridSetting.SolidStyle = style2; //设置地图对象的格网设置 map.Grid = gridSetting; //新建地图并保存工作空间 workspace.Maps.Add(workspace.Maps.GetAvailableMapName("NewMap"),map.ToXML()); workspace.Save(); //释放资源 map.Dispose(); workspace.Dispose(); }
继承层次
System..::.Object
SuperMap.Mapping..::.GridSetting
SuperMap.Mapping..::.GridSetting