annotate artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents e9d912c97fa8
children 0a5239a1e46e
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) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8747
diff changeset
121 log.debug("Query extent for RiverAxis with Srid: "
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8747
diff changeset
122 + getSrid());
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
123 return GeometryUtils.transform(
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
124 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
125 getSrid());
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
126 }
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
127 return GeometryUtils.getRiverBoundary(river.getName());
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
128 }
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
129
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
130 Envelope max = null;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
131
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
132 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
133 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
134
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
135 if (max == null) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
136 max = env;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
137 continue;
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
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
140 max.expandToInclude(env);
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
141 }
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
142
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
143 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
144 ? 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
145 : 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
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
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 @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
149 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
150 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
151 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
152 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
153 " 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
154 }
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
155 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
156 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
157 " 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
158 " 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
159 }
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
160 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
161 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
162 " AND name='" + getName() + "'";
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
163 }
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
164 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
165 " 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
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
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 @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
169 protected String getDataString() {
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
170 if (RiverUtils.isUsingOracle()) {
5304
ffa5eaad3a7b Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents: 4864
diff changeset
171 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
172 }
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
173 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
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
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 @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
177 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
178 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
179 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
180 } // 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
181 }
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
182 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org