Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java @ 4844:787733641877
Added tag 2.9.8 for changeset 88014b9852d0
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 23 Jan 2013 18:15:04 +0100 |
parents | ad0990a82ab8 |
children | dc0d37715e16 |
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; |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
8 import org.w3c.dom.Element; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.ArtifactFactory; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.CallMeta; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.CallContext; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
14 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
15 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
16 import de.intevation.artifactdatabase.ProtocolUtils; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifactdatabase.state.Facet; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifactdatabase.state.State; |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
19 import de.intevation.artifactdatabase.state.StateEngine; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
20 import de.intevation.artifactdatabase.state.Output; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.flys.model.River; |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
23 import de.intevation.flys.utils.FLYSUtils; |
4841
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4497
diff
changeset
|
24 import de.intevation.flys.utils.MapUtils; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
26 import de.intevation.flys.artifacts.RiverAxisArtifact.RiverAxisState; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
27 import de.intevation.flys.artifacts.states.DefaultState; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
28 import de.intevation.flys.artifacts.context.FLYSContext; |
3302
453d2d0c4258
Organized and added missing imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3193
diff
changeset
|
29 import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
32 public class MapArtifact extends FLYSArtifact { |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 private static final Logger logger = |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 Logger.getLogger(MapArtifact.class); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 public void setup( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 String identifier, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 ArtifactFactory factory, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 Object context, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 CallMeta callmeta, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 Document data) |
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 logger.debug("MapArtifact.setup"); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 this.identifier = identifier; |
2109
60e3bf470c5b
Changed the MapArtifact name to 'new_map'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2089
diff
changeset
|
47 name = "new_map"; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
49 List<State> states = getStates(context); |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
51 setCurrentState(states.get(0)); |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 @Override |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3083
diff
changeset
|
56 protected void appendBackgroundActivity( |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
57 ElementCreator cr, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
58 Element root, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
59 CallContext context |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
60 ) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
61 Element inBackground = cr.create("background-processing"); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
62 root.appendChild(inBackground); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
63 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
64 cr.addAttr( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
65 inBackground, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
66 "value", |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
67 String.valueOf(context.isInBackground()), |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
68 true); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
69 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
70 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
71 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
72 /** |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
73 * Append output mode nodes to a document. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
74 */ |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3083
diff
changeset
|
75 @Override |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
76 protected void appendOutputModes( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
77 Document doc, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
78 Element outs, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
79 CallContext context, |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
80 String uuid) |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
81 { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
82 List<String> stateIds = getPreviousStateIds(); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
83 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
84 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
85 StateEngine engine = (StateEngine) flysContext.get( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
86 FLYSContext.STATE_ENGINE_KEY); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
87 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
88 for (String stateId: stateIds) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
89 logger.debug("Append output modes for state: " + stateId); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
90 DefaultState state = (DefaultState) engine.getState(stateId); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
91 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
92 List<Output> list = state.getOutputs(); |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3302
diff
changeset
|
93 if (list == null || list.isEmpty()) { |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
94 logger.debug("-> No output modes for this state."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
95 continue; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
96 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
97 |
4497
a2735a4bf75e
Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4049
diff
changeset
|
98 List<Facet> fs = getFacets(stateId); |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
99 |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3302
diff
changeset
|
100 if (fs == null || fs.isEmpty()) { |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
101 logger.debug("No facets for previous state found."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
102 continue; |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
103 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
104 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
105 logger.debug("Found " + fs.size() + " facets in previous states."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
106 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
107 List<Output> generated = generateOutputs(list, fs); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
108 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
109 ProtocolUtils.appendOutputModes(doc, outs, generated); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
110 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
111 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
112 try { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
113 DefaultState cur = (DefaultState) getCurrentState(context); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
114 if (cur.validate(this)) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
115 List<Output> list = cur.getOutputs(); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
116 if (list != null && list.size() > 0) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
117 logger.debug( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
118 "Append output modes for current state: " + cur.getID()); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
119 |
4497
a2735a4bf75e
Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4049
diff
changeset
|
120 List<Facet> fs = getFacets(cur.getID()); |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
121 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
122 if (fs != null && fs.size() > 0) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
123 List<Output> generated = generateOutputs(list, fs); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
124 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
125 logger.debug("Found " + fs.size() + " current facets."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
126 if (!generated.isEmpty()) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
127 ProtocolUtils.appendOutputModes( |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
128 doc, outs, generated); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
129 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
130 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
131 else { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
132 logger.debug("No facets found for the current state."); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
133 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
134 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
135 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
136 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
137 catch (IllegalArgumentException iae) { |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
138 // state is not valid, so we do not append its outputs. |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
139 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
140 } |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
141 |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 public static class MapState extends RiverAxisState { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 @Override |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
145 public Object computeAdvance( |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 FLYSArtifact artifact, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 String hash, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 CallContext context, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 List<Facet> facets, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 Object old) |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 { |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
152 logger.debug("MapState.computeAdvance"); |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
153 |
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
154 this.artifact = artifact; |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 String type = getFacetType(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 WMSDBLayerFacet facet = new WMSDBLayerFacet( |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 0, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 type, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 getTitle(context.getMeta()), |
2089
0da8874bd378
Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2082
diff
changeset
|
162 ComputeType.ADVANCE, |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 getID(), hash, |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 getUrl()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 String name = type + "-" + artifact.identifier(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 facet.addLayer(name); |
3918
2fdbe78a8fc2
Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3555
diff
changeset
|
168 facet.setExtent(getExtent(false)); |
2fdbe78a8fc2
Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3555
diff
changeset
|
169 facet.setOriginalExtent(getExtent(true)); |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 facet.setSrid(getSrid()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 facet.setData(getDataString()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 facet.setFilter(getFilter()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 facet.setGeometryType(getGeometryType()); |
4841
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4497
diff
changeset
|
174 facet.setConnection(MapUtils.getConnection()); |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4497
diff
changeset
|
175 facet.setConnectionType(MapUtils.getConnectionType()); |
2082
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 facet.setLabelItem(getLabelItem()); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 facets.add(facet); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 return null; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 @Override |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 public int getRiverId() { |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 River r = FLYSUtils.getRiver(artifact); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 int riverId = r.getId(); |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 return riverId; |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 } |
007a8f5ed9f1
Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 } |
3083
4bd3d8bbb60c
Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2109
diff
changeset
|
192 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |