Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverAxisState.java @ 1767:b2730e31ff5b
Store Facets without association to state id.
flys-artifacts/trunk@3088 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 26 Oct 2011 12:45:34 +0000 |
parents | fbe18ad4caff |
children | 092e1e5020bc |
rev | line source |
---|---|
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
4 import java.util.Map; |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
8 import de.intevation.artifacts.CallContext; |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.CallMeta; |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifactdatabase.state.Facet; |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.FLYSArtifact; |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
14 import de.intevation.flys.artifacts.context.FLYSContext; |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.artifacts.model.WMSLayerFacet; |
954
a5ea28339e5b
Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
16 import de.intevation.flys.artifacts.resources.Resources; |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1063
diff
changeset
|
18 import de.intevation.flys.utils.FLYSUtils; |
1052
eeebf8514c7f
The boundary (extent) for the river axis is determined based on its geometry - this extent is written into the wms facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
19 import de.intevation.flys.utils.GeometryUtils; |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public class RiverAxisState extends OutputState { |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
954
a5ea28339e5b
Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
24 public static final String I18N_DESCRIPTION = "floodmap.riveraxis"; |
a5ea28339e5b
Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
25 |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
26 public static final String WMS_LAYER_NAME = "riveraxis"; |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
27 |
1052
eeebf8514c7f
The boundary (extent) for the river axis is determined based on its geometry - this extent is written into the wms facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
28 |
954
a5ea28339e5b
Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
29 |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 private static final Logger logger = Logger.getLogger(RiverAxisState.class); |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
32 |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 @Override |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 public Object computeInit( |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 FLYSArtifact artifact, |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 String hash, |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
37 Object context, |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 CallMeta meta, |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 List<Facet> facets |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 ) { |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 logger.debug("RiverAxisState.computeInit()"); |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
43 FLYSContext flysContext = null; |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
44 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
45 if (context instanceof FLYSContext) { |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
46 flysContext = (FLYSContext) context; |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
47 } |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
48 else { |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
49 flysContext = (FLYSContext) ((CallContext) context).globalContext(); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
50 } |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
51 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
52 Map<String, String> wms = (Map<String, String>) |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
53 flysContext.get(FLYSContext.RIVER_WMS); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
54 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
55 String river = artifact.getDataAsString("river"); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
56 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
57 if(river == null || river.length() == 0) { |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
58 logger.warn("No river found in the current parameterization."); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
59 return null; |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
60 } |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
61 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
62 String url = wms.get(river); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
63 |
954
a5ea28339e5b
Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
64 // TODO Add config for background layer |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 WMSLayerFacet facet = new WMSLayerFacet( |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 0, |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 FLOODMAP_RIVERAXIS, |
954
a5ea28339e5b
Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
68 Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION), |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 ComputeType.INIT, |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 getID(), hash, |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
71 url); |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
954
diff
changeset
|
73 facet.addLayer(WMS_LAYER_NAME); |
1144
c07e9e9c7482
Set the river extent for WMSLayers in the FloodMapState.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
74 facet.setExtent(GeometryUtils.getRiverBounds(river)); |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1063
diff
changeset
|
75 facet.setSrid(FLYSUtils.getRiverSrid(artifact)); |
954
a5ea28339e5b
Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
76 |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 facets.add(facet); |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 return null; |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 } |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |