Example #1
0
 public Rectangle(Point location, Size size)
 {
    this.x = location.X;
    this.y = location.Y;
    this.width = size.Width;
    this.height = size.Height;
 }
Example #2
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (list != null)
            {
                list.Clear();
                list = null;
            }
            list       = prj.GetAreaTileList(area, zoom, 0);
            maxOfTiles = prj.GetTileMatrixMaxXY(zoom);
            all        = list.Count;

            int countOk = 0;
            int retry   = 0;

            Stuff.Shuffle <GMap.NET.Point>(list);
            var types = GMaps.Instance.GetAllLayersOfType(type);

            for (int i = 0; i < all; i++)
            {
                if (worker.CancellationPending)
                {
                    break;
                }

                GMap.NET.Point p = list[i];
                {
                    if (CacheTiles(ref types, zoom, p))
                    {
                        countOk++;
                        retry = 0;
                    }
                    else
                    {
                        if (++retry <= 1) // retry only one
                        {
                            i--;
                            System.Threading.Thread.Sleep(1111);
                            continue;
                        }
                        else
                        {
                            retry = 0;
                        }
                    }
                }

                worker.ReportProgress((int)((i + 1) * 100 / all), i + 1);

                System.Threading.Thread.Sleep(sleep);
            }

            e.Result = countOk;
        }
Example #3
0
        public GMap.NET.Point[] GetPointsForTile(int x, int y, Bitmap dot, int zoom, IEnumerable <PointLatLng> _points)
        {
            List <GMap.NET.Point> points = new List <GMap.NET.Point>();

            GMap.NET.Size  maxTileSize;
            GMap.NET.Point adjustedPoint;
            GMap.NET.Point pixelCoordinate;
            GMap.NET.Point mapPoint;

            maxTileSize = _projection.GetTileMatrixMaxXY(zoom);
            //Top Left Bounds
            GMap.NET.Point tlb = _projection.FromTileXYToPixel(new GMap.NET.Point(x, y));

            maxTileSize = new GMap.NET.Size(SIZE, SIZE);
            //Lower right bounds
            GMap.NET.Point lrb = new GMap.NET.Point((tlb.X + maxTileSize.Width) + dot.Width, (tlb.Y + maxTileSize.Height) + dot.Width);

            //pad the Top left bounds
            tlb = new GMap.NET.Point(tlb.X - dot.Width, tlb.Y - dot.Height);


            //Go throught the list and convert the points to pixel cooridents
            foreach (GMap.NET.PointLatLng llPoint in GetList(tlb, lrb, zoom, _points))
            {
                //Now go through the list and turn it into pixel points
                pixelCoordinate = _projection.FromLatLngToPixel(llPoint.Lat, llPoint.Lng, zoom);

                //Make sure the weight and data is still pointing after the conversion
                pixelCoordinate.Data   = llPoint.Data;
                pixelCoordinate.Weight = llPoint.Weight;

                mapPoint      = _projection.FromPixelToTileXY(pixelCoordinate);
                mapPoint.Data = pixelCoordinate.Data;

                //Adjust the point to the specific tile
                adjustedPoint = AdjustMapPixelsToTilePixels(new GMap.NET.Point(x, y), pixelCoordinate);

                //Make sure the weight and data is still pointing after the conversion
                adjustedPoint.Data   = pixelCoordinate.Data;
                adjustedPoint.Weight = pixelCoordinate.Weight;

                //Add the point to the list
                points.Add(adjustedPoint);
            }

            return(points.ToArray());
        }
Example #4
0
 public static Point Subtract(Point pt, Size sz)
 {
     return new Point(pt.X - sz.Width, pt.Y - sz.Height);
 }
Example #5
0
 public static Point Add(Point pt, Size sz)
 {
     return new Point(pt.X + sz.Width, pt.Y + sz.Height);
 }
Example #6
0
 public Point(Size sz)
 {
     this.x = sz.Width;
     this.y = sz.Height;
 }
Example #7
0
      public void Inflate(Size size)
      {

         Inflate(size.Width, size.Height);
      }
Example #8
0
 public static Size Subtract(Size sz1, Size sz2)
 {
    return new Size(sz1.Width - sz2.Width, sz1.Height - sz2.Height);
 }
Example #9
0
 public static Size Add(Size sz1, Size sz2)
 {
    return new Size(sz1.Width + sz2.Width, sz1.Height + sz2.Height);
 }
      void worker_DoWork(object sender, DoWorkEventArgs e)
      {
         if(list != null)
         {
            list.Clear();
            list = null;
         }
         list = prj.GetAreaTileList(area, zoom, 0);
         maxOfTiles = prj.GetTileMatrixMaxXY(zoom);
         all = list.Count;

         int countOk = 0;
         int retry = 0;

         Stuff.Shuffle<GMap.NET.Point>(list);
         var types = GMaps.Instance.GetAllLayersOfType(type);

         for(int i = 0; i < all; i++)
         {
            if(worker.CancellationPending)
               break;

            GMap.NET.Point p = list[i];
            {
               if(CacheTiles(ref types, zoom, p))
               {
                  countOk++;
                  retry = 0;
               }
               else
               {
                  if(++retry <= 1) // retry only one
                  {
                     i--;
                     System.Threading.Thread.Sleep(1111);
                     continue;
                  }
                  else
                  {
                     retry = 0;
                  }
               }
            }

            worker.ReportProgress((int) ((i+1)*100/all), i+1);

            System.Threading.Thread.Sleep(sleep);
         }

         e.Result = countOk;
      }
Example #11
0
 public GMapMarkerTile(PointLatLng p, int size) : base(p)
 {
     Size = new Size(size, size);
 }