View Javadoc
1   package fr.ifremer.dali.map;
2   
3   /*-
4    * #%L
5    * Dali :: UI
6    * %%
7    * Copyright (C) 2017 Ifremer
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Affero General Public License as published by
11   * the Free Software Foundation, either version 3 of the License, or
12   * (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   *
19   * You should have received a copy of the GNU Affero General Public License
20   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21   * #L%
22   */
23  
24  import fr.ifremer.dali.map.config.*;
25  import fr.ifremer.quadrige3.core.dao.technical.enumeration.EnumValue;
26  
27  import java.util.List;
28  
29  import static org.nuiton.i18n.I18n.n;
30  import static org.nuiton.i18n.I18n.t;
31  
32  /**
33   * Map mode enumeration
34   *
35   * @author peck7 on 27/10/2017.
36   */
37  public enum MapMode implements EnumValue {
38  
39      EMBEDDED_SHAPE_MAP_MODE("EMB_SHAPE", n("dali.core.enums.mapMode.embeddedShape"), new EmbeddedShapeMapConfiguration()),
40  //    SEXTANT_WMS_MAP_MODE("WMS_SEXTANT", n("dali.core.enums.mapMode.sextantWMS"), new SextantWMSMapConfiguration()),
41      SEXTANT_WMTS_MAP_MODE("WMTS_SEXTANT", n("dali.core.enums.mapMode.sextantWMTS"), new SextantWMTSMapConfiguration()),
42      OSM_MAP_MODE("OSM", n("dali.core.enums.mapMode.openStreetMap"), new OSMMapConfiguration()),
43      OTM_MAP_MODE("OTM", n("dali.core.enums.mapMode.openTopoMap"), new OTMMapConfiguration()),
44      CARTO_BASE_MAP_MODE("VOYAGER", n("dali.core.enums.mapMode.cartoBase"), new CartoBaseMapConfiguration()),
45      SATELLITE_MAP_MODE("SATELLITE", n("dali.core.enums.mapMode.satellite"), new SatelliteMapConfiguration());
46  
47      private final String code;
48      private final String i18nKey;
49      private final MapConfiguration mapConfiguration;
50  
51      MapMode(String code, String i18nKey, MapConfiguration mapConfiguration) {
52          this.code = code;
53          this.i18nKey = i18nKey;
54          this.mapConfiguration = mapConfiguration;
55      }
56  
57      @Override
58      public String getCode() {
59          return code;
60      }
61  
62      @Override
63      public String getLabel() {
64          return t(i18nKey);
65      }
66  
67      public MapConfiguration getMapConfiguration() {
68          return mapConfiguration;
69      }
70  
71      public boolean isOnline() {
72          return mapConfiguration.isOnline();
73      }
74  
75      public String getUrl() {
76          return mapConfiguration.getUrl();
77      }
78  
79      public String getBaseLayerName() {
80          return mapConfiguration.getBaseLayerName();
81      }
82  
83      public List<MapLayerDefinition> getMapLayerDefinitions() {
84          return mapConfiguration.getMapLayerDefinitions();
85      }
86  
87      public boolean isProgressiveRender() {
88          return mapConfiguration.isProgressiveRender();
89      }
90  
91      public boolean isTransparent() {
92          return mapConfiguration.isTransparent();
93      }
94  
95  }