annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java @ 1870:ec458853f560

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

http://dive4elements.wald.intevation.org