爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 2649|回复: 4

投影的一个bug,请王老师看看,能不能改呢?

[复制链接]

新浪微博达人勋

发表于 2015-6-20 12:35:06 | 显示全部楼层 |阅读模式

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

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

x
  1.             string ProjStr = "+proj=lcc"+
  2.                             "+lat_1=30" +
  3.                             "+lat_2=60" +
  4.                             "+lat_0=30" +
  5.                             "+lon_0=110"+
  6.                             "+x_0=0"+
  7.                             "+y_0=0";
  8.             ProjectionInfo aProjInfo = new ProjectionInfo(ProjStr);
  9.             layersLegend1.ActiveMapFrame.MapView.Projection.ProjectLayers(layersLegend1.ActiveMapFrame.MapView, aProjInfo);
  10.             layersLegend1.ActiveMapFrame.MapView.ZoomToExtent(98, 108, 26, 35);
  11.             layersLegend1.MapLayout.PaintGraphics();
复制代码
执行投影之后,执行 layersLegend1.ActiveMapFrame.MapView.ZoomToExtent(98, 108, 26, 35) 之后,地图就完全看不到了,图层就成白的了,王老师,这个是bug不呢?还是说用法错了?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-6-20 16:27:54 | 显示全部楼层
投影后坐标就不是经纬度了(以米为单位),因此ZoomToExtent中的参数是不合适的,如果想用经纬度可以用ZoomToExtentLonLatEx方法。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-6-20 16:59:00 来自手机 | 显示全部楼层
奥,原来是这样~~~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-6-20 20:50:05 | 显示全部楼层
本帖最后由 ♂雨已~○ 于 2015-6-20 21:02 编辑
MeteoInfo 发表于 2015-6-20 16:27
投影后坐标就不是经纬度了(以米为单位),因此ZoomToExtent中的参数是不合适的,如果想用经纬度可以用Zoom ...

王老师,还有一个问题,就是如果在lambt投影下,不能用填值显示降水量呢?只要不用这种投影,就能正常填值显示降水量~~~下面是我降水量填值显示的代码:实现效果图
捕获.PNG
但只要用了投影就完全不能显示了!
  1.            string formName;
  2.             string title;
  3.             formName = Path.GetFileNameWithoutExtension(file);
  4.             MeteoDataInfo aDataInfo = new MeteoDataInfo();
  5.             string aFile = file;
  6.             aDataInfo.OpenMICAPSData(aFile);
  7.             StationData rainData = aDataInfo.GetStationData("Precipitation6h");
  8.             LegendScheme aLS = new LegendScheme(ShapeTypes.Point);
  9.             aLS.ImportFromXMLFile(Application.StartupPath+"\\Legend\\rain.lgs");
  10.             VectorLayer aLayer = DrawMeteoData.CreateSTPointLayer(rainData, aLS, "Precipitation6h", "Precipitation6h");
  11.             title = formName.Substring(0, 2) + "年" + formName.Substring(2, 2) + "月" + formName.Substring(4, 2) + "日" + formName.Substring(6, 2) + "时" + "自动观测6小时降水量数值填图";
  12.             aLayer.LayerName = "Precipitation6h_fillValue";
  13.             label3.Text = label3.Text + "\n" + title;
  14.             VectorLayer cityLayer = (VectorLayer)aLayer;
  15.             ((PointBreak)aLayer.LegendScheme.LegendBreaks[0]).EndValue = 100;
  16.             cityLayer.LabelSet.FieldName = "Precipitation6h";
  17.             cityLayer.LabelSet.AvoidCollision = true;
  18.             cityLayer.LabelSet.LabelAlignType = MeteoInfoC.Legend.AlignType.Center;
  19.             cityLayer.LabelSet.YOffset = 0;
  20.             cityLayer.LabelSet.LabelFont = new Font("Arial", 8);
  21.             cityLayer.LabelSet.LabelColor = Color.Black;
  22.             cityLayer.LabelSet.DrawShadow = false;
  23.             cityLayer.LabelSet.ShadowColor = Color.White;
  24.             cityLayer.LabelSet.ColorByLegend = false;
  25.             cityLayer.LabelSet.AutoDecimal = false;
  26.             cityLayer.LabelSet.DecimalDigits = 1;
  27.             cityLayer.AddLabels();
  28.             for (int i = 0; i < aLS.BreakNum; i++)
  29.             {
  30.                 ((PointBreak)aLayer.LegendScheme.LegendBreaks[i]).DrawFill = false;
  31.                 ((PointBreak)aLayer.LegendScheme.LegendBreaks[i]).DrawShape = false;
  32.             }
  33.             aLayer.IsMaskout = true;
  34.             int aLayerHandle = layersLegend1.ActiveMapFrame.AddLayer(aLayer, 0);
  35.             //根据标注值改变填色
  36.             for (int i = 0; i < aLayer.LabelPoints.Count; i++)
  37.             {
  38.                 if (double.Parse(((LabelBreak)aLayer.LabelPoints[i].Legend).Text) > 20.0)
  39.                 {
  40.                     ((LabelBreak)aLayer.LabelPoints[i].Legend).Color = Color.Red;
  41.                 }
  42.             }  
  43.             layersLegend1.Refresh();
  44.             layersLegend1.MapLayout.PaintGraphics();
复制代码







密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-6-20 21:37:24 | 显示全部楼层
♂雨已~○ 发表于 2015-6-20 20:50
王老师,还有一个问题,就是如果在lambt投影下,不能用填值显示降水量呢?只要不用这种投影,就能正常填 ...

投影以后再标注
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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