diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZone.java @ 9402:e511eb935ccd

Changed hard coded standard vegetation zone table to fetching it from the database, i18n for the standard zone names
author mschaefer
date Tue, 14 Aug 2018 14:04:01 +0200
parents b570b6fcc052
children
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZone.java	Tue Aug 14 14:02:26 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZone.java	Tue Aug 14 14:04:01 2018 +0200
@@ -13,6 +13,10 @@
 import java.util.List;
 import java.util.TreeSet;
 
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.resources.Resources;
+import org.dive4elements.river.model.River;
+
 /**
  * @author Domenico Nardi Tironi
  *
@@ -87,19 +91,13 @@
         return this.min_day_overflow;
     }
 
-    public static final List<VegetationZone> getStandardList() {
+    public static final List<VegetationZone> getStandardList(final River river, final CallContext context) {
 
         final List<VegetationZone> list = new ArrayList<>();
-        list.add(new VegetationZone("Zonaler Wald", 0, 5, "#336600"));
-        list.add(new VegetationZone("Hartholzaue, trocken", 6, 40, "#00cc00"));
-        list.add(new VegetationZone("Hartholzaue, feucht", 41, 80, "#66ff33"));
-        list.add(new VegetationZone("Silberweidenwald", 81, 140, "#008080"));
-        list.add(new VegetationZone("Weidengebüsch", 141, 200, "#33cccc"));
-        list.add(new VegetationZone("Uferröhricht", 201, 260, "#ffa8ff"));
-        list.add(new VegetationZone("Uferpioniere", 261, 320, "#ff0000"));
-        list.add(new VegetationZone("Vegetationslos", 321, 364, "#b2b2b2"));
-        list.add(new VegetationZone("Wasserfläche", 365, 365, "#0066ff"));
-
+        for (final org.dive4elements.river.model.uinfo.VegetationZone vz : org.dive4elements.river.model.uinfo.VegetationZone.getValues(river)) {
+            final String zn = Resources.getMsg(context.getMeta(), "uinfo_vegetation_type_" + vz.getVegetationType().getId().toString());
+            list.add(new VegetationZone(zn, vz.getMin_overflow_days(), vz.getMax_overflow_days(), vz.getColor()));
+        }
         return list;
     }
 

http://dive4elements.wald.intevation.org