[PATCH 2 of 2] (issue1838) Remove method in RiverUtils
Wald Commits
scm-commit at wald.intevation.org
Tue Aug 18 08:19:18 CEST 2015
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1439802383 -7200
# Node ID a5e450af498b80c9c9c5a8bfd4c45323ff62adfa
# Parent d5917ff74d8a22cdf90bb04cc5d6eecb2501645a
(issue1838) Remove method in RiverUtils.
diff -r d5917ff74d8a -r a5e450af498b artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java
--- 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();
}
diff -r d5917ff74d8a -r a5e450af498b artifacts/src/main/java/org/dive4elements/river/artifacts/states/EnterLocationState.java
--- 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]
diff -r d5917ff74d8a -r a5e450af498b artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java
--- 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");
More information about the Dive4Elements-commits
mailing list