爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3879|回复: 2

加载的地图图层不能标注全部点的名问题

[复制链接]

新浪微博达人勋

发表于 2012-9-19 17:13:23 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
wenti.jpg 王老师出现问题的图如上: 标注后 渠县下面的那个点 本是大竹 但是没标注出来
                 华蓥 下面的邻水也没显示出来
  必须要把地图放大 这两个点的标注才能显示出来

加载图层代码如下为一个加载函数:
private void LoadLayers()
        {
            layersLegend1.ActiveMapFrame.MapView.LockViewUpdate = true;

            //Load country layer
            string aFile = Application.StartupPath + "\\shape\\sichuanmask.shp";
            MapLayer aLayer = MapDataManage.OpenLayer(aFile);
            aLayer.LegendScheme.breakList[0].Color = Color.WhiteSmoke;
            layersLegend1.ActiveMapFrame.AddLayer(aLayer);
            //Load river layer
            aFile = Application.StartupPath + "\\shape\\shengjie.shp";
            aLayer = MapDataManage.OpenLayer(aFile);
            aLayer.LegendScheme.breakList[0].Color = Color.Black;
            ((PolyLineBreak)aLayer.LegendScheme.breakList[0]).Size = 1;
            layersLegend1.ActiveMapFrame.AddLayer(aLayer);
            aFile = Application.StartupPath + "\\shape\\shijie.shp";
            aLayer = MapDataManage.OpenLayer(aFile);
            // ((PointBreak)aLayer.LegendScheme.breakList[0]).Color = Color.Red;
            aLayer.Expanded = true;
            layersLegend1.ActiveMapFrame.AddLayer(aLayer);

            //Load city layer
            aFile = Application.StartupPath + "\\shape\\sichuanjibenzhan.shp";
            aLayer = MapDataManage.OpenLayer(aFile);
            ((PointBreak)aLayer.LegendScheme.breakList[0]).Color = Color.Black;
            aLayer.Expanded = true;
            layersLegend1.ActiveMapFrame.AddLayer(aLayer);


            //Label city name
            VectorLayer cityLayer = (VectorLayer)aLayer;
          //  cityLayer.AvoidCollision =false;
            cityLayer.LabelSet.FieldName = "NAME";
            cityLayer.LabelSet.AvoidCollision = true;
           
            cityLayer.LabelSet.LabelAlignType = MeteoInfoC.Legend.AlignType.Center;
           // cityLayer.LabelSet.Offset = 0;
            cityLayer.LabelSet.XOffset = 0;
            cityLayer.LabelSet.LabelFont = new Font("Arial", 8);
            cityLayer.LabelSet.LabelColor = Color.Black;
            cityLayer.LabelSet.DrawShadow = false;
            cityLayer.LabelSet.ShadowColor = Color.White;
            cityLayer.LabelSet.ColorByLegend = false;
            cityLayer.AddLabels();

           // //Set layout map size
         //   mapLayout1.ActiveLayoutMap.Left = 40;
          //  mapLayout1.ActiveLayoutMap.Top = 40;
           // mapLayout1.ActiveLayoutMap.Width = 600;
          //  mapLayout1.ActiveLayoutMap.Height = 400;
            //Refresh
            MeteoInfoC.Global.Extent aExtent = mapView1.Extent;


            layersLegend1.ActiveMapFrame.MapView.LockViewUpdate = false;
            mapView1.ZoomToExtent(aExtent);
           // layersLegend1.ActiveMapFrame.MapView.ZoomToExtent(70, 140, 10, 60);
            layersLegend1.Refresh();
        }
红色部分为标注代码,请老师解答下 谢谢
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-9-19 17:17:32 | 显示全部楼层
错误已经解决:将 cityLayer.LabelSet.AvoidCollision = true;设置为cityLayer.LabelSet.AvoidCollision = false;
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-9-19 17:17:56 | 显示全部楼层
错误已经解决:将 cityLayer.LabelSet.AvoidCollision = true;设置为cityLayer.LabelSet.AvoidCollision = false;
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表