Mercurial > dive4elements > river
changeset 8433:706668b19b04
Antiprogramming (in german: 'Softwareabwicklung')
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 17 Oct 2014 19:21:45 +0200 |
parents | e54641c44d6d |
children | 48ed9019d8a1 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphMinFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphSubFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/SQOverviewFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveInfoGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDerivedCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDerivedCurveInfoGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveInfoGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java backend/src/test/java/org/dive4elements/river/AppTest.java |
diffstat | 16 files changed, 3 insertions(+), 861 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java Fri Oct 17 19:13:40 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java Fri Oct 17 19:21:45 2014 +0200 @@ -325,9 +325,6 @@ String BED_DIFFERENCE_YEAR_FILTERED = "bedheight_difference.year.filtered"; String BED_DIFFERENCE_HEIGHT_YEAR = "bedheight_difference.height_year"; String BED_DIFFERENCE_HEIGHT_YEAR_FILTERED = "bedheight_difference.height_year.filtered"; - String BED_DIFFERENCE_MORPH_WIDTH1 = "bedheight_difference.morph_width1"; - String BED_DIFFERENCE_MORPH_WIDTH2 = "bedheight_difference.morph_width2"; - String BED_DIFFERENCE_SOUNDING_WIDTH = "bedheight_difference.sounding_width"; String BED_DIFFERENCE_YEAR_HEIGHT1 = "bedheight_difference.year.height1"; String BED_DIFFERENCE_YEAR_HEIGHT2 = "bedheight_difference.year.height2"; String BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED = "bedheight_difference.year.height1.filtered";
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Fri Oct 17 19:13:40 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Fri Oct 17 19:21:45 2014 +0200 @@ -78,8 +78,6 @@ TDoubleArrayList gap2 = new TDoubleArrayList(size); TDoubleArrayList heights1 = new TDoubleArrayList(size); TDoubleArrayList heights2 = new TDoubleArrayList(size); - //TDoubleArrayList morphs1 = new TDoubleArrayList(size); - //TDoubleArrayList morphs2 = new TDoubleArrayList(size); Integer range = null; if (s1.getYear() != null && s2.getYear() != null) { @@ -90,8 +88,6 @@ double station = stations.getQuick(i); double h1 = s1.getHeight(station); double h2 = s2.getHeight(station); - //double m1 = s1.getWidth(station); - //double m2 = s2.getWidth(station); double hDiff = h1 - h2; if (!Double.isNaN(hDiff)) { @@ -109,8 +105,6 @@ } heights1.add(h1); heights2.add(h2); - //morphs1.add(m1); - //morphs2.add(m2); } } return new BedDiffYearResult( @@ -118,8 +112,6 @@ diffRes, heights1, heights2, - //morphs1, - //morphs2, soundings1, soundings2, absolute,
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphMinFacet.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -package org.dive4elements.river.artifacts.model.minfo; - -import org.apache.log4j.Logger; -import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.artifacts.Artifact; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.model.CalculationResult; -import org.dive4elements.river.artifacts.model.DataFacet; -import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; - - -public class BedDiffMorphMinFacet -extends DataFacet -implements FacetTypes -{ - private static Logger log = Logger.getLogger(BedDiffMorphMinFacet.class); - - public BedDiffMorphMinFacet() { - } - - public BedDiffMorphMinFacet(int idx, String name, String description, - ComputeType type, String stateId, String hash) { - super(idx, name, description, type, hash, stateId); - this.metaData.put("X", "chart.longitudinal.section.xaxis.label"); - this.metaData.put("Y", "chart.beddifference.yaxis.label.morph"); - } - - public Object getData(Artifact artifact, CallContext context) { - log.debug("Get data for bed density at index: " + index); - - D4EArtifact flys = (D4EArtifact) artifact; - - CalculationResult res = (CalculationResult) flys.compute(context, hash, - stateId, type, false); - - BedDiffYearResult[] resultData = - (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS - - /* - if (resultData != null && resultData.length > index) { - BedDiffYearResult data = resultData[index]; - return data.getMorphWidth1Data(); - } - */ - return null; - } - - /** Copy deeply. */ - @Override - public Facet deepCopy() { - BedDiffMorphMinFacet copy = new BedDiffMorphMinFacet(); - copy.set(this); - copy.type = type; - copy.hash = hash; - copy.stateId = stateId; - return copy; - } -}
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphSubFacet.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -package org.dive4elements.river.artifacts.model.minfo; - -import org.apache.log4j.Logger; -import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.artifacts.Artifact; -import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.model.CalculationResult; -import org.dive4elements.river.artifacts.model.DataFacet; -import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; - - -public class BedDiffMorphSubFacet -extends DataFacet -implements FacetTypes -{ - private static Logger log = Logger.getLogger(BedDiffMorphSubFacet.class); - - public BedDiffMorphSubFacet() { - } - - public BedDiffMorphSubFacet(int idx, String name, String description, - ComputeType type, String stateId, String hash) { - super(idx, name, description, type, hash, stateId); - this.metaData.put("X", "chart.longitudinal.section.xaxis.label"); - this.metaData.put("Y", "chart.beddifference.yaxis.label.morph"); - } - - public Object getData(Artifact artifact, CallContext context) { - log.debug("Get data for bed density at index: " + index); - - D4EArtifact flys = (D4EArtifact) artifact; - - CalculationResult res = (CalculationResult) flys.compute(context, hash, - stateId, type, false); - - BedDiffYearResult[] resultData = - (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS - - /* - if (resultData != null && resultData.length > index) { - BedDiffYearResult data = resultData[index]; - return data.getMorphWidth2Data(); - } - */ - return null; - } - - /** Copy deeply. */ - @Override - public Facet deepCopy() { - BedDiffMorphSubFacet copy = new BedDiffMorphSubFacet(); - copy.set(this); - copy.type = type; - copy.hash = hash; - copy.stateId = stateId; - return copy; - } -}
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java Fri Oct 17 19:13:40 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java Fri Oct 17 19:21:45 2014 +0200 @@ -20,8 +20,6 @@ protected TDoubleArrayList dataGap2; protected TDoubleArrayList soundingWidth1; protected TDoubleArrayList soundingWidth2; - //protected TDoubleArrayList morphWidth1; - //protected TDoubleArrayList morphWidth2; protected Integer start; protected Integer end; protected String nameFirst; @@ -36,8 +34,6 @@ this.dataGap2 = new TDoubleArrayList(); this.soundingWidth1 = new TDoubleArrayList(); this.soundingWidth2 = new TDoubleArrayList(); - //this.morphWidth1 = new TDoubleArrayList(); - //this.morphWidth2 = new TDoubleArrayList(); } /** @@ -52,8 +48,6 @@ TDoubleArrayList differences, TDoubleArrayList heights1, TDoubleArrayList heights2, - //TDoubleArrayList morphWidth1, - //TDoubleArrayList morphWidth2, TDoubleArrayList soundingWidth1, TDoubleArrayList soundingWidth2, TDoubleArrayList diffsPerYear, @@ -72,8 +66,6 @@ this.dataGap2 = dataGap2; this.soundingWidth1 = soundingWidth1; this.soundingWidth2 = soundingWidth2; - //this.morphWidth1 = morphWidth1; - //this.morphWidth2 = morphWidth2; this.start = start; this.end = end; this.nameFirst = nameFirst; @@ -94,16 +86,6 @@ return this.dataGap2; } - /* - public TDoubleArrayList getMorphWidth1() { - return this.morphWidth1; - } - - public TDoubleArrayList getMorphWidth2() { - return this.morphWidth2; - } - */ - public TDoubleArrayList getSoundingWidth1() { return this.soundingWidth1; } @@ -148,16 +130,6 @@ return this.idSecond; } - /* - public void addMorphWidth1(double value) { - this.morphWidth1.add(value); - } - - public void addMorphWidth2(double value) { - this.morphWidth2.add(value); - } - */ - public void addSoundingWidth1(double value) { this.soundingWidth1.add(value); } @@ -170,22 +142,6 @@ this.diffsPerYear.add(value); } - /* - public double[][] getMorphWidth1Data() { - return new double[][] { - kms.toNativeArray(), - morphWidth1.toNativeArray() - }; - } - - public double[][] getMorphWidth2Data() { - return new double[][] { - kms.toNativeArray(), - morphWidth2.toNativeArray() - }; - } - */ - public double[][] getSoundingWidth1Data() { return new double[][] { kms.toNativeArray(),
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java Fri Oct 17 19:13:40 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java Fri Oct 17 19:21:45 2014 +0200 @@ -68,14 +68,6 @@ else if ("diffheader".equals(fieldName)) { value = metaData.get("diffheader"); } - /* - else if ("morph1header".equals(fieldName)) { - value = metaData.get("morph1header"); - } - else if ("morph2header".equals(fieldName)) { - value = metaData.get("morph2header"); - } - */ else if ("km".equals(fieldName)) { value = data.get(index)[0]; }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/SQOverviewFacet.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +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.artifacts.model.sq; - -import org.apache.log4j.Logger; - -import org.dive4elements.artifacts.Artifact; -import org.dive4elements.artifacts.CallContext; - -import org.dive4elements.artifactdatabase.state.Facet; - -import org.dive4elements.river.artifacts.model.DataFacet; -import org.dive4elements.river.artifacts.model.FacetTypes; - -import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; - -public class SQOverviewFacet -extends DataFacet -implements FacetTypes -{ - private static final Logger log = Logger.getLogger(SQOverviewFacet.class); - - protected int fractionIdx; - - public SQOverviewFacet() { - } - - public SQOverviewFacet( - int idx, - int fractionIdx, - String name, - String description, - String hash, - String stateId - ) { - super(idx, name, description, ComputeType.ADVANCE, hash, stateId); - this.fractionIdx = fractionIdx; - } - - - @Override - public Object getData(Artifact artifact, CallContext context) { - log.debug("SQOverviewFacet.getData"); - - switch(fractionIdx) { - case 0: return "sq_relation_a"; - case 1: return "sq_relation_b"; - case 2: return "sq_relation_c"; - case 3: return "sq_relation_d"; - case 4: return "sq_relation_e"; - case 5: return "sq_relation_f"; - default: return null; - } - } - - - @Override - public Facet deepCopy() { - SQOverviewFacet copy = new SQOverviewFacet(); - copy.set(this); - copy.type = type; - copy.hash = hash; - copy.stateId = stateId; - copy.fractionIdx = fractionIdx; - - return copy; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java Fri Oct 17 19:13:40 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java Fri Oct 17 19:21:45 2014 +0200 @@ -134,22 +134,6 @@ ComputeType.ADVANCE, stateId, hash)); - /* - newFacets.add(new BedDiffMorphMinFacet( - idx, - BED_DIFFERENCE_MORPH_WIDTH1, - createBedDiffMorph1Description(meta), - ComputeType.ADVANCE, - stateId, - hash)); - newFacets.add(new BedDiffMorphSubFacet( - idx, - BED_DIFFERENCE_MORPH_WIDTH2, - createBedDiffMorph2Description(meta), - ComputeType.ADVANCE, - stateId, - hash)); - */ newFacets.add(new BedDiffHeightMinFacet( idx, BED_DIFFERENCE_YEAR_HEIGHT1, @@ -325,14 +309,12 @@ name.equals(BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED)){ return Boolean.FALSE; } - else if (name.equals(BED_DIFFERENCE_SOUNDING_WIDTH) || + if (name.equals(BEDHEIGHT_SOUNDING_WIDTH) || name.equals(BED_DIFFERENCE_HEIGHT_YEAR_FILTERED) || name.equals(BED_DIFFERENCE_YEAR_FILTERED)) { return Boolean.TRUE; } - else { - return null; - } + return null; } }); }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +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; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.artifactdatabase.state.Facet; -import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.StaticWKmsArtifact; -import org.dive4elements.river.artifacts.WINFOArtifact; -import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.model.WKms; -import org.dive4elements.river.artifacts.model.WQKms; -import org.dive4elements.river.exports.process.MiscDischargeProcessor; -import org.dive4elements.river.jfree.RiverAnnotation; -import org.dive4elements.river.jfree.StickyAxisAnnotation; -import org.dive4elements.river.jfree.StyledXYSeries; - -import org.dive4elements.river.themes.ThemeDocument; -import org.dive4elements.river.utils.RiverUtils; - -import java.util.ArrayList; -import java.util.List; - -import org.jfree.data.xy.XYSeries; - -import org.apache.log4j.Logger; - - -/** - * An OutGenerator that generates discharge curves, also at locations - * not at a gauge. - * - * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> - */ -public class ComputedDischargeCurveGenerator -extends DischargeCurveGenerator -implements FacetTypes -{ - /** The log used in this generator. */ - private static Logger log = - Logger.getLogger(ComputedDischargeCurveGenerator.class); - - public static final String I18N_CHART_TITLE = - "chart.computed.discharge.curve.title"; - - public static final String I18N_YAXIS_LABEL = - "chart.computed.discharge.curve.yaxis.label"; - - public static final String I18N_CHART_TITLE_DEFAULT = "Abflusskurve"; - public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; - - /** Trivial Constructor. */ - public ComputedDischargeCurveGenerator () { - super(); - } - - - @Override - protected String getDefaultChartTitle() { - return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); - } - - - @Override - protected String getDefaultYAxisLabel(int pos) { - D4EArtifact flys = (D4EArtifact) master; - - String unit = RiverUtils.getRiver(flys).getWstUnit().getName(); - if (pos == 0 && getCurrentGaugeDatum() != 0) - unit = "cm"; - - return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit }); - } - - /** - * Process data, build up plot. - */ - @Override - public void doOut( - ArtifactAndFacet artifactFacet, - ThemeDocument attr, - boolean visible - ) { - String name = artifactFacet.getFacetName(); - - log.debug("ComputedDischargeCurveGenerator.doOut: " + name); - - if (name == null) { - log.warn("Broken facet in computed discharge out generation."); - return; - } - - MiscDischargeProcessor dProcessor = new MiscDischargeProcessor(getRange()[0]); - if (dProcessor.canHandle(name)) { - dProcessor.doOut(this, artifactFacet, attr, visible, YAXIS.W.idx); - } - else if (name.equals(COMPUTED_DISCHARGE_Q)) { - doDischargeQOut((WQKms) artifactFacet.getData(context), artifactFacet, attr, visible); - } - else if (name.equals(STATIC_WQ)) { - doWQOut(artifactFacet.getData(context), artifactFacet, attr, visible); - } - else if (name.equals(STATIC_WQ_ANNOTATIONS)) { - doWQAnnotations( - artifactFacet.getData(context), - artifactFacet, - attr, - visible); - } - else if (STATIC_WKMS_INTERPOL.equals(name) || - HEIGHTMARKS_POINTS.equals(name) || - STATIC_WQKMS_W.equals(name)) { - doWAnnotations( - artifactFacet.getData(context), - artifactFacet, - attr, - visible); - } - else if (name.equals(STATIC_WKMS)) { - doWAnnotations( - artifactFacet.getData(context), - artifactFacet, - attr, - visible); - } - else if (FacetTypes.IS.MANUALPOINTS(name)) { - doPoints(artifactFacet.getData(context), - artifactFacet, - attr, visible, YAXIS.W.idx); - } - else if (name.equals(DISCHARGE_CURVE)) { - doDischargeOut( - (WINFOArtifact) artifactFacet.getArtifact(), - artifactFacet.getData(context), - artifactFacet.getFacetDescription(), - attr, - visible); - } - else { - log.warn("Unknown facet type for computed discharge: " + name); - return; - } - } - - - /** - * Add WQ Data to plot. - * @param wq data as double[][] - */ - protected void doWQOut( - Object wq, - ArtifactAndFacet aaf, - ThemeDocument theme, - boolean visible - ) { - log.debug("ComputedDischargeCurveGenerator: doWQOut"); - XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); - if (wq instanceof double[][]) { - double [][] data = (double [][]) wq; - StyledSeriesBuilder.addPoints(series, data, true); - } else if (wq instanceof WQKms) { - WQKms wqkms = (WQKms) wq; - StyledSeriesBuilder.addPointsQW(series, (WQKms) wq); - } - - addAxisSeries(series, YAXIS.W.idx, visible); - } - - - /** - * Add discharge Q-Series to plot, scale if at gauge. - * @param wqkms actual data - * @param theme theme to use. - */ - protected void doDischargeQOut( - WQKms wqkms, - ArtifactAndFacet aaf, - ThemeDocument theme, - boolean visible - ) { - log.debug("ComputedDischargeCurveGenerator: doDischargeQOut"); - XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); - - double subtractPNP = getCurrentGaugeDatum(); - - if (subtractPNP == 0d) { - StyledSeriesBuilder.addPointsQW(series, wqkms); - addAxisSeries(series, YAXIS.W.idx, visible); - } - else { - XYSeries series2 = new StyledXYSeries(aaf.getFacetDescription(), theme); - StyledSeriesBuilder.addPointsQW(series2, wqkms); - addAxisSeries(series2, YAXIS.W.idx, false); - - // Use second axis... - StyledSeriesBuilder.addPointsQW(series, wqkms, -subtractPNP, 100d); - addAxisSeries(series, YAXIS.WCm.idx, visible); - } - } - - - /** - * Add W/Q-Series to plot. - * @param wqkms actual data - * @param theme theme to use. - */ - protected void doQOut( - WQKms wqkms, - ArtifactAndFacet aaf, - ThemeDocument theme, - boolean visible - ) { - log.debug("ComputedDischargeCurveGenerator: doQOut (add W/Q data)."); - XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); - StyledSeriesBuilder.addPointsQW(series, wqkms); - - addAxisSeries(series, YAXIS.W.idx, visible); - } - - - /** - * Add WQ-Annotations to plot. - * @param wqkms actual data - * @param theme theme to use. - */ - protected void doWQAnnotations( - Object wqkms, - ArtifactAndFacet aandf, - ThemeDocument theme, - boolean visible - ) { - List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); - double [][] data = (double [][]) wqkms; - for (int i = 0; i< data[0].length; i++) { - // TODO we need linear interpolation? - xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), - (float) data[0][i], StickyAxisAnnotation.SimpleAxis.X_AXIS)); - xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), - (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS)); - } - - doAnnotations(new RiverAnnotation(aandf.getFacetDescription(), xy), - aandf, theme, visible); - } - - - /** - * Add W-Annotations to plot. - * @param wqkms actual data (double[][]). - * @param theme theme to use. - */ - protected void doWAnnotations( - Object wqkms, - ArtifactAndFacet aandf, - ThemeDocument theme, - boolean visible - ) { - Facet facet = aandf.getFacet(); - - List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); - // Try to find them as WKms as well... - if (wqkms instanceof double[][]) { - log.debug("its double[][] time, baby"); - double [][] data = (double [][]) wqkms; - // TODO Do we need interpolation? - for (int i = 0; i< data[0].length; i++) { - xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), - (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS)); - } - - doAnnotations(new RiverAnnotation(facet.getDescription(), xy), - aandf, theme, visible); - } - else { - log.debug("its wkms time, baby"); - WKms data = (WKms) wqkms; - // Assume its WKms. - // XXX DEAD CODE // double location = getRange()[0]; - double w = StaticWKmsArtifact.getWAtKmLin(data, getRange()[0]); - xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), - (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS)); - - doAnnotations(new RiverAnnotation(facet.getDescription(), xy), - aandf, theme, visible); - } - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveInfoGenerator.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +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; - - -/** - * A ChartInfoGenerator that generates meta information for specific computed - * discharge curves. - * - * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> - */ -public class ComputedDischargeCurveInfoGenerator extends ChartInfoGenerator { - - public ComputedDischargeCurveInfoGenerator() { - super(new ComputedDischargeCurveGenerator()); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDerivedCurveGenerator.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +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.fixings; - -import org.apache.log4j.Logger; - -import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; -import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.artifacts.model.fixings.FixDerivateFacet; -import org.dive4elements.river.artifacts.model.fixings.FixFunction; -import org.dive4elements.river.artifacts.resources.Resources; -import org.dive4elements.river.exports.ChartGenerator; -import org.dive4elements.river.jfree.JFreeUtil; -import org.dive4elements.river.jfree.StyledXYSeries; -import org.dive4elements.river.themes.ThemeDocument; - -/** - * Generator for fixation derived function curve. - * - * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a> - */ -public class FixDerivedCurveGenerator -extends FixChartGenerator -implements FacetTypes -{ - /** Private log. */ - private static Logger log = - Logger.getLogger(FixDerivedCurveGenerator.class); - - public static final String I18N_CHART_TITLE = - "chart.fixings.derivedcurve.title"; - - public static final String I18N_CHART_SUBTITLE = - "chart.fixings.derivedcurve.subtitle"; - - public static final String I18N_XAXIS_LABEL = - "chart.fixings.derivedcurve.xaxis.label"; - - public static final String I18N_YAXIS_LABEL = - "chart.fixings.derivedcurve.yaxis.label"; - - public static final String I18N_CHART_TITLE_DEFAULT = - "Ableitungskurve"; - - public static final String I18N_XAXIS_LABEL_DEFAULT = - "Q [m\u00B3/s]"; - - public static final String I18N_YAXIS_LABEL_DEFAULT = - "W [NN + m]"; - - public static enum YAXIS { - W(0), - Q(1); - public int idx; - private YAXIS(int c) { - idx = c; - } - } - - - @Override - public void doOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { - log.debug("doOut"); - - if (FacetTypes.IS.MANUALPOINTS(aaf.getFacetName())) { - doPoints(aaf.getData(context), - aaf, - doc, visible, YAXIS.W.idx); - } - else { - FixDerivateFacet facet = (FixDerivateFacet)aaf.getFacet(); - FixFunction func = (FixFunction)facet.getData( - aaf.getArtifact(), context); - - if (func == null) { - log.warn("doOut: Facet does not contain FixFunction"); - return; - } - - double maxQ = func.getMaxQ(); - - if (maxQ > 0) { - StyledXYSeries series = JFreeUtil.sampleFunction2D( - func.getFunction(), - doc, - aaf.getFacetDescription(), - 500, // number of samples - 0.0 , // start - maxQ); // end - addAxisSeries(series, 0, visible); - } - } - } - - - @Override - protected String getDefaultChartTitle() { - return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); - } - - - @Override - protected String getChartTitle() { - return Resources.format( - context.getMeta(), - I18N_CHART_TITLE, - I18N_CHART_TITLE_DEFAULT, - context.getContextValue(CURRENT_KM)); - } - - - @Override - protected String getDefaultXAxisLabel() { - return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); - } - - - @Override - protected String getDefaultYAxisLabel(int pos) { - return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); - } - - - @Override - protected ChartGenerator.YAxisWalker getYAxisWalker() { - return new YAxisWalker() { - @Override - public int length() { - return YAXIS.values().length; - } - - @Override - public String getId(int idx) { - YAXIS[] yaxes = YAXIS.values(); - return yaxes[idx].toString(); - } - }; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDerivedCurveInfoGenerator.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +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.fixings; - -import org.dive4elements.river.exports.ChartInfoGenerator; - -public class FixDerivedCurveInfoGenerator extends ChartInfoGenerator { - - public FixDerivedCurveInfoGenerator() { - super(new FixDerivedCurveGenerator()); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveInfoGenerator.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +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.fixings; - -import org.dive4elements.river.exports.ChartInfoGenerator; - -/** - * A ChartInfoGenerator that generates meta information for specific fixing - * analysis W/Q curves. - * - * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> - */ -public class FixWQCurveInfoGenerator extends ChartInfoGenerator { - - public FixWQCurveInfoGenerator() { - super(new FixWQCurveGenerator()); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java Fri Oct 17 19:13:40 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java Fri Oct 17 19:21:45 2014 +0200 @@ -59,14 +59,6 @@ private static final String CSV_HEADER_DIFF_PAIR = "export.minfo.beddifference.diff.pair"; - /* - private static final String CSV_HEADER_MORPH1 = - "export.minfo.beddifference.morph1"; - - private static final String CSV_HEADER_MORPH2 = - "export.minfo.beddifference.morph2"; - */ - private static final String CSV_HEADER_SOUNDING1 = "export.minfo.beddifference.sounding1"; @@ -109,8 +101,6 @@ double[][] sounding2 = yResult.getSoundingWidth2Data(); double[][] gap1 = yResult.getDataGap1Data(); double[][] gap2 = yResult.getDataGap2Data(); - //double[][] morph1 = yResult.getMorphWidth1Data(); - //double[][] morph2 = yResult.getMorphWidth2Data(); for (int j = 0; j < kms[0].length; j++) { writer.writeNext(new String[] { kmf.format(kms[0][j]), @@ -120,8 +110,6 @@ mf.format(sounding2[1][j]), mf.format(gap1[1][j]), mf.format(gap2[1][j]) - //mf.format(morph1[1][j]), - //mf.format(morph2[1][j]), }); } } @@ -159,7 +147,6 @@ D4EArtifact arti = (D4EArtifact) master; - //source.addMetaData ("river", RiverUtils.getRivername(arti)); source.addMetaData ("river", new RiverAccess(arti).getRiverName()); Locale locale = Resources.getLocale(meta); @@ -172,8 +159,6 @@ PDF_HEADER_MODE, "Bedheight difference")); - // Now the dynamic parts - BedDifferencesAccess access = new BedDifferencesAccess(arti); source.addMetaData("differences", StringUtils.join( @@ -184,12 +169,6 @@ source.addMetaData("diffpairheader", msg(CSV_HEADER_DIFF_PAIR, "Difference pair")); source.addMetaData("diffheader", msg(CSV_HEADER_DIFF, "cm")); - /* - source.addMetaData("morph1header", - msg(CSV_HEADER_MORPH1, "Morph. active width minuend")); - source.addMetaData("morph2header", - msg(CSV_HEADER_MORPH2, "Morph. active width subtrahend")); - */ } @@ -226,8 +205,6 @@ double[][] sounding2 = yResult.getSoundingWidth2Data(); double[][] gap1 = yResult.getDataGap1Data(); double[][] gap2 = yResult.getDataGap2Data(); - //double[][] morph1 = yResult.getMorphWidth1Data(); - //double[][] morph2 = yResult.getMorphWidth2Data(); for (int j = 0; j < kms[0].length; j++) { source.addData(new String[] { kmf.format(kms[0][j]), @@ -237,8 +214,6 @@ mf.format(sounding2[1][j]), mf.format(gap1[1][j]), mf.format(gap2[1][j]) - //mf.format(morph1[1][j]), - //mf.format(morph2[1][j]) }); } }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java Fri Oct 17 19:13:40 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java Fri Oct 17 19:21:45 2014 +0200 @@ -71,10 +71,7 @@ @Override public boolean canHandle(String facettype) { - return facettype.equals(FacetTypes.BED_DIFFERENCE_SOUNDING_WIDTH) || - facettype.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH1) || - facettype.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH2) || - facettype.equals(FacetTypes.MORPHOLOGIC_WIDTH) || + return facettype.equals(FacetTypes.MORPHOLOGIC_WIDTH) || facettype.equals(FacetTypes.BEDHEIGHT_SOUNDING_WIDTH); }
--- a/backend/src/test/java/org/dive4elements/river/AppTest.java Fri Oct 17 19:13:40 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -}