Mercurial > dive4elements > river
changeset 7499:ab17c76611f9
issue1658: Let SedimentYieldArtifact create facet based on Sed.L. unit.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 01 Nov 2013 16:25:19 +0100 |
parents | 6bfa19119040 |
children | aaa48ad40bbd |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java |
diffstat | 1 files changed, 48 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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);