/// <summary> /// Sets the current view of mapper window represented by windowId using a MapInfo MBR /// </summary> /// <param name="windowId">Window identification number of mapper window</param> /// <param name="mipMBR">MBR to fit Map to</param> /// <param name="csys">CoordSys string that specifies the coordinate system used by the mipMBR arguments</param> public static void SetViewMBR(int windowId, MBR mipMBR, string unit, string csys) { double xMin, yMin, xMax, yMax; double winHeight, winWidth; double mapZoom; xMin = mipMBR.MinimumX; yMin = mipMBR.MinimumY; xMax = mipMBR.MaximumX; yMax = mipMBR.MaximumY; //MessageBox.Show (String.Format("MBR: {0}", mipMBR.ToString())); //MessageBox.Show (String.Format("Center: {0}", mipMBR.GetCenter())); winHeight = GetWindowHeight(windowId); winWidth = GetWindowWidth(windowId); if (((xMax - xMin)/winWidth) > ((yMax-yMin)/winHeight)) { mapZoom = xMax - xMin; } else { mapZoom = ((winWidth + 10)/winHeight) * (yMax - yMin); } //MessageBox.Show(String.Format("Zoom: {0} {1}", Convert.ToString(mapZoom), unit)); SetView(windowId, mipMBR.GetCenterX(), mipMBR.GetCenterY(), mapZoom, unit, csys); }