//'增加风矢图层
SharpMap.Layers.VectorLayer windarrowLayer = new SharpMap.Layers.VectorLayer("Wind Arrow");
windarrowLayer.DataSource = (map.Layers[3] as SharpMap.Layers.VectorLayer).DataSource;
windarrowLayer.Style.SymbolScale = 0.8F;
windarrowLayer.SRID = 4326;
windarrowLayer.MaxVisible = 15;
SharpMap.Rendering.Thematics.CustomTheme iTheme = new SharpMap.Rendering.Thematics.CustomTheme(GetWindArrowStyle);
windarrowLayer.Theme = iTheme;
map.Layers.Add(windarrowLayer);
private static SharpMap.Styles.VectorStyle GetWindArrowStyle(SharpMap.Data.FeatureDataRow row)
{
SharpMap.Styles.VectorStyle s = new SharpMap.Styles.VectorStyle();
s.Fill = new SolidBrush(Color.Green);
s.Symbol = GetWindArrow(row);
return s;
}
private static Bitmap GetWindArrow(SharpMap.Data.FeatureDataRow row)
{
// Replace polygon with a center point (this is where we place the symbol
row.Geometry = GeometryFactory.CreatePoint(
row.Geometry.EnvelopeInternal.Centre.X,
row.Geometry.EnvelopeInternal.Centre.Y);
Random Rand = new Random();
int size = 50;
Bitmap b = new Bitmap(size, size);
Graphics g = Graphics.FromImage(b);
wmplot.clsWindArrow. CHyAwsView(g, new Point(25, 25), 10, 90);
g.Dispose();
return b;
}
本文介绍了一种在地图上绘制风矢图层的方法。通过创建一个名为WindArrow的VectorLayer,并使用自定义主题来设置样式。针对每个特征数据行生成一个特定大小的位图作为风矢符号。
2299

被折叠的 条评论
为什么被折叠?



