Ejemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- 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);
                }
            }
        }