Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java @ 3230:b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
flys-artifacts/trunk@4859 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 03 Jul 2012 12:13:36 +0000 |
parents | 4c00cf83fff1 |
children | cdbc457e23e2 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java Tue Jul 03 11:03:16 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java Tue Jul 03 12:13:36 2012 +0000 @@ -5,12 +5,13 @@ import org.apache.log4j.Logger; +import de.intevation.artifacts.Artifact; import de.intevation.flys.model.DischargeZone; import de.intevation.flys.model.FlowVelocityModel; import de.intevation.flys.model.FlowVelocityModelValue; import de.intevation.flys.model.River; -import de.intevation.flys.artifacts.MINFOArtifact; +import de.intevation.flys.artifacts.access.FlowVelocityAccess; import de.intevation.flys.artifacts.model.FlowVelocityData; import de.intevation.flys.utils.FLYSUtils; @@ -19,16 +20,18 @@ private static final Logger logger = Logger.getLogger(FlowVelocityCalculation.class); - + + - public CalculationResult calculate(MINFOArtifact artifact) { + public CalculationResult calculate(FlowVelocityAccess access) { logger.info("FlowVelocityCalculation.calculate"); - - int[] mainIds = artifact.getMainChannels(); - int[] totalIds = artifact.getTotalChannels(); + + int[] mainIds = access.getMainChannels(); + int[] totalIds = access.getTotalChannels(); if (logger.isDebugEnabled()) { - logger.debug("Artifact '" + artifact.identifier() + "' contains:"); + Artifact a = access.getArtifact(); + logger.debug("Artifact '" + a.identifier() + "' contains:"); if (mainIds != null) { logger.debug(" " + mainIds.length + " main channel ids"); } @@ -39,9 +42,9 @@ } List<DischargeZone> zones = getDischargeZones(mainIds, totalIds); - List<FlowVelocityModel> models = getFlowVelocityModels(artifact, zones); + List<FlowVelocityModel> models = getFlowVelocityModels(access, zones); - return buildCalculationResult(artifact, models); + return buildCalculationResult(access, models); } @@ -76,10 +79,10 @@ protected List<FlowVelocityModel> getFlowVelocityModels( - MINFOArtifact artifact, + FlowVelocityAccess access, List<DischargeZone> zones ) { - River river = FLYSUtils.getRiver(artifact); + River river = FLYSUtils.getRiver(access.getArtifact()); List<FlowVelocityModel> models = new ArrayList<FlowVelocityModel>(); @@ -129,11 +132,11 @@ protected CalculationResult buildCalculationResult( - MINFOArtifact artifact, + FlowVelocityAccess access, List<FlowVelocityModel> models ) { - double kmLo = artifact.getDataAsDouble("ld_from"); - double kmHi = artifact.getDataAsDouble("ld_to"); + double kmLo = access.getLowerKM(); + double kmHi = access.getUpperKM(); logger.debug("Prepare data for km range: " + kmLo + " - " + kmHi);