Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java @ 9523:d421c2bf0195
Allow to edit colors in vegetation zones
author | gernotbelger |
---|---|
date | Mon, 01 Oct 2018 17:08:50 +0200 |
parents | 515643b2c49a |
children | 9b8ba3b83a15 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java Mon Oct 01 16:37:12 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java Mon Oct 01 17:08:50 2018 +0200 @@ -26,13 +26,17 @@ public class VegetationZoneServerClientXChange implements Comparable<VegetationZoneServerClientXChange> { // IMMER ABGLEICHEN MIT VegetationZoneServerClientXChange.class Server und Client - public static final boolean HAS_COLORS_EDITABLE = false; private static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR"; + private static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR"; + private final String zoneName; + private final int min_day_overflow; + private final int max_day_overflow; + private final String hexColor; public static List<VegetationZoneServerClientXChange> parse(final String zonesRaw) { @@ -50,14 +54,16 @@ } for (final String[] zone : results) { - final VegetationZoneServerClientXChange helper = new VegetationZoneServerClientXChange(zone[0], Integer.valueOf(zone[1]), Integer.valueOf(zone[2]), zone[3]); + final VegetationZoneServerClientXChange helper = new VegetationZoneServerClientXChange(zone[0], Integer.valueOf(zone[1]), Integer.valueOf(zone[2]), + zone[3]); resultList.add(helper); } return resultList; } - public static VegetationZoneServerClientXChange createFromTableEntry(final String zone, final String min_day_overflow, final String max_day_overflow, final String hexColor) { + public static VegetationZoneServerClientXChange createFromTableEntry(final String zone, final String min_day_overflow, final String max_day_overflow, + final String hexColor) { return new VegetationZoneServerClientXChange(zone, Integer.valueOf(min_day_overflow), Integer.valueOf(max_day_overflow), hexColor); // Error-Handling? } @@ -81,10 +87,12 @@ public String getHexColor() { try { - final int test = Integer.decode(this.hexColor); + // REMARK: only return valid colors + Integer.decode(this.hexColor); return this.hexColor; } catch (final NumberFormatException e) { + e.printStackTrace(); return "#ffffff"; } } @@ -162,7 +170,7 @@ treeList.addAll(list); int lowerCompare = lower; for (final VegetationZoneServerClientXChange zone : treeList) { - if (zone.getLowerFromTo() > (lowerCompare + 1)) { // nicht inklusiv + if (zone.getLowerFromTo() > (lowerCompare)) { // nicht inklusiv return true; } lowerCompare = zone.getUpperFromTo(); @@ -179,12 +187,11 @@ final int upper = getUpperFromTo(); final int lower = getLowerFromTo(); - final int otherSchwerpunkt = (otherLower + otherUpper) / 2; - if ((otherUpper <= upper && otherUpper >= lower)) { + if ((otherUpper <= upper && otherUpper > lower)) { return true; - } else if (otherLower >= lower && otherLower <= upper) { + } else if (otherLower >= lower && otherLower < upper) { return true; - } else if (otherSchwerpunkt >= (lower) && otherSchwerpunkt <= (upper)) { + } else if (otherLower == lower && otherUpper == upper) { return true; } return false; @@ -197,5 +204,4 @@ public Integer getUpperFromTo() { return this.min_day_overflow > this.max_day_overflow ? this.min_day_overflow : this.max_day_overflow;// Math. is forbidden :-( } - -} +} \ No newline at end of file