Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java @ 2060:3ffb7195173f
Validate user defined Qs based on the start kilometer ('Q free').
flys-artifacts/trunk@3553 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 28 Dec 2011 12:39:35 +0000 |
parents | d13be39cfd1d |
children | 97a25b54eea3 |
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; |
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
|
9 |
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
|
10 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
|
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 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
|
13 |
1845
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
14 import org.hibernate.SessionFactory; |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
15 import org.hibernate.impl.SessionFactoryImpl; |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
16 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 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
|
18 |
1174
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
19 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
|
20 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
|
21 |
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
|
22 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
|
23 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
|
24 |
1845
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
25 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
|
26 |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
27 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
|
28 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
|
29 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
|
30 import de.intevation.flys.artifacts.model.RiverFactory; |
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.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
|
32 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
|
33 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
|
34 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 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
|
36 |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
37 /** 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
|
38 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
|
39 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 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
|
41 |
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
|
42 /** |
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
|
43 * 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
|
44 * <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
|
45 */ |
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 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
|
47 |
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
|
48 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
|
49 "/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
|
50 |
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
|
51 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
|
52 "/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
|
53 |
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
|
54 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
|
55 "/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
|
56 |
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
|
57 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
|
58 "/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
|
59 |
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 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
|
61 "/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
|
62 |
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 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
|
64 "/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
|
65 |
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 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
|
67 "/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
|
68 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 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
|
71 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
74 /** |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
75 * Pulls Artifact with given UUID fromm database. |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
76 * @return FLYSArtifact with given UUID or null (in case of errors). |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
77 */ |
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
|
78 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
|
79 try { |
1174
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
80 Artifact artifact = context.getDatabase().getRawArtifact(uuid); |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
81 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
82 if (artifact == null) { |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
83 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
|
84 return null; |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
85 } |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
86 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
87 if (!(artifact instanceof FLYSArtifact)) { |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
88 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
|
89 return null; |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
90 } |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
91 |
f58be0d661b9
Improved FLYSUtils: fetch Artifacts from ArtifactDatabase properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1150
diff
changeset
|
92 return (FLYSArtifact) artifact; |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
93 } |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
94 // TODO: catch more selective |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
95 catch (Exception e) { |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
96 logger.error("Cannot get FLYSArtifact " + uuid |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1845
diff
changeset
|
97 + " from database (" + e.getMessage() + ")."); |
1150
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
98 return null; |
5f53b443d67c
Implement getArtifact(uuid,context) in FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1129
diff
changeset
|
99 } |
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
|
100 } |
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
101 |
7398280b11a0
Write WSP file for WSPLGEN and add its filepath to the WSPLGEN job.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1105
diff
changeset
|
102 |
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
|
103 /** |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
104 * Returns the FLYSContext from context object. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
105 * |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
106 * @param context The CallContext or the FLYSContext. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
107 * |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
108 * @return the FLYSContext. |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
109 */ |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
110 public static FLYSContext getFlysContext(Object context) { |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
111 return context instanceof FLYSContext |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
112 ? (FLYSContext) context |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
113 : (FLYSContext) ((CallContext) context).globalContext(); |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
114 } |
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 |
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1740
diff
changeset
|
117 /** |
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
|
118 * 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
|
119 * 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
|
120 * |
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
|
121 * @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
|
122 * |
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
|
123 * @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
|
124 */ |
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
|
125 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
|
126 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
|
127 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
|
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 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
|
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 |
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 |
1845
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
133 public static boolean isUsingOracle() { |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
134 SessionFactory sf = SessionFactoryProvider.getSessionFactory(); |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
135 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
136 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
|
137 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
138 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
|
139 } |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
140 |
06c157848c8f
Made the floodmap compatible with an Oracle database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1805
diff
changeset
|
141 |
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
|
142 /** |
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
|
143 * 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
|
144 * 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
|
145 * 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
|
146 * |
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
|
147 * @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
|
148 * |
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
|
149 * @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
|
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 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
|
152 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
|
153 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
|
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 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
|
156 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
|
157 } |
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 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
|
159 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
|
160 } |
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 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
|
162 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
|
163 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
164 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2035
diff
changeset
|
165 |
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 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 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
|
168 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
|
169 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 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
|
171 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
|
172 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 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
|
174 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
|
175 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 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
|
177 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
|
178 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 else { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 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
|
181 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 |
2041
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
184 /** |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
185 * Get min and max kilometer, independent of parametization |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
186 * (ld_from/to vs ld_locations). |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
187 */ |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 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
|
189 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
|
190 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
|
191 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
|
192 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 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
|
195 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
|
196 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
|
197 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 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
|
200 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
|
201 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
|
202 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
|
203 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 else { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 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
|
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 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 |
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[] { 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
|
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 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 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
|
215 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
|
216 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
|
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 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
|
219 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
|
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 try { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 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
|
224 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
|
225 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
|
226 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 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
|
228 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
|
229 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 |
2041
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
233 /** |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
234 * Return sorted array of locations at which stuff was calculated |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
235 * (from ld_locations data), null if not parameterized this way. |
e5f01f2325c9
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2038
diff
changeset
|
236 */ |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 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
|
238 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
|
239 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 if (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
|
241 return null; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 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
|
245 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
|
246 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 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
|
248 try { |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 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
|
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 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
|
252 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 } |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 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
|
256 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 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
|
258 } |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
259 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
260 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
261 /** |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
262 * 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
|
263 * only instances of WINFOArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
264 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
265 * @param flys A FLYSArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
266 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
267 * @return the Qs. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
268 */ |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
269 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
|
270 double[] kmRange = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
271 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
272 // 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
|
273 if (flys instanceof WINFOArtifact) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
274 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
|
275 } |
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 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
|
278 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
279 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
280 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
281 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
282 |
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 * 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
|
285 * only instances of WINFOArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
286 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
287 * @param flys A FLYSArtifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
288 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
289 * @return the Ws. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
290 */ |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
291 public static double[] getWs(FLYSArtifact flys) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
292 double[] kmRange = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
293 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
294 // XXX this is not nice! |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
295 if (flys instanceof WINFOArtifact) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
296 return ((WINFOArtifact) flys).getWs(kmRange); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
297 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
298 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
299 logger.warn("This method currently supports WINFOArtifact only!"); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
300 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
301 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
302 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
303 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
304 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
305 /** |
1099
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
306 * 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
|
307 * 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
|
308 * |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
309 * @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
|
310 */ |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
311 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
|
312 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
|
313 |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
314 return (sRiver != null) |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
315 ? RiverFactory.getRiver(sRiver) |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
316 : null; |
af73f196eccc
Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
317 } |
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
|
318 |
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
|
319 |
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
|
320 /** |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
321 * 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
|
322 * Artifact. |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
323 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
324 * @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
|
325 * |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
326 * @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
|
327 */ |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
328 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
|
329 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
|
330 } |
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 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
333 /** |
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
|
334 * 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
|
335 * 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
|
336 * |
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
|
337 * @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
|
338 * |
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
|
339 * @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
|
340 */ |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
341 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
|
342 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
|
343 |
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 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
|
345 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
|
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 |
1805
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
348 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
|
349 } |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
350 |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
351 |
5e9696c32f04
Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1792
diff
changeset
|
352 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
|
353 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
|
354 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
|
355 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
356 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
|
357 |
adb52a2005e7
Moved code to extract the river srid defined in the global configuration into FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1099
diff
changeset
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 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
|
364 } |
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
|
365 |
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
|
366 |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
367 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
|
368 River river = getRiver(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
369 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
370 if (river == null) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
371 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
|
372 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
373 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
374 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
375 double[] dist = getKmRange(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
376 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
377 if (dist == null) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
378 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
|
379 return null; |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
380 } |
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 if (logger.isDebugEnabled()) { |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
383 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
|
384 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
|
385 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
|
386 } |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
387 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
388 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
|
389 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
390 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
|
391 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
|
392 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
393 return gauge; |
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 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
397 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
|
398 Gauge gauge = getGauge(flys); |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
399 |
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2041
diff
changeset
|
400 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
|
401 } |
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 |
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
|
404 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
|
405 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
|
406 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
|
407 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
|
408 ) { |
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
|
409 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
|
410 |
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
|
411 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
|
412 |
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
|
413 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
|
414 |
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
|
415 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
|
416 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
|
417 |
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
|
418 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
|
419 |
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
|
420 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
|
421 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
|
422 |
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
|
423 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
|
424 } |
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
|
425 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
|
426 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
|
427 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
|
428 } |
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
|
429 |
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
|
430 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
|
431 |
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
|
432 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
|
433 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
|
434 } |
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 |
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 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
|
437 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
|
438 } |
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 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
|
441 ? "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
|
442 : "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
|
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 |
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 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
|
447 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
|
448 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
|
449 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
|
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 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
|
452 |
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 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
|
454 |
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 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
|
456 |
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 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
|
458 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
|
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 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
|
461 |
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 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
|
463 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
|
464 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
465 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
|
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 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
|
468 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
|
469 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
|
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 |
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 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
|
473 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
474 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
|
475 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
|
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 |
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 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
|
479 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
|
480 } |
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 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
|
483 ? "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
|
484 : "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
|
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 |
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 |
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
|
488 /** |
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
|
489 * 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
|
490 * 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
|
491 * |
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
|
492 * @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
|
493 * @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
|
494 * |
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
|
495 * @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
|
496 */ |
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
|
497 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
|
498 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
|
499 |
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
|
500 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
|
501 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
|
502 } |
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
|
503 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
|
504 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
|
505 } |
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
|
506 } |
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
|
507 |
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
|
508 |
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
|
509 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
|
510 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
|
511 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
|
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 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
|
514 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
|
515 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
|
516 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
|
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 } |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
519 |
8d08f6641372
Improved the title creation of WSP Q and W facets - named main values are taken into account while title creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1174
diff
changeset
|
520 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
|
521 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
|
522 } |
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
|
523 |
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
|
524 |
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
|
525 /** |
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
|
526 * |
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
|
527 * @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
|
528 * |
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
|
529 * @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
|
530 */ |
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
|
531 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
|
532 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
|
533 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
|
534 |
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
|
535 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
|
536 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
|
537 } |
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
|
538 |
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
|
539 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
|
540 } |
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
|
541 |
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
|
542 |
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
|
543 /** |
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
|
544 * 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
|
545 * <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
|
546 * |
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
|
547 * @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
|
548 * |
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
|
549 * @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
|
550 */ |
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
|
551 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
|
552 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
|
553 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
|
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 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
|
556 } |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
557 } |
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
|
558 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |