View Javadoc
1   package fr.ifremer.dali.map.config;
2   
3   import com.google.common.collect.ImmutableList;
4   import fr.ifremer.dali.config.DaliConfiguration;
5   import fr.ifremer.dali.map.MapLayerDefinition;
6   import fr.ifremer.dali.map.OSMBasedMapConfiguration;
7   import fr.ifremer.dali.map.osm.OSMService2;
8   import org.geotools.geometry.jts.ReferencedEnvelope;
9   import org.geotools.tile.TileService;
10  
11  import java.util.List;
12  
13  /**
14   * @author peck7 on 13/06/2019.
15   */
16  public class OSMMapConfiguration implements OSMBasedMapConfiguration {
17  
18      private List<MapLayerDefinition> mapLayerDefinitions;
19  
20      @Override
21      public boolean isProgressiveRender() {
22          return true;
23      }
24  
25      @Override
26      public String getUrl() {
27          return DaliConfiguration.getInstance().getMapOSMUrl();
28      }
29  
30      @Override
31      public TileService getTileService() {
32          return new OSMService2(getBaseLayerName(), getUrl());
33      }
34  
35      @Override
36      public String getBaseLayerName() {
37          return "mapnik";
38      }
39  
40      @Override
41      public List<MapLayerDefinition> getMapLayerDefinitions() {
42          if (mapLayerDefinitions == null) {
43              mapLayerDefinitions = ImmutableList.of(new MapLayerDefinition(getBaseLayerName(), ReferencedEnvelope.EVERYTHING));
44          }
45          return mapLayerDefinitions;
46      }
47  }