Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java @ 9006:7134a4c7d1b6
U-Info S-Info general work
author | gernotbelger |
---|---|
date | Tue, 17 Apr 2018 13:20:25 +0200 |
parents | fb9430250899 |
children | a5cf8d7bff3c |
comparison
equal
deleted
inserted
replaced
9005:460fcc128794 | 9006:7134a4c7d1b6 |
---|---|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | 2 * Software engineering by |
3 * Björnsen Beratende Ingenieure GmbH | 3 * Björnsen Beratende Ingenieure GmbH |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | 4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
5 * | 5 * |
6 * This file is Free Software under the GNU AGPL (>=v3) | 6 * This file is Free Software under the GNU AGPL (>=v3) |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | 7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
17 import org.dive4elements.river.artifacts.access.RiverAccess; | 17 import org.dive4elements.river.artifacts.access.RiverAccess; |
18 import org.dive4elements.river.artifacts.common.ResultRow; | 18 import org.dive4elements.river.artifacts.common.ResultRow; |
19 import org.dive4elements.river.artifacts.model.Calculation; | 19 import org.dive4elements.river.artifacts.model.Calculation; |
20 import org.dive4elements.river.artifacts.model.CalculationResult; | 20 import org.dive4elements.river.artifacts.model.CalculationResult; |
21 import org.dive4elements.river.artifacts.resources.Resources; | 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; | 22 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; |
24 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | 23 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; |
25 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; | 24 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; |
25 import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType; | |
26 import org.dive4elements.river.model.River; | 26 import org.dive4elements.river.model.River; |
27 | 27 |
28 /** | 28 /** |
29 * @author Domenico Nardi Tironi | 29 * @author Domenico Nardi Tironi |
30 * | 30 * |
31 */ | 31 */ |
32 final class VegetationZonesCalculation { | 32 final class VegetationZonesCalculation { |
33 | 33 |
34 private CallContext context; | 34 private final CallContext context; |
35 | 35 |
36 public VegetationZonesCalculation(CallContext context) { | 36 public VegetationZonesCalculation(final CallContext context) { |
37 this.context = context; | 37 this.context = context; |
38 } | 38 } |
39 | 39 |
40 public CalculationResult calculate(UINFOArtifact uinfo) { | 40 public CalculationResult calculate(final UINFOArtifact uinfo) { |
41 final Calculation problems = new Calculation(); | 41 final Calculation problems = new Calculation(); |
42 | 42 |
43 final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name()); | 43 final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name()); |
44 final String user = CalculationUtils.findArtifactUser(this.context, uinfo); | 44 final String user = CalculationUtils.findArtifactUser(this.context, uinfo); |
45 | 45 |
46 final RiverAccess access = new RiverAccess(uinfo); | 46 final RiverAccess access = new RiverAccess(uinfo); |
47 final River river = access.getRiver(); | 47 final River river = access.getRiver(); |
48 DoubleRange calcRange = null; | 48 final DoubleRange calcRange = null; |
49 final RiverInfo riverInfo = new RiverInfo(river); | 49 final RiverInfo riverInfo = new RiverInfo(river); |
50 | 50 |
51 final VegetationZonesCalculationResults results = new VegetationZonesCalculationResults(calcModeLabel, user, riverInfo, calcRange); | 51 final VegetationZonesCalculationResults results = new VegetationZonesCalculationResults(calcModeLabel, user, riverInfo, calcRange); |
52 | 52 |
53 final Collection<ResultRow> rows = new ArrayList<ResultRow>(); | 53 final Collection<ResultRow> rows = new ArrayList<>(); |
54 | |
55 final ResultRow row1 = ResultRow.create(). // | |
56 putValue(SInfoResultType.discharge, 100). // | |
57 putValue(SInfoResultType.waterlevel, 2). // | |
58 putValue(SInfoResultType.gaugeLabel, "Torgau"); | |
59 | 54 |
60 rows.add(row1); | 55 final ResultRow row2 = ResultRow.create(). // |
61 | 56 putValue(UInfoResultType.vegname, "Zonaler Wald"). // |
62 ResultRow row2 = ResultRow.create(). // | 57 putValue(UInfoResultType.vegdauervon, 0). // |
63 putValue(SInfoResultType.discharge, 200). // | 58 putValue(UInfoResultType.vegdauerbis, 5); |
64 putValue(SInfoResultType.waterlevel, 3). // | |
65 putValue(SInfoResultType.gaugeLabel, "Zollenspieker"); | |
66 | 59 |
67 rows.add(row2); | 60 rows.add(row2); |
68 | 61 |
69 final VegetationZonesCalculationResult result = new VegetationZonesCalculationResult("Ergebnis 1", null, rows); | 62 final VegetationZonesCalculationResult result = new VegetationZonesCalculationResult("Ergebnis 1", null, rows); |
70 | 63 |
71 results.addResult(result, problems); | 64 results.addResult(result, problems); |
72 | 65 |
73 return new CalculationResult(results, problems); | 66 return new CalculationResult(results, problems); |
74 } | 67 } |
75 } | 68 } |