Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationzonesAccess.java @ 9070:611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
author | gernotbelger |
---|---|
date | Tue, 15 May 2018 18:04:36 +0200 |
parents | 1ffd38826175 |
children | 8b7bf26b8782 |
comparison
equal
deleted
inserted
replaced
9069:1ffd38826175 | 9070:611a523fc42f |
---|---|
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 | 10 |
11 package org.dive4elements.river.artifacts.uinfo.vegetationzones; | 11 package org.dive4elements.river.artifacts.uinfo.vegetationzones; |
12 | 12 |
13 import java.util.ArrayList; | |
14 | |
15 import org.apache.commons.lang.math.DoubleRange; | |
16 import org.dive4elements.river.artifacts.access.RangeAccess; | 13 import org.dive4elements.river.artifacts.access.RangeAccess; |
17 import org.dive4elements.river.artifacts.common.AccessHelper; | 14 import org.dive4elements.river.artifacts.common.EpochYearAccessHelper; |
18 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; | 15 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; |
19 import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode; | 16 import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode; |
20 | 17 |
21 /** | 18 /** |
22 * Access to the flow depth calculation type specific SInfo artifact data. | 19 * Access to the flow depth calculation type specific SInfo artifact data. |
26 * | 23 * |
27 * @author Gernot Belger | 24 * @author Gernot Belger |
28 */ | 25 */ |
29 final class VegetationzonesAccess extends RangeAccess { | 26 final class VegetationzonesAccess extends RangeAccess { |
30 | 27 |
31 // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR | 28 private final EpochYearAccessHelper helper; |
32 public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR"; | |
33 public static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR"; | |
34 private final AccessHelper helper; | |
35 | 29 |
36 // Fields from state: | 30 // Fields from state: |
37 // calculation_mode (String) | 31 // calculation_mode (String) |
38 // ld_from, ld_to,ld_step | 32 // ld_from, ld_to,ld_step |
39 // vegzones (String) | 33 // vegzones (String) |
41 public VegetationzonesAccess(final UINFOArtifact uinfo) { | 35 public VegetationzonesAccess(final UINFOArtifact uinfo) { |
42 super(uinfo); | 36 super(uinfo); |
43 | 37 |
44 /* assert calculation mode */ | 38 /* assert calculation mode */ |
45 final UinfoCalcMode calculationMode = uinfo.getCalculationMode(); | 39 final UinfoCalcMode calculationMode = uinfo.getCalculationMode(); |
46 this.helper = new AccessHelper(uinfo); | 40 this.helper = new EpochYearAccessHelper(uinfo); |
47 assert (calculationMode == UinfoCalcMode.uinfo_vegetation_zones); | 41 assert (calculationMode == UinfoCalcMode.uinfo_vegetation_zones); |
48 } | 42 } |
49 | 43 |
50 public DoubleRange getRange() { | 44 public String getVegZones() { |
51 final double from = getFrom(); | 45 return super.getString("vegzones"); |
52 final double to = getTo(); | |
53 return new DoubleRange(from, to); | |
54 } | |
55 | |
56 public ArrayList<String[]> getVegZones() { | |
57 final ArrayList<String[]> results = new ArrayList<>(); | |
58 final String zonesRaw = super.getString("vegzones"); | |
59 if (zonesRaw.contains(TABLE_ROW_SEPARATOR)) { | |
60 final String[] rows = zonesRaw.split(TABLE_ROW_SEPARATOR); | |
61 for (final String row : rows) { | |
62 if (row.contains(TABLE_CELL_SEPARATOR)) { | |
63 final String[] result = row.split(TABLE_CELL_SEPARATOR); | |
64 results.add(result); | |
65 } | |
66 } | |
67 } | |
68 return results; | |
69 } | 46 } |
70 | 47 |
71 } | 48 } |