protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
        {
            base.OnRenderSizeChanged(sizeInfo);

            {
                System.Windows.Size constraint = sizeInfo.NewSize;
                region = new GMap.NET.Rectangle(-50, -50, (int)constraint.Width + 100, (int)constraint.Height + 100);

                TilesLayer.Width  = sizeInfo.NewSize.Width;
                TilesLayer.Height = sizeInfo.NewSize.Height;

                QuadTree.Bounds = new Rect(sizeInfo.NewSize);
            }

            //var sizeInPx = Projection.GetTileMatrixSizePixel(ZoomStep);
            //TilesLayer.Width = sizeInPx.Width;
            //TilesLayer.Height = sizeInPx.Height;

            if (IsLoaded)
            {
                Refresh();
            }
        }
Exemple #2
0
      public static Rectangle Union(Rectangle a, Rectangle b)
      {
         int x1 = Math.Min(a.X, b.X);
         int x2 = Math.Max(a.X + a.Width, b.X + b.Width);
         int y1 = Math.Min(a.Y, b.Y);
         int y2 = Math.Max(a.Y + a.Height, b.Y + b.Height);

         return new Rectangle(x1, y1, x2 - x1, y2 - y1);
      }
Exemple #3
0
 public bool IntersectsWith(Rectangle rect)
 {
    return (rect.X < this.X + this.Width) &&
       (this.X < (rect.X + rect.Width)) && 
       (rect.Y < this.Y + this.Height) &&
       (this.Y < rect.Y + rect.Height);
 }
Exemple #4
0
      public static Rectangle Intersect(Rectangle a, Rectangle b)
      {
         int x1 = Math.Max(a.X, b.X);
         int x2 = Math.Min(a.X + a.Width, b.X + b.Width);
         int y1 = Math.Max(a.Y, b.Y);
         int y2 = Math.Min(a.Y + a.Height, b.Y + b.Height);

         if(x2 >= x1
                && y2 >= y1)
         {

            return new Rectangle(x1, y1, x2 - x1, y2 - y1);
         }
         return Rectangle.Empty;
      }
Exemple #5
0
      public void Intersect(Rectangle rect)
      {
         Rectangle result = Rectangle.Intersect(rect, this);

         this.X = result.X;
         this.Y = result.Y;
         this.Width = result.Width;
         this.Height = result.Height;
      }
Exemple #6
0
 public static Rectangle Inflate(Rectangle rect, int x, int y)
 {
    Rectangle r = rect;
    r.Inflate(x, y);
    return r;
 }
Exemple #7
0
 public bool Contains(Rectangle rect)
 {
    return (this.X <= rect.X) &&
       ((rect.X + rect.Width) <= (this.X + this.Width)) && 
       (this.Y <= rect.Y) &&
       ((rect.Y + rect.Height) <= (this.Y + this.Height));
 }
Exemple #8
0
        protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
        {
            base.OnRenderSizeChanged(sizeInfo);

             {
            System.Windows.Size constraint = sizeInfo.NewSize;
            region = new GMap.NET.Rectangle(-50, -50, (int) constraint.Width + 100, (int) constraint.Height + 100);

            TilesLayer.Width = sizeInfo.NewSize.Width;
            TilesLayer.Height = sizeInfo.NewSize.Height;

            QuadTree.Bounds = new Rect(sizeInfo.NewSize);
             }

             //var sizeInPx = Projection.GetTileMatrixSizePixel(ZoomStep);
             //TilesLayer.Width = sizeInPx.Width;
             //TilesLayer.Height = sizeInPx.Height;

             if(IsLoaded)
             {
            Refresh();
             }
        }
      /// <summary>
      /// recalculates size
      /// </summary>
      /// <param name="sender"></param>
      /// <param name="e"></param>
      void GMapControl_SizeChanged(object sender, SizeChangedEventArgs e)
      {
         System.Windows.Size constraint = e.NewSize;

         // 50px outside control
         region = new GMap.NET.Rectangle(-50, -50, (int) constraint.Width + 100, (int) constraint.Height + 100);

         Core.OnMapSizeChanged((int) constraint.Width, (int) constraint.Height);

         // keep center on same position
         if(IsLoaded)
         {
            Core.GoToCurrentPosition();

            if(IsRotated)
            {
               UpdateRotationMatrix();
               Core_OnMapZoomChanged();
            }
            else
            {
               UpdateMarkersOffset();
            }
         }
      }