annotate artifacts/src/main/java/org/dive4elements/river/artifacts/MapArtifact.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents 8d5ca5175038
children 5e38e2924c07
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: 5272
diff changeset
9 package org.dive4elements.river.artifacts;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
11 import org.dive4elements.artifactdatabase.ProtocolUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
12 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
13 import org.dive4elements.artifactdatabase.state.Output;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
14 import org.dive4elements.artifactdatabase.state.State;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
15 import org.dive4elements.artifactdatabase.state.StateEngine;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
16 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
17 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
18 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
19 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
20 import org.dive4elements.river.artifacts.RiverAxisArtifact.RiverAxisState;
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
21 import org.dive4elements.river.artifacts.context.RiverContext;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
22 import org.dive4elements.river.artifacts.model.map.WMSDBLayerFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
23 import org.dive4elements.river.artifacts.states.DefaultState;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
24 import org.dive4elements.river.model.River;
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
25 import org.dive4elements.river.utils.RiverUtils;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5272
diff changeset
26 import org.dive4elements.river.utils.MapUtils;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@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: 4841
diff changeset
28 import java.util.List;
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4841
diff changeset
29
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4841
diff changeset
30 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: 4841
diff changeset
31 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: 4841
diff changeset
32 import org.w3c.dom.Element;
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
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
35 public class MapArtifact extends D4EArtifact {
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
37 private static final Logger log =
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 Logger.getLogger(MapArtifact.class);
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 @Override
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 public void setup(
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 String identifier,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 ArtifactFactory factory,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 Object context,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 CallMeta callmeta,
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7747
diff changeset
46 Document data,
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7747
diff changeset
47 List<Class> loadFacets)
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
49 log.debug("MapArtifact.setup");
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 this.identifier = identifier;
2109
60e3bf470c5b Changed the MapArtifact name to 'new_map'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2089
diff changeset
51 name = "new_map";
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52
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
53 List<State> states = getStates(context);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54
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
55 setCurrentState(states.get(0));
7747
cfa7e2164f87 Partial fix issue1532: at least clone artifacts data when cloning
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
56
cfa7e2164f87 Partial fix issue1532: at least clone artifacts data when cloning
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
57 // Needed if cloning another artifact.
cfa7e2164f87 Partial fix issue1532: at least clone artifacts data when cloning
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
58 super.handleInitModel(data, context, callmeta);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 }
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
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 @Override
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3083
diff changeset
63 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
64 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
65 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
66 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
67 ) {
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 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
69 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
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 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
72 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
73 "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
74 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
75 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
76 }
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
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
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 /**
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 * 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
81 */
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3083
diff changeset
82 @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
83 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
84 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
85 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
86 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
87 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
88 {
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 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
90
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
91 RiverContext flysContext = RiverUtils.getFlysContext(context);
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
92 StateEngine engine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
93 RiverContext.STATE_ENGINE_KEY);
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
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 for (String stateId: stateIds) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
96 log.debug("Append output modes for state: " + 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
97 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
98
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 List<Output> list = state.getOutputs();
3555
b1912514e0f5 s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3302
diff changeset
100 if (list == null || list.isEmpty()) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
101 log.debug("-> No output modes for this 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
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
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4049
diff changeset
105 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
106
3555
b1912514e0f5 s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3302
diff changeset
107 if (fs == null || fs.isEmpty()) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
108 log.debug("No facets for previous state found.");
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
109 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
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
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
112 log.debug("Found " + fs.size() + " facets in previous states.");
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
113
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 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
115
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 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
117 }
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
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 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
120 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
121 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
122 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
123 if (list != null && list.size() > 0) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
124 log.debug(
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
125 "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
126
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4049
diff changeset
127 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
128
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 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
130 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
131
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
132 log.debug("Found " + fs.size() + " current facets.");
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
133 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
134 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
135 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
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 }
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 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
139 log.debug("No facets found for the current 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
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 }
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
142 }
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
143 }
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
144 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
145 // 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
146 }
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
147 }
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
148
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 public static class MapState extends RiverAxisState {
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 @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
152 public Object computeAdvance(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
153 D4EArtifact artifact,
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 String hash,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 CallContext context,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 List<Facet> facets,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 Object old)
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
159 log.debug("MapState.computeAdvance");
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
160
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
161 this.artifact = artifact;
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 String type = getFacetType();
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 WMSDBLayerFacet facet = new WMSDBLayerFacet(
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 0,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 type,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 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
169 ComputeType.ADVANCE,
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 getID(), hash,
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 getUrl());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172
5272
da3101abc9da Use river name as layername in new map projects.
Raimund Renkert <rrenkert@intevation.de>
parents: 4864
diff changeset
173 String name = artifact.getDataAsString("river");
4864
dc0d37715e16 Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
Christian Lins <christian.lins@intevation.de>
parents: 4841
diff changeset
174
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 facet.addLayer(name);
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3555
diff changeset
176 facet.setExtent(getExtent(false));
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3555
diff changeset
177 facet.setOriginalExtent(getExtent(true));
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 facet.setSrid(getSrid());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 facet.setData(getDataString());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 facet.setFilter(getFilter());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 facet.setGeometryType(getGeometryType());
4841
ad0990a82ab8 Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents: 4497
diff changeset
182 facet.setConnection(MapUtils.getConnection());
ad0990a82ab8 Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents: 4497
diff changeset
183 facet.setConnectionType(MapUtils.getConnectionType());
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 facet.setLabelItem(getLabelItem());
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 facets.add(facet);
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 null;
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 @Override
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 public int getRiverId() {
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
193 River r = RiverUtils.getRiver(artifact);
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 int riverId = r.getId();
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 return riverId;
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 }
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 }
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 }
3083
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2109
diff changeset
200 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org