annotate gnv-artifacts/src/main/java/de/intevation/gnv/utils/WKTUtils.java @ 1129:ccfa07b88476

merged geo-backend
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:01 +0200
parents f953c9a559d8
children
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
5 * Read the file LGPL.txt coming with the software for details
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
8
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.utils;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import com.vividsolutions.jts.geom.Coordinate;
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
12 import com.vividsolutions.jts.geom.LineString;
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import com.vividsolutions.jts.geom.Point;
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
14 import com.vividsolutions.jts.geom.Polygon;
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
15
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import com.vividsolutions.jts.io.ParseException;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import com.vividsolutions.jts.io.WKTReader;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
19 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
20
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.gnv.geobackend.base.Result;
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
22
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
25
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
440
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
27
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 import de.intevation.gnv.math.LinearFunction;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
507
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
30 import java.text.MessageFormat;
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
31 import java.text.NumberFormat;
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
32
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 import java.util.ArrayList;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 import java.util.Collection;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 import java.util.List;
507
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
36 import java.util.Locale;
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
38 import org.apache.commons.math.FunctionEvaluationException;
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
39
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 import org.apache.commons.math.optimization.OptimizationException;
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
41
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 import org.apache.commons.math.optimization.fitting.CurveFitter;
519
4e347624ee7c Last part to fix gnv/issue153. Now 'Profilschnitte', 'Horizontalschnitte' and 'horizontale Schnittprofile'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 507
diff changeset
43
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 import org.apache.commons.math.optimization.general.GaussNewtonOptimizer;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 import org.apache.log4j.Logger;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
48 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
49 * A helper class which supports some useful methods to work with wkt strings.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
50 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
51 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
52 */
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 public abstract class WKTUtils {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 private static Logger log = Logger.getLogger(WKTUtils.class);
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 public static final double NAUTICAL_MILE = 1852.216d;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 public static final double KILOMETER = 1000d;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
60 public static final String I_NAME = "MEDIAN.MESHPOINT.IPOSITION";
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
61 public static final String J_NAME = "MEDIAN.MESHPOINT.JPOSITION";
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
62
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
63 public static final String TRUE_EXPRESSION = "FEATUREID=FEATUREID";
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
64
507
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
65 public static final String[] COORDINATE_OUT_FORMAT = {
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
66 "coordinate.template.northeast",
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
67 "coordinate.template.southeast",
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
68 "coordinate.template.northwest",
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
69 "coordinate.template.southwest"
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
70 };
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
71
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
72 public static final String DEFAULT_COORDINATE_TEMPLATE =
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
73 "{0}\u00b0N {1}'' {2}\u00b0E {3}''";
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
74
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
75 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
76 * Checks the difference of two <code>Result</code>s.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
77 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
78 * @param a A Result.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
79 * @param b Another Result.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
80 * @param indices Indices to be checked.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
81 * @return true, if <i>a</i> and <i>b</i> are different - otherwise false.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
82 */
423
2402173a1490 Moved some methods back to old place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
83 public static boolean different(Result a, Result b, int [] indices) {
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 for (int i = 0; i < indices.length; ++i) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 String oa = a.getString(indices[i]);
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 String ob = b.getString(indices[i]);
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 if (oa == null && ob == null) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 continue;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 if (oa == null || ob == null) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 return true;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 if (!oa.equals(ob)) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 return true;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 return false;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
103 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
104 * Turns a wkt string into a coordinate.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
105 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
106 * @param shape A wkt string.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
107 * @return wkt string as coordinate.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
108 */
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 public static Coordinate toCoordinate(String shape) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 try {
482
64e65daa65e9 Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 480
diff changeset
111 return shape != null
64e65daa65e9 Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 480
diff changeset
112 ? ((Point)(new WKTReader().read(shape))).getCoordinate()
64e65daa65e9 Fixed some bugs with calculating "Horizontalschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 480
diff changeset
113 : null;
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 catch (ParseException pe) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 log.error(pe);
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 }
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
118 catch (ClassCastException cce) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
119 log.error("cannot read WKT point", cce);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
120 }
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 return null;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
124 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
125 * Turns a wkt string into a polygon.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
126 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
127 * @param shape A wkt string.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
128 * @return wkt string as polygon.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
129 */
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
130 public static Polygon toPolygon(String shape) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
131 try {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
132 return (Polygon)new WKTReader().read(shape);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
133 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
134 catch (ParseException pe) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
135 log.error(pe);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
136 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
137 catch (ClassCastException cce) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
138 log.error("cannot read WKT polygon", cce);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
139 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
140 return null;
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
141 }
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
143 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
144 * Returns a distance in km.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
145 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
146 * @param distance A distance.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
147 * @return distance in km.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
148 */
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 public static final double toKM(double distance) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 return (distance * NAUTICAL_MILE) / KILOMETER;
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
154 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
155 * Turns a coordinate into a wkt string.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
156 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
157 * @param coordinate A coordinate.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
158 * @return the coordinate as wkt string.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
159 */
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 public static String toWKT(Coordinate coordinate) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 StringBuilder sb = new StringBuilder("POINT(");
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 sb.append(coordinate.x)
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 .append(' ')
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 .append(coordinate.y)
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 .append(')');
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 return sb.toString();
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
169
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
170 public static final String indexBox(
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 740
diff changeset
171 java.awt.Point a,
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
172 java.awt.Point b,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
173 String iName,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
174 String jName
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
175 ) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
176 int minI = Math.min(a.x, b.x) - 1;
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
177 int maxI = Math.max(a.x, b.x) + 1;
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
178 int minJ = Math.min(a.y, b.y) - 1;
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
179 int maxJ = Math.max(a.y, b.y) + 1;
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
180 StringBuilder sb = new StringBuilder("(")
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
181 .append(iName).append(" >= ").append(minI)
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
182 .append(" AND ").append(iName).append(" <= ").append(maxI)
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
183 .append(" AND ").append(jName).append(" >= ").append(minJ)
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
184 .append(" AND ").append(jName).append(" <= ").append(maxJ)
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
185 .append(')');
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
186 return sb.toString();
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
187 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
188
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
189 public static final String diagonalBox(List<java.awt.Point> points) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
190
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
191 if (points.get(0) != null && points.get(2) != null) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
192 return indexBox(
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
193 points.get(0), points.get(2),
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
194 I_NAME,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
195 J_NAME);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
196 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
197
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
198 if (points.get(1) != null && points.get(3) != null) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
199 return indexBox(
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
200 points.get(1), points.get(3),
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
201 I_NAME,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
202 J_NAME);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
203 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
204
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
205 return null;
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
206 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
207
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
208 public static String worldEnvelopeCoordinatesToIndex(
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
209 Coordinate [] coords,
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
210 String meshid,
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
211 String ijkQueryID
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
212 )
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
213 throws QueryException
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
214 {
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
215 List<java.awt.Point> points =
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
216 new ArrayList<java.awt.Point>(coords.length);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
217
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
218 ArrayList<Object []> missingPoints =
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
219 new ArrayList<Object []>();
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
220
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
221 createIJKPoints(coords, meshid, ijkQueryID, points, missingPoints);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 740
diff changeset
222
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
223 String additionWhere = null;
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
224
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
225 if (missingPoints.size() == coords.length) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
226 log.debug("cannot create index buffer");
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
227 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
228 else {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
229 additionWhere = diagonalBox(points);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
230
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
231 if (additionWhere == null) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
232 // 3 Points are missing or are on one side of the envelope
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
233 boolean remainsMissingPoints = calculateIJ4MissingPoints(
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
234 coords, points, missingPoints);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
235
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
236 if (!remainsMissingPoints) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
237 additionWhere = diagonalBox(points);
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
238 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
239 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
240 }
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
241
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
242 return additionWhere != null
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
243 ? additionWhere
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
244 : TRUE_EXPRESSION;
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
245 }
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
246
423
2402173a1490 Moved some methods back to old place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 420
diff changeset
247 public static String worldCoordinatesToIndex(
440
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
248 Coordinate [] coords,
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
249 Collection<Result> result,
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
250 String meshid,
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
251 String ijkQueryID
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
252 )
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
253 throws QueryException
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254 {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 List<java.awt.Point> points = new ArrayList<java.awt.Point>(coords.length);
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
257 ArrayList<Object []> missingPoints = new ArrayList<Object []>();
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
259 createIJKPoints(coords, meshid, ijkQueryID, points, missingPoints);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 740
diff changeset
260
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
261 String additionWhere = TRUE_EXPRESSION;
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
262
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
263 if (missingPoints.size() == coords.length) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
264 log.debug("cannot create index buffer");
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
265 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
266 else { // generate index filter
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
267 boolean remainsMissingPoints = calculateIJ4MissingPoints(
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
268 coords, points, missingPoints);
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
270 if (!remainsMissingPoints) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
271 // TODO: Make Tablenames and Columns Configurable
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
272 IndexBuffer ib = new IndexBuffer(
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 740
diff changeset
273 points,
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 740
diff changeset
274 I_NAME,
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
275 J_NAME );
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
276 additionWhere = ib.toWhereClause();
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
277 log.debug("Additional Where Clause = "+additionWhere);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
278 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
279 } // if generate index filter
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
281 return additionWhere;
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
282 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
283
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
284
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
285 /**
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
286 * @param coords
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
287 * @param points
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
288 * @param missingPoints
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
289 * @return
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
290 */
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
291 private static boolean calculateIJ4MissingPoints(
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
292 Coordinate [] coords,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
293 List<java.awt.Point> points,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
294 ArrayList<Object[]> missingPoints
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
295 ) {
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
296 boolean remainsMissingPoints = !missingPoints.isEmpty();
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
297
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
298 if (remainsMissingPoints) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
299 // try to guess the missing (i, j)
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
300 CurveFitter iFitter = new CurveFitter(new GaussNewtonOptimizer(true));
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
301 CurveFitter jFitter = new CurveFitter(new GaussNewtonOptimizer(true));
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
302
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
303 for (int i = 0, N = points.size(); i < N; ++i) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
304 java.awt.Point p = (java.awt.Point)points.get(i);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
305 if (p != null) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
306 Coordinate coord = coords[i];
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
307 iFitter.addObservedPoint(coord.x, p.x);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
308 jFitter.addObservedPoint(coord.y, p.y);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
309 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
310 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
311 try {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
312 // XXX: Assumption: (i, j) are created by componentwise linear function.
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
313 // This is surely not correct because (x, y) are in a ellipsoid projection.
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
314 // TODO: use ellipsoid functions and fit with Levenberg Marquardt.
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
315 double [] iParams = iFitter.fit(
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
316 LinearFunction.INSTANCE, new double [] { 1d, 1d });
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
317
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
318 double [] jParams = jFitter.fit(
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
319 LinearFunction.INSTANCE, new double [] { 1d, 1d });
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
320
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
321 for (int i = missingPoints.size()-1; i >= 0; --i) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
322 Object [] a = (Object [])missingPoints.get(i);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
323 Coordinate coord = (Coordinate)a[1];
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
324 int pi = (int)Math.round(iParams[0]*coord.x + iParams[1]);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
325 int pj = (int)Math.round(jParams[0]*coord.y + jParams[1]);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
326 points.set(
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
327 ((Integer)a[0]).intValue(),
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
328 new java.awt.Point(pi, pj));
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
329 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
330
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
331 remainsMissingPoints = false; // we filled the gaps
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
332 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
333 catch (FunctionEvaluationException fee) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
334 log.error(fee);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
335 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
336 catch (OptimizationException oe) {
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
337 log.error(oe);
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
338 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
339 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
340 return remainsMissingPoints;
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
341 }
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
342
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
343
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
344 /**
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
345 * @param coords
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
346 * @param meshid
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
347 * @param ijkQueryID
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
348 * @param points
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
349 * @param missingPoints
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
350 * @throws QueryException
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
351 */
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
352 private static void createIJKPoints(
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
353 Coordinate[] coords,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
354 String meshid,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
355 String ijkQueryID,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
356 List<java.awt.Point> points,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
357 ArrayList<Object []> missingPoints
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
358 )
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 740
diff changeset
359 throws QueryException
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
360 {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
361 boolean debug = log.isDebugEnabled();
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
362
468
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
363 QueryExecutor queryExecutor = QueryExecutorFactory
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
364 .getInstance()
7ba4c7222265 Added ij-Index determination for horizontal-cross-sections.
Tim Englich <tim.englich@intevation.de>
parents: 440
diff changeset
365 .getQueryExecutor();
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 740
diff changeset
366
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
367 for (int i = 0; i < coords.length; i++) {
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
368
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
369 String wkt = toWKT(coords[i]);
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
370
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
371 Collection<Result> result = queryExecutor.executeQuery(
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
372 ijkQueryID,
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
373 new String [] {meshid, wkt});
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
374
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
375 if (!result.isEmpty()) {
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
376 Result resultValue = result.iterator().next();
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
377 int iPos = resultValue.getInteger(1);
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
378 int jPos = resultValue.getInteger(0);
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
379 if (debug) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
380 log.debug("Found Pos "+iPos+"/"+jPos +" for "+wkt);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
381 }
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
382 points.add(i, new java.awt.Point(iPos,jPos));
471
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
383 }
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
384 else {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
385 if (debug) {
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
386 log.debug("No i/j Pos found for "+wkt);
06887e2e3f7a Some minor code cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 468
diff changeset
387 }
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
388 missingPoints.add(new Object [] { Integer.valueOf(i), coords[i] });
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
389 points.add(i, null);
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
390 // Special Case no i,j found for Coordinate
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
391 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
392 }
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
393 }
440
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
394
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
395 public static Coordinate [] toCoordinates(String wkt) {
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
396 try {
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
397 LineString ls = (LineString)new WKTReader().read(wkt);
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
398 return ls.getCoordinates();
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
399 }
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
400 catch (ParseException pe) {
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
401 log.error("cannot read WKT line string", pe);
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
402 }
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
403 catch (ClassCastException cce) {
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
404 log.error("cannot read WKT line string", cce);
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
405 }
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
406 return null;
eb2ac62e853a Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 423
diff changeset
407 }
507
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
408
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
409 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
410 * Turns a wkt coordinate into a string format using the default locale of
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
411 * the virtual machine.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
412 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
413 * @param wkt A wkt coordinate.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
414 * @return A formatted coordinate.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
415 */
507
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
416 public static String toText(String wkt) {
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
417 return toText(Locale.getDefault(), wkt);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
418 }
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
419
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
420 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
421 * Turns a point into a string format using the default locale of the
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
422 * virtual machine.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
423 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
424 * @param p A point.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
425 * @return A point formatted as string.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
426 */
740
0563389138bb Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 519
diff changeset
427 public static String toText(Point p) {
0563389138bb Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 519
diff changeset
428 return toText(Locale.getDefault(), toWKT(p.getCoordinate()));
0563389138bb Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 519
diff changeset
429 }
0563389138bb Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 519
diff changeset
430
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
431 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
432 * Turns a point into a string format using a given locale.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
433 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
434 * @param locale A locale.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
435 * @param p A point.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
436 * @return a point formatted as string.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
437 */
740
0563389138bb Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 519
diff changeset
438 public static String toText(Locale locale, Point p) {
0563389138bb Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 519
diff changeset
439 return toText(locale, toWKT(p.getCoordinate()));
0563389138bb Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 519
diff changeset
440 }
0563389138bb Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 519
diff changeset
441
806
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
442 /**
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
443 * Turns a wkt coordiante into a formatted text using a given locale.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
444 *
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
445 * @param locale A locale.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
446 * @param wkt A wkt coordinate.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
447 * @return a formatted coordinate.
2cea76f1112e Added Javadoc in utils package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 778
diff changeset
448 */
507
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
449 public static String toText(Locale locale, String wkt) {
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
450 String formattedCoordinate = null;
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
451 try {
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
452 Point p = (Point)new WKTReader().read(wkt);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
453 double lat = p.getY();
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
454 double lon =p.getX();
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
455
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
456 int choice = 0;
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
457
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
458 if (lat <0 ) {
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
459 choice += 1;
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
460 lat=-lat;
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
461 }
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
462
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
463 if (lon <0 ) {
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
464 choice += 2;
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
465 lon=-lon;
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
466 }
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
467
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
468 RessourceFactory factory = RessourceFactory.getInstance();
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
469 String template = factory.getRessource(
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
470 locale,
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
471 COORDINATE_OUT_FORMAT[choice],
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
472 DEFAULT_COORDINATE_TEMPLATE
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
473 );
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
474
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
475 NumberFormat minFormatter = NumberFormat.getInstance(locale);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
476 minFormatter.setMaximumFractionDigits(3);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
477 minFormatter.setMinimumFractionDigits(3);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
478
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
479 String minLat = minFormatter.format(60.*(lat-((int)lat)));
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
480 String minLon = minFormatter.format(60.*(lon-((int)lon)));
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
481
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
482 NumberFormat degFormatter = NumberFormat.getInstance(locale);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
483 degFormatter.setMinimumIntegerDigits(2);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
484
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
485 String formLat = degFormatter.format((int)lat);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
486 String formLon = degFormatter.format((int)lon);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
487
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
488 MessageFormat formatter = new MessageFormat(template);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
489
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
490 Object[] args = {
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
491 formLat, minLat,
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
492 formLon, minLon
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
493 };
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
494
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
495 return formatter.format(args);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
496
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
497 }
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
498 catch (ParseException e) {
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
499 log.warn(e,e);
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
500 }
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
501
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
502 return null;
45be952a3215 Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 482
diff changeset
503 }
420
c6a287398379 Outsourcing of some methods for preparing results for chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
504 }
836
05bf8534a35a Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 806
diff changeset
505 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org