annotate artifacts/src/main/java/org/dive4elements/river/artifacts/RiverAxisArtifact.java @ 7167:2fd238b681a9

Add debug output triggered by debugging the last commit
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 26 Sep 2013 12:22:01 +0200
parents 4eaa7c84c0a5
children 8d5ca5175038
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.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
18 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
19 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
20 import org.dive4elements.river.artifacts.model.RiverFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
21 import org.dive4elements.river.model.River;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
22 import org.dive4elements.river.model.RiverAxis;
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
23 import org.dive4elements.river.utils.RiverUtils;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5477
diff changeset
24 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
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 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
27
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 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
29 import org.w3c.dom.Document;
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
30
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
31 @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
32 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
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 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
35
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 private static final Logger logger =
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 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
39
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 @Override
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
42 public void setup(
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
43 String identifier,
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
44 ArtifactFactory factory,
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
45 Object context,
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
46 CallMeta callMeta,
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
47 Document data)
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
48 {
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
49 logger.debug("RiverAxisArtifact.setup");
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
50
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
51 super.setup(identifier, factory, context, callMeta, data);
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
52 }
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
53
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
54
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
55 @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
56 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
57 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
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
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 @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
62 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
63 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
64
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3923
diff changeset
65 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
66
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 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
68 "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
69 "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
70 "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
71 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
72 "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
73
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 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
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 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
77 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
78
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
79
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
80 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
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 private static final Logger logger =
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 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
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 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
86 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
87
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1845
diff changeset
88 public RiverAxisState(){}
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1845
diff changeset
89
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
90 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
91 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
92 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
93
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
94 private boolean isUnofficial() {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
95 return getIdPart(2) != null && !getIdPart(2).equals("1");
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
96 }
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
97
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
98 @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
99 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
100 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
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
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
104 protected String getLayer() {
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
105 if (isUnofficial()) {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
106 return super.getLayer();
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
107 }
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
108 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
109 }
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
110
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4497
diff changeset
111 @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
112 protected String getUrl() {
6705
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
113 if (isUnofficial()) {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
114 return RiverUtils.getUserWMSUrl(artifact.identifier());
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
115 } else {
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
116 return RiverUtils.getRiverWMSUrl();
f3d0aac478cd issue766: Minimal fix for doubled RiverAxis.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
117 }
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
118 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
119
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
120 @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
121 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
122 River river = RiverFactory.getRiver(getRiverId());
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
123 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
124 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
125
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
126 @Override
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
127 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
128 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
129 List<RiverAxis> axes;
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
130
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
131 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
132
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
133 if (kind != null && kind.equals("1")) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
134 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
135 Integer.parseInt(kind));
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
136 } else if (kind != null) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
137 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
138 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
139 } else {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
140 if (reproject) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
141 logger.debug("Query extent for RiverAxis with Srid: " + getSrid());
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
142 return GeometryUtils.transform(
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
143 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
144 getSrid());
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
145 } else {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
146 return GeometryUtils.transform(
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
147 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
148 "31467");
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
149 }
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
150 }
5477
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
151
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
152 Envelope max = null;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
153
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
154 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
155 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
156
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
157 if (max == null) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
158 max = env;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
159 continue;
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
160 }
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
161
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
162 max.expandToInclude(env);
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
163 }
5477
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 max != null && reproject
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
166 ? 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
167 : 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
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
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 @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
171 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
172 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
173 if (kind != null && kind.equals("1")) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
174 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
175 " 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
176 } else if (kind != null) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
177 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
178 " 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
179 " AND name='" + getName() + "'";
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
180 } else if (getIdPart(1) != null) {
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
181 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
182 " AND name='" + getName() + "'";
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
183 }
ae60bb7b8085 Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents: 5304
diff changeset
184 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
185 " 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
186 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
187
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
188 @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
189 protected String getDataString() {
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
190 if (RiverUtils.isUsingOracle()) {
5304
ffa5eaad3a7b Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents: 4864
diff changeset
191 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
192 }
06c157848c8f Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1832
diff changeset
193 else {
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
194 return "geom FROM river_axes USING UNIQUE id";
1845
06c157848c8f Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1832
diff changeset
195 }
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
196 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
197
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
198 @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
199 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
200 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
201 }
a8910c1c82fb Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1771
diff changeset
202 } // 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
203 }
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
204 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org