public bool Contains(GRect 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))); }
public static GRect Inflate(GRect rect, int x, int y) { GRect r = rect; r.Inflate(x, y); return(r); }
public static GRect Inflate(GRect rect, long x, long y) { GRect r = rect; r.Inflate(x, y); return(r); }
public bool IntersectsWith(GRect rect) { return(rect.X < X + Width && X < rect.X + rect.Width && rect.Y < Y + Height && Y < rect.Y + rect.Height); }
public bool IntersectsWith(GRect 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)); }
public bool Contains(GRect rect) { return(X <= rect.X && rect.X + rect.Width <= X + Width && Y <= rect.Y && rect.Y + rect.Height <= Y + Height); }
public void Intersect(GRect rect) { GRect result = GRect.Intersect(rect, this); this.X = result.X; this.Y = result.Y; this.Width = result.Width; this.Height = result.Height; }
public void Intersect(GRect rect) { GRect result = Intersect(rect, this); X = result.X; Y = result.Y; Width = result.Width; Height = result.Height; }
public static GRect Union(GRect a, GRect 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 GRect(x1, y1, x2 - x1, y2 - y1)); }
public override bool Equals(object obj) { if (!(obj is GRect)) { return(false); } GRect comp = (GRect)obj; return((comp.X == this.X) && (comp.Y == this.Y) && (comp.Width == this.Width) && (comp.Height == this.Height)); }
public static GRect Intersect(GRect a, GRect 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 GRect(x1, y1, x2 - x1, y2 - y1)); } return(GRect.Empty); }
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { base.OnRenderSizeChanged(sizeInfo); { System.Windows.Size constraint = sizeInfo.NewSize; region = new GRect(-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(); } }
void GmapWidget_ButtonPressEvent(object o, Gtk.ButtonPressEventArgs args) { if(args.Event.Button == 1) { bool markerIsSelect = false; if (args.Event.State.HasFlag(ModifierType.Mod1Mask)) { foreach (var marker in addressesOverlay.Markers) { if (marker.IsMouseOver) { var markerUnderMouse = selectedMarkers.FirstOrDefault(m => ((Order)m.Tag).Id == ((Order)marker.Tag).Id); if( markerUnderMouse == null) { selectedMarkers.Add(marker); logger.Debug("Маркер с заказом №{0} добавлен в список выделенных", ((Order)marker.Tag).Id); } else { selectedMarkers.Remove(markerUnderMouse); logger.Debug("Маркер с заказом №{0} исключен из списка выделенных", ((Order)marker.Tag).Id); } markerIsSelect = true; } } //Требуется просмотреть код, для возможного улучшения UpdateSelectedInfo(selectedMarkers); UpdateAddressesOnMap(); return; } if (!markerIsSelect) { selectedMarkers.Clear(); logger.Debug("Список выделенных маркеров очищен"); } UpdateAddressesOnMap(); if(poligonSelection) { GRect rect = new GRect((long)args.Event.X - 5, (long)args.Event.Y - 5, 10, 10); rect.OffsetNegative(gmapWidget.RenderOffset); dragSelectionPointId = brokenSelection.LocalPoints.FindIndex(rect.Contains); if(dragSelectionPointId != -1) { gmapWidget.DisableAltForSelection = false; return; } } if(args.Event.State.HasFlag(ModifierType.ControlMask)) { if(!poligonSelection) { poligonSelection = true; logger.Debug("Старт выделения через полигон."); var startPoint = gmapWidget.FromLocalToLatLng((int)args.Event.X, (int)args.Event.Y); brokenSelection = new GMapPolygon(new List<PointLatLng>{startPoint}, "Выделение" ); gmapWidget.UpdatePolygonLocalPosition(brokenSelection); selectionOverlay.Polygons.Add(brokenSelection); } else { logger.Debug("Продолжили."); var newPoint = gmapWidget.FromLocalToLatLng((int)args.Event.X, (int)args.Event.Y); brokenSelection.Points.Add(newPoint); gmapWidget.UpdatePolygonLocalPosition(brokenSelection); } OnPoligonSelectionUpdated(); } else { logger.Debug("Закончили."); poligonSelection = false; UpdateSelectedInfo(new List<GMapMarker>()); selectionOverlay.Clear(); } } }
public static GRect Union(GRect a, GRect b) { long x1 = Math.Min(a.X, b.X); long x2 = Math.Max(a.X + a.Width, b.X + b.Width); long y1 = Math.Min(a.Y, b.Y); long y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); return new GRect(x1, y1, x2 - x1, y2 - y1); }
public bool IntersectsWith(GRect 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); }
public static GRect Intersect(GRect a, GRect b) { long x1 = Math.Max(a.X, b.X); long x2 = Math.Min(a.X + a.Width, b.X + b.Width); long y1 = Math.Max(a.Y, b.Y); long y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); if(x2 >= x1 && y2 >= y1) { return new GRect(x1, y1, x2 - x1, y2 - y1); } return GRect.Empty; }
public static GRect Inflate(GRect rect, long x, long y) { GRect r = rect; r.Inflate(x, y); return r; }
public bool Contains(GRect 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)); }
/// <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 GRect(-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(); } ForceUpdateOverlays(); } }
public static GRect Inflate(GRect rect, int x, int y) { GRect r = rect; r.Inflate(x, y); return r; }