Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculation.java @ 9237:972e10522ed6
salix.supraregional ui
author | gernotbelger |
---|---|
date | Tue, 10 Jul 2018 11:24:12 +0200 |
parents | 5a0e8d76582e |
children | da0bdbcd6f09 |
rev | line source |
---|---|
8996 | 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.salix; | |
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.common.GeneralResultType; | |
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; | |
25 import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType; | |
26 import org.dive4elements.river.model.River; | |
27 | |
28 /** | |
29 * @author Domenico Nardi Tironi | |
30 * | |
31 */ | |
32 final class SalixLineCalculation { | |
33 | |
34 private final CallContext context; | |
35 | |
36 public SalixLineCalculation(final CallContext context) { | |
37 this.context = context; | |
38 } | |
39 | |
40 public CalculationResult calculate(final 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 | |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
46 final SalixLineAccess accessSalix = new SalixLineAccess(uinfo); |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
47 |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
48 final River river = accessSalix.getRiver(); |
8996 | 49 final RiverInfo riverInfo = new RiverInfo(river); |
50 | |
9068
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
51 final DoubleRange range = accessSalix.getRange(); |
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
52 final boolean useScenario = accessSalix.getUseScenario(); |
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
53 final String selectedScenario = accessSalix.getScenario(); |
9222 | 54 final Double fromPart = accessSalix.getFromPart(); |
55 final Double toPart = accessSalix.getToPart(); | |
9068
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
56 // calculation_mode |
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
57 // ld_from , ld_to |
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
58 // use_scenario (boolean) |
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
59 // ld_from_part; ld_to_part |
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
60 // scenario_selection (mögliche Werte:"scenarioType.option1" "scenarioType.option2" "scenarioType.option3" |
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
8996
diff
changeset
|
61 |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
62 // FIXME: real calculation |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
63 |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
64 final SalixLineCalculationResults results = new SalixLineCalculationResults(calcModeLabel, user, riverInfo, range); |
8996 | 65 |
66 final Collection<ResultRow> rows = new ArrayList<>(); | |
67 | |
68 final ResultRow row1 = ResultRow.create(). // | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9068
diff
changeset
|
69 putValue(GeneralResultType.station, 100).// |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9068
diff
changeset
|
70 putValue(UInfoResultType.salixline, 28).// |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9068
diff
changeset
|
71 putValue(UInfoResultType.salixlinehist, 2).// |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9068
diff
changeset
|
72 putValue(UInfoResultType.salixlinescen, 82); |
8996 | 73 rows.add(row1); |
74 | |
75 final ResultRow row2 = ResultRow.create(). // | |
76 putValue(GeneralResultType.station, 200). // | |
77 putValue(UInfoResultType.salixline, 3). // | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9068
diff
changeset
|
78 putValue(UInfoResultType.salixlinehist, 2).// |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9068
diff
changeset
|
79 putValue(UInfoResultType.salixlinescen, 822); |
8996 | 80 |
81 rows.add(row2); | |
82 | |
83 final SalixLineCalculationResult result = new SalixLineCalculationResult("Ergebnis 1", null, rows); | |
84 | |
85 results.addResult(result, problems); | |
86 | |
87 return new CalculationResult(results, problems); | |
88 } | |
89 } |