Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java @ 3814:8083f6384023
merged flys-artifacts/pre2.6-2012-01-04
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:56 +0200 |
parents | 0cf60d64895c |
children | aa9cc91c8193 |
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; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
1174
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
21 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
|
22 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
|
23 |
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
|
24 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
|
25 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
|
26 |
1845
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
27 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
|
28 |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
29 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
|
30 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
|
31 import de.intevation.flys.artifacts.WINFOArtifact; |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
32 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
|
33 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
|
34 import de.intevation.flys.artifacts.model.WQ; |
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
|
35 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
|
36 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
|
37 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
|
38 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 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
|
40 |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
41 /** 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
|
42 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
|
43 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 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
|
45 |
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
|
46 /** |
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
|
47 * 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
|
48 * <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
|
49 */ |
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
|
50 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
|
51 |
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
|
52 |
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
|
53 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
|
54 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
|
55 |
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
|
56 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
|
57 "/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
|
58 |
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
|
59 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
|
60 "/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
|
61 |
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
|
62 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
|
63 "/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
|
64 |
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
|
65 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
|
66 "/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
|
67 |
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 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
|
69 "/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
|
70 |
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 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
|
72 "/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
|
73 |
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 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
|
75 "/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
|
76 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 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
|
79 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
82 /** |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
83 * Pulls Artifact with given UUID fromm database. |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
84 * @return FLYSArtifact with given UUID or null (in case of errors). |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
85 */ |
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
|
86 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
|
87 try { |
1174
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
88 Artifact artifact = context.getDatabase().getRawArtifact(uuid); |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
89 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
90 if (artifact == null) { |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
91 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
|
92 return null; |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
93 } |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
94 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
95 if (!(artifact instanceof FLYSArtifact)) { |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
96 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
|
97 return null; |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
98 } |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
99 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
100 return (FLYSArtifact) artifact; |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
101 } |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
102 // TODO: catch more selective |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
103 catch (Exception e) { |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
104 logger.error("Cannot get FLYSArtifact " + uuid |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
105 + " from database (" + e.getMessage() + ")."); |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
106 return null; |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
107 } |
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
|
108 } |
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
109 |
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
110 |
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
|
111 /** |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
112 * Returns the FLYSContext from context object. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
113 * |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
114 * @param context The CallContext or the FLYSContext. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
115 * |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
116 * @return the FLYSContext. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
117 */ |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
118 public static FLYSContext getFlysContext(Object context) { |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
119 return context instanceof FLYSContext |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
120 ? (FLYSContext) context |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
121 : (FLYSContext) ((CallContext) context).globalContext(); |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
122 } |
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 |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
125 /** |
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
|
126 * 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
|
127 * 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
|
128 * |
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
|
129 * @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
|
130 * |
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
|
131 * @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
|
132 */ |
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
|
133 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
|
134 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
|
135 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
|
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 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
|
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 |
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 |
1845
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
141 public static boolean isUsingOracle() { |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
142 SessionFactory sf = SessionFactoryProvider.getSessionFactory(); |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
143 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
144 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
|
145 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
146 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
|
147 } |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
148 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
149 |
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
|
150 /** |
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
|
151 * 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
|
152 * 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
|
153 * 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
|
154 * |
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
|
155 * @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
|
156 * |
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
|
157 * @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
|
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 public static WQ_MODE getWQMode(FLYSArtifact flys) { |
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 String mode = flys.getDataAsString("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
|
161 boolean free = flys.getDataAsBoolean("wq_free"); |
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 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
|
164 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
|
165 } |
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 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
|
167 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
|
168 } |
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
|
169 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
|
170 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
|
171 } |
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 } |
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
|
173 |
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
|
174 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 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
|
176 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
|
177 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 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
|
179 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
|
180 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 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
|
182 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
|
183 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 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
|
185 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
|
186 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 else { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 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
|
189 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 |
2041
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
192 /** |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
193 * Get min and max kilometer, independent of parametization |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
194 * (ld_from/to vs ld_locations). |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
195 */ |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 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
|
197 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
|
198 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
|
199 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
|
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 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 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
|
203 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
|
204 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
|
205 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 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
|
208 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
|
209 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
|
210 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
|
211 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 else { |
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 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 |
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[] { 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
|
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 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 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
|
223 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
|
224 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
|
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 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
|
227 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
|
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 try { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 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
|
232 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
|
233 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
|
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 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
|
236 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
|
237 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 } |
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 |
2041
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
241 /** |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
242 * Return sorted array of locations at which stuff was calculated |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
243 * (from ld_locations data), null if not parameterized this way. |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
244 */ |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 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
|
246 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
|
247 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 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
|
249 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
|
250 } |
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 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
|
253 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
|
254 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 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
|
256 try { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 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
|
258 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 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
|
260 } |
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 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 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
|
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 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
|
266 } |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
267 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
268 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
269 /** |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
270 * 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
|
271 * only instances of WINFOArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
272 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
273 * @param flys A FLYSArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
274 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
275 * @return the Qs. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
276 */ |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
277 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
|
278 double[] kmRange = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
279 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
280 // 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
|
281 if (flys instanceof WINFOArtifact) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
282 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
|
283 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
284 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
285 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
|
286 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
287 return null; |
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 |
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 /** |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
292 * 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
|
293 * only instances of WINFOArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
294 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
295 * @param flys A FLYSArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
296 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
297 * @return the Ws. |
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 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
|
300 double[] kmRange = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
301 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
302 // 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
|
303 if (flys instanceof WINFOArtifact) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
304 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
|
305 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
306 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
307 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
|
308 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
309 return null; |
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 |
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 /** |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
314 * 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
|
315 * 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
|
316 * |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
317 * @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
|
318 */ |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
319 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
|
320 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
|
321 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
322 return (sRiver != null) |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
323 ? RiverFactory.getRiver(sRiver) |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
324 : null; |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
325 } |
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
|
326 |
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
|
327 |
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
|
328 /** |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
329 * 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
|
330 * Artifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
331 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
332 * @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
|
333 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
334 * @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
|
335 */ |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
336 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
|
337 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
|
338 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
339 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
340 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
341 /** |
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
|
342 * 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
|
343 * 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
|
344 * |
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
|
345 * @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
|
346 * |
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
|
347 * @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
|
348 */ |
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
|
349 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
|
350 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
|
351 |
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
|
352 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
|
353 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
|
354 } |
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
|
355 |
1805
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
356 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
|
357 } |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
358 |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
359 |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
360 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
|
361 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
|
362 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
|
363 |
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 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
|
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 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
|
367 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
|
368 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
|
369 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
|
370 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
|
371 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
|
372 } |
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
|
373 |
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
|
374 |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
375 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
|
376 River river = getRiver(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
377 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
378 if (river == null) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
379 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
|
380 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
381 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
382 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
383 double[] dist = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
384 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
385 if (dist == null) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
386 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
|
387 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
388 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
389 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
390 if (logger.isDebugEnabled()) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
391 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
|
392 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
|
393 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
|
394 } |
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 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
|
397 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
398 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
|
399 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
|
400 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
401 return gauge; |
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 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
405 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
|
406 Gauge gauge = getGauge(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
407 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
408 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
|
409 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
410 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
411 |
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
|
412 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
|
413 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
|
414 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
|
415 } |
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
|
416 |
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
|
417 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
|
418 |
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
|
419 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
|
420 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
|
421 |
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
|
422 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
|
423 |
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
|
424 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
|
425 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
|
426 } |
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
|
427 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
|
428 } |
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
|
429 } |
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
|
430 |
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
|
431 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
|
432 } |
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
|
433 |
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
|
434 |
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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 ) { |
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
|
440 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
|
441 |
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
|
442 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
|
443 |
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
|
444 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
|
445 |
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
|
446 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
|
447 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
|
448 |
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
|
449 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
|
450 |
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
|
451 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
|
452 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
|
453 |
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
|
454 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
|
455 } |
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
|
456 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
|
457 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
|
458 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
|
459 } |
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 |
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 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
|
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 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
|
464 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
|
465 } |
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 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
|
468 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
|
469 } |
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 |
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 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
|
472 ? "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
|
473 : "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
|
474 } |
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 |
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 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
|
478 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
|
479 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
|
480 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
|
481 ) { |
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 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
|
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 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
|
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 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
|
487 |
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 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
|
489 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
|
490 |
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 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
|
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 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
|
494 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
|
495 |
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 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
|
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 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
|
499 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
|
500 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
|
501 } |
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 |
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 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
|
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 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
|
506 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
|
507 } |
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 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
|
510 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
|
511 } |
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 |
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 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
|
514 ? "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
|
515 : "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
|
516 } |
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 |
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 |
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
|
519 /** |
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
|
520 * 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
|
521 * 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
|
522 * |
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
|
523 * @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
|
524 * @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
|
525 * |
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
|
526 * @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
|
527 */ |
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
|
528 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
|
529 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
|
530 |
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
|
531 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
|
532 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
|
533 } |
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
|
534 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
|
535 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
|
536 } |
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
|
537 } |
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
|
538 |
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
|
539 |
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
|
540 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
|
541 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
|
542 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
|
543 |
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
|
544 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
|
545 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
|
546 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
|
547 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
|
548 } |
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
|
549 } |
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
|
550 |
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
|
551 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
|
552 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
|
553 } |
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
|
554 |
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
|
555 |
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
|
556 /** |
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
|
557 * |
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
|
558 * @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
|
559 * |
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
|
560 * @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
|
561 */ |
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
|
562 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
|
563 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
|
564 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
|
565 |
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
|
566 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
|
567 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
|
568 } |
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
|
569 |
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
|
570 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
|
571 } |
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
|
572 |
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
|
573 |
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
|
574 /** |
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
|
575 * 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
|
576 * <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
|
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 * @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
|
579 * |
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
|
580 * @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
|
581 */ |
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
|
582 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
|
583 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
|
584 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
|
585 |
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
|
586 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
|
587 } |
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
|
588 |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
589 |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
590 /** |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
591 * 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
|
592 * 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
|
593 * |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
594 * @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
|
595 * @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
|
596 * |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
597 * @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
|
598 * 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
|
599 */ |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
600 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
|
601 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
|
602 |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
603 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
|
604 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
|
605 } |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
606 |
97a25b54eea3
Part 1 of #125: added a description for a location to the WaterlevelExport.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2045
diff
changeset
|
607 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
|
608 } |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
609 } |
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
|
610 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |