# HG changeset patch # User Raimund Renkert # Date 1345711777 0 # Node ID 66f539df4e8b036313d345be1b5a6cb9a2e7c19a # Parent a16837d7313009449cbdd9d5020fdf6f561d529e Issue 716. FixA: Spilt reference and analysis period themes into one theme for each event. flys-artifacts/trunk@5239 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Aug 23 08:49:37 2012 +0000 @@ -1,3 +1,38 @@ +2012-08-23 Raimund Renkert + + Issue 716. FixA: Spilt reference and analysis period themes into one theme for each event. + + * src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java: + Create a facet for each event and use new facet for sector average in + longitudinal section chart. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixReferenceEventsFacet.java, + src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisEventsFacet.java, + src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java, + src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java: + The facets now return data for a single event. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAvSectorFacet.java: + New. This facet returns an analysis period containing the calculated + average. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java: + Added methods to get the dates for all reference and analysis period events. + + * src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java: + Fixed range combining. + + * src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java, + src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java, + src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java: + Adjusted generators to use the data returned by the facets. + + * 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-08-22 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java: diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisEventsFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisEventsFacet.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisEventsFacet.java Thu Aug 23 08:49:37 2012 +0000 @@ -5,8 +5,6 @@ import de.intevation.flys.artifacts.FLYSArtifact; -import de.intevation.flys.artifacts.access.FixAnalysisAccess; - import de.intevation.flys.artifacts.model.CalculationResult; import de.intevation.flys.artifacts.model.DataFacet; import de.intevation.flys.artifacts.model.FacetTypes; @@ -61,7 +59,6 @@ if (artifact instanceof FLYSArtifact) { FLYSArtifact flys = (FLYSArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys); CalculationResult res = (CalculationResult) flys.compute(context, @@ -86,8 +83,18 @@ logger.debug("getData: periods == null"); return null; } - QWD[] qwdData = periods[index].getQWDs(); - return qwdData; + int ndx = index >> 8; + QWD[] qwdData = periods[ndx].getQWDs(); + if (qwdData == null) { + return null; + } + int ndy = index & 255; + for (int i = 0; i < qwdData.length; i++) { + if (qwdData[i].getIndex() == ndy) { + return qwdData[i]; + } + } + return null; } else { logger.debug("Not an instance of FixationArtifact."); diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java Thu Aug 23 08:49:37 2012 +0000 @@ -1,5 +1,10 @@ package de.intevation.flys.artifacts.model.fixings; +import java.util.Date; +import java.util.TreeSet; + +import org.apache.log4j.Logger; + import de.intevation.flys.artifacts.model.Parameters; import de.intevation.flys.utils.KMIndex; @@ -37,6 +42,29 @@ return result; } + public TreeSet getReferenceEventsDates() { + TreeSet dates = new TreeSet(); + for (KMIndex.Entry entry: referenced) { + for (int i = 0; i < entry.getValue().length; i++) { + QWD qwd = entry.getValue()[i]; + dates.add(qwd.date); + } + } + return dates; + } + + public TreeSet getAnalysisEventsDates(int analysisPeriod) { + TreeSet dates = new TreeSet(); + for (KMIndex.Entry entry: analysisPeriods) { + AnalysisPeriod period = entry.getValue()[analysisPeriod]; + for (int i = 0; i < period.qwds.length; i++) { + QWD qwd = period.qwds[i]; + dates.add(qwd.date); + } + } + return dates; + } + public KMIndex getAnalysisPeriods() { return analysisPeriods; } diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java Thu Aug 23 08:49:37 2012 +0000 @@ -1,22 +1,16 @@ 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.access.FixAnalysisAccess; - import de.intevation.flys.artifacts.model.CalculationResult; import de.intevation.flys.artifacts.model.DataFacet; import de.intevation.flys.artifacts.model.FacetTypes; - import de.intevation.flys.artifacts.states.DefaultState.ComputeType; - import de.intevation.flys.utils.KMIndex; -import org.apache.log4j.Logger; - /** * Facet to show average W values for Q sectors. * @@ -63,7 +57,6 @@ if (artifact instanceof FLYSArtifact) { FLYSArtifact flys = (FLYSArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys); CalculationResult res = (CalculationResult) flys.compute(context, @@ -73,13 +66,26 @@ FixAnalysisResult result = (FixAnalysisResult) res.getData(); KMIndex kmPeriods = result.getAnalysisPeriods(); - if (kmPeriods == null) { logger.warn("No analysis periods found."); return null; } + int periodNdx = index >> 8; + int qwdNdx = index & 255; + KMIndex resPeriods = + new KMIndex(); + for (KMIndex.Entry entry: kmPeriods) { + AnalysisPeriod ap = entry.getValue()[periodNdx]; + QWD[] qwds = ap.qwds; + for(int i = 0; i < qwds.length; i++) { + if(qwds[i].getIndex() == qwdNdx) { + resPeriods.add(entry.getKm(), qwds[i]); + } + } + } - return kmPeriods; + + return resPeriods; } else { logger.warn("Artifact is no instance of FLYSArtifact."); diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAvSectorFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAvSectorFacet.java Thu Aug 23 08:49:37 2012 +0000 @@ -0,0 +1,97 @@ +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.model.CalculationResult; +import de.intevation.flys.artifacts.model.DataFacet; +import de.intevation.flys.artifacts.model.FacetTypes; +import de.intevation.flys.artifacts.states.DefaultState.ComputeType; +import de.intevation.flys.utils.KMIndex; + +public class FixLongitudinalAvSectorFacet +extends DataFacet +implements FacetTypes { + + /** House logger. */ + private static Logger logger = + Logger.getLogger(FixLongitudinalAvSectorFacet.class); + + /** Trivial Constructor. */ + public FixLongitudinalAvSectorFacet() { + } + + + public FixLongitudinalAvSectorFacet( + 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("FixLongitudinalAvSectorFacet.getData"); + + if (artifact instanceof FLYSArtifact) { + FLYSArtifact flys = (FLYSArtifact)artifact; + + CalculationResult res = + (CalculationResult) flys.compute(context, + ComputeType.ADVANCE, + false); + + FixAnalysisResult result = (FixAnalysisResult) res.getData(); + + KMIndex kmPeriods = result.getAnalysisPeriods(); + if (kmPeriods == null) { + logger.warn("No analysis periods found."); + return null; + } + int periodNdx = index >> 2; + KMIndex resPeriods = + new KMIndex(); + for (KMIndex.Entry entry: kmPeriods) { + AnalysisPeriod ap = entry.getValue()[periodNdx]; + resPeriods.add(entry.getKm(), ap); + } + + return resPeriods; + } + else { + logger.warn("Artifact is no instance of FLYSArtifact."); + return null; + } + } + + + /** + * Create a deep copy of this Facet. + * @return a deep copy. + */ + @Override + public FixLongitudinalAvSectorFacet deepCopy() { + FixLongitudinalAvSectorFacet copy = new FixLongitudinalAvSectorFacet(); + copy.set(this); + return copy; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java Thu Aug 23 08:49:37 2012 +0000 @@ -80,7 +80,18 @@ return null; } - return kmReference; + int qwdNdx = index & 255; + KMIndex resReference = + new KMIndex(); + for (KMIndex.Entry entry: kmReference) { + QWD[] qwds = entry.getValue(); + for(int i = 0; i < qwds.length; i++) { + if(qwds[i].getIndex() == qwdNdx) { + resReference.add(entry.getKm(), qwds[i]); + } + } + } + return resReference; } else { logger.warn("Artifact is no instance of FLYSArtifact."); diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixReferenceEventsFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixReferenceEventsFacet.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixReferenceEventsFacet.java Thu Aug 23 08:49:37 2012 +0000 @@ -70,9 +70,16 @@ KMIndex.Entry kmQWsEntry = kmQWs.binarySearch(currentKm); QWD[] qwds = null; if (kmQWsEntry != null) { + int ndx = index & 255; qwds = kmQWsEntry.getValue(); + for (int i = 0; i < qwds.length; i++) { + if (qwds[i].getIndex() == ndx) { + return qwds[i]; + } + } + return null; } - return qwds; + return null; } else { logger.debug("Not an instance of FixationArtifact."); diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java Thu Aug 23 08:49:37 2012 +0000 @@ -1,45 +1,40 @@ package de.intevation.flys.artifacts.states.fixation; +import java.text.DateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.TreeSet; + +import org.apache.log4j.Logger; + import de.intevation.artifactdatabase.state.Facet; - import de.intevation.artifacts.CallContext; - import de.intevation.flys.artifacts.FLYSArtifact; - import de.intevation.flys.artifacts.access.FixAnalysisAccess; - import de.intevation.flys.artifacts.model.CalculationResult; import de.intevation.flys.artifacts.model.DataFacet; import de.intevation.flys.artifacts.model.DateRange; import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.ReportFacet; - +import de.intevation.flys.artifacts.model.fixings.FixAnalysisCalculation; import de.intevation.flys.artifacts.model.fixings.FixAnalysisEventsFacet; import de.intevation.flys.artifacts.model.fixings.FixAnalysisPeriodsFacet; +import de.intevation.flys.artifacts.model.fixings.FixAnalysisResult; import de.intevation.flys.artifacts.model.fixings.FixAvSectorFacet; -import de.intevation.flys.artifacts.model.fixings.FixAnalysisCalculation; 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.FixLongitudinalAvSectorFacet; import de.intevation.flys.artifacts.model.fixings.FixLongitudinalDeviationFacet; import de.intevation.flys.artifacts.model.fixings.FixLongitudinalReferenceFacet; import de.intevation.flys.artifacts.model.fixings.FixOutlierFacet; import de.intevation.flys.artifacts.model.fixings.FixReferenceEventsFacet; -import de.intevation.flys.artifacts.model.fixings.FixAnalysisResult; import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet; - import de.intevation.flys.artifacts.resources.Resources; - import de.intevation.flys.artifacts.states.DefaultState; - import de.intevation.flys.utils.IdGenerator; -import java.text.DateFormat; - -import java.util.List; - -import org.apache.log4j.Logger; - /** * @author Raimund Renkert */ @@ -50,7 +45,7 @@ /** The log used in this class. */ private static Logger log = Logger.getLogger(FixAnalysisCompute.class); - private static final String I18N_REFERENCEPERIOD = "fix.reference.period.events"; + private static final String I18N_REFERENCEPERIOD = "fix.reference.period.event.short"; private static final String I18N_ANALYSISPERIODS = "fix.analysis.periods"; @@ -58,7 +53,7 @@ private static final String I18N_OUTLIER = "fix.outlier"; - private static final String I18N_ANALYSIS = "fix.analysis"; + private static final String I18N_ANALYSIS = "fix.analysis.short"; private static final String I18N_DEVIATION = "fix.deviation"; @@ -109,7 +104,6 @@ } FixAnalysisResult fr = (FixAnalysisResult)res.getData(); - if (fr == null) { return res; } @@ -165,14 +159,14 @@ FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx, description)); facets.add( - new FixLongitudinalAnalysisFacet( + new FixLongitudinalAvSectorFacet( facetNdx, FIX_SECTOR_AVERAGE_LS + "_" + sectorNdx, description)); // TODO: i18n String dev = "Abweichung: " + description; facets.add( - new FixLongitudinalAnalysisFacet( + new FixLongitudinalAvSectorFacet( facetNdx, FIX_SECTOR_AVERAGE_LS_DEVIATION + "_" + sectorNdx, dev)); @@ -187,17 +181,23 @@ String eventDesc = Resources.getMsg(context.getMeta(), I18N_ANALYSIS, - I18N_ANALYSIS) + - ": " + startDate + " - " + endDate; - facets.add(new FixAnalysisEventsFacet(i, - FIX_ANALYSIS_EVENTS_DWT, - eventDesc)); - facets.add(new FixLongitudinalAnalysisFacet(i, - FIX_ANALYSIS_EVENTS_LS, - eventDesc)); - facets.add(new FixAnalysisEventsFacet(i, - FIX_ANALYSIS_EVENTS_WQ, - eventDesc)); + I18N_ANALYSIS); + + int k = 0; + for (Date d: fr.getAnalysisEventsDates(i)) { + int anaNdx = i << 8; + anaNdx = anaNdx | k; + facets.add(new FixAnalysisEventsFacet(anaNdx, + FIX_ANALYSIS_EVENTS_DWT, + eventDesc + (i+1) + " - " + df.format(d))); + facets.add(new FixLongitudinalAnalysisFacet(anaNdx, + FIX_ANALYSIS_EVENTS_LS, + eventDesc + (i+1) + " - " + df.format(d))); + facets.add(new FixAnalysisEventsFacet(anaNdx, + FIX_ANALYSIS_EVENTS_WQ, + eventDesc + (i+1) +" - " + df.format(d))); + k++; + } } IdGenerator idg = new IdGenerator(maxId + 1); @@ -209,16 +209,29 @@ I18N_REFERENCEDEVIATION, I18N_REFERENCEDEVIATION); + TreeSet dates = fr.getReferenceEventsDates(); + Iterator iter = dates.iterator(); + int i = 0; + while (iter.hasNext()) { + Date d = iter.next(); + int refNdx = idg.next() << 8; + refNdx |= i; + facets.add(new FixReferenceEventsFacet(refNdx, + FIX_REFERENCE_EVENTS_DWT, + i18n_ref + " - " + df.format(d))); + refNdx = idg.next() << 8; + refNdx = refNdx | i; + facets.add(new FixLongitudinalReferenceFacet(refNdx, + FIX_REFERENCE_EVENTS_LS, + i18n_ref + " - " + df.format(d))); + refNdx = idg.next() << 8; + refNdx |= i; + facets.add(new FixReferenceEventsFacet(refNdx, + FIX_REFERENCE_EVENTS_WQ, + i18n_ref + " - " + df.format(d))); + i++; + } - facets.add(new FixReferenceEventsFacet(idg.next(), - FIX_REFERENCE_EVENTS_DWT, - i18n_ref)); - facets.add(new FixLongitudinalReferenceFacet(idg.next(), - FIX_REFERENCE_EVENTS_LS, - i18n_ref)); - facets.add(new FixReferenceEventsFacet(idg.next(), - FIX_REFERENCE_EVENTS_WQ, - i18n_ref)); facets.add(new FixLongitudinalDeviationFacet(idg.next(), FIX_DEVIATION_LS, diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java Thu Aug 23 08:49:37 2012 +0000 @@ -123,8 +123,11 @@ // Determine min/max of range axis. for (int i = 0; i < dataset.getSeriesCount(); i++) { - double min = 0; - double max = 0; + if (dataset.getSeries(i).getItemCount() == 0) { + continue; + } + double min = Double.MAX_VALUE; + double max = -Double.MAX_VALUE; TimeSeries series = dataset.getSeries(i); for (int j = 0; j < series.getItemCount(); j++) { double tmp = series.getValue(j).doubleValue(); diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java Thu Aug 23 08:49:37 2012 +0000 @@ -243,7 +243,7 @@ addAttribute(desc, "outline"); Map annoIdxMap = new HashMap(); annoIdxMap.put (0, new int[]{0,0}); - doQWDTextAnnotations(annoIdxMap, tsc, new QWD[]{qwd.qwd}, theme, visible); + doQWDTextAnnotations(annoIdxMap, tsc, qwd.qwd, theme, visible); } @@ -256,25 +256,20 @@ ) { logger.debug("doAnalysisEventsOut: desc = " + desc); - QWD[] qwds = (QWD[]) data; - doQWDEventsOut(qwds, desc, theme, visible); + QWD qwd = (QWD) data; + doQWDEventsOut(qwd, desc, theme, visible); } - protected void doQWDEventsOut(QWD[] qwds, String desc, Document theme, boolean visible) + protected void doQWDEventsOut(QWD qwd, String desc, Document theme, boolean visible) { TimeSeriesCollection tsc = new TimeSeriesCollection(); TimeSeries series = new StyledTimeSeries(desc, theme); TimeSeries interpol = new StyledTimeSeries(desc + "interpol", theme); - if (qwds == null) { - logger.debug("doQWDEventsOut: qwds == null"); - return; - } - - if (qwds.length == 0) { - logger.debug("doQWDEventsOut: qwds.length == 0"); + if (qwd == null) { + logger.debug("doQWDEventsOut: qwd == null"); return; } @@ -282,38 +277,33 @@ int idxInterpol = 0; int idxRegular = 0; - for (int i = 0; i < qwds.length; i++) { - if (qwds[i] == null) { - logger.debug("doQWDEventsOut: qwds[" + i + "] == null"); - continue; - } - RegularTimePeriod rtp = new Day(qwds[i].getDate()); - double value = qwds[i].getDeltaW(); - boolean interpolate = qwds[i].getInterpolated(); - if (interpolate) { - if(interpol.addOrUpdate(rtp, value) == null) { - annoIdxMap.put( - i, - new int[]{1, idxInterpol}); - idxInterpol++; - } - } - else { - if(series.addOrUpdate(rtp, value) == null) { - annoIdxMap.put( - i, - new int[]{0, idxRegular}); - idxRegular++; - } + RegularTimePeriod rtp = new Day(qwd.getDate()); + double value = qwd.getDeltaW(); + boolean interpolate = qwd.getInterpolated(); + if (interpolate) { + if(interpol.addOrUpdate(rtp, value) == null) { + annoIdxMap.put( + 0, + new int[]{1, idxInterpol}); + idxInterpol++; } } + else { + if(series.addOrUpdate(rtp, value) == null) { + annoIdxMap.put( + 0, + new int[]{0, idxRegular}); + idxRegular++; + } + } + tsc.addSeries(series); tsc.addSeries(interpol); addAxisDataset(tsc, 0, visible); addAttribute(desc + "interpol", "interpolate"); addAttribute(desc, "outline"); - doQWDTextAnnotations(annoIdxMap, tsc, qwds, theme, visible); + doQWDTextAnnotations(annoIdxMap, tsc, qwd, theme, visible); } @@ -321,7 +311,7 @@ * @param annoIdxMap map of index in qwds to series/data item indices in tsc. */ protected void doQWDTextAnnotations(Map annoIdxMap, - TimeSeriesCollection tsc, QWD[] qwds, Document theme, + TimeSeriesCollection tsc, QWD qwd, Document theme, boolean visible) { logger.debug("doQWDTextAnnotation()"); @@ -334,7 +324,6 @@ Set> entries = annoIdxMap.entrySet(); for(Map.Entry entry : entries) { - QWD qwd = qwds[entry.getKey()]; int[] idxs = entry.getValue(); double x = tsc.getXValue(idxs[0], idxs[1]); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( @@ -359,8 +348,8 @@ ) { logger.debug("doReferenceEventsOut: desc = " + desc); - QWD[] qwds = (QWD[]) data; - doQWDEventsOut(qwds, desc, theme, visible); + QWD qwd = (QWD) data; + doQWDEventsOut(qwd, desc, theme, visible); } diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java Thu Aug 23 08:49:37 2012 +0000 @@ -101,10 +101,9 @@ int index = aaf.getFacet().getIndex(); int sectorNdx = index & 3; - int periodNdx = index >> 2; - KMIndex kms = - (KMIndex)aaf.getData(context); + KMIndex kms = + (KMIndex)aaf.getData(context); if(kms == null) { return; @@ -112,10 +111,10 @@ XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); - for (KMIndex.Entry entry: kms) { + for (KMIndex.Entry entry: kms) { double km = entry.getKm(); - AnalysisPeriod[] ap = entry.getValue(); - QWD qwd = ap[periodNdx].getQSectorAverages()[sectorNdx]; + AnalysisPeriod ap = entry.getValue(); + QWD qwd = ap.getQSectorAverages()[sectorNdx]; if (qwd == null) { continue; } @@ -138,10 +137,9 @@ int index = aaf.getFacet().getIndex(); int sectorNdx = index & 3; - int periodNdx = index >> 2; - KMIndex kms = - (KMIndex)aaf.getData(context); + KMIndex kms = + (KMIndex)aaf.getData(context); if(kms == null) { return; @@ -154,11 +152,11 @@ new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc); - for (KMIndex.Entry entry: kms) { + 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); + AnalysisPeriod ap = entry.getValue(); + QWD qwd = ap.getQSectorAverages()[sectorNdx]; + double dev = ap.getQSectorStdDev(sectorNdx); logger.debug("std-dev: " + dev); if (qwd == null) { continue; @@ -227,11 +225,9 @@ boolean visible) { logger.debug("doAnalysisEventsOut"); - int index = aaf.getFacet().getIndex(); - int periodNdx = index >> 2; - KMIndex kms = - (KMIndex)aaf.getData(context); + KMIndex kms = + (KMIndex)aaf.getData(context); if(kms == null) { return; @@ -239,27 +235,15 @@ 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(); + StyledXYSeries series = new StyledXYSeries(aaf.getFacetDescription(), false, doc); - 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 (KMIndex.Entry entry: kms) { + double km = entry.getKm(); + QWD qwd = entry.getValue(); + + series.add(km, qwd.getDeltaW()); } - for (StyledXYSeries s: series) { - col.addSeries(s); - } + col.addSeries(series); addAxisDataset(col, 0, visible); } @@ -272,8 +256,8 @@ { logger.debug("doReferenceEventOut"); - KMIndex kms = - (KMIndex)aaf.getData(context); + KMIndex kms = + (KMIndex)aaf.getData(context); if(kms == null) { return; @@ -281,26 +265,15 @@ XYSeriesCollection col = new XYSeriesCollection(); - List series = new ArrayList(); - - for (KMIndex.Entry entry: kms) { - double km = entry.getKm(); - QWD[] qwds = entry.getValue(); + StyledXYSeries series = new StyledXYSeries(aaf.getFacetDescription(), false, doc); - 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 (KMIndex.Entry entry: kms) { + double km = entry.getKm(); + QWD qwd = entry.getValue(); + + series.add(km, qwd.getDeltaW()); } - for (StyledXYSeries s: series) { - col.addSeries(s); - } + col.addSeries(series); addAxisDataset(col, 0, visible); } diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java Thu Aug 23 08:49:37 2012 +0000 @@ -168,9 +168,28 @@ protected void doAnalysisEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { logger.debug("doAnalysisEventsOut"); - QWD[] qwds = (QWD[])aaf.getData(context); - if(qwds != null) { - addQWSeries(qwds, aaf, doc, visible); + QWD qwd = (QWD)aaf.getData(context); + if(qwd != null) { + XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); + List textAnnos = new ArrayList(); + + DateFormat dateFormat = DateFormat.getDateInstance( + DateFormat.SHORT); + + series.add(qwd.getQ(), qwd.getW()); + + XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( + dateFormat.format(qwd.getDate()), + qwd.getQ(), + qwd.getW()); + textAnnos.add(anno); + + addAxisSeries(series, 0, visible); + if(visible && ThemeUtil.parseShowPointLabel(doc)) { + FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, doc); + flysAnno.setTextAnnotations(textAnnos); + addAnnotations(flysAnno); + } } else { logger.debug("doAnalysisEventsOut: qwds == null"); @@ -181,8 +200,32 @@ protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { logger.debug("doReferenceEventsOut"); - QW[] qws = (QW[])aaf.getData(context); - addQWSeries(qws, aaf, doc, visible); + QW qwd = (QW)aaf.getData(context); + if(qwd != null) { + XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); + List textAnnos = new ArrayList(); + + DateFormat dateFormat = DateFormat.getDateInstance( + DateFormat.SHORT); + + series.add(qwd.getQ(), qwd.getW()); + + XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( + dateFormat.format(qwd.getDate()), + qwd.getQ(), + qwd.getW()); + textAnnos.add(anno); + + addAxisSeries(series, 0, visible); + if(visible && ThemeUtil.parseShowPointLabel(doc)) { + FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, doc); + flysAnno.setTextAnnotations(textAnnos); + addAnnotations(flysAnno); + } + } + else { + logger.debug("doAnalysisEventsOut: qwds == null"); + } } protected void doWQCurveOut(ArtifactAndFacet aaf, Document doc, boolean visible) { diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/resources/messages.properties --- a/flys-artifacts/src/main/resources/messages.properties Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Thu Aug 23 08:49:37 2012 +0000 @@ -342,11 +342,13 @@ help.winfo.historical.discharge.mode=https://flys-intern.intevation.de/Flys-3.0/OnlineHilfe/WINFO#Auswahl_der_Analyseart fix.reference.period=Reference period -fix.reference.period.events=Reference period events +fix.reference.period.event=Reference event +fix.reference.period.event.short=R +fix.analysis.short=A fix.analysis.periods=Analysis periods fix.derivative=Derivative fix.outlier=Outlier -fix.analysis=Analysis +fix.analysis=Analysis event fix.deviation=Standard deviation fix.reference.deviation=Reference deviation fix.vollmer.wq.curve=W/Q diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/resources/messages_de.properties --- a/flys-artifacts/src/main/resources/messages_de.properties Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Thu Aug 23 08:49:37 2012 +0000 @@ -344,11 +344,13 @@ help.winfo.historical.discharge.mode=https://flys-intern.intevation.de/Flys-3.0/OnlineHilfe/WINFO#Auswahl_der_Analyseart fix.reference.period=Bezugszeitraum -fix.reference.period.events=Ereignisse im Bezugszeitraum +fix.reference.period.event=Bezugsereignis +fix.reference.period.event.short=B +fix.analysis.short=A fix.analysis.periods=Analysezeitr\u00e4ume fix.derivative=Ableitung fix.outlier=Ausrei\u00dfer -fix.analysis=Analyse +fix.analysis=Analyseereignis fix.deviation=Standardabweichung fix.reference.deviation=Abweichung im Bezugszeitraum fix.vollmer.wq.curve=W/Q diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/resources/messages_de_DE.properties --- a/flys-artifacts/src/main/resources/messages_de_DE.properties Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Aug 23 08:49:37 2012 +0000 @@ -341,11 +341,13 @@ help.winfo.historical.discharge.mode=https://flys-intern.intevation.de/Flys-3.0/OnlineHilfe/WINFO#Auswahl_der_Analyseart fix.reference.period=Bezugszeitraum -fix.reference.period.events=Ereignisse im Bezugszeitraum +fix.reference.period.event=Bezugsereignis +fix.reference.period.event.short=B +fix.analysis.short=A fix.analysis.periods=Analysezeitr\u00e4ume fix.derivative=Ableitung fix.outlier=Ausrei\u00dfer -fix.analysis=Analyse +fix.analysis=Analyseereignis fix.deviation=Standardabweichung fix.reference.deviation=Abweichung im Bezugszeitraum fix.vollmer.wq.curve=W/Q diff -r a16837d73130 -r 66f539df4e8b flys-artifacts/src/main/resources/messages_en.properties --- a/flys-artifacts/src/main/resources/messages_en.properties Wed Aug 22 14:51:19 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Thu Aug 23 08:49:37 2012 +0000 @@ -345,11 +345,13 @@ help.winfo.historical.discharge.mode=https://flys-intern.intevation.de/Flys-3.0/OnlineHilfe/WINFO#Auswahl_der_Analyseart fix.reference.period=Reference period -fix.reference.period.events=Reference period events +fix.reference.period.event=Reference event +fix.reference.period.event.short=R +fix.analysis.short=A fix.analysis.periods=Analysis periods fix.derivative=Derivative fix.outlier=Outlier -fix.analysis=Analysis +fix.analysis=Analysis event fix.deviation=Standard deviation fix.reference.deviation=Reference deviation fix.vollmer.wq.curve=W/Q