# HG changeset patch # User Felix Wolfsteller # Date 1383319884 -3600 # Node ID 83b7b957c360d41bc060ea47406cae0f5d34c566 # Parent e11bf92bca4ac54fbe68dda19318f0c6dc0b2fb2 Remove now obsolete SedimentLoadProcessor. diff -r e11bf92bca4a -r 83b7b957c360 artifacts/src/main/java/org/dive4elements/river/exports/process/SedimentLoadProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/SedimentLoadProcessor.java Fri Nov 01 16:30:52 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* Copyright (C) 2013 by Bundesanstalt für Gewässerkunde - * Software engineering by Intevation GmbH - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ - -package org.dive4elements.river.exports.process; - -import java.util.Set; - -import org.apache.log4j.Logger; -import org.jfree.data.xy.XYSeries; -import org.dive4elements.river.artifacts.D4EArtifact; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.access.SedimentLoadAccess; -import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.exports.DiagramGenerator; -import org.dive4elements.river.exports.StyledSeriesBuilder; -import org.dive4elements.river.jfree.StyledXYSeries; -import org.dive4elements.river.themes.ThemeDocument; - -import org.dive4elements.river.artifacts.model.minfo.SedimentLoad; -import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFraction; - -public class SedimentLoadProcessor extends DefaultProcessor { - - private final static Logger logger = - Logger.getLogger(SedimentLoadProcessor.class); - - public static final String I18N_YAXIS_LABEL_1 = - "chart.sedimentload.ls.yaxis.label.tpera"; - public static final String I18N_YAXIS_LABEL_2 = - "chart.sedimentload.ls.yaxis.label.m3pera"; - public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]"; - public static final String I18N_YAXIS_LABEL_DEFAULT_2 = "[m\u00b3/a]"; - - @Override - public void doOut( - DiagramGenerator generator, - ArtifactAndFacet bundle, - ThemeDocument theme, - boolean visible) { - logger.debug("doOut " + bundle.getFacetName()); - CallContext context = generator.getCallContext(); - XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), - theme); - Object data = bundle.getData(context); - String facetName = bundle.getFacetName(); - double [][] points; - - if (FacetTypes.IS.SEDIMENT_LOAD(facetName)) { - points = (double[][]) data; - } else if (FacetTypes.IS.SEDIMENT_LOAD_UNKNOWN(facetName)) { - SedimentLoad load = (SedimentLoad) data; - Set kms = load.getKms(); - points = new double[2][kms.size()]; - int counter = 0; - for (Double km: kms) { - SedimentLoadFraction fraction = load.getFraction(km); - points[0][counter] = km; - points[1][counter] = fraction.getUnknown(); - counter++; - } - } else { - logger.error("Unknown facet name: " + facetName); - return; - } - StyledSeriesBuilder.addPoints(series, points, true); - - generator.addAxisSeries(series, axisName, visible); - } - - @Override - public boolean canHandle(String facettype) { - return FacetTypes.IS.SEDIMENT_LOAD(facettype) || - FacetTypes.IS.SEDIMENT_LOAD_UNKNOWN(facettype); - } - - @Override - public String getAxisLabel(DiagramGenerator generator) { - SedimentLoadAccess slaccess = - new SedimentLoadAccess((D4EArtifact) generator.getMaster()); - String unit = slaccess.getUnit(); - if (unit != null && unit.equals("m3_per_a")) { - return generator.msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2); - } - else { - return generator.msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1); - } - } -}