Example #1
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 18JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Copy constructor.
  * @param pline     map object copy from.
  */
 public MapPline(MapPline pline)
     : base(pline)
 {
     SetMapObjectType(PLINE);
     PenStyle = new MapPen(pline.PenStyle);
     Pline = new GeoPolyline(pline.Pline);
 }
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 18JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Copy constructor.
  * @param multiPline     map object copy from.
  */
 public MapMultiPline(MapMultiPline multiPline)
     : base(multiPline)
 {
     SetMapObjectType(MULTIPLINE);
     PenStyle = new MapPen(multiPline.PenStyle);
     Plines = new GeoPolyline[multiPline.Plines.Length];
     for (int i = 0; i < Plines.Length; i++)
     {
         Plines[i] = new GeoPolyline(multiPline.Plines[i]);
     }
 }
Example #3
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 18JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * Creates a polyline from encoded strings of aggregated points and levels.
         * ZoomFactor and  NumLevels  these two values determine the precision
         * of the levels within an encoded polyline.
         * @param _color the _color of the polyline.
         * @param _weight Width of the line in pixels.
         * @param _opacity the _opacity of the polyline.
         * @param points a string containing the encoded latitude and longitude
         *  coordinates.
         * @param ZoomFactor  the magnification between adjacent sets of zoom levels
         * in the encoded levels string.
         * @param levels a string containing the encoded polyline zoom level groups.
         * @param NumLevels the number of zoom levels contained in the encoded
         * levels string.
         * @return Geo polyline object.
         */
        public static GeoPolyline FromEncoded(int color, int weight, double opacity,
                                              String points, int zoomFactor, String levels, int numLevels)
        {
            ArrayList trk = PolylineEncoder.CreateDecodings(points);

            GeoLatLng[] array = new GeoLatLng[trk.Count];
            var         temp  = trk.ToArray();

            for (int i = 0; i < temp.Length; i++)
            {
                array[i] = (GeoLatLng)temp[i];
            }
            GeoPolyline polyline = new GeoPolyline(array, color, weight, opacity);

            polyline._levels    = PolylineEncoder.DecodeLevel(levels);
            polyline.ZoomFactor = zoomFactor;
            polyline.NumLevels  = numLevels;
            return(polyline);
        }
Example #4
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 18JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * copy constructor.
         * @param pline pline object copied from.
         */
        public GeoPolyline(GeoPolyline pline)
        {
            if (pline._latlngs != null)
            {
                _latlngs = new GeoLatLng[pline._latlngs.Length];
                Array.Copy(_latlngs, 0, _latlngs, 0, _latlngs.Length);
                _levels = new int[pline._levels.Length];
                for (int i = 0; i < _levels.Length; i++)
                {
                    _levels[i] = pline._levels[i];
                }
                _bounds = new GeoLatLngBounds(pline._bounds);
            }
            _color     = pline._color;
            _weight    = pline._weight;
            _opacity   = pline._opacity;
            ZoomFactor = pline.ZoomFactor;
            NumLevels  = pline.NumLevels;
            _visible   = pline._visible;
        }
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- 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);
                }

            }
        }
Example #6
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 18JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Creates a polyline from encoded strings of aggregated points and levels.
  * ZoomFactor and  NumLevels  these two values determine the precision
  * of the levels within an encoded polyline.
  * @param _color the _color of the polyline.
  * @param _weight Width of the line in pixels.
  * @param _opacity the _opacity of the polyline.
  * @param points a string containing the encoded latitude and longitude
  *  coordinates.
  * @param ZoomFactor  the magnification between adjacent sets of zoom levels
  * in the encoded levels string.
  * @param levels a string containing the encoded polyline zoom level groups.
  * @param NumLevels the number of zoom levels contained in the encoded
  * levels string.
  * @return Geo polyline object.
  */
 public static GeoPolyline FromEncoded(int color, int weight, double opacity,
         String points, int zoomFactor, String levels, int numLevels)
 {
     ArrayList trk = PolylineEncoder.CreateDecodings(points);
     GeoLatLng[] array = new GeoLatLng[trk.Count];
     var temp = trk.ToArray();
     for (int i = 0; i < temp.Length; i++)
     {
         array[i] = (GeoLatLng)temp[i];
     }
     GeoPolyline polyline = new GeoPolyline(array, color, weight, opacity);
     polyline._levels = PolylineEncoder.DecodeLevel(levels);
     polyline.ZoomFactor = zoomFactor;
     polyline.NumLevels = numLevels;
     return polyline;
 }
Example #7
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 18JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * copy constructor.
  * @param pline pline object copied from.
  */
 public GeoPolyline(GeoPolyline pline)
 {
     if (pline._latlngs != null)
     {
         _latlngs = new GeoLatLng[pline._latlngs.Length];
         Array.Copy(_latlngs, 0, _latlngs, 0, _latlngs.Length);
         _levels = new int[pline._levels.Length];
         for (int i = 0; i < _levels.Length; i++)
         {
             _levels[i] = pline._levels[i];
         }
         _bounds = new GeoLatLngBounds(pline._bounds);
     }
     _color = pline._color;
     _weight = pline._weight;
     _opacity = pline._opacity;
     ZoomFactor = pline.ZoomFactor;
     NumLevels = pline.NumLevels;
     _visible = pline._visible;
 }
Example #8
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 18JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * default constructor.
  */
 public MapPline()
 {
     SetMapObjectType(PLINE);
     PenStyle = new MapPen();
     Pline = null;
 }
Example #9
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 18JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Set GeoPolyline of the map Pline.
  * @param pline  the GeoPolyline object.
  */
 public void SetPline(GeoPolyline pline)
 {
     Pline = pline;
 }
        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;
        }
Example #11
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 18JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Set GeoPolyline array of the map MultiPline.
  * @param plines  the GeoPolyline object array.
  */
 public void SetPlines(GeoPolyline[] plines)
 {
     Plines = plines;
 }