annotate artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java @ 9726:0a5239a1e46e 3.2.x

Upgrade to Log4j 2
author Tom Gottfried <tom@intevation.de>
date Wed, 02 Mar 2022 10:26:50 +0100
parents 5e38e2924c07
children a41f9c355204
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
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
26 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
27 import org.apache.logging.log4j.LogManager;
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
28
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
29 @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
30 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
31
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 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
33
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7855
diff changeset
35 private static final Logger log =
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
36 LogManager.getLogger(RiverAxisArtifact.class);
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
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
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 @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
40 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
41 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
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
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 @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
46 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
47 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
48
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3923
diff changeset
49 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
50
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 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
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 "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
54 "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
55 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
56 "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
57
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 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
59
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 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
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
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
64 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
65 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7855
diff changeset
66 private static final Logger log =
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
67 LogManager.getLogger(RiverAxisState.class);
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
68
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 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
70 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
71
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1845
diff changeset
72 public RiverAxisState(){}
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1845
diff changeset
73
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
74 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
75 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
76 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
77
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
78 private boolean isUnofficial() {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
79 return getIdPart(2) != null && !getIdPart(2).equals("1");
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
80 }
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
81
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
82 @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
83 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
84 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
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
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
87 @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
88 protected String getLayer() {
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
89 if (isUnofficial()) {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
90 return super.getLayer();
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
91 }
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
92 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
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
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
95 @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
96 protected String getUrl() {
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
97 if (isUnofficial()) {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
98 return RiverUtils.getUserWMSUrl(artifact.identifier());
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
99 } else {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
100 return RiverUtils.getRiverWMSUrl();
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
101 }
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
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
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 @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
105 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
106 River river = RiverFactory.getRiver(getRiverId());
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
107 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
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
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
110 @Override
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
111 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
112 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
113 List<RiverAxis> axes;
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
114
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
115 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
116
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
117 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
118 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
119 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
120 } else {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
121 if (reproject) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8747
diff changeset
122 log.debug("Query extent for RiverAxis with Srid: "
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8747
diff changeset
123 + getSrid());
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
124 return GeometryUtils.transform(
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
125 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
126 getSrid());
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
127 }
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
128 return GeometryUtils.getRiverBoundary(river.getName());
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
129 }
5477
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 Envelope max = null;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
132
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
133 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
134 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
135
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
136 if (max == null) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
137 max = env;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
138 continue;
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
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
141 max.expandToInclude(env);
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
142 }
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
143
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
144 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
145 ? 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
146 : 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
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
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 @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
150 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
151 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
152 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
153 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
154 " 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
155 }
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
156 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
157 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
158 " 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
159 " 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
160 }
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
161 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
162 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
163 " AND name='" + getName() + "'";
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
164 }
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
165 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
166 " 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
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
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 @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
170 protected String getDataString() {
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
171 if (RiverUtils.isUsingOracle()) {
5304
ffa5eaad3a7b Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents: 4864
diff changeset
172 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
173 }
8747
e9d912c97fa8 We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
174 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
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
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 @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
178 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
179 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
180 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
181 } // 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
182 }
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
183 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org