annotate flys-artifacts/src/main/java/de/intevation/flys/wsplgen/FacetCreator.java @ 4242:448cbd8708d5

Added new classes for the last commit.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 24 Oct 2012 14:44:12 +0200
parents 36147ddb2c32
children 6ccdcb956c14
rev   line source
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.wsplgen;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.List;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
2091
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
6 import org.apache.log4j.Logger;
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
7
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
8 import com.vividsolutions.jts.geom.Envelope;
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
9
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import de.intevation.artifactdatabase.state.Facet;
3302
453d2d0c4258 Organized and added missing imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3083
diff changeset
11 import de.intevation.artifacts.CallContext;
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import de.intevation.flys.artifacts.FLYSArtifact;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import de.intevation.flys.artifacts.model.FacetTypes;
3302
453d2d0c4258 Organized and added missing imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3083
diff changeset
14 import de.intevation.flys.artifacts.model.map.WMSLayerFacet;
453d2d0c4258 Organized and added missing imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3083
diff changeset
15 import de.intevation.flys.artifacts.model.map.WSPLGENLayerFacet;
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.artifacts.resources.Resources;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
3302
453d2d0c4258 Organized and added missing imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3083
diff changeset
18 import de.intevation.flys.model.CrossSectionTrack;
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.flys.utils.FLYSUtils;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.utils.GeometryUtils;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.utils.MapfileGenerator;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public class FacetCreator implements FacetTypes {
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
2639
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
26 public static final String I18N_WSPLGEN_RESULT = "floodmap.uesk";
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
27 public static final String I18N_WSPLGEN_DEFAULT = "floodmap.uesk";
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
28 public static final String I18N_BARRIERS = "floodmap.barriers";
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
29 public static final String I18N_BARRIERS_DEFAULT = "floodmap.barriers";
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
30 public static final String I18N_USERSHAPE = "floodmap.usershape";
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
31 public static final String I18N_USERSHAPE_DEFAULT = "floodmap.usershape";
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 protected FLYSArtifact artifact;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 protected CallContext cc;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 protected List<Facet> facets;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 protected List<Facet> tmpFacets;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 protected String url;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 protected String hash;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 protected String stateId;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
2091
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
44
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
45 private static Logger logger = Logger.getLogger(FacetCreator.class);
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
46
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
47
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 public FacetCreator(
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 FLYSArtifact artifact,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 CallContext cc,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 String hash,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 String sId,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 List<Facet> facets
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 ) {
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 this.tmpFacets = new ArrayList<Facet>(2);
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 this.facets = facets;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 this.artifact = artifact;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 this.cc = cc;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 this.hash = hash;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 this.stateId = sId;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 protected String getRiver() {
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 return artifact.getDataAsString("river");
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 protected String getUrl() {
1792
49ad801076e4 Enabled the MapGenerator to create WMS layers with database datastore - riveraxis is the first layer that is no longer fetched from static WMS service but from user specific one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1775
diff changeset
68 return FLYSUtils.getUserWMSUrl(artifact.identifier());
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 protected String getSrid() {
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 return FLYSUtils.getRiverSrid(artifact);
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
75 protected Envelope getWSPLGENBounds() {
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 String river = getRiver();
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 double kms[] = FLYSUtils.getKmRange(artifact);
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
2091
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
79 logger.debug("### getWSPLGENBounds");
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
80 logger.debug("### from km: " + kms[0]);
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
81 logger.debug("### to km: " + kms[1]);
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
82
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 CrossSectionTrack a =
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 CrossSectionTrack.getCrossSectionTrack(river, kms[0]);
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 CrossSectionTrack b =
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 CrossSectionTrack.getCrossSectionTrack(river, kms[1]);
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 if (a == null || b == null) {
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 return null;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
93 Envelope envA = a.getGeom().getEnvelopeInternal();
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
94 Envelope envB = b.getGeom().getEnvelopeInternal();
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
95
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
96 envA.expandToInclude(envB);
3925
36147ddb2c32 Set the missing 'originalExtent' attribute for WSPLGEN layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3302
diff changeset
97 envA = GeometryUtils.transform(envA, getSrid());
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
98
2091
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
99 logger.debug("### => " + envA);
5d158f8ad080 #298 Fixed broken auto-zoom-to-wsplgen in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1956
diff changeset
100
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
101 return envA;
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
104 protected Envelope getBounds() {
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
105 return GeometryUtils.getRiverBoundary(getRiver());
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 public List<Facet> getFacets() {
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 return tmpFacets;
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 public void createWSPLGENFacet() {
2638
ccad7a6ddaa4 Issue 560.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2091
diff changeset
113 WSPLGENLayerFacet wsplgen = new WSPLGENLayerFacet(
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 0,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 FLOODMAP_WSPLGEN,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 Resources.getMsg(
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 cc.getMeta(),
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 I18N_WSPLGEN_RESULT,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 I18N_WSPLGEN_DEFAULT),
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 ComputeType.ADVANCE,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 stateId,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 hash,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 getUrl());
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
125 Envelope bounds = getWSPLGENBounds();
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1650
diff changeset
127 if (bounds == null) {
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 bounds = getBounds();
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 wsplgen.addLayer(
1956
a5f87f8dbe57 Modified prefix constants for Mapserver layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1917
diff changeset
132 MapfileGenerator.MS_WSPLGEN_PREFIX + artifact.identifier());
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 wsplgen.setSrid(getSrid());
3925
36147ddb2c32 Set the missing 'originalExtent' attribute for WSPLGEN layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3302
diff changeset
134 wsplgen.setOriginalExtent(bounds);
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 wsplgen.setExtent(bounds);
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 tmpFacets.add(wsplgen);
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 public void createBarrierFacet() {
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 WMSLayerFacet barriers = new WMSLayerFacet(
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 1,
1775
0156105222c9 Improved the MapfileGenerator. It offers methods to create barrier and wsplgen layer files for mapserver.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1774
diff changeset
143 FLOODMAP_BARRIERS,
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 Resources.getMsg(
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 cc.getMeta(),
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 I18N_BARRIERS,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 I18N_BARRIERS_DEFAULT),
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 ComputeType.ADVANCE,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 stateId,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 hash,
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 getUrl());
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 barriers.addLayer(
1956
a5f87f8dbe57 Modified prefix constants for Mapserver layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1917
diff changeset
154 MapfileGenerator.MS_BARRIERS_PREFIX + artifact.identifier());
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 barriers.setSrid(getSrid());
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 barriers.setExtent(getBounds());
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 tmpFacets.add(barriers);
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 }
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161
2639
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
162 public void createUserShapeFacet() {
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
163 WMSLayerFacet shape = new WMSLayerFacet(
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
164 1,
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
165 FLOODMAP_USERSHAPE,
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
166 Resources.getMsg(
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
167 cc.getMeta(),
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
168 I18N_USERSHAPE,
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
169 I18N_USERSHAPE_DEFAULT),
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
170 ComputeType.ADVANCE,
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
171 stateId,
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
172 hash,
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
173 getUrl());
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
174
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
175 shape.addLayer(
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
176 MapfileGenerator.MS_USERSHAPE_PREFIX + artifact.identifier());
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
177 shape.setSrid(getSrid());
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
178 shape.setExtent(getBounds());
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
179
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
180 tmpFacets.add(shape);
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
181 }
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
182
a78dafdd8590 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2638
diff changeset
183
1650
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 public void finish() {
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 facets.addAll(getFacets());
aaf8d32f85bd Improved Facet creation for floodmaps - WSPLGEN and barriers Facets are only created if the calculation was successful.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 }
3083
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2639
diff changeset
187 }
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2639
diff changeset
188 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org