//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 21JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * draw a pline. * @param mapPen the pen used to draw the polyline * @param pline the polyline object. */ private void DrawPline(MapPen mapPen, GeoPolyline pline) { ArrayList clippedPts = _sutherlandHodgman.ClipPline(pline.GetPoints()); GeoPoint[] screenPts = FromLatLngToMapPixel(clippedPts); if (screenPts.Length > 1) { { int penWidth = mapPen.Width; if (mapPen.Pattern > 62) { penWidth = mapPen.Width * 2; } Pen pen = new Pen(new Color(mapPen.Color, false), penWidth); SharedGraphics2D.SetDefaultPen(pen); int[] xpoints = new int[screenPts.Length]; int[] ypoints = new int[screenPts.Length]; for (int i = 0; i < screenPts.Length; i++) { xpoints[i] = (int)screenPts[i].X; ypoints[i] = (int)screenPts[i].Y; } Polyline polyline = new Polyline { Xpoints = xpoints, Ypoints = ypoints, NumOfPoints = xpoints.Length }; SharedGraphics2D.DrawPolyline(null, polyline); } } }
private Point[] DrawPline(MapPen mapPen, GeoPolyline pline) { ArrayList clippedPts = _sutherlandHodgman.ClipPline(pline.GetPoints()); GeoPoint[] screenPts = FromLatLngToMapPixel(clippedPts); if (screenPts.Length > 1) { { Pen pen = GetPen(mapPen); int[] xpoints = new int[screenPts.Length]; int[] ypoints = new int[screenPts.Length]; for (int i = 0; i < screenPts.Length; i++) { xpoints[i] = (int)screenPts[i].X; ypoints[i] = (int)screenPts[i].Y; } Point[] points = new Point[xpoints.Length]; for (int i = 0; i < points.Length; i++) { points[i] = new Point(xpoints[i], ypoints[i]); } SharedGraphics2D.Graphics.DrawLines(pen, points); return(points); } } return(null); }