在项目中需要用到画线功能,要求不同的电压等级使用不同的颜色,如1000 是红色 500是蓝色
不同项目的线可以用 LineString 类描述,上代码
SharpMap.Data.FeatureDataTable dt = new SharpMap.Data.FeatureDataTable();
dt.Columns.Add("ContainerGrade");
SharpMap.Data.FeatureDataRow row = dt.NewRow();
row["ContainerGrade"] = "500";
LineString lineString = new LineString();
lineString.Vertices.Add(new SharpMap.Geometries.Point(121.0266, 29.1368));
lineString.Vertices.Add(new SharpMap.Geometries.Point(120.527, 29.85));
row.Geometry = lineString;
dt.AddRow(row);
VectorLayer SymbolsLayer = new VectorLayer("ProjectLineLayer");
SharpMap.Rendering.Thematics.CustomTheme theme = new SharpMap.Rendering.Thematics.CustomTheme(GetMyLineStyle);
SymbolsLayer.DataSource = new Geomet