Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java @ 2231:5648b5b34ae2
Issue 466.
Added CSV export for activated chart themes excluding annotations.
flys-artifacts/trunk@3874 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 02 Feb 2012 10:54:21 +0000 |
parents | 31fa7cae0f35 |
children | ee5310134463 |
rev | line source |
---|---|
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.utils; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
3 import org.apache.log4j.Logger; |
1740
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
4 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
5 import java.text.NumberFormat; |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
6 import java.util.HashMap; |
1740
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
7 import java.util.List; |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
8 import java.util.Map; |
2068
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
9 import java.util.regex.Matcher; |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
10 import java.util.regex.Pattern; |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
11 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
12 import javax.xml.xpath.XPathConstants; |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
13 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
14 import org.w3c.dom.Document; |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
15 |
1845
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
16 import org.hibernate.SessionFactory; |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
17 import org.hibernate.impl.SessionFactoryImpl; |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
18 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import gnu.trove.TDoubleArrayList; |
2216
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
20 import gnu.trove.TIntArrayList; |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
1174
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
22 import de.intevation.artifacts.Artifact; |
1118
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
23 import de.intevation.artifacts.CallContext; |
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
24 |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
25 import de.intevation.artifacts.common.utils.Config; |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
26 import de.intevation.artifacts.common.utils.XMLUtils; |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
27 |
1845
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
28 import de.intevation.flys.backend.SessionFactoryProvider; |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
29 |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
30 import de.intevation.flys.artifacts.context.FLYSContext; |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.flys.artifacts.FLYSArtifact; |
1740
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
32 import de.intevation.flys.artifacts.WINFOArtifact; |
2179
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
33 import de.intevation.flys.artifacts.StaticWKmsArtifact; |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
34 import de.intevation.flys.artifacts.model.RiverFactory; |
2063
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
35 import de.intevation.flys.artifacts.model.LocationProvider; |
2068
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
36 import de.intevation.flys.artifacts.model.WQ; |
2179
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
37 import de.intevation.flys.artifacts.model.WKms; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
38 import de.intevation.flys.artifacts.model.WQKms; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
39 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
40 import de.intevation.artifactdatabase.state.State; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
41 import de.intevation.flys.artifacts.states.WaterlevelSelectState; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
42 import de.intevation.flys.artifacts.states.WDifferencesState; |
1740
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
43 import de.intevation.flys.model.Gauge; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
44 import de.intevation.flys.model.MainValue; |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
45 import de.intevation.flys.model.River; |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 public class FLYSUtils { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
49 /** The logger that is used in this utility. */ |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
50 private static Logger logger = Logger.getLogger(FLYSUtils.class); |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
51 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 public static enum KM_MODE { RANGE, LOCATIONS, NONE }; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
2038
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
54 /** |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
55 * An enum that represents the 5 possible WQ modes in FLYS. The 5 values are |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
56 * <i>QFREE</i> <i>QGAUGE</i> <i>WGAUGE</i> <i>WFREE</i> and <i>NONE</i>. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
57 */ |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
58 public static enum WQ_MODE { QFREE, QGAUGE, WFREE, WGAUGE, NONE }; |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
59 |
2068
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
60 |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
61 public static final Pattern NUMBERS_PATTERN = |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
62 Pattern.compile("\\D*(\\d++.\\d*)\\D*"); |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
63 |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
64 public static final String XPATH_RIVER_PROJECTION = |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
65 "/artifact-database/floodmap/river[@name=$name]/srid/@value"; |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
66 |
1129
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
67 public static final String XPATH_SHAPEFILE_DIR = |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
68 "/artifact-database/floodmap/shapefile-path/@value"; |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
69 |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
70 public static final String XPATH_VELOCITY_LOGFILE = |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
71 "/artifact-database/floodmap/velocity/logfile/@path"; |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
72 |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
73 public static final String XPATH_MAPSERVER_URL = |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
74 "/artifact-database/floodmap/mapserver/server/@path"; |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
75 |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
76 public static final String XPATH_MAPFILE_PATH = |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
77 "/artifact-database/floodmap/mapserver/mapfile/@path"; |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
78 |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
79 public static final String XPATH_MAPFILE_TEMPLATE = |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
80 "/artifact-database/floodmap/mapserver/map-template/@path"; |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
81 |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
82 public static final String XPATH_MAPSERVER_TEMPLATE_PATH = |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
83 "/artifact-database/floodmap/mapserver/templates/@path"; |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
84 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 private FLYSUtils() { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
90 /** |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
91 * Pulls Artifact with given UUID fromm database. |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
92 * @return FLYSArtifact with given UUID or null (in case of errors). |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
93 */ |
1118
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
94 public static FLYSArtifact getArtifact(String uuid, CallContext context) { |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
95 try { |
1174
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
96 Artifact artifact = context.getDatabase().getRawArtifact(uuid); |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
97 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
98 if (artifact == null) { |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
99 logger.error("Artifact '" + uuid + "' does not exist."); |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
100 return null; |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
101 } |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
102 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
103 if (!(artifact instanceof FLYSArtifact)) { |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
104 logger.error("Artifact '" +uuid+ "' is no valid FLYSArtifact."); |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
105 return null; |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
106 } |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
107 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
108 return (FLYSArtifact) artifact; |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
109 } |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
110 // TODO: catch more selective |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
111 catch (Exception e) { |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
112 logger.error("Cannot get FLYSArtifact " + uuid |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
113 + " from database (" + e.getMessage() + ")."); |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
114 return null; |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
115 } |
1118
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
116 } |
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
117 |
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
118 |
1129
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
119 /** |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
120 * Returns the FLYSContext from context object. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
121 * |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
122 * @param context The CallContext or the FLYSContext. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
123 * |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
124 * @return the FLYSContext. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
125 */ |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
126 public static FLYSContext getFlysContext(Object context) { |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
127 return context instanceof FLYSContext |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
128 ? (FLYSContext) context |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
129 : (FLYSContext) ((CallContext) context).globalContext(); |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
130 } |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
131 |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
132 |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
133 /** |
1129
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
134 * Convinience function to retrieve an XPath as string with replaced config |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
135 * directory. |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
136 * |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
137 * @param xpath The XPath expression. |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
138 * |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
139 * @return a string with replaced config directory. |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
140 */ |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
141 public static String getXPathString(String xpath) { |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
142 String tmp = Config.getStringXPath(xpath); |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
143 tmp = Config.replaceConfigDir(tmp); |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
144 |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
145 return tmp; |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
146 } |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
147 |
da3c3e286c88
Introduced a MapfileGenerator that creates Mapserver specific mapfiles based on WSPLGEN results read from filesystem.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1118
diff
changeset
|
148 |
1845
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
149 public static boolean isUsingOracle() { |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
150 SessionFactory sf = SessionFactoryProvider.getSessionFactory(); |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
151 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
152 String d = SessionFactoryProvider.getDriver((SessionFactoryImpl) sf); |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
153 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
154 return d != null ? d.indexOf("Oracle") >= 0 : false; |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
155 } |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
156 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
157 |
2038
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
158 /** |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
159 * This method returns an WQ_MODE enum which is based on the parameters |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
160 * stored in <i>flys</i> Artifact. If there is no <i>wq_mode</i> parameter |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
161 * existing, WQ_MODE.NONE is returned. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
162 * |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
163 * @param flys The FLYSArtifact that stores wq mode relevant parameters. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
164 * |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
165 * @return an enum WQ_MODE. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
166 */ |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
167 public static WQ_MODE getWQMode(FLYSArtifact flys) { |
2081
aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2068
diff
changeset
|
168 if (flys == null) { |
aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2068
diff
changeset
|
169 return WQ_MODE.NONE; |
aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2068
diff
changeset
|
170 } |
aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2068
diff
changeset
|
171 |
2038
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
172 String mode = flys.getDataAsString("wq_mode"); |
2081
aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2068
diff
changeset
|
173 Boolean free = flys.getDataAsBoolean("wq_free"); |
aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2068
diff
changeset
|
174 |
aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2068
diff
changeset
|
175 free = free != null ? free : false; |
2038
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
176 |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
177 if (mode != null && mode.equals("Q")) { |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
178 return free ? WQ_MODE.QFREE : WQ_MODE.QGAUGE; |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
179 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
180 else if (mode != null && mode.equals("W")) { |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
181 return free ? WQ_MODE.WFREE : WQ_MODE.WGAUGE; |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
182 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
183 else { |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
184 return WQ_MODE.NONE; |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
185 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
186 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
187 |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
188 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 public static KM_MODE getKmRangeMode(FLYSArtifact flys) { |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
190 String mode = flys.getDataAsString("ld_mode"); |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 if (mode == null || mode.length() == 0) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 return KM_MODE.NONE; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 else if (mode.equals("distance")) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 return KM_MODE.RANGE; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 else if (mode.equals("locations")) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 return KM_MODE.LOCATIONS; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 else { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 return KM_MODE.NONE; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 |
2041
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
206 /** |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
207 * Get min and max kilometer, independent of parametization |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
208 * (ld_from/to vs ld_locations). |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
209 */ |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 public static double[] getKmRange(FLYSArtifact flys) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 switch (getKmRangeMode(flys)) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 case RANGE: { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 return getKmFromTo(flys); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 case LOCATIONS: { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 double[] locs = getLocations(flys); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 return new double[] { locs[0], locs[locs.length-1] }; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 case NONE: { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 double[] locs = getLocations(flys); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 if (locs != null) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 return new double[] { locs[0], locs[locs.length-1] }; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 else { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 return getKmFromTo(flys); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 return new double[] { Double.NaN, Double.NaN }; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 public static double[] getKmFromTo(FLYSArtifact flys) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 String strFrom = flys.getDataAsString("ld_from"); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 String strTo = flys.getDataAsString("ld_to"); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 if (strFrom == null || strTo == null) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 return null; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 try { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 return new double[] { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 Double.parseDouble(strFrom), |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 Double.parseDouble(strTo) }; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 catch (NumberFormatException nfe) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 return null; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 |
2041
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
255 /** |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
256 * Return sorted array of locations at which stuff was calculated |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
257 * (from ld_locations data), null if not parameterized this way. |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
258 */ |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 public static double[] getLocations(FLYSArtifact flys) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 String locationStr = flys.getDataAsString("ld_locations"); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
262 if (locationStr == null || locationStr.length() == 0) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 return null; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 String[] tmp = locationStr.split(" "); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 TDoubleArrayList locations = new TDoubleArrayList(); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 for (String l: tmp) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 try { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 locations.add(Double.parseDouble(l)); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 catch (NumberFormatException nfe) { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
275 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
276 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 locations.sort(); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 return locations.toNativeArray(); |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 } |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
281 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
282 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
283 /** |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
284 * Returns the Qs for a given FLYSArtifact. This method currently accepts |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
285 * only instances of WINFOArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
286 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
287 * @param flys A FLYSArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
288 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
289 * @return the Qs. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
290 */ |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
291 public static double[] getQs(FLYSArtifact flys) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
292 double[] kmRange = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
293 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
294 // XXX this is not nice! |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
295 if (flys instanceof WINFOArtifact) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
296 return ((WINFOArtifact) flys).getQs(kmRange); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
297 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
298 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
299 logger.warn("This method currently supports WINFOArtifact only!"); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
300 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
301 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
302 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
303 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
304 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
305 /** |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
306 * Returns the Ws for a given FLYSArtifact. This method currently accepts |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
307 * only instances of WINFOArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
308 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
309 * @param flys A FLYSArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
310 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
311 * @return the Ws. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
312 */ |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
313 public static double[] getWs(FLYSArtifact flys) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
314 double[] kmRange = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
315 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
316 // XXX this is not nice! |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
317 if (flys instanceof WINFOArtifact) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
318 return ((WINFOArtifact) flys).getWs(kmRange); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
319 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
320 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
321 logger.warn("This method currently supports WINFOArtifact only!"); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
322 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
323 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
324 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
325 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
326 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
327 /** |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
328 * Returns the selected River object based on the 'river' data that might |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
329 * have been inserted by the user. |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
330 * |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
331 * @return the selected River or null if no river has been chosen yet. |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
332 */ |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
333 public static River getRiver(FLYSArtifact flys) { |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
334 String sRiver = getRivername(flys); |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
335 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
336 return (sRiver != null) |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
337 ? RiverFactory.getRiver(sRiver) |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
338 : null; |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
339 } |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
340 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
341 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
342 /** |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
343 * Returns the name of the river specified in the given <i>flys</i> |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
344 * Artifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
345 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
346 * @param flys The FLYSArtifact that stores a river relevant information. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
347 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
348 * @return the name of the specified river or null. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
349 */ |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
350 public static String getRivername(FLYSArtifact flys) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
351 return flys != null ? flys.getDataAsString("river") : null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
352 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
353 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
354 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
355 /** |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
356 * Extracts the SRID defined in the global configuration for the river |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
357 * specified in <i>artifact</i>. |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
358 * |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
359 * @param artifact The FLYSArtifact that stores the name of the river. |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
360 * |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
361 * @return the SRID as string (e.g. "31466"). |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
362 */ |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
363 public static String getRiverSrid(FLYSArtifact artifact) { |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
364 String river = artifact.getDataAsString("river"); |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
365 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
366 if (river == null || river.length() == 0) { |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
367 return null; |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
368 } |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
369 |
1805
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
370 return getRiverSrid(river); |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
371 } |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
372 |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
373 |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
374 public static String getRiverSrid(String rivername) { |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
375 Map<String, String> variables = new HashMap<String, String>(1); |
1805
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
376 variables.put("name", rivername); |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
377 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
378 Document cfg = Config.getConfig(); |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
379 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
380 return (String) XMLUtils.xpath( |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
381 cfg, |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
382 XPATH_RIVER_PROJECTION, |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
383 XPathConstants.STRING, |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
384 null, |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
385 variables); |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
386 } |
1740
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
387 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
388 |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
389 public static Gauge getGauge(FLYSArtifact flys) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
390 River river = getRiver(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
391 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
392 if (river == null) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
393 logger.debug("no river found"); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
394 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
395 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
396 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
397 double[] dist = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
398 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
399 if (dist == null) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
400 logger.debug("no range found"); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
401 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
402 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
403 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
404 if (logger.isDebugEnabled()) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
405 logger.debug("Determine gauge for:"); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
406 logger.debug("... river: " + river.getName()); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
407 logger.debug("... distance: " + dist[0] + " - " + dist[1]); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
408 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
409 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
410 Gauge gauge = river.determineGauge(dist[0], dist[1]); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
411 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
412 String name = gauge != null ? gauge.getName() : "'n/a"; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
413 logger.debug("Found gauge: " + name); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
414 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
415 return gauge; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
416 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
417 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
418 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
419 public static String getGaugename(FLYSArtifact flys) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
420 Gauge gauge = getGauge(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
421 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
422 return gauge != null ? gauge.getName() : null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
423 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
424 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
425 |
2128
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
426 public static Gauge getReferenceGauge(FLYSArtifact flys) { |
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
427 Long officialNumber = flys.getDataAsLong("reference_gauge"); |
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
428 |
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
429 return officialNumber != null |
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
430 ? Gauge.getGaugeByOfficialNumber(officialNumber) |
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
431 : null; |
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
432 } |
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
433 |
bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2081
diff
changeset
|
434 |
2068
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
435 public static Double getValueFromWQ(WQ wq) { |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
436 if (wq == null) { |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
437 return null; |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
438 } |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
439 |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
440 Matcher m = NUMBERS_PATTERN.matcher(wq.getName()); |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
441 |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
442 if (m.matches()) { |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
443 logger.debug("Found a number."); |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
444 |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
445 String raw = m.group(1); |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
446 |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
447 try { |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
448 return Double.valueOf(raw); |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
449 } |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
450 catch (NumberFormatException nfe) { |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
451 } |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
452 } |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
453 |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
454 return null; |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
455 } |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
456 |
0cf60d64895c
#370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2063
diff
changeset
|
457 |
1740
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
458 public static String createWspWTitle( |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
459 WINFOArtifact winfo, |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
460 CallContext cc, |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
461 String name |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
462 ) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
463 String[] parts = name.split("="); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
464 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
465 NumberFormat nf = Formatter.getWaterlevelW(cc); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
466 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
467 String namedMainValue = null; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
468 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
469 boolean isQ = winfo.isQ(); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
470 boolean isFree = winfo.isFreeQ(); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
471 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
472 double v; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
473 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
474 try { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
475 v = Double.valueOf(parts[1]); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
476 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
477 namedMainValue = getNamedMainValue(winfo.getGauge(), v); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
478 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
479 catch (NumberFormatException nfe) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
480 logger.warn("Cannot parse Double of: '" + parts[1] + "'"); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
481 return name; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
482 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
483 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
484 String prefix = null; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
485 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
486 if (isQ && !isFree && namedMainValue != null) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
487 return "W (" + namedMainValue + ")"; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
488 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
489 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
490 if (isQ) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
491 prefix = "Q="; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
492 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
493 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
494 return prefix == null |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
495 ? "W(" + nf.format(v) + ")" |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
496 : "W(" + prefix + nf.format(v) + ")"; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
497 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
498 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
499 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
500 public static String createWspQTitle( |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
501 WINFOArtifact winfo, |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
502 CallContext cc, |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
503 String name |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
504 ) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
505 String[] parts = name.split("="); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
506 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
507 NumberFormat nf = Formatter.getWaterlevelQ(cc); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
508 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
509 String namedMainValue = null; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
510 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
511 boolean isQ = winfo.isQ(); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
512 boolean isFree = winfo.isFreeQ(); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
513 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
514 double v; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
515 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
516 try { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
517 v = Double.valueOf(parts[1]); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
518 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
519 namedMainValue = getNamedMainValue(winfo.getGauge(), v); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
520 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
521 catch (NumberFormatException nfe) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
522 logger.warn("Cannot parse Double of: '" + parts[1] + "'"); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
523 return name; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
524 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
525 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
526 String prefix = null; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
527 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
528 if (isQ && !isFree && namedMainValue != null) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
529 return namedMainValue; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
530 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
531 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
532 if (!isQ) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
533 prefix = "W="; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
534 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
535 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
536 return prefix == null |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
537 ? "Q(" + nf.format(v) + ")" |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
538 : "Q(" + prefix + nf.format(v) + ")"; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
539 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
540 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
541 |
2038
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
542 /** |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
543 * Returns the named main value if a Q was selected and if this Q fits to a |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
544 * named main value. Otherwise, this function returns null. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
545 * |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
546 * @param winfo The WINFO Artifact. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
547 * @param value The Q (or W) value. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
548 * |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
549 * @return a named main value or null. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
550 */ |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
551 public static String getNamedMainValue(WINFOArtifact winfo, double value) { |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
552 WQ_MODE wqmode = getWQMode(winfo); |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
553 |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
554 if (wqmode != WQ_MODE.QGAUGE) { |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
555 return null; |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
556 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
557 else { |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
558 return getNamedMainValue(winfo.getGauge(), value); |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
559 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
560 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
561 |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
562 |
1740
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
563 public static String getNamedMainValue(Gauge gauge, double value) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
564 List<MainValue> mainValues = gauge.getMainValues(); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
565 logger.debug("Search named main value for: " + value); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
566 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
567 for (MainValue mv: mainValues) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
568 if (mv.getValue().doubleValue() == value) { |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
569 logger.debug("Found named main value: " + mv.getMainValue().getName()); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
570 return mv.getMainValue().getName(); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
571 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
572 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
573 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
574 logger.debug("Did not find a named main value for: " + value); |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
575 return null; |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
576 } |
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:
1777
diff
changeset
|
577 |
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:
1777
diff
changeset
|
578 |
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:
1777
diff
changeset
|
579 /** |
2035
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
580 * |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
581 * @param nmv A string that represents a named main value. |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
582 * |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
583 * @throws NullPointerException if nmv is null. |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
584 */ |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
585 public static String stripNamedMainValue(String nmv) { |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
586 int startIndex = nmv.indexOf("("); |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
587 int endIndex = nmv.indexOf(")"); |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
588 |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
589 if (startIndex > 0 && endIndex > 0 && startIndex < endIndex) { |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
590 return nmv.substring(0, startIndex); |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
591 } |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
592 |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
593 return nmv; |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
594 } |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
595 |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
596 |
3ebbe497d7f7
#252 Set titles in waterlevel exports to named main values if those are existing for given Q values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2017
diff
changeset
|
597 /** |
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:
1777
diff
changeset
|
598 * Returns the URL of user mapfile for the owner of Artifact |
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:
1777
diff
changeset
|
599 * <i>artifactId</i>. |
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:
1777
diff
changeset
|
600 * |
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:
1777
diff
changeset
|
601 * @param artifactId The UUID of an artifact. |
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:
1777
diff
changeset
|
602 * |
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:
1777
diff
changeset
|
603 * @return the URL of the user wms. |
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:
1777
diff
changeset
|
604 */ |
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:
1777
diff
changeset
|
605 public static String getUserWMSUrl(String artifactId) { |
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:
1777
diff
changeset
|
606 String url = getXPathString(XPATH_MAPSERVER_URL); |
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:
1777
diff
changeset
|
607 url = url + "user-wms"; |
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:
1777
diff
changeset
|
608 |
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:
1777
diff
changeset
|
609 return url; |
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:
1777
diff
changeset
|
610 } |
2063
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
611 |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
612 |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
613 /** |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
614 * This method returns the description for a given <i>km</i> for a specific |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
615 * river. The river is provided by the FLYSArtifact <i>flys</i>. |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
616 * |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
617 * @param flys The FLYSArtifact that provides a river. |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
618 * @param km The kilometer. |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
619 * |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
620 * @return the description for <i>km</i> or an empty string if no |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
621 * description was found. |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
622 */ |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
623 public static String getLocationDescription(FLYSArtifact flys, double km) { |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
624 String river = getRivername(flys); |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
625 |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
626 if (river == null) { |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
627 return ""; |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
628 } |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
629 |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
630 return LocationProvider.getLocation(river, km); |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
631 } |
2179
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
632 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
633 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
634 /** |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
635 * This method returns the differences for a w-differences calculation. |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
636 * |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
637 * @param winfo The WINFOArtifact. |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
638 * @param context The context. |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
639 * |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
640 * @return The differences as string separated by semicolon and linebreak. |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
641 */ |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
642 public static String getWDifferences( |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
643 WINFOArtifact winfo, |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
644 CallContext context) |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
645 { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
646 State state = winfo.getCurrentState(context); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
647 if(state instanceof WDifferencesState) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
648 String diffids = winfo.getDataAsString("diffids"); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
649 String datas[] = diffids.split("#"); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
650 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
651 // Validate the Data-Strings. |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
652 for (String s: datas) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
653 if (!WaterlevelSelectState.isValueValid(winfo.getDataAsString("diffids"))) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
654 return ""; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
655 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
656 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
657 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
658 if (datas.length < 2) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
659 return ""; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
660 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
661 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
662 String diffs = ""; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
663 for(int i = 0; i < datas.length; i+=2) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
664 // e.g.: |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
665 // 42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
666 WKms minuendWKms = getWKms(StringUtil.unbracket(datas[i+0]), |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
667 context); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
668 WKms subtrahendWKms = getWKms(StringUtil.unbracket(datas[i+1]), |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
669 context); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
670 if (minuendWKms != null && subtrahendWKms != null) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
671 diffs += StringUtil.wWrap(minuendWKms.getName()) |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
672 + " - " + StringUtil.wWrap(subtrahendWKms.getName()); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
673 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
674 diffs += ";\n"; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
675 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
676 return diffs; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
677 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
678 else { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
679 logger.warn("Not a valid state for differences."); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
680 return ""; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
681 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
682 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
683 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
684 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
685 protected static WKms getWKms(String mingle, CallContext context) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
686 String[] def = mingle.split(";"); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
687 String uuid = def[0]; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
688 String name = def[1]; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
689 int idx = Integer.parseInt(def[2]); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
690 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
691 if (name.startsWith("staticwkms")) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
692 StaticWKmsArtifact staticWKms = |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
693 (StaticWKmsArtifact) FLYSUtils.getArtifact( |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
694 uuid, |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
695 context); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
696 WKms wkms = staticWKms.getWKms(idx); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
697 if (wkms == null) |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
698 logger.error("No WKms from artifact."); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
699 return wkms; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
700 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
701 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
702 WINFOArtifact flys = (WINFOArtifact) FLYSUtils.getArtifact( |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
703 uuid, |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
704 context); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
705 |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
706 if (flys == null) { |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
707 logger.warn("One of the artifacts (1) for diff calculation could not be loaded"); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
708 return null; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
709 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
710 else{ |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
711 WQKms[] wqkms = (WQKms[]) flys.getWaterlevelData(). |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
712 getData(); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
713 if (wqkms == null) |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
714 logger.warn("not waterlevels in artifact"); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
715 else if (wqkms.length < idx) |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
716 logger.warn("not enough waterlevels in artifact"); |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
717 return wqkms[idx]; |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
718 } |
c3e523a76340
Added method that return the differences for a w-differences calculation as
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2128
diff
changeset
|
719 } |
2216
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
720 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
721 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
722 /** |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
723 * This method transform a string into an int array. Therefore, the string |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
724 * <i>raw</i> must consist of int values separated by a <i>';'</i>. |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
725 * |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
726 * @param raw The raw integer array as string separated by a ';'. |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
727 * |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
728 * @return an array of int values. |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
729 */ |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
730 public static int[] intArrayFromString(String raw) { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
731 String[] splitted = raw != null ? raw.split(";") : null; |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
732 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
733 if (splitted == null || splitted.length == 0) { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
734 logger.warn("No integer values found in '" + raw + "'"); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
735 return new int[0]; |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
736 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
737 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
738 TIntArrayList integers = new TIntArrayList(splitted.length); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
739 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
740 for (String value: splitted) { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
741 try { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
742 integers.add(Integer.valueOf(value)); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
743 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
744 catch (NumberFormatException nfe) { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
745 logger.warn("Parsing integer failed: " + nfe); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
746 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
747 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
748 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
749 return integers.toNativeArray(); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
750 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
751 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
752 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
753 /** |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
754 * This method transform a string into an double array. Therefore, the |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
755 * string <i>raw</i> must consist of double values separated by a |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
756 * <i>';'</i>. |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
757 * |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
758 * @param raw The raw double array as string separated by a ';'. |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
759 * |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
760 * @return an array of double values. |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
761 */ |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
762 public static double[] doubleArrayFromString(String raw) { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
763 String[] splitted = raw != null ? raw.split(";") : null; |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
764 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
765 if (splitted == null || splitted.length == 0) { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
766 logger.warn("No double values found in '" + raw + "'"); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
767 return new double[0]; |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
768 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
769 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
770 TDoubleArrayList doubles = new TDoubleArrayList(splitted.length); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
771 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
772 for (String value: splitted) { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
773 try { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
774 doubles.add(Double.valueOf(value)); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
775 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
776 catch (NumberFormatException nfe) { |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
777 logger.warn("Parsing double failed: " + nfe); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
778 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
779 } |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
780 |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
781 return doubles.toNativeArray(); |
31fa7cae0f35
Added new helper methods to FLYSUtils that extract int[] and double[] from string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2179
diff
changeset
|
782 } |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
783 } |
1105
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
784 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |