- 积分
- 769
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-7-6
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
想要绘制等值线图时添加标注。
下图是想要达到的效果,在MeteoInfo里面,手动绘制成功。
下图是二次开发时,绘制的图,标注老是不显示,不知道原因。
代码如下:
- bool hasUndefData = false;
- LegendScheme ShadedLS = LegendManage.CreateLegendSchemeFromGridData(
- temperData, LegendType.GraduatedColor, ShapeTypes.Polygon, ref hasUndefData);//配色方案
- VectorLayer ShadedLayer = DrawMeteoData.CreateShadedLayer(temperData, ShadedLS, DataName, DataName);//图层
- ShadedLayer.LabelSet.LabelFont = new Font("Arial", 20);//字体
- ShadedLayer.LabelSet.LabelColor = Color.Black;//标注颜色
- ShadedLayer.LabelSet.ShadowColor = Color.White;//背景色
- ShadedLayer.LabelSet.XOffset = 0;//X偏移
- ShadedLayer.LabelSet.YOffset = 0;//Y偏移
- ShadedLayer.LabelSet.AvoidCollision = true;//避免压盖
- ShadedLayer.LabelSet.AutoDecimal = true;//自动小数
- ShadedLayer.LabelSet.DrawShadow = true;//阴影
- ShadedLayer.LabelSet.ColorByLegend = false;//字体颜色随图例
- ShadedLayer.LabelSet.DrawLabels = true;//绘图
复制代码 换成等值线的话,标注成功。
代码如下:
- LegendScheme ContourLS = LegendManage.CreateLegendSchemeFromGridData(
- temperData, LegendType.GraduatedColor, ShapeTypes.Polyline, ref hasUndefData);//根据数据,创建配色方案
- VectorLayer ContourLayer = DrawMeteoData.CreateContourLayer(temperData, ContourLS, DataName, DataName);//图层
- ContourLayer.LabelSet.LabelFont = new Font("Arial", 20);//字体
- ContourLayer.LabelSet.LabelColor = Color.Black;//标注颜色
- ContourLayer.LabelSet.ShadowColor = Color.White;//背景色
- ContourLayer.LabelSet.XOffset = 0;//X偏移
- ContourLayer.LabelSet.YOffset = 0;//Y偏移
- ContourLayer.LabelSet.AvoidCollision = true;//避免压盖
- ContourLayer.LabelSet.AutoDecimal = true;//自动小数
- ContourLayer.LabelSet.DrawShadow = true;//阴影
- ContourLayer.LabelSet.ColorByLegend = false;//字体颜色随图例
- ContourLayer.LabelSet.DrawLabels = true;//绘图
- ContourLayer.AddLabels();
复制代码 于是在绘制等值线的地方依样画葫芦,加了一句ContourLayer.AddLabels();结果报错:列“RH”不属于表
把这句ShadedLayer.LabelSet.FieldName = "RH";注释掉,报错为:列“”不属于表。
有谁知道要怎么设置吗?
|
|