- 积分
- 11718
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-6-23
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 xuzheyong 于 2017-4-27 14:35 编辑
问题1
问题1:中文名显示问题
LonLatStationDataInfo aDataInfo = new LonLatStationDataInfo();
string aFile = Application.StartupPath + @"\Sample\ZhejiangCity.csv";
aDataInfo.ReadDataInfo(aFile);
// 1、即绘制台站位置点信息。
LegendScheme aLS = LegendManage.CreateSingleSymbolLegendScheme(ShapeTypes.Point, Color.Black, 2);
VectorLayer aLayerV = new VectorLayer(ShapeTypes.Point); // Point类型
aLayerV = DrawMeteoData.CreateSTInfoLayer(aDataInfo.GetStationInfoData(0, 0), aLS, "台站位置信息");
layersLegend1.ActiveMapFrame.AddLayer(aLayerV);
//Set label,首先获得变量名,然后绘制标签数据数据。!!!!
List<string> fieldNameList = aLayerV.GetFieldNameList();
aLayerV.LabelSet.FieldName = fieldNameList[3]; //台站名称存储位置
aLayerV.LabelSet.AvoidCollision = true;
aLayerV.LabelSet.LabelAlignType = MeteoInfoC.Legend.AlignType.Right;
aLayerV.LabelSet.XOffset = -2;
FontFamily ff = new FontFamily("Arial");
aLayerV.LabelSet.LabelFont = new System.Drawing.Font(ff, 9);
aLayerV.LabelSet.LabelColor = Color.Black;
aLayerV.LabelSet.DrawShadow = false;
aLayerV.LabelSet.ShadowColor = Color.Black;
aLayerV.LabelSet.ColorByLegend = false;
//Add labels
aLayerV.AddLabels();
this.mapView1.PaintLayers();
问题2
问题2:色标图最高一格无显示
参考的是这段代码
// ls = LegendScheme(ShapeTypes.Polygon)
// ls.setLegendType(LegendType.GraduatedColor)
// values = [450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950,1000, 1050]
// colors = [Color(160,0,200),Color(110,0,220),Color(30,60,255),Color(0,160,255),Color(0,200,200),Color(0,220,0),
// Color(160,230,50),Color(230,220,50),Color(230,175,45),Color(240,130,40),Color(250,60,60),Color(240,0,130)]
// lbs = ls.getLegendBreaks()
// for i in range(0, len(colors)):
// lb = PolygonBreak()
// lb.setColor(colors)
// lb.setStartValue(values)
// lb.setEndValue(values[i + 1])
// lb.setCaption(str(values) + ' ' + str(values[i + 1]))
// lb.setDrawOutline(False)
// lbs.add(lb)
// layer = DrawMeteoData.createShadedLayer(gdata, ls, 'Pressure_Shaded', 'PS', True)
LegendScheme aLS1 = new LegendScheme(ShapeTypes.Polygon);
aLS1.LegendType = LegendType.GraduatedColor;
double[] values = new double[11] {0,0.1,1,5,10,25,50,100,150,200,10000 };
Color[] colors = new Color[10] { Color.FromArgb(255,255,255) ,Color.FromArgb(194,238,181),
Color.FromArgb(166,242,143), Color.FromArgb(61,186,61),
Color.FromArgb(97,184,255), Color.FromArgb(0,0,255) ,
Color.FromArgb(250,0,250), Color.FromArgb(128,0,64),
Color.FromArgb(214,79,116), Color.FromArgb(166,242,143) };
List<ColorBreak> lbs = aLS1.LegendBreaks;
PolygonBreak lb;
for (int i = 0; i < colors.Length; i++)
{
lb = new PolygonBreak();
lb.Color = colors;
lb.StartValue = values[i ];
lb.EndValue = values[i + 1];
lb.Caption = values + "-" + values[i + 1] ;
//lb.DrawOutline = false;
lbs.Add(lb);
}
// 反转色标图
aLS1.LegendBreaks.Reverse(0, aLS1.BreakNum);
((PolygonBreak)aLS1.LegendBreaks[0]).DrawFill = false;
//Create layer
VectorLayer aLayer = new VectorLayer(ShapeTypes.Polygon);
aLayer = DrawMeteoData.CreateShadedLayer(gridData, aLS1, "Rain", "Rain");
aLayer.IsMaskout = true;
//Add layer
layersLegend1.ActiveMapFrame.AddLayer(aLayer);
layersLegend1.ActiveMapFrame.MoveLayer(aLayer.Handle, 0);
//layersLegend1.Refresh();
this.mapView1.PaintLayers();
MaskOut ma = new MaskOut(mapView1);
ma.MaskLayer = "3.shp";
ma.SetMaskLayer = true;
mapView1.MaskOut = ma;
mapView1.PaintLayers();
|
|