# HG changeset patch # User Raimund Renkert # Date 1340639614 0 # Node ID b6da650b0718a05050b74281bf7c63ad746db37c # Parent e10323bf3cbc647790242fe76434f958da19af6f FixA: Added longitudinal section chart. flys-artifacts/trunk@4782 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon Jun 25 15:53:34 2012 +0000 @@ -1,3 +1,37 @@ +2012-06-25 Raimund Renkert + + * src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java: + New. Generator for longitudinal sections in fix analysis. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java, + src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java, + src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java: + New. Facets for longitudinal sections chart in fix analysis. + + * src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java: + Added new facet types. + + * src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java: + Add facets for new chart. + + * src/main/java/de/intevation/flys/exports/ChartGenerator.java: + Fixed NPE. + + * doc/conf/artifacts/fixanalysis.xml: + Added facets to config. + + * doc/conf/themes.xml: + Added new themes. + + * doc/conf/conf.xml: + Added new chart generator. + + * src/main/resources/messages.properties, + src/main/resources/messages_de_DE.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages_de.properties: + Added i18n strings. + 2012-06-25 Raimund Renkert * src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java: diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/doc/conf/artifacts/fixanalysis.xml --- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Mon Jun 25 15:53:34 2012 +0000 @@ -155,8 +155,18 @@ - + + + + + + + + + + + diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/doc/conf/conf.xml --- a/flys-artifacts/doc/conf/conf.xml Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/doc/conf/conf.xml Mon Jun 25 15:53:34 2012 +0000 @@ -266,6 +266,7 @@ de.intevation.flys.exports.SQRelationExporter de.intevation.flys.exports.DeltaWtExporter de.intevation.flys.exports.fixings.FixDeltaWtGenerator + de.intevation.flys.exports.fixings.FixLongitudinalGenerator de.intevation.flys.exports.ReportGenerator de.intevation.flys.exports.ReportGenerator diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/doc/conf/themes.xml --- a/flys-artifacts/doc/conf/themes.xml Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/doc/conf/themes.xml Mon Jun 25 15:53:34 2012 +0000 @@ -1088,6 +1088,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2104,6 +2205,12 @@ + + + + + + @@ -2675,5 +2782,16 @@ + + + + + + + + + + + diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Mon Jun 25 15:53:34 2012 +0000 @@ -232,6 +232,7 @@ String FIX_SECTOR_AVERAGE_DWT = "fix_sector_average_dwt"; String FIX_SECTOR_AVERAGE_LS = "fix_sector_average_ls"; String FIX_SECTOR_AVERAGE_WQ = "fix_sector_average_wq"; + String FIX_SECTOR_AVERAGE_LS_DEVIATION = "fix_sector_average_ls_deviation"; String FIX_WQ_CURVE = "fix_wq_curve"; String FIX_OUTLIER = "fix_outlier"; @@ -243,5 +244,7 @@ String FIX_DERIVATE = "fix_derivate"; String FIX_DEVIATION_DWT = "fix_deviation_dwt"; + String FIX_DEVIATION_LS = "fix_deviation_ls"; + } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java Mon Jun 25 15:53:34 2012 +0000 @@ -0,0 +1,104 @@ +package de.intevation.flys.artifacts.model.fixings; + +import java.util.Iterator; + +import org.apache.log4j.Logger; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.CallContext; + +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.FixationArtifactAccess; + +import de.intevation.flys.artifacts.model.FacetTypes; +import de.intevation.flys.artifacts.model.DataFacet; +import de.intevation.flys.artifacts.model.CalculationResult; + +import de.intevation.flys.utils.KMIndex; + +import de.intevation.flys.artifacts.states.DefaultState.ComputeType; + + +/** + * Facet to show average W values for Q sectors. + * + * @author Raimund Renkert + */ +public class FixLongitudinalAnalysisFacet +extends DataFacet +implements FacetTypes { + + /** House logger. */ + private static Logger logger = Logger.getLogger(FixLongitudinalAnalysisFacet.class); + + /** Trivial Constructor. */ + public FixLongitudinalAnalysisFacet() { + } + + + public FixLongitudinalAnalysisFacet( + int ndx, + String name, + String description) + { + super( + ndx, + name, + description, + ComputeType.ADVANCE, + null, + null); + } + + + /** + * Returns the data this facet requires. + * + * @param artifact the owner artifact. + * @param context the CallContext. + * + * @return the data as KMIndex. + */ + @Override + public Object getData(Artifact artifact, CallContext context) { + logger.debug("FixLongitudinalAnalysisFacet.getData"); + + if (artifact instanceof FLYSArtifact) { + FLYSArtifact flys = (FLYSArtifact)artifact; + FixationArtifactAccess access = new FixationArtifactAccess(flys); + + CalculationResult res = + (CalculationResult) flys.compute(context, + ComputeType.ADVANCE, + false); + + FixResult result = (FixResult) res.getData(); + + KMIndex kmPeriods = result.getAnalysisPeriods(); + + if (kmPeriods == null) { + logger.warn("No analysis periods found."); + return null; + } + + return kmPeriods; + } + else { + logger.warn("Artifact is no instance of FLYSArtifact."); + return null; + } + } + + + /** + * Create a deep copy of this Facet. + * @return a deep copy. + */ + @Override + public FixLongitudinalAnalysisFacet deepCopy() { + FixLongitudinalAnalysisFacet copy = new FixLongitudinalAnalysisFacet(); + copy.set(this); + return copy; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalDeviationFacet.java Mon Jun 25 15:53:34 2012 +0000 @@ -0,0 +1,120 @@ +package de.intevation.flys.artifacts.model.fixings; + +import java.util.Iterator; + +import org.apache.log4j.Logger; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.CallContext; + +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.FixationArtifactAccess; + +import de.intevation.flys.artifacts.model.FacetTypes; +import de.intevation.flys.artifacts.model.DataFacet; +import de.intevation.flys.artifacts.model.CalculationResult; +import de.intevation.flys.artifacts.model.Parameters; + +import de.intevation.flys.utils.KMIndex; + +import de.intevation.flys.artifacts.states.DefaultState.ComputeType; + + +/** + * Facet to show average W values for Q sectors. + * + * @author Raimund Renkert + */ +public class FixLongitudinalDeviationFacet +extends DataFacet +implements FacetTypes { + + /** House logger. */ + private static Logger logger = Logger.getLogger(FixLongitudinalDeviationFacet.class); + + /** Trivial Constructor. */ + public FixLongitudinalDeviationFacet() { + } + + + public FixLongitudinalDeviationFacet( + int ndx, + String name, + String description) + { + super( + ndx, + name, + description, + ComputeType.ADVANCE, + null, + null); + } + + + /** + * Returns the data this facet requires. + * + * @param artifact the owner artifact. + * @param context the CallContext. + * + * @return the data as KMIndex. + */ + @Override + public Object getData(Artifact artifact, CallContext context) { + logger.debug("FixLongitudinalDeviationFacet.getData"); + + if (artifact instanceof FLYSArtifact) { + FLYSArtifact flys = (FLYSArtifact)artifact; + FixationArtifactAccess access = new FixationArtifactAccess(flys); + + CalculationResult res = + (CalculationResult) flys.compute(context, + ComputeType.ADVANCE, + false); + + FixResult result = (FixResult) res.getData(); + + KMIndex kmPeriods = result.getAnalysisPeriods(); + + if (kmPeriods == null) { + logger.warn("No analysis periods found."); + return null; + } + + Parameters params = result.getParameters(); + + KMIndex kmIndex = new KMIndex(); + for (KMIndex.Entry entry: kmPeriods) { + double km = entry.getKm(); + double[] stdDev = + params.interpolate("km", km, new String[] {"std-dev"}); + + if(stdDev == null) { + logger.warn("getData: stdDev == null"); + continue; + } + kmIndex.add(km, stdDev); + } + + return kmIndex; + } + else { + logger.warn("Artifact is no instance of FLYSArtifact."); + return null; + } + } + + + /** + * Create a deep copy of this Facet. + * @return a deep copy. + */ + @Override + public FixLongitudinalDeviationFacet deepCopy() { + FixLongitudinalDeviationFacet copy = new FixLongitudinalDeviationFacet(); + copy.set(this); + return copy; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java Mon Jun 25 15:53:34 2012 +0000 @@ -0,0 +1,104 @@ +package de.intevation.flys.artifacts.model.fixings; + +import org.apache.log4j.Logger; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.CallContext; + +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.FixationArtifactAccess; + +import de.intevation.flys.artifacts.model.FacetTypes; +import de.intevation.flys.artifacts.model.DataFacet; +import de.intevation.flys.artifacts.model.CalculationResult; +import de.intevation.flys.artifacts.model.Parameters; + +import de.intevation.flys.utils.KMIndex; + +import de.intevation.flys.artifacts.states.DefaultState.ComputeType; + + +/** + * Facet to show average W values for Q sectors. + * + * @author Raimund Renkert + */ +public class FixLongitudinalReferenceFacet +extends DataFacet +implements FacetTypes { + + /** House logger. */ + private static Logger logger = Logger.getLogger(FixLongitudinalReferenceFacet.class); + + /** Trivial Constructor. */ + public FixLongitudinalReferenceFacet() { + } + + + public FixLongitudinalReferenceFacet( + int ndx, + String name, + String description) + { + super( + ndx, + name, + description, + ComputeType.ADVANCE, + null, + null); + } + + + /** + * Returns the data this facet requires. + * + * @param artifact the owner artifact. + * @param context the CallContext. + * + * @return the data as KMIndex. + */ + @Override + public Object getData(Artifact artifact, CallContext context) { + logger.debug("FixLongitudinalReferenceFacet.getData"); + + if (artifact instanceof FLYSArtifact) { + FLYSArtifact flys = (FLYSArtifact)artifact; + FixationArtifactAccess access = new FixationArtifactAccess(flys); + + CalculationResult res = + (CalculationResult) flys.compute(context, + ComputeType.ADVANCE, + false); + + FixResult result = (FixResult) res.getData(); + + KMIndex kmReference = result.getReferenced(); + + if (kmReference == null) { + logger.warn("No references found."); + return null; + } + + return kmReference; + } + else { + logger.warn("Artifact is no instance of FLYSArtifact."); + return null; + } + } + + + /** + * Create a deep copy of this Facet. + * @return a deep copy. + */ + @Override + public FixLongitudinalReferenceFacet deepCopy() { + FixLongitudinalReferenceFacet copy = + new FixLongitudinalReferenceFacet(); + copy.set(this); + return copy; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java Mon Jun 25 15:53:34 2012 +0000 @@ -24,6 +24,9 @@ import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet; import de.intevation.flys.artifacts.model.fixings.FixDerivateFacet; import de.intevation.flys.artifacts.model.fixings.FixDeviationFacet; +import de.intevation.flys.artifacts.model.fixings.FixLongitudinalAnalysisFacet; +import de.intevation.flys.artifacts.model.fixings.FixLongitudinalDeviationFacet; +import de.intevation.flys.artifacts.model.fixings.FixLongitudinalReferenceFacet; import de.intevation.flys.artifacts.model.fixings.DateRange; @@ -58,6 +61,8 @@ private static final String I18N_DEVIATION = "fix.deviation"; + private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation"; + /** * The default constructor that initializes an empty State object. */ @@ -130,9 +135,14 @@ FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx, description)); facets.add( - new FixAvSectorFacet(facetNdx, - FIX_SECTOR_AVERAGE_LS, + new FixLongitudinalAnalysisFacet(facetNdx, + FIX_SECTOR_AVERAGE_LS + "_" + sectorNdx, description)); + String dev = "Abweichung: " + description; + facets.add( + new FixLongitudinalAnalysisFacet(facetNdx, + FIX_SECTOR_AVERAGE_LS_DEVIATION + "_" + sectorNdx, + dev)); facets.add( new FixAvSectorFacet(facetNdx, FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx, @@ -147,7 +157,7 @@ facets.add(new FixAnalysisEventsFacet(i, FIX_ANALYSIS_EVENTS_DWT, eventDesc)); - facets.add(new FixAnalysisEventsFacet(i, + facets.add(new FixLongitudinalAnalysisFacet(i, FIX_ANALYSIS_EVENTS_LS, eventDesc)); facets.add(new FixAnalysisEventsFacet(i, @@ -158,17 +168,25 @@ String i18n_ref = Resources.getMsg(context.getMeta(), I18N_REFERENCEPERIOD, I18N_REFERENCEPERIOD); + String i18n_dev = Resources.getMsg(context.getMeta(), + I18N_REFERENCEDEVIATION, + I18N_REFERENCEDEVIATION); + facets.add(new FixReferenceEventsFacet(0, FIX_REFERENCE_EVENTS_DWT, i18n_ref)); - facets.add(new FixReferenceEventsFacet(1, + facets.add(new FixLongitudinalReferenceFacet(1, FIX_REFERENCE_EVENTS_LS, i18n_ref)); facets.add(new FixReferenceEventsFacet(2, FIX_REFERENCE_EVENTS_WQ, i18n_ref)); + facets.add(new FixLongitudinalDeviationFacet(0, + FIX_DEVIATION_LS, + i18n_dev)); + String i18n_ana = Resources.getMsg(context.getMeta(), I18N_ANALYSISPERIODS, I18N_ANALYSISPERIODS); diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Mon Jun 25 15:53:34 2012 +0000 @@ -1196,10 +1196,8 @@ } LegendItem legendItem = renderer.getLegendItem(idx, s); - if (legendItem.getLabel().endsWith(" ")) { - legendItem = null; - } - if (legendItem.getLabel().endsWith("interpol")) { + if (legendItem.getLabel().endsWith(" ") || + legendItem.getLabel().endsWith("interpol")) { legendItem = null; } diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Mon Jun 25 15:53:34 2012 +0000 @@ -195,6 +195,8 @@ protected List domainMarkers = new ArrayList(); + protected List valueMarkers = new ArrayList(); + /** The max X range to include all X values of all series for each axis. */ protected Map xBounds; @@ -381,10 +383,25 @@ } + /** + * Add the given vertical marker to the chart. + */ + public void addValueMarker(Marker marker) { + if (marker == null) { + return; + } + + valueMarkers.add(marker); + } + + protected void addMarkers(XYPlot plot) { for(Marker marker : domainMarkers) { plot.addDomainMarker(marker); } + for(Marker marker : valueMarkers) { + plot.addRangeMarker(marker); + } } diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java Mon Jun 25 15:53:34 2012 +0000 @@ -0,0 +1,344 @@ +package de.intevation.flys.exports.fixings; + +import java.util.List; +import java.util.ArrayList; + +import java.awt.BasicStroke; +import java.awt.Color; + +import de.intevation.artifactdatabase.state.ArtifactAndFacet; + +import de.intevation.flys.artifacts.model.FacetTypes; + +import de.intevation.flys.artifacts.model.fixings.DateRange; +import de.intevation.flys.artifacts.model.fixings.FixFunction; +import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet; +import de.intevation.flys.artifacts.model.fixings.QW; +import de.intevation.flys.artifacts.model.fixings.QWD; +import de.intevation.flys.artifacts.model.fixings.AnalysisPeriod; + +import de.intevation.flys.exports.ChartGenerator; +import de.intevation.flys.exports.XYChartGenerator; + +import de.intevation.flys.jfree.Function2DAdapter; +import de.intevation.flys.jfree.StyledXYSeries; +import de.intevation.flys.jfree.StyledAreaSeriesCollection; + +import de.intevation.flys.utils.KMIndex; + +import org.apache.log4j.Logger; + +import org.jfree.data.general.DatasetUtilities; + +import org.jfree.data.xy.XYSeries; +import org.jfree.chart.plot.Marker; +import org.jfree.chart.plot.ValueMarker; +import org.jfree.data.xy.XYSeriesCollection; + +import org.w3c.dom.Document; + +public class FixLongitudinalSectionGenerator +extends XYChartGenerator +implements FacetTypes +{ + private static Logger logger = + Logger.getLogger(FixLongitudinalSectionGenerator.class); + + public static final String I18N_CHART_TITLE = + "chart.fixings.longitudinalsection.title"; + + public static final String I18N_CHART_SUBTITLE = + "chart.fixings.longitudinalsection.subtitle"; + + public static final String I18N_XAXIS_LABEL = + "chart.fixings.longitudinalsection.xaxis.label"; + + public static final String I18N_YAXIS_LABEL = + "chart.fixings.longitudinalsection.yaxis.label"; + + public static final String I18N_CHART_TITLE_DEFAULT = + "Fixierungsanalyse"; + + public static final String I18N_XAXIS_LABEL_DEFAULT = + "[m]"; + + public static final String I18N_YAXIS_LABEL_DEFAULT = + "delta W [cm]"; + + public static enum YAXIS { + dW(0); + public int idx; + private YAXIS(int c) { + idx = c; + } + } + + @Override + public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + String name = aaf.getFacetName(); + logger.debug("doOut: " + name); + + if (name.contains(FIX_SECTOR_AVERAGE_LS_DEVIATION)) { + doSectorAverageDeviationOut(aaf, doc, visible); + } + else if (name.contains(FIX_SECTOR_AVERAGE_LS)) { + doSectorAverageOut(aaf, doc, visible); + } + else if (name.equals(FIX_REFERENCE_EVENTS_LS)) { + doReferenceEventsOut(aaf, doc, visible); + } + else if (name.equals(FIX_ANALYSIS_EVENTS_LS)) { + doAnalysisEventsOut(aaf, doc, visible); + } + else if (name.equals(FIX_DEVIATION_LS)) { + doReferenceDeviationOut(aaf, doc, visible); + } + else { + logger.warn("Unknown facet name " + name); + return; + } + } + + protected void doSectorAverageOut( + ArtifactAndFacet aaf, + Document doc, + boolean visible) + { + logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex()); + + int index = aaf.getFacet().getIndex(); + int sectorNdx = index & 3; + int periodNdx = index >> 2; + + KMIndex kms = + (KMIndex)aaf.getData(context); + + if(kms == null) { + return; + } + + XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); + + for (KMIndex.Entry entry: kms) { + double km = entry.getKm(); + AnalysisPeriod[] ap = entry.getValue(); + QWD qwd = ap[periodNdx].getQSectorAverages()[sectorNdx]; + if (qwd == null) { + continue; + } + double deltaW = qwd.getDeltaW(); + series.add(km, deltaW); + } + + addAxisSeries(series, 0, visible); + + } + + + protected void doSectorAverageDeviationOut( + ArtifactAndFacet aaf, + Document doc, + boolean visible) + { + logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex()); + + int index = aaf.getFacet().getIndex(); + int sectorNdx = index & 3; + int periodNdx = index >> 2; + + KMIndex kms = + (KMIndex)aaf.getData(context); + + if(kms == null) { + return; + } + + StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(doc); + XYSeries upper = + new StyledXYSeries(aaf.getFacetDescription(), false, doc); + XYSeries lower = + new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc); + + + for (KMIndex.Entry entry: kms) { + double km = entry.getKm(); + AnalysisPeriod[] ap = entry.getValue(); + QWD qwd = ap[periodNdx].getQSectorAverages()[sectorNdx]; + double dev = ap[periodNdx].getQSectorStdDev(sectorNdx); + logger.debug("std-dev: " + dev); + if (qwd == null) { + continue; + } + double deltaW = qwd.getDeltaW(); + double up = deltaW + dev; + double lo = deltaW - dev; + upper.add(km, up); + lower.add(km, lo); + } + area.addSeries(upper); + area.addSeries(lower); + + addAreaSeries(area, 0, visible); + } + + + protected void doReferenceDeviationOut( + ArtifactAndFacet aaf, + Document doc, + boolean visible) + { + logger.debug("doReferenceOut"); + + KMIndex kms = + (KMIndex)aaf.getData(context); + + if(kms == null) { + return; + } + + StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(doc); + XYSeries upper = + new StyledXYSeries(aaf.getFacetDescription(), false, doc); + XYSeries lower = + new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc); + + + for (KMIndex.Entry entry: kms) { + double km = entry.getKm(); + double[] devArray = entry.getValue(); + if (devArray == null) { + continue; + } + double dev = devArray[0]; + double up = dev; + double lo = -dev; + upper.add(km, up); + lower.add(km, lo); + } + area.addSeries(upper); + area.addSeries(lower); + + Marker marker = new ValueMarker(0); + marker.setStroke(new BasicStroke(2)); + marker.setPaint(Color.BLACK); + addValueMarker(marker); + addAreaSeries(area, 0, visible); + } + + protected void doAnalysisEventsOut( + ArtifactAndFacet aaf, + Document doc, + boolean visible) + { + logger.debug("doAnalysisEventsOut"); + int index = aaf.getFacet().getIndex(); + int sectorNdx = index & 3; + int periodNdx = index >> 2; + + KMIndex kms = + (KMIndex)aaf.getData(context); + + if(kms == null) { + return; + } + + XYSeriesCollection col = new XYSeriesCollection(); + + List series = new ArrayList(); + + for (KMIndex.Entry entry: kms) { + double km = entry.getKm(); + AnalysisPeriod[] ap = entry.getValue(); + QWD[] qwds = ap[periodNdx].getQWDs(); + + String space = ""; + for (int i = 0; i < qwds.length; i++) { + if (series.size() <= i && qwds.length > i) { + StyledXYSeries s = new StyledXYSeries(aaf.getFacetDescription() + space, false, doc); + series.add (s); + } + StyledXYSeries s = series.get(i); + s.add(km, qwds[i].getDeltaW()); + space+= " "; + } + } + for (StyledXYSeries s: series) { + col.addSeries(s); + } + + addAxisDataset(col, 0, visible); + } + + protected void doReferenceEventsOut( + ArtifactAndFacet aaf, + Document doc, + boolean visible) + { + logger.debug("doReferenceEventOut"); + + KMIndex kms = + (KMIndex)aaf.getData(context); + + if(kms == null) { + return; + } + + XYSeriesCollection col = new XYSeriesCollection(); + + List series = new ArrayList(); + + for (KMIndex.Entry entry: kms) { + double km = entry.getKm(); + QWD[] qwds = entry.getValue(); + + String space = ""; + for (int i = 0; i < qwds.length; i++) { + if (series.size() <= i && qwds.length > i) { + StyledXYSeries s = new StyledXYSeries(aaf.getFacetDescription() + space, false, doc); + series.add (s); + } + StyledXYSeries s = series.get(i); + s.add(km, qwds[i].getDeltaW()); + space += " "; + } + } + for (StyledXYSeries s: series) { + col.addSeries(s); + } + + addAxisDataset(col, 0, visible); + } + + + @Override + protected String getDefaultChartTitle() { + return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); + } + + @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 : diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/resources/messages.properties --- a/flys-artifacts/src/main/resources/messages.properties Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Mon Jun 25 15:53:34 2012 +0000 @@ -335,6 +335,7 @@ fix.outlier=Outlier fix.analysis=Analysis fix.deviation=Standard deviation +fix.reference.deviation=Reference deviation chart.fix.deltawt.title=\u0394 W(t) (Please change...) chart.fix.deltawt.subtitle=add subtitle diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/resources/messages_de.properties --- a/flys-artifacts/src/main/resources/messages_de.properties Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Mon Jun 25 15:53:34 2012 +0000 @@ -336,6 +336,7 @@ fix.outlier=Ausrei\u00dfer fix.analysis=Analyse fix.deviation=Standardabweichung +fix.reference.deviation=Abweichung im Bezugszeitraum chart.fix.deltawt.title=\u0394W(t) (Bitte aendern...) chart.fix.deltawt.subtitle=add subtitle diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/resources/messages_de_DE.properties --- a/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Jun 25 15:53:34 2012 +0000 @@ -335,6 +335,7 @@ fix.outlier=Ausrei\u00dfer fix.analysis=Analyse fix.deviation=Standardabweichung +fix.reference.deviation=Abweichung im Bezugszeitraum chart.fix.deltawt.title=\u0394 W(t) (Bitte aendern...) chart.fix.deltawt.subtitle=add subtitle diff -r e10323bf3cbc -r b6da650b0718 flys-artifacts/src/main/resources/messages_en.properties --- a/flys-artifacts/src/main/resources/messages_en.properties Mon Jun 25 15:38:38 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Mon Jun 25 15:53:34 2012 +0000 @@ -328,13 +328,14 @@ help.winfo.historical.discharge.timerange=https://flys-intern.intevation.de/Flys-3.0/OnlineHilfe/WINFO#Auswahl_des_Auswertezeitraumes help.winfo.historical.discharge.mode=https://flys-intern.intevation.de/Flys-3.0/OnlineHilfe/WINFO#Auswahl_der_Analyseart -fix.reference.period=Referenceperiod -fix.reference.period.events=Referenceperiodevents -fix.analysis.periods=Analysisperiods +fix.reference.period=Reference period +fix.reference.period.events=Reference period events +fix.analysis.periods=Analysis periods fix.derivative=Derivative fix.outlier=Outlier fix.analysis=Analysis fix.deviation=Standard deviation +fix.reference.deviation=Reference deviation chart.fix.deltawt.title=Delta W(t) (Please change...) chart.fix.deltawt.subtitle=add subtitle