Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java @ 3227:ed07dd55f487
Fixed various bugs (package declarations, moved classes to correct places).
flys-artifacts/trunk@4854 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 03 Jul 2012 08:46:14 +0000 |
parents | 0ca00d547f35 |
children | c8f670ae96e8 |
rev | line source |
---|---|
1856
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.w3c.dom.Document; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.apache.log4j.Logger; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import com.vividsolutions.jts.geom.Envelope; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.ArtifactFactory; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.CallMeta; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifactdatabase.state.DefaultOutput; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifactdatabase.state.Facet; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifactdatabase.state.State; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.model.Catchment; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.model.River; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.artifacts.model.FacetTypes; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.flys.artifacts.model.RiverFactory; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.flys.utils.FLYSUtils; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 public class WMSCatchmentArtifact extends WMSDBArtifact { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 public static final String NAME = "catchment"; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 private static final Logger logger = |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 Logger.getLogger(WMSCatchmentArtifact.class); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public void setup( |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 String identifier, |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 ArtifactFactory factory, |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 Object context, |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 CallMeta callMeta, |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 Document data) |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 logger.debug("WMSCatchmentArtifact.setup"); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 super.setup(identifier, factory, context, callMeta, data); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 public String getName() { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 return NAME; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 public State getCurrentState(Object cc) { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 State s = new CatchmentState(this); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 List<Facet> fs = facets.get(getCurrentStateId()); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 DefaultOutput o = new DefaultOutput( |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 "floodmap", |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 "floodmap", |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 "image/png", |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 fs, |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 "map"); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 s.getOutputs().add(o); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 return s; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 public static class CatchmentState extends WMSDBState implements FacetTypes |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 private static final Logger logger = |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 Logger.getLogger(CatchmentState.class); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 protected int riverId; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 public CatchmentState(WMSDBArtifact artifact) { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 super(artifact); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 riverId = 0; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 public int getRiverId() { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 if (riverId == 0) { |
2671
055315495f8d
Modified floodmap specific datacage configuration and improved WMS catchment layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1856
diff
changeset
|
88 String ids = artifact.getDataAsString("ids"); |
055315495f8d
Modified floodmap specific datacage configuration and improved WMS catchment layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1856
diff
changeset
|
89 String[] parts = ids.split(";"); |
1856
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 try { |
2671
055315495f8d
Modified floodmap specific datacage configuration and improved WMS catchment layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1856
diff
changeset
|
92 riverId = Integer.valueOf(parts[0]); |
1856
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 catch (NumberFormatException nfe) { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 logger.error("Cannot parse river id from '" + ids + "'"); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 return riverId; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 protected String getFacetType() { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 return FLOODMAP_CATCHMENT; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 protected String getUrl() { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 return FLYSUtils.getUserWMSUrl(artifact.identifier()); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 protected String getSrid() { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 River river = RiverFactory.getRiver(getRiverId()); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 return FLYSUtils.getRiverSrid(river.getName()); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 protected Envelope getExtent() { |
2671
055315495f8d
Modified floodmap specific datacage configuration and improved WMS catchment layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1856
diff
changeset
|
120 List<Catchment> catchments = |
055315495f8d
Modified floodmap specific datacage configuration and improved WMS catchment layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1856
diff
changeset
|
121 Catchment.getCatchments(getRiverId(), getName()); |
1856
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 Envelope max = null; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 for (Catchment c: catchments) { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 Envelope env = c.getGeom().getEnvelopeInternal(); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 if (max == null) { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 max = env; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 continue; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 max.expandToInclude(env); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 return max; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 protected String getFilter() { |
2671
055315495f8d
Modified floodmap specific datacage configuration and improved WMS catchment layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1856
diff
changeset
|
141 return "river_id=" + String.valueOf(getRiverId()) |
055315495f8d
Modified floodmap specific datacage configuration and improved WMS catchment layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1856
diff
changeset
|
142 + " AND name='" + getName() + "'"; |
1856
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 protected String getDataString() { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 String srid = getSrid(); |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 if (FLYSUtils.isUsingOracle()) { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 return "geom FROM catchment USING SRID " + srid; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 else { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 return "geom FROM catchment USING UNIQUE id USING SRID " + srid; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 @Override |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 protected String getGeometryType() { |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 return "POLYGON"; |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 } // end of WMSKmState |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 } |
410e40b88c7a
Added new WMSCatchmentArtifact for displaying catchments in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |