Mercurial > dive4elements > river
changeset 8765:a5e450af498b
(issue1838) Remove method in RiverUtils.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 17 Aug 2015 11:06:23 +0200 |
parents | d5917ff74d8a |
children | 35c0b3fccc03 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/EnterLocationState.java artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java |
diffstat | 3 files changed, 8 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java Mon Aug 17 10:18:05 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java Mon Aug 17 11:06:23 2015 +0200 @@ -24,8 +24,7 @@ import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.resources.Resources; - -import org.dive4elements.river.utils.RiverUtils; +import org.dive4elements.river.artifacts.access.RiverAccess; /** @@ -123,8 +122,8 @@ @Override protected double[] getMinMax(Artifact artifact) { - D4EArtifact flysArtifact = (D4EArtifact) artifact; - return RiverUtils.getRiverMinMax(flysArtifact); + return new RiverAccess((D4EArtifact)artifact).getRiver() + .determineMinMaxDistance(); }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/EnterLocationState.java Mon Aug 17 10:18:05 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/EnterLocationState.java Mon Aug 17 11:06:23 2015 +0200 @@ -10,7 +10,7 @@ import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.utils.RiverUtils; +import org.dive4elements.river.artifacts.access.RiverAccess; /** @@ -28,7 +28,8 @@ /** Allow from min km of river. */ @Override protected Object getLower(D4EArtifact flys) { - double[] lowerUpper = RiverUtils.getRiverMinMax(flys); + double[] lowerUpper = new RiverAccess(flys).getRiver() + .determineMinMaxDistance(); return lowerUpper != null ? lowerUpper[0] @@ -39,7 +40,8 @@ /** Allow to max km of river. */ @Override protected Object getUpper(D4EArtifact flys) { - double[] lowerUpper = RiverUtils.getRiverMinMax(flys); + double[] lowerUpper = new RiverAccess(flys).getRiver() + .determineMinMaxDistance(); return lowerUpper != null ? lowerUpper[1]
--- a/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java Mon Aug 17 10:18:05 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java Mon Aug 17 11:06:23 2015 +0200 @@ -234,33 +234,6 @@ } - /** - * Get bounds for river of artifact. - * @param flysArtifact artifact which has a "river" data. - * @return double array. min is at[0], max at[1]. null if given artifact is null - */ - public static double[] getRiverMinMax(D4EArtifact flysArtifact) { - if (flysArtifact == null) { - return null; - } - - String riverName = flysArtifact.getDataAsString("river"); - - if (riverName == null) { - riverName = ""; - } - - log.debug("Search for the min/max distances of '" + riverName + "'"); - - // Why not use getRiver(flysArtifact) ? - River river = RiverFactory.getRiver(riverName); - - return river != null - ? river.determineMinMaxDistance() - : null; - } - - public static double[] getKmFromTo(D4EArtifact flys) { String strFrom = flys.getDataAsString("ld_from"); String strTo = flys.getDataAsString("ld_to");