Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java @ 8996:fb9430250899
Work on uinfo
author | gernotbelger |
---|---|
date | Thu, 12 Apr 2018 19:13:39 +0200 |
parents | |
children | 7134a4c7d1b6 |
comparison
equal
deleted
inserted
replaced
8995:8c3e5682cb60 | 8996:fb9430250899 |
---|---|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
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.common.SInfoResultType; | |
23 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; | |
24 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
25 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; | |
26 import org.dive4elements.river.model.River; | |
27 | |
28 /** | |
29 * @author Domenico Nardi Tironi | |
30 * | |
31 */ | |
32 final class VegetationZonesCalculation { | |
33 | |
34 private CallContext context; | |
35 | |
36 public VegetationZonesCalculation(CallContext context) { | |
37 this.context = context; | |
38 } | |
39 | |
40 public CalculationResult calculate(UINFOArtifact uinfo) { | |
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(); | |
48 DoubleRange calcRange = null; | |
49 final RiverInfo riverInfo = new RiverInfo(river); | |
50 | |
51 final VegetationZonesCalculationResults results = new VegetationZonesCalculationResults(calcModeLabel, user, riverInfo, calcRange); | |
52 | |
53 final Collection<ResultRow> rows = new ArrayList<ResultRow>(); | |
54 | |
55 final ResultRow row1 = ResultRow.create(). // | |
56 putValue(SInfoResultType.discharge, 100). // | |
57 putValue(SInfoResultType.waterlevel, 2). // | |
58 putValue(SInfoResultType.gaugeLabel, "Torgau"); | |
59 | |
60 rows.add(row1); | |
61 | |
62 ResultRow row2 = ResultRow.create(). // | |
63 putValue(SInfoResultType.discharge, 200). // | |
64 putValue(SInfoResultType.waterlevel, 3). // | |
65 putValue(SInfoResultType.gaugeLabel, "Zollenspieker"); | |
66 | |
67 rows.add(row2); | |
68 | |
69 final VegetationZonesCalculationResult result = new VegetationZonesCalculationResult("Ergebnis 1", null, rows); | |
70 | |
71 results.addResult(result, problems); | |
72 | |
73 return new CalculationResult(results, problems); | |
74 } | |
75 } |