/// <summary> /// Creates a new instance of the <see cref="OsmSharp.UI.Renderer.View2D"/> class. /// </summary> /// <returns>The from bounds.</returns> /// <param name="top">Top.</param> /// <param name="left">Left.</param> /// <param name="bottom">Bottom.</param> /// <param name="right">Right.</param> public static View2D CreateFromBounds(double top, double left, double bottom, double right) { double width; bool xInverted; double centerX = (left + right) / 2.0; if (left > right) { xInverted = true; width = left - right; } else { width = right - left; xInverted = false; } double height; bool yInverted; double centerY = (top + bottom) / 2.0; if (bottom > top) { yInverted = true; height = bottom - top; } else { yInverted = false; height = top - bottom; } return(View2D.CreateFromCenterAndSize(width, height, centerX, centerY, xInverted, yInverted)); }
/// <summary> /// Creates a view based on a center location a zoomfactor and the size of the current viewport. /// </summary> /// <param name="centerX"></param> /// <param name="centerY"></param> /// <param name="pixelsWidth"></param> /// <param name="pixelsHeight"></param> /// <param name="zoomFactor"></param> /// <param name="xInverted"></param> /// <param name="yInverted"></param> /// <param name="angleY"></param> /// <returns></returns> public static View2D CreateFrom(double centerX, double centerY, double pixelsWidth, double pixelsHeight, double zoomFactor, bool xInverted, bool yInverted, Degree angleY) { double realZoom = zoomFactor; double width = pixelsWidth / realZoom; double height = pixelsHeight / realZoom; return(View2D.CreateFromCenterAndSize(width, height, centerX, centerY, xInverted, yInverted, angleY)); }
/// <summary> /// Creates a new instance of the <see cref="OsmSharp.UI.Renderer.View2D"/> class. /// </summary> /// <param name="width"></param> /// <param name="height"></param> /// <param name="centerX"></param> /// <param name="centerY"></param> /// <param name="directionX"></param> /// <param name="directionY"></param> /// <param name="angleY"></param> /// <returns></returns> public static View2D CreateFromCenterAndSize(double width, double height, double centerX, double centerY, bool directionX, bool directionY) { return(View2D.CreateFromCenterAndSize(width, height, centerX, centerY, directionX, directionY, 0)); }