private GraphicsPath ToGraphicsPath(CodeCell.AgileMap.Core.Feature feature, ICanvas canvas) { CodeCell.AgileMap.Core.ShapePolyline ply = feature.Geometry as CodeCell.AgileMap.Core.ShapePolyline; GeoDo.RSS.Core.DrawEngine.ICoordinateTransform tran = canvas.CoordTransform; double prjX, prjY; int screenX, screenY; GraphicsPath path = new GraphicsPath(); foreach (CodeCell.AgileMap.Core.ShapeLineString line in ply.Parts) { PointF[] pts = new PointF[line.Points.Length]; for (int i = 0; i < pts.Length; i++) { if (!feature.Projected) { tran.Geo2Prj(line.Points[i].X, line.Points[i].Y, out prjX, out prjY); } else { prjX = line.Points[i].X; prjY = line.Points[i].Y; } tran.Prj2Screen(prjX, prjY, out screenX, out screenY); pts[i].X = screenX; pts[i].Y = screenY; } path.AddCurve(pts.ToArray()); //path.AddLines(); path.StartFigure(); } return(path); }
private GraphicsPath ToGraphicsPath(Feature feature, ICanvas canvas) { if (feature == null) { return(null); } ShapePolygon ply = feature.Geometry as ShapePolygon; if (ply == null || ply.Rings == null || ply.Rings.Length == 0) { return(null); } GeoDo.RSS.Core.DrawEngine.ICoordinateTransform tran = canvas.CoordTransform; double prjX, prjY; int screenX, screenY; GraphicsPath path = new GraphicsPath(); foreach (ShapeRing ring in ply.Rings) { PointF[] pts = new PointF[ring.Points.Length]; if (pts == null || pts.Length == 0) { continue; } for (int i = 0; i < pts.Length; i++) { if (!feature.Projected) { tran.Geo2Prj(ring.Points[i].X, ring.Points[i].Y, out prjX, out prjY); } else { prjX = ring.Points[i].X; prjY = ring.Points[i].Y; } tran.Prj2Screen(prjX, prjY, out screenX, out screenY); pts[i].X = screenX; pts[i].Y = screenY; } path.AddPolygon(pts.ToArray()); } return(path); }