comparison gnv-artifacts/src/main/java/de/intevation/gnv/utils/WKTUtils.java @ 440:eb2ac62e853a

Cleaned up messy code a bit in "Horizontales Schnittprofil" and "Profilschnitt". gnv-artifacts/trunk@488 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 28 Dec 2009 17:13:12 +0000
parents 2402173a1490
children 7ba4c7222265
comparison
equal deleted inserted replaced
439:8975de9d7483 440:eb2ac62e853a
8 8
9 import de.intevation.gnv.geobackend.base.Result; 9 import de.intevation.gnv.geobackend.base.Result;
10 import de.intevation.gnv.geobackend.base.query.QueryExecutor; 10 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
11 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; 11 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
12 import de.intevation.gnv.geobackend.base.query.exception.QueryException; 12 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
13
13 import de.intevation.gnv.math.LinearFunction; 14 import de.intevation.gnv.math.LinearFunction;
14 import de.intevation.gnv.state.InputData;
15 15
16 import java.util.ArrayList; 16 import java.util.ArrayList;
17 import java.util.Collection; 17 import java.util.Collection;
18 import java.util.List; 18 import java.util.List;
19 import java.util.Map;
20 19
21 import org.apache.commons.math.optimization.OptimizationException; 20 import org.apache.commons.math.optimization.OptimizationException;
22 import org.apache.commons.math.optimization.fitting.CurveFitter; 21 import org.apache.commons.math.optimization.fitting.CurveFitter;
23 import org.apache.commons.math.optimization.general.GaussNewtonOptimizer; 22 import org.apache.commons.math.optimization.general.GaussNewtonOptimizer;
24 import org.apache.commons.math.FunctionEvaluationException; 23 import org.apache.commons.math.FunctionEvaluationException;
82 return sb.toString(); 81 return sb.toString();
83 } 82 }
84 83
85 84
86 public static String worldCoordinatesToIndex( 85 public static String worldCoordinatesToIndex(
87 Collection<Result> result, 86 Coordinate [] coords,
88 Map<String, InputData> inputData, 87 Collection<Result> result,
89 String ijkQueryID 88 String meshid,
90 ) throws ParseException, QueryException 89 String ijkQueryID
90 )
91 throws QueryException
91 { 92 {
92 // 1. IJK Anfragen für Stuetzpunkte im Netz ausführen. 93 // 1. IJK Anfragen für Stuetzpunkte im Netz ausführen.
93 LineString ls = (LineString)new WKTReader().read(
94 inputData.get("mesh_linestring").getValue());
95
96 Coordinate[] coords = ls.getCoordinates();
97 94
98 List<java.awt.Point> points = new ArrayList<java.awt.Point>(coords.length); 95 List<java.awt.Point> points = new ArrayList<java.awt.Point>(coords.length);
99 96
100 String meshid = inputData.get("meshid").getValue();
101 QueryExecutor queryExecutor = QueryExecutorFactory 97 QueryExecutor queryExecutor = QueryExecutorFactory
102 .getInstance() 98 .getInstance()
103 .getQueryExecutor(); 99 .getQueryExecutor();
104 100
105 ArrayList missingPoints = new ArrayList(); 101 ArrayList missingPoints = new ArrayList();
187 } 183 }
188 } // if generate index filter 184 } // if generate index filter
189 185
190 return additionWhere; 186 return additionWhere;
191 } 187 }
188
189 public static Coordinate [] toCoordinates(String wkt) {
190 try {
191 LineString ls = (LineString)new WKTReader().read(wkt);
192 return ls.getCoordinates();
193 }
194 catch (ParseException pe) {
195 log.error("cannot read WKT line string", pe);
196 }
197 catch (ClassCastException cce) {
198 log.error("cannot read WKT line string", cce);
199 }
200 return null;
201 }
192 } 202 }

http://dive4elements.wald.intevation.org