private static LabelPlace GetOpposite(LabelPlace place) { switch (place) { case LabelPlace.None: return(LabelPlace.None); case LabelPlace.Left: return(LabelPlace.Right); case LabelPlace.Top: return(LabelPlace.Bottom); case LabelPlace.Right: return(LabelPlace.Left); case LabelPlace.Bottom: return(LabelPlace.Top); } throw new ArgumentOutOfRangeException(); }
private static LabelRect GetLabelRect(MapMarker marker, Point markerPosition, Size markerSize, Size labelSize, LabelPlace place) { switch (place) { case LabelPlace.None: case LabelPlace.Left: return(new LabelRect(marker, new Rect(markerPosition.X - markerSize.Width / 2 - labelSize.Width, markerPosition.Y - labelSize.Height / 2, labelSize.Width, labelSize.Height), place)); case LabelPlace.Top: return(new LabelRect(marker, new Rect(markerPosition.X - labelSize.Width / 2, markerPosition.Y - labelSize.Height - markerSize.Height / 2, labelSize.Width, labelSize.Height), place)); case LabelPlace.Right: return(new LabelRect(marker, new Rect(markerPosition.X + markerSize.Width / 2, markerPosition.Y - labelSize.Height / 2, labelSize.Width, labelSize.Height), place)); case LabelPlace.Bottom: return(new LabelRect(marker, new Rect(markerPosition.X - labelSize.Width / 2, markerPosition.Y + markerSize.Height / 2, labelSize.Width, labelSize.Height), place)); default: throw new ArgumentOutOfRangeException("place"); } }
public LabelRect(MapMarker marker, Rect rect, LabelPlace place) { MapMarker = marker; Rect = rect; Place = place; }