Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java @ 431:422275fc9927
Refactored the XYColumn and Point2d code a bit to be more reusable in 3D.
gnv-artifacts/trunk@479 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 23 Dec 2009 06:53:46 +0000 |
parents | bed9735adf84 |
children | 6a70e8883307 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java Tue Dec 22 20:45:45 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java Wed Dec 23 06:53:46 2009 +0000 @@ -40,9 +40,12 @@ import de.intevation.gnv.geobackend.base.query.QueryExecutor; import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory; import de.intevation.gnv.geobackend.base.query.exception.QueryException; + import de.intevation.gnv.math.AttributedXYColumns; import de.intevation.gnv.math.HeightValue; import de.intevation.gnv.math.XYColumn; +import de.intevation.gnv.math.IJKey; + import de.intevation.gnv.state.describedata.KeyValueDescibeData; import de.intevation.gnv.state.exception.StateException; import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; @@ -156,7 +159,7 @@ protected AttributedXYColumns preProcess(Collection results) { AttributedXYColumns attColumns = new AttributedXYColumns(); - Map map = new HashMap(); + Map map = new HashMap(1013); Iterator iter = results.iterator(); int sIdx = -1; @@ -200,14 +203,16 @@ int k = result.getInteger(kIdx); int z = result.getInteger(zIdx); - XYColumn col = new XYColumn(point.getX(), point.getY(), i, j); - XYColumn old = (XYColumn)map.get(col); + IJKey key = new IJKey(i, j); - if (old == null) { - map.put(old = col, col); + XYColumn col = (XYColumn)map.get(key); + + if (col == null) { + col = new XYColumn(point.getX(), point.getY(), i, j); + map.put(key, col); } - old.add(new HeightValue(z, v, k)); + col.add(new HeightValue(z, v, k)); } catch (ParseException pe) { log.warn("Error while parsing geometry.", pe);