Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java @ 9068:a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
author | gernotbelger |
---|---|
date | Mon, 14 May 2018 18:24:35 +0200 |
parents | 7134a4c7d1b6 |
children | 1ffd38826175 |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.artifacts.uinfo.vegetationzones; import java.util.ArrayList; import java.util.Collection; import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.access.RiverAccess; import org.dive4elements.river.artifacts.common.ResultRow; import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType; import org.dive4elements.river.model.River; /** * @author Domenico Nardi Tironi * */ final class VegetationZonesCalculation { private final CallContext context; public VegetationZonesCalculation(final CallContext context) { this.context = context; } public CalculationResult calculate(final UINFOArtifact uinfo) { final Calculation problems = new Calculation(); final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name()); final String user = CalculationUtils.findArtifactUser(this.context, uinfo); final RiverAccess access = new RiverAccess(uinfo); final River river = access.getRiver(); final DoubleRange calcRange = null; final RiverInfo riverInfo = new RiverInfo(river); final VegetationZonesCalculationResults results = new VegetationZonesCalculationResults(calcModeLabel, user, riverInfo, calcRange); final Collection<ResultRow> rows = new ArrayList<>(); // TODO: get results from access! final ResultRow row2 = ResultRow.create(). // putValue(UInfoResultType.vegname, "Zonaler Wald"). // putValue(UInfoResultType.vegdauervon, 0). // putValue(UInfoResultType.vegdauerbis, 5); rows.add(row2); final VegetationZonesCalculationResult result = new VegetationZonesCalculationResult("Ergebnis 1", null, rows); results.addResult(result, problems); return new CalculationResult(results, problems); } }