Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DGMSelect.java @ 5827:e308d4ecd35a
Fixed pom for etl process.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 11:48:36 +0200 |
parents | a075f26a516c |
children |
rev | line source |
---|---|
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
1622
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
3 import java.io.File; |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
4 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
5 import org.w3c.dom.Element; |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
6 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
7 import org.apache.log4j.Logger; |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
8 |
2013
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
9 import de.intevation.artifacts.Artifact; |
1622
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
10 import de.intevation.artifacts.CallContext; |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
11 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
12 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
13 |
2013
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
14 import de.intevation.flys.model.DGM; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
15 import de.intevation.flys.model.River; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
16 |
1743
8a2cbf947395
Prepared the DESCRIBE document of a WINFO Artifact so that named main values for Qs are displayed.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1622
diff
changeset
|
17 import de.intevation.flys.artifacts.FLYSArtifact; |
2013
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
18 import de.intevation.flys.utils.FLYSUtils; |
1622
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
19 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
20 |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 */ |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public class DGMSelect extends DefaultState { |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
1622
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
26 private static final Logger logger = Logger.getLogger(DGMSelect.class); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
27 |
2013
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
28 public static final String ERR_EMPTY = "error_no_dgm_selected"; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
29 public static final String ERR_INVALID_DGM = "error_invalid_dgm_selected"; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
30 public static final String ERR_BAD_DGM_RANGE = "error_bad_dgm_range"; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
31 public static final String ERR_BAD_DGM_RIVER = "error_bad_dgm_river"; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
32 |
1622
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
33 |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 @Override |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 protected String getUIProvider() { |
1172
23eb122c8ec1
Prepared the winfo artifact for floodmap calculations (now selectable in the UI).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1051
diff
changeset
|
36 return "dgm_datacage_panel"; |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 } |
1622
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
38 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
39 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
40 @Override |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
41 protected Element createStaticData( |
1743
8a2cbf947395
Prepared the DESCRIBE document of a WINFO Artifact so that named main values for Qs are displayed.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1622
diff
changeset
|
42 FLYSArtifact flys, |
1622
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
43 ElementCreator creator, |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
44 CallContext cc, |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
45 String name, |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
46 String value, |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
47 String type |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
48 ) { |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
49 Element dataElement = creator.create("data"); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
50 creator.addAttr(dataElement, "name", name, true); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
51 creator.addAttr(dataElement, "type", type, true); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
52 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
53 Element itemElement = creator.create("item"); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
54 creator.addAttr(itemElement, "value", value, true); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
55 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
56 creator.addAttr(itemElement, "label", getLabel(cc, value), true); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
57 dataElement.appendChild(itemElement); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
58 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
59 return dataElement; |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
60 } |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
61 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
62 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
63 public static String getLabel(CallContext cc, String value) { |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
64 logger.debug("Create label for value: " + value); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
65 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
66 try { |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
67 DGM dgm = DGM.getDGM(Integer.parseInt(value)); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
68 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
69 File file = new File(dgm.getPath()); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
70 return file.getName(); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
71 } |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
72 catch (NumberFormatException nfe) { |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
73 logger.warn("Cannot parse int value: '" + value + "'"); |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
74 } |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
75 |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
76 return ""; |
6d0299d63819
#325 Create human readable label for the selected DEM (used in the static UI part).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1172
diff
changeset
|
77 } |
2013
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
78 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
79 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
80 @Override |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
81 public boolean validate(Artifact artifact) |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
82 throws IllegalArgumentException |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
83 { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
84 FLYSArtifact flys = (FLYSArtifact) artifact; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
85 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
86 DGM dgm = getDGM(flys); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
87 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
88 if (dgm == null) { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
89 throw new IllegalArgumentException(ERR_INVALID_DGM); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
90 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
91 |
5225
a075f26a516c
Use range object to get lower and upper km for dgm.
Raimund Renkert <rrenkert@intevation.de>
parents:
2013
diff
changeset
|
92 double l = dgm.getRange().getA().doubleValue(); |
a075f26a516c
Use range object to get lower and upper km for dgm.
Raimund Renkert <rrenkert@intevation.de>
parents:
2013
diff
changeset
|
93 double u = dgm.getRange().getB().doubleValue(); |
2013
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
94 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
95 double[] range = FLYSUtils.getKmFromTo(flys); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
96 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
97 if (range[0] < l || range[0] > u || range[1] < l || range[1] > u) { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
98 throw new IllegalArgumentException(ERR_BAD_DGM_RANGE); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
99 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
100 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
101 River selectedRiver = FLYSUtils.getRiver(flys); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
102 River dgmRiver = dgm.getRiver(); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
103 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
104 if (selectedRiver != dgmRiver) { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
105 throw new IllegalArgumentException(ERR_BAD_DGM_RIVER); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
106 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
107 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
108 return true; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
109 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
110 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
111 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
112 /** |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
113 * Returns the DGM specified in the parameters of <i>flys</i>. |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
114 * |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
115 * @param flys The FLYSArtifact that knows the ID of a DGM. |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
116 * |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
117 * @throws IllegalArgumentException If the FLYSArtifact doesn't know the ID |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
118 * of a DGM. |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
119 * |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
120 * @return the DGM specified by FLYSArtifact's parameters. |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
121 */ |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
122 public static DGM getDGM(FLYSArtifact flys) |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
123 throws IllegalArgumentException |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
124 { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
125 try { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
126 Integer dgmId = flys.getDataAsInteger("dgm"); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
127 if (dgmId == null) { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
128 throw new IllegalArgumentException(ERR_EMPTY); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
129 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
130 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
131 logger.debug("Found selected dgm: '" + dgmId + "'"); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
132 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
133 return DGM.getDGM(dgmId); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
134 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
135 catch (NumberFormatException nfe) { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
136 throw new IllegalArgumentException(ERR_INVALID_DGM); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
137 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1743
diff
changeset
|
138 } |
927
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 } |
53a2be494765
Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |