Mercurial > dive4elements > river
changeset 7128:917b26172853
Rename BedheightProcessor to BedWidthProcessor
Confusing names become more important when the classes are configurable
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 25 Sep 2013 11:51:22 +0200 |
parents | 1106f580420c |
children | 7fc41a235f47 |
files | artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java |
diffstat | 4 files changed, 118 insertions(+), 118 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java Wed Sep 25 11:47:45 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java Wed Sep 25 11:51:22 2013 +0200 @@ -20,7 +20,7 @@ import org.dive4elements.river.exports.process.Processor; import org.dive4elements.river.exports.process.BedDiffHeightYearProcessor; import org.dive4elements.river.exports.process.BedDiffYearProcessor; -import org.dive4elements.river.exports.process.BedheightProcessor; +import org.dive4elements.river.exports.process.BedWidthProcessor; import org.dive4elements.river.exports.process.QOutProcessor; import org.dive4elements.river.exports.process.WOutProcessor; import org.dive4elements.river.exports.process.AnnotationProcessor; @@ -341,7 +341,7 @@ Processor wProcessor = new WOutProcessor(); Processor qProcessor = new QOutProcessor(); - Processor bedp = new BedheightProcessor(); + Processor bedp = new BedWidthProcessor(); Processor bdyProcessor = new BedDiffYearProcessor(); Processor bdhyProcessor = new BedDiffHeightYearProcessor(); Processor annotationProcessor = new AnnotationProcessor();
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Wed Sep 25 11:47:45 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Wed Sep 25 11:51:22 2013 +0200 @@ -16,7 +16,7 @@ import org.dive4elements.river.artifacts.model.MiddleBedHeightData; import org.dive4elements.river.artifacts.model.WQKms; -import org.dive4elements.river.exports.process.BedheightProcessor; +import org.dive4elements.river.exports.process.BedWidthProcessor; import org.dive4elements.river.exports.process.Processor; import org.dive4elements.river.exports.process.QOutProcessor; import org.dive4elements.river.exports.process.WOutProcessor; @@ -195,7 +195,7 @@ } Processor woutp = new WOutProcessor(); - Processor bedp = new BedheightProcessor(); + Processor bedp = new BedWidthProcessor(); Processor qoutp = new QOutProcessor(); if (woutp.canHandle(name)) { woutp.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java Wed Sep 25 11:51:22 2013 +0200 @@ -0,0 +1,114 @@ +/* Copyright (C) 2011, 2012, 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.List; + +import org.apache.log4j.Logger; +import org.jfree.data.xy.XYSeries; + +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.model.minfo.BedHeightSingle; +import org.dive4elements.river.exports.XYChartGenerator; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.model.BedHeightSingleValue; +import org.dive4elements.river.themes.ThemeDocument; + +public class BedWidthProcessor extends DefaultProcessor { + + private final static Logger logger = + Logger.getLogger(BedWidthProcessor.class); + + private final static String BEDHEIGHT = "bedheight"; + + public static final String I18N_AXIS_LABEL_DEFAULT + = "Gepeilte Breite [m]"; + public static final String I18N_AXIS_LABEL = + "chart.bedheight_middle.sounding.yaxis.label"; + + @Override + public void doOut( + DiagramGenerator generator, + ArtifactAndFacet bundle, + ThemeDocument theme, + boolean visible) { + CallContext context = generator.getCallContext(); + Object data = bundle.getData(context); + XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), + theme); + if (data instanceof BedHeightSingle) { + BedHeightSingle bData = (BedHeightSingle)data; + double[] width = bData.getMorphWidths(); + double[] stations = bData.getStations().toNativeArray(); + + logger.debug("doBedheightSingleOut"); + + for (int i = 0; i < width.length; i++) { + series.add(stations[i], width[i], false); + } + } else if (data instanceof List<?>) { + List<BedHeightSingleValue> bData = (List<BedHeightSingleValue>)data; + + logger.debug("doBedheightSingleValueOut"); + + for(BedHeightSingleValue bvalue: bData) { + series.add(bvalue.getStation(), bvalue.getSoundingWidth()); + } + } + generator.addAxisSeries(series, axisName, visible); + } + + @Override + public void doOut( + XYChartGenerator generator, + ArtifactAndFacet bundle, + ThemeDocument theme, + boolean visible, + int index + ) { + CallContext context = generator.getCallContext(); + Object data = bundle.getData(context); + XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), + theme); + if (data instanceof BedHeightSingle) { + BedHeightSingle bData = (BedHeightSingle)data; + double[] width = bData.getMorphWidths(); + double[] stations = bData.getStations().toNativeArray(); + + logger.debug("doBedheightSingleOut"); + + for (int i = 0; i < width.length; i++) { + series.add(stations[i], width[i], false); + } + } else if (data instanceof List<?>) { + List<BedHeightSingleValue> bData = (List<BedHeightSingleValue>)data; + + logger.debug("doBedheightSingleValueOut"); + + for(BedHeightSingleValue bvalue: bData) { + series.add(bvalue.getStation(), bvalue.getSoundingWidth()); + } + } + generator.addAxisSeries(series, index, visible); + } + + @Override + public boolean canHandle(String facettype) { + return BEDHEIGHT.equals(facettype); + } + + @Override + public String getAxisLabel(DiagramGenerator generator) { + return generator.msg( + I18N_AXIS_LABEL, + I18N_AXIS_LABEL_DEFAULT); + } +}
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java Wed Sep 25 11:47:45 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* Copyright (C) 2011, 2012, 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.List; - -import org.apache.log4j.Logger; -import org.jfree.data.xy.XYSeries; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.model.minfo.BedHeightSingle; -import org.dive4elements.river.exports.XYChartGenerator; -import org.dive4elements.river.exports.DiagramGenerator; -import org.dive4elements.river.jfree.StyledXYSeries; -import org.dive4elements.river.model.BedHeightSingleValue; -import org.dive4elements.river.themes.ThemeDocument; - -public class BedheightProcessor extends DefaultProcessor { - - private final static Logger logger = - Logger.getLogger(BedheightProcessor.class); - - private final static String BEDHEIGHT = "bedheight"; - - public static final String I18N_AXIS_LABEL_DEFAULT - = "Gepeilte Breite [m]"; - public static final String I18N_AXIS_LABEL = - "chart.bedheight_middle.sounding.yaxis.label"; - - @Override - public void doOut( - DiagramGenerator generator, - ArtifactAndFacet bundle, - ThemeDocument theme, - boolean visible) { - CallContext context = generator.getCallContext(); - Object data = bundle.getData(context); - XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), - theme); - if (data instanceof BedHeightSingle) { - BedHeightSingle bData = (BedHeightSingle)data; - double[] width = bData.getMorphWidths(); - double[] stations = bData.getStations().toNativeArray(); - - logger.debug("doBedheightSingleOut"); - - for (int i = 0; i < width.length; i++) { - series.add(stations[i], width[i], false); - } - } else if (data instanceof List<?>) { - List<BedHeightSingleValue> bData = (List<BedHeightSingleValue>)data; - - logger.debug("doBedheightSingleValueOut"); - - for(BedHeightSingleValue bvalue: bData) { - series.add(bvalue.getStation(), bvalue.getSoundingWidth()); - } - } - generator.addAxisSeries(series, axisName, visible); - } - - @Override - public void doOut( - XYChartGenerator generator, - ArtifactAndFacet bundle, - ThemeDocument theme, - boolean visible, - int index - ) { - CallContext context = generator.getCallContext(); - Object data = bundle.getData(context); - XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), - theme); - if (data instanceof BedHeightSingle) { - BedHeightSingle bData = (BedHeightSingle)data; - double[] width = bData.getMorphWidths(); - double[] stations = bData.getStations().toNativeArray(); - - logger.debug("doBedheightSingleOut"); - - for (int i = 0; i < width.length; i++) { - series.add(stations[i], width[i], false); - } - } else if (data instanceof List<?>) { - List<BedHeightSingleValue> bData = (List<BedHeightSingleValue>)data; - - logger.debug("doBedheightSingleValueOut"); - - for(BedHeightSingleValue bvalue: bData) { - series.add(bvalue.getStation(), bvalue.getSoundingWidth()); - } - } - generator.addAxisSeries(series, index, visible); - } - - @Override - public boolean canHandle(String facettype) { - return BEDHEIGHT.equals(facettype); - } - - @Override - public String getAxisLabel(DiagramGenerator generator) { - return generator.msg( - I18N_AXIS_LABEL, - I18N_AXIS_LABEL_DEFAULT); - } -}