annotate artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java @ 8755:30b1ddadf275

(issue1801) Unify reference gauge finding code The basic way as described in the method comment of the determineRefGauge method is now used in the WINFOArtifact, MainValuesService and RiverUtils.getGauge method. RiverUtils.getGauge previously just returned the first gauge found. While this is now a behavior change I believe that it is always more correct then the undeterministic behavior of the previous implmenentation.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 24 Jun 2015 14:07:26 +0200
parents e9d912c97fa8
children 5e38e2924c07
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
9 package org.dive4elements.river.artifacts;
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
10
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
11 import com.vividsolutions.jts.geom.Envelope;
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
12 import com.vividsolutions.jts.geom.Geometry;
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
13
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
14 import org.dive4elements.artifactdatabase.state.DefaultOutput;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
15 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
16 import org.dive4elements.artifactdatabase.state.State;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
17 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
18 import org.dive4elements.river.artifacts.model.RiverFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
19 import org.dive4elements.river.model.River;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
20 import org.dive4elements.river.model.RiverAxis;
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
21 import org.dive4elements.river.utils.RiverUtils;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
22 import org.dive4elements.river.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
23
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
24 import java.util.List;
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
25
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
26 import org.apache.log4j.Logger;
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
27
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
28 @Deprecated
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
29 public class RiverAxisArtifact extends WMSDBArtifact {
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
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 public static final String NAME = "riveraxis";
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
32
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
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7855
diff changeset
34 private static final Logger log =
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
35 Logger.getLogger(RiverAxisArtifact.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
36
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
37
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 @Override
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
39 public String getName() {
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
40 return NAME;
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
41 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
42
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
43
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
44 @Override
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
45 public State getCurrentState(Object cc) {
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
46 State s = new RiverAxisState(this);
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
47
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3923
diff changeset
48 List<Facet> fs = getFacets(getCurrentStateId());
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
49
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
50 DefaultOutput o = new DefaultOutput(
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
51 "floodmap",
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
52 "floodmap",
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
53 "image/png",
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
54 fs,
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
55 "map");
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
56
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
57 s.getOutputs().add(o);
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
58
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
59 return s;
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
60 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
61
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
62
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
63 public static class RiverAxisState extends WMSDBState implements FacetTypes
1075
feaf778d510e Changed the way of collecting the data for the RiverAxisArtifact - use the database instead of a Master-Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 958
diff changeset
64 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7855
diff changeset
65 private static final Logger log =
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
66 Logger.getLogger(RiverAxisState.class);
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
67
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
68 protected Geometry geom;
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
69 protected int riverId;
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
70
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1845
diff changeset
71 public RiverAxisState(){}
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1845
diff changeset
72
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
73 public RiverAxisState(D4EArtifact artifact) {
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
74 super(artifact);
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
75 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
76
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
77 private boolean isUnofficial() {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
78 return getIdPart(2) != null && !getIdPart(2).equals("1");
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
79 }
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
80
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
81 @Override
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
82 protected String getFacetType() {
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
83 return FLOODMAP_RIVERAXIS;
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
84 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
85
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
86 @Override
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
87 protected String getLayer() {
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
88 if (isUnofficial()) {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
89 return super.getLayer();
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
90 }
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
91 return RiverFactory.getRiver(getRiverId()).getName();
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
92 }
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
93
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
94 @Override
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
95 protected String getUrl() {
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
96 if (isUnofficial()) {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
97 return RiverUtils.getUserWMSUrl(artifact.identifier());
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
98 } else {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
99 return RiverUtils.getRiverWMSUrl();
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
100 }
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
101 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
102
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
103 @Override
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
104 protected String getSrid() {
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
105 River river = RiverFactory.getRiver(getRiverId());
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
106 return RiverUtils.getRiverSrid(river.getName());
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
107 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
108
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
109 @Override
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
110 protected Envelope getExtent(boolean reproject) {
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
111 River river = RiverFactory.getRiver(getRiverId());
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
112 List<RiverAxis> axes;
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
113
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
114 String kind = getIdPart(2);
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
115
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
116 if (kind != null && !kind.equals(RiverAxis.KIND_CURRENT)) {
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
117 axes = RiverAxis.getRiverAxis(river.getName(),
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
118 getName(), Integer.parseInt(kind));
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
119 } else {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
120 if (reproject) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7855
diff changeset
121 log.debug("Query extent for RiverAxis with Srid: " + getSrid());
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
122 return GeometryUtils.transform(
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
123 GeometryUtils.getRiverBoundary(river.getName()),
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
124 getSrid());
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
125 }
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
126 return GeometryUtils.getRiverBoundary(river.getName());
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
127 }
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
128
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
129 Envelope max = null;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
130
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
131 for (RiverAxis ax: axes) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
132 Envelope env = ax.getGeom().getEnvelopeInternal();
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
133
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
134 if (max == null) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
135 max = env;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
136 continue;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
137 }
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
138
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
139 max.expandToInclude(env);
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
140 }
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
141
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
142 return max != null && reproject
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
143 ? GeometryUtils.transform(max, getSrid())
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
144 : max;
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
145 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
146
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
147 @Override
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
148 protected String getFilter() {
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
149 String kind = getIdPart(2);
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
150 if (kind != null && kind.equals(RiverAxis.KIND_CURRENT)) {
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
151 return "river_id=" + String.valueOf(getRiverId()) +
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
152 " AND kind_id=" + kind;
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
153 }
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
154 if (kind != null) {
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
155 return "river_id=" + String.valueOf(getRiverId()) +
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
156 " AND kind_id=" + kind +
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
157 " AND name='" + getName() + "'";
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
158 }
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
159 if (getIdPart(1) != null) {
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
160 return "river_id=" + String.valueOf(getRiverId()) +
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
161 " AND name='" + getName() + "'";
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
162 }
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
163 return "river_id=" + String.valueOf(getRiverId()) +
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
164 " AND kind_id=" + kind;
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
165 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
166
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
167 @Override
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
168 protected String getDataString() {
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
169 if (RiverUtils.isUsingOracle()) {
5304
ffa5eaad3a7b Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents: 4864
diff changeset
170 return "geom FROM river_axes USING SRID " + getSrid();
1845
06c157848c8f Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1832
diff changeset
171 }
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
172 return "geom FROM river_axes USING UNIQUE id";
1832
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
173 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
174
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
175 @Override
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
176 protected String getGeometryType() {
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
177 return "LINE";
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
178 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
179 } // end of WMSKmState
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
180 }
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
181 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org