AnsweredAssumed Answered

runtime freezes sometimes when zooming on S57 layer -- bug or incorrect api usage?

Question asked by ccasanova on Apr 22, 2016
Latest reply on Dec 18, 2017 by mnielsen-esristaff

The application remains responsive and does not die. The map view, however, stops accepting user input and appears frozen. We've seen this sporadically. Below is a small sample that reproduces the problem. Note you may have to run it a few times before it occurs; the issue does not happen every time.

 

 

<Window

    x:Class="Sample.MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"

    Title="esri sample" Height="350" Width="525">

  <Grid>

    <esri:MapView x:Name="MyMapView">

      <esri:Map x:Name="TheMap">

        <esri:ArcGISTiledMapServiceLayer

            ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" />

      </esri:Map>

    </esri:MapView>

  </Grid>

</Window>

 

 

using Esri.ArcGISRuntime.Geometry;

using Esri.ArcGISRuntime.Hydrographic;

using System.Collections.Generic;

using System.Windows;

 

 

namespace Sample

{

  /// <summary>

  /// Interaction logic for MainWindow.xaml

  /// </summary>

  public partial class MainWindow : Window

  {

    public MainWindow()

    {

      InitializeComponent();

 

 

      var center = (MapPoint)GeometryEngine.Project(new MapPoint(-80.1, 26.1, SpatialReferences.Wgs84), SpatialReferences.WebMercator);

      MyMapView.SetView(center, 30000);

 

 

      SingleMapRepeat();

      //MultiMapRepeat();

    }

 

 

    private void SingleMapRepeat()

    {

      //Wait for the zoomed area, most likely to see frozen. If not, increase the repeat number.

      int repeat = 9;

      MyMapView.LayerLoaded += Zoom;

      AddS57("../../../../../../s57/US5FL32M/ENC_ROOT/US5FL32M/US5FL32M.000", repeat);

    }

 

 

    private void MultiMapRepeat()

    {

      //start to see frozen when repeat is 3. If not, increase the repeat number. Pan or manually zoom may increase the chance to make the map frozen.

      int repeat = 3;

      MyMapView.LayerLoaded += Zoom;

      AddS57("../../../../../../s57/US5FL32M/ENC_ROOT/US5FL32M/US5FL32M.000", repeat);

      AddS57("../../../../../../s57/US4MA23M/ENC_ROOT/US4MA23M/US4MA23M.000", repeat);

      AddS57("../../../../../../s57/US3NY01M/ENC_ROOT/US3NY01M/US3NY01M.000", repeat);

      AddS57("../../../../../../s57/US1GC09M/US1GC09M.000", repeat);

 

 

      AddS57("../../../../../../s57/US2EC01M/US2EC01M.000", repeat);

      AddS57("../../../../../../s57/US3FL30M/US3FL30M.000", repeat);

      AddS57("../../../../../../s57/US4AL12M/US4AL12M.000", repeat);

      AddS57("../../../../../../s57/US5FL4AM/US5FL4AM.000", repeat);

      AddS57("../../../../../../s57/US5AL12M/US5AL12M.000", repeat);

    }

 

 

  

 

 

    private void AddS57(string path, int repeat)

    {

      for (int i = 0; i < repeat; i++)

      {

        var layer = new HydrographicS57Layer() { Path = path };

        layer.DisplayName = path;

        TheMap.Layers.Add(layer);

       

        System.Console.WriteLine("add layer " + layer.DisplayName);

      }

    }

 

 

    async void Zoom(object _, Esri.ArcGISRuntime.Controls.LayerLoadedEventArgs e)

    {

      System.Console.WriteLine("zoom layer " + e.Layer.ID + " " + e.Layer.FullExtent.Extent.XMin + " " + e.Layer.FullExtent.Extent.YMin);

      await MyMapView.LayersLoadedAsync(new Esri.ArcGISRuntime.Layers.Layer[] { e.Layer });

      await MyMapView.SetViewAsync(e.Layer.FullExtent);

    }

  }

}

Outcomes