标签:maps lsp add image rac rectangle get nec poi
地图网格设定
LayoutElements elements = m_mapLayoutControl.MapLayout.Elements; //构造GeoMap GeoMap geoMap = new GeoMap(); geoMap.MapName = "京津地区交通干线图"; // 新建一个 GeoMapGrid 对象。 GeoMapGrid geoMapGrid = new GeoMapGrid(); // 设置 GeoMapGrid 对象的相关属性,即设置地图的经纬网的风格。 // 设置为地图添加经纬网。 geoMapGrid.GridType = GeoMapGridType.Graticule; // 设置经纬网的格网线的线型风格。 geoMapGrid.GridLineStyle.LineSymbolID = 9; geoMapGrid.GridLineStyle.LineColor = Color.Black; // 设置经纬网的格网线的水平、竖直间距。 geoMapGrid.HorizontalGridDistance = 40; geoMapGrid.VerticalGridDistance = 40; // 设置经纬网的格网线的类型为实线。 geoMapGrid.GridLineType = GeoMapGridLineType.SolidLine; // 设置经纬网的边框风格。 GeoStyle style = new GeoStyle(); style.LineSymbolID = 6; style.LineColor = Color.Blue; style.LineWidth = 0.2; geoMapGrid.BorderLineStyle = style; // 设置经纬网文本标注的水平、竖直位置。 geoMapGrid.HorizontalTextPosition = HorizontalTextPositionType.Middle; geoMapGrid.VerticalTextPosition = VerticalTextPositionType.Middle; // 设置经纬网文本标注的文本风格。 geoMapGrid.GridLineTextStyle.ForeColor = Color.Black; geoMapGrid.GridLineTextStyle.FontHeight = 60; // 为地图对象添加经纬网。 geoMap.IsGridVisible = true; geoMap.MapGrid = geoMapGrid; //设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapID = elements.GetID(); //构造指北针 GeoNorthArrow northArrow = new GeoNorthArrow( NorthArrowStyleType.EightDirection, new Rectangle2D(new Point2D(1400, 2250), new Size2D(350, 350)), 0); northArrow.BindingGeoMapID = m_mapID; elements.AddNew(northArrow); //构造比例尺 GeoMapScale scale = new GeoMapScale(m_mapID, new Point2D(125, 400), 50, 50); scale.LeftDivisionCount = 2; scale.ScaleUnit = Unit.Kilometer; scale.SegmentCount = 4; elements.AddNew(scale);
布局网格设定
/* //背景色 GeoStyle s=new GeoStyle(); s.FillForeColor = background.BackColor; m_mapLayoutControl.MapLayout.BackgroundStyle = s; //刻度尺 RulerSetting ssss = m_mapLayoutControl.MapLayout.RulerSetting; ssss.IsRulerVisible = false; //压盖 m_mapLayoutControl.MapLayout.IsOverlapDisplayed = true; //布局文字反走样式 m_mapLayoutControl.MapLayout.IsTextAntialias = true; //最小缩放比例 m_mapLayoutControl.MapLayout.MinZoomRatio = 0.01; //最大缩放比例 m_mapLayoutControl.MapLayout.MaxZoomRatio = 0.01; //是否显示水平滚动条 m_mapLayoutControl.IsHorizontalScrollbarVisible = true; //是否显示垂直滚动条 m_mapLayoutControl.IsVerticalScrollbarVisible = true; //是否支持对象修改后启用实时刷新 // m_mapLayoutControl.RefreshAtTracked = true; //获取设置格网是否可以捕捉 m_mapLayoutControl.IsGridSnapable = true; */ //构造一个格网设置对象,并设置其相应属性 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; //设置地图对象的格网设置 m_mapLayoutControl.MapLayout.Paper.Grid = gridSetting; // m_mapLayoutControl.MapLayout.Paper.IsVisible = false; // m_mapLayoutControl.MapLayout.Elements.AddNew(geoMap); m_mapLayoutControl.MapLayout.Refresh();
标签:maps lsp add image rac rectangle get nec poi
原文地址:http://www.cnblogs.com/tianyiwuying/p/6255213.html