private void InitializeViewport() { if (ActualWidth.IsNanOrZero()) { return; } if (double.IsNaN(Map.Viewport.Resolution)) // only when not set yet { if (!_map.Envelope.IsInitialized()) { return; } if (_map.Envelope.GetCentroid() == null) { return; } if (Math.Abs(_map.Envelope.Width) > Constants.Epsilon) { Map.Viewport.Resolution = _map.Envelope.Width / ActualWidth; } else { // An envelope width of zero can happen when there is no data in the Maps' layers (yet). // It should be possible to start with an empty map. Map.Viewport.Resolution = Constants.DefaultResolution; } } if (double.IsNaN(Map.Viewport.Center.X) || double.IsNaN(Map.Viewport.Center.Y)) // only when not set yet { if (!_map.Envelope.IsInitialized()) { return; } if (_map.Envelope.GetCentroid() == null) { return; } Map.Viewport.Center = _map.Envelope.GetCentroid(); } Map.Viewport.Width = ActualWidth; Map.Viewport.Height = ActualHeight; Map.Viewport.RenderResolutionMultiplier = 1.0; _viewportInitialized = true; OnViewportInitialize(); Map.ViewChanged(true); }
public void ZoomToFullEnvelope() { if (Map.Envelope == null) { return; } if (ActualWidth.IsNanOrZero()) { return; } Map.Viewport.Resolution = Math.Max(Map.Envelope.Width / ActualWidth, Map.Envelope.Height / ActualHeight); Map.Viewport.Center = Map.Envelope.GetCentroid(); }
public void ZoomToFullEnvelope() { if (Map.Envelope == null) { return; } if (ActualWidth.IsNanOrZero()) { return; } viewport.Resolution = Map.Envelope.Width / ActualWidth; viewport.Center = Map.Envelope.GetCentroid(); }
public void ZoomToFullEnvelope() { if (Map.Envelope == null) { return; } if (ActualWidth.IsNanOrZero()) { return; } Map.Viewport.Resolution = Map.Envelope.Width / ActualWidth; Map.Viewport.Center = Map.Envelope.Centroid; OnViewChanged(); }
private void InitializeViewport() { if (ActualWidth.IsNanOrZero()) { return; } if (_map == null) { return; } if (_map.Envelope == null) { return; } if (_map.Envelope.Width.IsNanOrZero()) { return; } if (_map.Envelope.Height.IsNanOrZero()) { return; } if (_map.Envelope.GetCentroid() == null) { return; } if (double.IsNaN(Map.Viewport.Resolution)) { Map.Viewport.Resolution = _map.Envelope.Width / ActualWidth; } if (double.IsNaN(Map.Viewport.Center.X) || double.IsNaN(Map.Viewport.Center.Y)) { Map.Viewport.Center = _map.Envelope.GetCentroid(); } Map.Viewport.Width = ActualWidth; Map.Viewport.Height = ActualHeight; Map.Viewport.RenderResolutionMultiplier = 1.0; _viewportInitialized = true; OnViewportInitialize(); Map.ViewChanged(true); }
private void InitializeViewport() { if (ActualWidth.IsNanOrZero()) { return; } if (_map == null) { return; } if (_map.Envelope == null) { return; } if (_map.Envelope.Width.IsNanOrZero()) { return; } if (_map.Envelope.Height.IsNanOrZero()) { return; } if (_map.Envelope.GetCentroid() == null) { return; } if (double.IsNaN(Map.Viewport.Resolution)) { Map.Viewport.Resolution = _map.Envelope.Width / ActualWidth; } if (double.IsNaN(Map.Viewport.Center.X) || double.IsNaN(Map.Viewport.Center.Y)) { Map.Viewport.Center = _map.Envelope.GetCentroid(); } _viewportInitialized = true; }
private void InitializeView() { if (ActualWidth.IsNanOrZero()) { return; } if (map == null) { return; } if (map.Envelope == null) { return; } if (map.Envelope.Width.IsNanOrZero()) { return; } if (map.Envelope.Height.IsNanOrZero()) { return; } if (map.Envelope.GetCentroid() == null) { return; } if ((viewport.CenterX > 0) && (viewport.CenterY > 0) && (viewport.Resolution > 0)) { viewInitialized = true; //view was already initialized return; } viewport.Center = map.Envelope.GetCentroid(); viewport.Resolution = map.Envelope.Width / ActualWidth; viewInitialized = true; }