爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3496|回复: 2

求助:关于二次开发时等值线图标注的问题

[复制链接]

新浪微博达人勋

发表于 2018-4-9 14:38:43 | 显示全部楼层 |阅读模式

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

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

x

想要绘制等值线图时添加标注。
下图是想要达到的效果,在MeteoInfo里面,手动绘制成功。
1.png

下图是二次开发时,绘制的图,标注老是不显示,不知道原因。
3.png

代码如下:
  1. bool hasUndefData = false;
  2.                 LegendScheme ShadedLS = LegendManage.CreateLegendSchemeFromGridData(
  3.                     temperData, LegendType.GraduatedColor, ShapeTypes.Polygon, ref hasUndefData);//配色方案
  4.                 VectorLayer ShadedLayer = DrawMeteoData.CreateShadedLayer(temperData, ShadedLS, DataName, DataName);//图层
  5.                 ShadedLayer.LabelSet.LabelFont = new Font("Arial", 20);//字体
  6.                 ShadedLayer.LabelSet.LabelColor = Color.Black;//标注颜色
  7.                 ShadedLayer.LabelSet.ShadowColor = Color.White;//背景色
  8.                 ShadedLayer.LabelSet.XOffset = 0;//X偏移
  9.                 ShadedLayer.LabelSet.YOffset = 0;//Y偏移
  10.                 ShadedLayer.LabelSet.AvoidCollision = true;//避免压盖
  11.                 ShadedLayer.LabelSet.AutoDecimal = true;//自动小数
  12.                 ShadedLayer.LabelSet.DrawShadow = true;//阴影
  13.                 ShadedLayer.LabelSet.ColorByLegend = false;//字体颜色随图例
  14.                 ShadedLayer.LabelSet.DrawLabels = true;//绘图
复制代码
换成等值线的话,标注成功。
2.png
代码如下:
  1. LegendScheme ContourLS = LegendManage.CreateLegendSchemeFromGridData(
  2.                     temperData, LegendType.GraduatedColor, ShapeTypes.Polyline, ref hasUndefData);//根据数据,创建配色方案
  3.                 VectorLayer ContourLayer = DrawMeteoData.CreateContourLayer(temperData, ContourLS, DataName, DataName);//图层
  4.                 ContourLayer.LabelSet.LabelFont = new Font("Arial", 20);//字体
  5.                 ContourLayer.LabelSet.LabelColor = Color.Black;//标注颜色
  6.                 ContourLayer.LabelSet.ShadowColor = Color.White;//背景色
  7.                 ContourLayer.LabelSet.XOffset = 0;//X偏移
  8.                 ContourLayer.LabelSet.YOffset = 0;//Y偏移
  9.                 ContourLayer.LabelSet.AvoidCollision = true;//避免压盖
  10.                 ContourLayer.LabelSet.AutoDecimal = true;//自动小数
  11.                 ContourLayer.LabelSet.DrawShadow = true;//阴影
  12.                 ContourLayer.LabelSet.ColorByLegend = false;//字体颜色随图例
  13.                 ContourLayer.LabelSet.DrawLabels = true;//绘图
  14.                 ContourLayer.AddLabels();
复制代码
于是在绘制等值线的地方依样画葫芦,加了一句ContourLayer.AddLabels();结果报错:列“RH”不属于表
4.png

把这句ShadedLayer.LabelSet.FieldName = "RH";注释掉,报错为:列“”不属于表。

有谁知道要怎么设置吗?





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

新浪微博达人勋

 楼主| 发表于 2018-4-10 18:46:25 | 显示全部楼层
没人了啊。。。。
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2020-5-16 23:22:04 | 显示全部楼层
设置项比较多
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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