本文主要是介绍贡献一个sharpmap,自定义专题地图源码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
专题图代码主体部分SharpMap.Layers.VectorLayer layerValve;
layerValve = new SharpMap.Layers.VectorLayer("valve", new SharpMap.Data.Providers.ShapeFile("../data/valve.shp"));
layerValve.Style.SymbolOffset = new PointF(20, -35);
map.Layers.Add(layerValve);
SharpMap.Rendering.Thematics.CustomTheme myThemeValve = new SharpMap.Rendering.Thematics.CustomTheme(GetThemeStyleValve);
layerValve.Theme = myThemeValve;
专题图函数为
private static SharpMap.Styles.VectorStyle GetThemeStyleValve(SharpMap.Data.FeatureDataRow row)
{
string strThemeField = row["onoroff"].ToString();
SharpMap.Styles.VectorStyle style = new SharpMap.Styles.VectorStyle();
if (strThemeField != null)
{
if (strThemeField != "" && int.Parse(strThemeField) == 1)
{
style.SymbolScale = 0.4f;
style.Symbol = new Bitmap("../resourcefiles/pipeOn.PNG");
}
else
{
style.SymbolScale = 0.42f;
style.Symbol = new Bitmap("../resourcefiles/pipeOff.PNG");
}
style.SymbolOffset = new PointF(0, -15);
}
style.EnableOutline = true;
return style;
}
这篇关于贡献一个sharpmap,自定义专题地图源码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!