Mercurial > dive4elements > river
annotate 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 |
rev | line source |
---|---|
8996 | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
9006 | 2 * Software engineering by |
3 * Björnsen Beratende Ingenieure GmbH | |
8996 | 4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.uinfo.vegetationzones; | |
11 | |
12 import java.util.ArrayList; | |
13 import java.util.Collection; | |
14 | |
15 import org.apache.commons.lang.math.DoubleRange; | |
16 import org.dive4elements.artifacts.CallContext; | |
17 import org.dive4elements.river.artifacts.access.RiverAccess; | |
18 import org.dive4elements.river.artifacts.common.ResultRow; | |
19 import org.dive4elements.river.artifacts.model.Calculation; | |
20 import org.dive4elements.river.artifacts.model.CalculationResult; | |
21 import org.dive4elements.river.artifacts.resources.Resources; | |
22 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; | |
23 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
24 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; | |
9006 | 25 import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType; |
8996 | 26 import org.dive4elements.river.model.River; |
27 | |
28 /** | |
29 * @author Domenico Nardi Tironi | |
30 * | |
31 */ | |
32 final class VegetationZonesCalculation { | |
33 | |
9006 | 34 private final CallContext context; |
8996 | 35 |
9006 | 36 public VegetationZonesCalculation(final CallContext context) { |
8996 | 37 this.context = context; |
38 } | |
39 | |
9006 | 40 public CalculationResult calculate(final UINFOArtifact uinfo) { |
8996 | 41 final Calculation problems = new Calculation(); |
42 | |
43 final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name()); | |
44 final String user = CalculationUtils.findArtifactUser(this.context, uinfo); | |
45 | |
46 final RiverAccess access = new RiverAccess(uinfo); | |
47 final River river = access.getRiver(); | |
9006 | 48 final DoubleRange calcRange = null; |
8996 | 49 final RiverInfo riverInfo = new RiverInfo(river); |
9006 | 50 |
8996 | 51 final VegetationZonesCalculationResults results = new VegetationZonesCalculationResults(calcModeLabel, user, riverInfo, calcRange); |
52 | |
9006 | 53 final Collection<ResultRow> rows = new ArrayList<>(); |
9068
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
9006
diff
changeset
|
54 // TODO: get results from access! |
9006 | 55 final ResultRow row2 = ResultRow.create(). // |
56 putValue(UInfoResultType.vegname, "Zonaler Wald"). // | |
57 putValue(UInfoResultType.vegdauervon, 0). // | |
58 putValue(UInfoResultType.vegdauerbis, 5); | |
8996 | 59 |
60 rows.add(row2); | |
61 | |
62 final VegetationZonesCalculationResult result = new VegetationZonesCalculationResult("Ergebnis 1", null, rows); | |
9006 | 63 |
8996 | 64 results.addResult(result, problems); |
9006 | 65 |
8996 | 66 return new CalculationResult(results, problems); |
67 } | |
68 } |