Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java @ 2085:dd3f5bd174ea
Fix typo in meta data, such that string can be translated in GUI.
flys-artifacts/trunk@3606 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 06 Jan 2012 07:57:28 +0000 |
parents | 007a8f5ed9f1 |
children | 0da8874bd378 |
rev | line source |
---|---|
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.ArtifactFactory; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.CallMeta; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.CallContext; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifactdatabase.state.DefaultOutput; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifactdatabase.state.Facet; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifactdatabase.state.State; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.artifacts.model.WMSDBLayerFacet; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.model.River; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.artifacts.model.FacetTypes; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.flys.artifacts.model.RiverFactory; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.flys.artifacts.resources.Resources; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.utils.FLYSUtils; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.utils.GeometryUtils; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 public class MapArtifact extends RiverAxisArtifact { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 private static final Logger logger = |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 Logger.getLogger(MapArtifact.class); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 public void setup( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 String identifier, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 ArtifactFactory factory, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 Object context, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 CallMeta callmeta, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 Document data) |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 logger.debug("MapArtifact.setup"); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 this.identifier = identifier; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 public State getCurrentState(Object cc) { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 logger.debug("MapArtifact.getCurrentState"); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 State state = new MapState(this); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 List<Facet> fs = facets.get(getCurrentStateId()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 DefaultOutput o = new DefaultOutput( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 "floodmap", |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 "floodmap", |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 "image/png", |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 fs, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 "map"); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 state.getOutputs().add(o); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 return state; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 public String getCurrentStateId() { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 return "state.map.new"; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 public static class MapState extends RiverAxisState { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 public MapState() { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 public MapState(MapArtifact artifact) { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 super(artifact); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 this.id = "state.map.new"; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 public Object computeInit( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 FLYSArtifact artifact, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 String hash, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 Object context, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 CallMeta meta, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 List<Facet> facets) |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 return null; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 public Object computeFeed( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 FLYSArtifact artifact, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 String hash, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 CallContext context, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 List<Facet> facets, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 Object old) |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 logger.debug("MapState.computeFeed"); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 String type = getFacetType(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 WMSDBLayerFacet facet = new WMSDBLayerFacet( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 0, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 type, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 getTitle(context.getMeta()), |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 ComputeType.FEED, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 getID(), hash, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 getUrl()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 String name = type + "-" + artifact.identifier(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 facet.addLayer(name); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 facet.setExtent(getExtent()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 facet.setSrid(getSrid()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 facet.setData(getDataString()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 facet.setFilter(getFilter()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 facet.setGeometryType(getGeometryType()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 facet.setConnection(getConnection()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 facet.setConnectionType(getConnectionType()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 facet.setLabelItem(getLabelItem()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 facets.add(facet); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 return null; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 public int getRiverId() { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 River r = FLYSUtils.getRiver(artifact); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 int riverId = r.getId(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 return riverId; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 } |