public Point ToView(MercatorLocation location) { var point = new Point { X = Math.Floor((location.X + _translation.X) * _mercatorToViewScale + 0.5), Y = Math.Floor((location.Y + _translation.Y) * (-_mercatorToViewScale) + 0.5) }; return(point); }
public MercatorLocation ToScene(Point pos) { var tmp = new MercatorLocation { X = pos.X * _viewToMercatorScale - _translation.X, Y = pos.Y * (-_viewToMercatorScale) - _translation.Y }; return(tmp); }
public MercatorRectangle ToScene(Rect rect) { MercatorLocation topLeft = ToScene(rect.TopLeft); MercatorLocation bottomRight = ToScene(rect.BottomRight); return(new MercatorRectangle { Min = new MercatorLocation(Math.Min(topLeft.X, bottomRight.X), Math.Min(topLeft.Y, bottomRight.Y)), Max = new MercatorLocation(Math.Max(topLeft.X, bottomRight.X), Math.Max(topLeft.Y, bottomRight.Y)) }); }