// 当分辨率发生变化时,重新设置各个LayerCanvas的参考点和分辨率,并重置偏移量 private void SetOriginAndResolution(double newResolution, Utility.Point2D originPoint) { _origin = originPoint; foreach (Layer layer in Layers) { ResetTranslate(); layer.LayerCanvas.Resolution = newResolution; layer.LayerCanvas.OriginX = originPoint.X; layer.LayerCanvas.OriginY = originPoint.Y; } }
private void CalculateStartViewBounds(Size size) { if (this._cacheBounds != null && this._origin == null) { Utility.Rectangle2D bounds = this._cacheBounds; double width = size.Width; double height = size.Height; double resWidth = bounds.Width / width; double resHeight = bounds.Height / height; _mapResolution = (resHeight > resWidth) ? resHeight : resWidth; _origin = new Utility.Point2D(bounds.Center.X - width * 0.5 * _mapResolution, bounds.Center.Y + height * 0.5 * _mapResolution); _cacheBounds = new Utility.Rectangle2D(this.ViewBounds); SetOriginAndResolution(_mapResolution, new Utility.Point2D(_origin)); } }