码迷,mamicode.com
首页 > 其他好文 > 详细

supermap布局设定地图网格及布局网格

时间:2017-01-06 10:41:35      阅读:1116      评论:0      收藏:0      [点我收藏+]

标签: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();
布局网格设定

 

supermap布局设定地图网格及布局网格

标签:maps   lsp   add   image   rac   rectangle   get   nec   poi   

原文地址:http://www.cnblogs.com/tianyiwuying/p/6255213.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!