Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverAxisState.java @ 958:ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
flys-artifacts/trunk@2377 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 20 Jul 2011 15:06:16 +0000 |
parents | a5ea28339e5b |
children | eeebf8514c7f |
comparison
equal
deleted
inserted
replaced
957:e91996b46e3c | 958:ae198bef4ba0 |
---|---|
1 package de.intevation.flys.artifacts.states; | 1 package de.intevation.flys.artifacts.states; |
2 | 2 |
3 import java.util.List; | 3 import java.util.List; |
4 import java.util.Map; | |
4 | 5 |
5 import org.apache.log4j.Logger; | 6 import org.apache.log4j.Logger; |
6 | 7 |
8 import de.intevation.artifacts.CallContext; | |
7 import de.intevation.artifacts.CallMeta; | 9 import de.intevation.artifacts.CallMeta; |
8 | 10 |
9 import de.intevation.artifactdatabase.state.Facet; | 11 import de.intevation.artifactdatabase.state.Facet; |
10 | 12 |
11 import de.intevation.flys.artifacts.FLYSArtifact; | 13 import de.intevation.flys.artifacts.FLYSArtifact; |
14 import de.intevation.flys.artifacts.context.FLYSContext; | |
12 import de.intevation.flys.artifacts.model.WMSLayerFacet; | 15 import de.intevation.flys.artifacts.model.WMSLayerFacet; |
13 import de.intevation.flys.artifacts.resources.Resources; | 16 import de.intevation.flys.artifacts.resources.Resources; |
14 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; | 17 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
15 | 18 |
16 | 19 |
17 public class RiverAxisState extends OutputState { | 20 public class RiverAxisState extends OutputState { |
18 | 21 |
19 public static final String I18N_DESCRIPTION = "floodmap.riveraxis"; | 22 public static final String I18N_DESCRIPTION = "floodmap.riveraxis"; |
20 | 23 |
24 public static final String WMS_LAYER_NAME = "riveraxis"; | |
25 | |
21 | 26 |
22 private static final Logger logger = Logger.getLogger(RiverAxisState.class); | 27 private static final Logger logger = Logger.getLogger(RiverAxisState.class); |
28 | |
23 | 29 |
24 @Override | 30 @Override |
25 public Object computeInit( | 31 public Object computeInit( |
26 FLYSArtifact artifact, | 32 FLYSArtifact artifact, |
27 String hash, | 33 String hash, |
34 Object context, | |
28 CallMeta meta, | 35 CallMeta meta, |
29 List<Facet> facets | 36 List<Facet> facets |
30 ) { | 37 ) { |
31 logger.debug("RiverAxisState.computeInit()"); | 38 logger.debug("RiverAxisState.computeInit()"); |
39 | |
40 FLYSContext flysContext = null; | |
41 | |
42 if (context instanceof FLYSContext) { | |
43 flysContext = (FLYSContext) context; | |
44 } | |
45 else { | |
46 flysContext = (FLYSContext) ((CallContext) context).globalContext(); | |
47 } | |
48 | |
49 Map<String, String> wms = (Map<String, String>) | |
50 flysContext.get(FLYSContext.RIVER_WMS); | |
51 | |
52 String river = artifact.getDataAsString("river"); | |
53 | |
54 if(river == null || river.length() == 0) { | |
55 logger.warn("No river found in the current parameterization."); | |
56 return null; | |
57 } | |
58 | |
59 String url = wms.get(river); | |
32 | 60 |
33 // TODO Add config for background layer | 61 // TODO Add config for background layer |
34 WMSLayerFacet facet = new WMSLayerFacet( | 62 WMSLayerFacet facet = new WMSLayerFacet( |
35 0, | 63 0, |
36 FLOODMAP_RIVERAXIS, | 64 FLOODMAP_RIVERAXIS, |
37 Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION), | 65 Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION), |
38 ComputeType.INIT, | 66 ComputeType.INIT, |
39 getID(), hash, | 67 getID(), hash, |
40 "http://denmark.atlas/cgi-bin/flys-wms"); // TODO add correct WMS URL | 68 url); |
41 | 69 |
42 facet.addLayer("riveraxis"); | 70 facet.addLayer(WMS_LAYER_NAME); |
43 | 71 |
44 // TODO determine extent based on the given geometry | 72 // TODO determine extent based on the given geometry |
45 facet.setExtent("6.5 49.1 7.0 49.7"); | 73 facet.setExtent("6.5 49.1 7.0 49.7"); |
46 | 74 |
47 facets.add(facet); | 75 facets.add(facet); |