Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java @ 9178:2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
author | gernotbelger |
---|---|
date | Tue, 26 Jun 2018 19:48:35 +0200 |
parents | 23945061daec |
children | 0633f963c5be |
rev | line source |
---|---|
8996 | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
2 * Software engineering by |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
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.inundationduration; | |
11 | |
12 import java.util.ArrayList; | |
13 import java.util.Collection; | |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
14 import java.util.List; |
8996 | 15 |
16 import org.apache.commons.lang.math.DoubleRange; | |
17 import org.dive4elements.artifacts.CallContext; | |
18 import org.dive4elements.river.artifacts.access.RiverAccess; | |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9118
diff
changeset
|
19 import org.dive4elements.river.artifacts.common.GeneralResultType; |
8996 | 20 import org.dive4elements.river.artifacts.common.ResultRow; |
21 import org.dive4elements.river.artifacts.model.Calculation; | |
22 import org.dive4elements.river.artifacts.model.CalculationResult; | |
23 import org.dive4elements.river.artifacts.resources.Resources; | |
24 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; | |
25 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; | |
26 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
27 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; | |
9118
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9070
diff
changeset
|
28 import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZone; |
8996 | 29 import org.dive4elements.river.model.River; |
30 | |
31 /** | |
32 * @author Domenico Nardi Tironi | |
33 * | |
34 */ | |
35 final class InundationDurationCalculation { | |
36 | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
37 private final CallContext context; |
8996 | 38 |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
39 public InundationDurationCalculation(final CallContext context) { |
8996 | 40 this.context = context; |
41 } | |
42 | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
43 public CalculationResult calculate(final UINFOArtifact uinfo) { |
8996 | 44 final Calculation problems = new Calculation(); |
45 | |
46 final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name()); | |
47 final String user = CalculationUtils.findArtifactUser(this.context, uinfo); | |
48 | |
49 final RiverAccess access = new RiverAccess(uinfo); | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
50 |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
51 final InundationDurationAccess indurax = new InundationDurationAccess(uinfo); |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
52 final River river = indurax.getRiver(); |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
53 final RiverInfo riverInfo = new RiverInfo(river); |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
54 final DoubleRange calcRange = indurax.getRange(); |
9178
2f5052835b76
uinfo inundationduration langjähr. Mittel, Uedauern.properties, Meldung
gernotbelger
parents:
9150
diff
changeset
|
55 final String url = indurax.getWMSUrl(); |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
56 final Integer year = indurax.getYear(); // null bei year -> Integer.. evtl ungünstig.. evtl. anders lösen |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
57 final DoubleRange range = indurax.getRange(); |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
58 final Double sedimentHeight = indurax.getSedimentHeight(); |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
59 final String zonesRaw = indurax.getVegZones(); |
9118
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9070
diff
changeset
|
60 final List<VegetationZone> zones = VegetationZone.parse(zonesRaw); |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
61 |
8996 | 62 final InundationDurationCalculationResults results = new InundationDurationCalculationResults(calcModeLabel, user, riverInfo, calcRange); |
63 | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
64 final Collection<ResultRow> rows = new ArrayList<>(); |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
65 |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
66 final ResultRow row1 = ResultRow.create(). // |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9118
diff
changeset
|
67 putValue(GeneralResultType.station, 88). // |
8996 | 68 putValue(SInfoResultType.discharge, 100). // |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
69 putValue(SInfoResultType.waterlevel, 2). // |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
70 putValue(SInfoResultType.gaugeLabel, "Torgau"); |
8996 | 71 |
72 rows.add(row1); | |
73 | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
74 final ResultRow row2 = ResultRow.create(). // |
8996 | 75 putValue(SInfoResultType.discharge, 200). // |
76 putValue(SInfoResultType.waterlevel, 3). // | |
77 putValue(SInfoResultType.gaugeLabel, "Zollenspieker"); | |
78 | |
79 rows.add(row2); | |
80 | |
81 final InundationDurationCalculationResult result = new InundationDurationCalculationResult("Ergebnis 1", null, rows); | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
82 |
8996 | 83 results.addResult(result, problems); |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
8996
diff
changeset
|
84 |
8996 | 85 return new CalculationResult(results, problems); |
86 } | |
87 } |