[PATCH 04 of 15] issue1658: Let SedimentYieldArtifact create facet based on Sed.L. unit
Wald Commits
scm-commit at wald.intevation.org
Fri Nov 1 18:11:54 CET 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1383319519 -3600
# Node ID ab17c76611f9ae29c39eedee9365d68f62221940
# Parent 6bfa1911904053a26a3dbb7f45c4362580edb6b1
issue1658: Let SedimentYieldArtifact create facet based on Sed.L. unit.
diff -r 6bfa19119040 -r ab17c76611f9 artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java Fri Nov 01 16:23:32 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java Fri Nov 01 16:25:19 2013 +0100
@@ -146,9 +146,10 @@
String code = getDatacageIDValue(data);
if (code != null) {
- String fraction = SedimentLoadFactory.getSedimentYieldFractionName(Integer.valueOf(code));
+ int id = Integer.valueOf(code);
+ String fraction = SedimentLoadFactory.getSedimentYieldFractionName(id);
String fractionName = Resources.getMsg(callMeta, fraction, "-");
- Date[] dates = SedimentLoadFactory.getSedimentYieldTimes(Integer.valueOf(code));
+ Date[] dates = SedimentLoadFactory.getSedimentYieldTimes(id);
Calendar date = Calendar.getInstance();
date.setTime(dates[0]);
String name = fractionName + " - " + date.get(Calendar.YEAR);
@@ -157,27 +158,65 @@
name += " - " + date.get(Calendar.YEAR);
}
+ boolean unitIsTA =
+ SedimentLoadFactory.getSedimentYieldUnitName(id).startsWith("t");
+
String facetType = "";
if (fraction.equals("coarse")) {
- facetType = SEDIMENT_LOAD_COARSE;
+ if (unitIsTA) {
+ facetType = SEDIMENT_LOAD_TA_COARSE;
+ }
+ else {
+ facetType = SEDIMENT_LOAD_M3A_COARSE;
+ }
}
else if (fraction.equals("sand")) {
- facetType = SEDIMENT_LOAD_SAND;
+ if (unitIsTA) {
+ facetType = SEDIMENT_LOAD_TA_SAND;
+ }
+ else {
+ facetType = SEDIMENT_LOAD_M3A_SAND;
+ }
}
else if (fraction.equals("fine_middle")) {
- facetType = SEDIMENT_LOAD_FINEMIDDLE;
+ if (unitIsTA) {
+ facetType = SEDIMENT_LOAD_TA_FINEMIDDLE;
+ }
+ else {
+ facetType = SEDIMENT_LOAD_M3A_FINEMIDDLE;
+ }
}
else if (fraction.equals("susp_sand")) {
- facetType = SEDIMENT_LOAD_SUSP_SAND;
+ if (unitIsTA) {
+ facetType = SEDIMENT_LOAD_TA_SUSP_SAND;
+ }
+ else {
+ facetType = SEDIMENT_LOAD_M3A_SAND;
+ }
}
else if (fraction.equals("susp_sand_bed")) {
- facetType = SEDIMENT_LOAD_SUSP_SAND_BED;
+ if (unitIsTA) {
+ facetType = SEDIMENT_LOAD_TA_SUSP_SAND_BED;
+ }
+ else {
+ facetType = SEDIMENT_LOAD_M3A_SUSP_SAND_BED;
+ }
}
else if (fraction.equals("suspended_sediment")) {
- facetType = SEDIMENT_LOAD_SUSP_SEDIMENT;
+ if (unitIsTA) {
+ facetType = SEDIMENT_LOAD_TA_SUSP_SEDIMENT;
+ }
+ else {
+ facetType = SEDIMENT_LOAD_M3A_SUSP_SEDIMENT;
+ }
}
else if (fraction.equals("total")) {
- facetType = SEDIMENT_LOAD_TOTAL_LOAD;
+ if (unitIsTA) {
+ facetType = SEDIMENT_LOAD_TA_TOTAL_LOAD;
+ }
+ else {
+ facetType = SEDIMENT_LOAD_M3A_TOTAL_LOAD;
+ }
}
else {
logger.error("Do not know fraction type " + fraction);
More information about the Dive4elements-commits
mailing list