Mercurial > dive4elements > river
changeset 2325:1fcaeced48f2
#485 Fixed broken renaming of chart themes.
flys-artifacts/trunk@4009 c6561f87-3c4e-4783-a992-168aeb5c3f6f
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Feb 09 15:59:49 2012 +0000 @@ -1,3 +1,25 @@ +2012-02-09 Ingo Weinzierl <ingo@intevation.de> + + flys/issue485 (Themen können umgenannt werden, dies wird nicht in der Legende reflektiert) + + * src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java: + Use ArtifactAndFacet.setFacetDescription() to set the description for + themes which are stored in the Collection's XML attribute. + + * src/main/java/de/intevation/flys/exports/XYChartGenerator.java, + * src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java, + src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java, + src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java, + src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java, + src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java, + src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java, + src/main/java/de/intevation/flys/exports/NormalizedReferenceCurveGenerator.java, + src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java, + src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java: + Some refactoring of doXXXOut() methods. We pass the ArtifactAndFacet + objects of doOut() into those concrete doOut() methods which allows us to + generate series names for chart curves. + 2012-02-09 Felix Wolfsteller <felix.wolfsteller@intevation.de> * doc/conf/meta-data.xml: Replaced dashes by underscores in entities
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Thu Feb 09 15:59:49 2012 +0000 @@ -462,9 +462,14 @@ String uuid = theme.getArtifact(); Artifact artifact = getArtifact(uuid, context); FLYSArtifact flys = (FLYSArtifact) artifact; - ArtifactAndFacet artifactAndFacet = new ArtifactAndFacet(artifact, + + ArtifactAndFacet artifactAndFacet = new ArtifactAndFacet( + artifact, flys.getNativeFacet(theme)); + // XXX HELP ME PLEASE + artifactAndFacet.setFacetDescription(theme.getDescription()); + // Show blackboard to facet. artifactAndFacet.register(context);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -115,7 +115,11 @@ doWQOut(artifactFacet.getData(context), facet, attr, visible); } else if (name.equals(STATIC_WQ_ANNOTATIONS)) { - doWQAnnotations(artifactFacet.getData(context), facet, attr, visible); + doWQAnnotations( + artifactFacet.getData(context), + artifactFacet, + attr, + visible); } else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q) || name.equals(MAINVALUES_Q) @@ -123,14 +127,18 @@ || name.equals(MAINVALUES_W) ) { doAnnotations((FLYSAnnotation) - artifactFacet.getData(context), facet, attr, visible); + artifactFacet.getData(context), artifactFacet, attr, visible); } else if (name.equals(STATIC_WKMS_INTERPOL)) { - doWAnnotations(artifactFacet.getData(context), facet, attr, visible); + doWAnnotations( + artifactFacet.getData(context), + artifactFacet, + attr, + visible); } else if (FacetTypes.IS.MANUALPOINTS(name)) { doPoints(artifactFacet.getData(context), - artifactFacet.getFacetDescription(), + artifactFacet, attr, visible, YAXIS.W.idx); } else { @@ -183,21 +191,21 @@ */ protected void doWQAnnotations( Object wqkms, - Facet facet, + ArtifactAndFacet aandf, Document theme, boolean visible ) { List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); double [][] data = (double [][]) wqkms; for (int i = 0; i< data[0].length; i++) { - xy.add(new StickyAxisAnnotation(facet.getDescription(), + xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), (float) data[0][i], StickyAxisAnnotation.SimpleAxis.X_AXIS)); - xy.add(new StickyAxisAnnotation(facet.getDescription(), + xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS)); } - doAnnotations(new FLYSAnnotation(facet.getDescription(), xy), - facet, theme, visible); + doAnnotations(new FLYSAnnotation(aandf.getFacetDescription(), xy), + aandf, theme, visible); } @@ -208,19 +216,21 @@ */ protected void doWAnnotations( Object wqkms, - Facet facet, + ArtifactAndFacet aandf, Document theme, boolean visible ) { + Facet facet = aandf.getFacet(); + List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); double [][] data = (double [][]) wqkms; for (int i = 0; i< data[0].length; i++) { - xy.add(new StickyAxisAnnotation(facet.getDescription(), + xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS)); } doAnnotations(new FLYSAnnotation(facet.getDescription(), xy), - facet, theme, visible); + aandf, theme, visible); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -173,7 +173,7 @@ } else if (FacetTypes.IS.AREA(name)) { doArea(artifactFacet.getData(context), - artifactFacet.getFacetDescription(), + artifactFacet, attr, visible); } @@ -185,7 +185,7 @@ } else if (FacetTypes.IS.MANUALPOINTS(name)) { doPoints(artifactFacet.getData(context), - artifactFacet.getFacetDescription(), + artifactFacet, attr, visible, YAXIS.W.idx); } else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -168,11 +168,11 @@ || name.equals(MAINVALUES_W)) { doAnnotations((FLYSAnnotation) artifactFacet.getData(context), - artifactFacet.getFacet(), theme, visible); + artifactFacet, theme, visible); } else if (FacetTypes.IS.MANUALPOINTS(name)) { doPoints(artifactFacet.getData(context), - artifactFacet.getFacetDescription(), + artifactFacet, theme, visible, YAXIS.W.idx); } else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -54,10 +54,18 @@ Facet facet = artifactFacet.getFacet(); if (IS.WQ_KM(name)) { - doWOut((WQKms) artifactFacet.getData(context), facet, attr, visible); + doWOut( + (WQKms) artifactFacet.getData(context), + artifactFacet, + attr, + visible); } else if (name.equals(DISCHARGE_LONGITUDINAL_Q)) { - doQOut((WQKms) artifactFacet.getData(context), facet, attr, visible); + doQOut( + (WQKms) artifactFacet.getData(context), + artifactFacet, + attr, + visible); } else if (name.equals(DISCHARGE_LONGITUDINAL_C)) { doCorrectedWOut( @@ -67,15 +75,18 @@ visible); } else if (IS.W_KM(name)) { - doWOut((WKms) artifactFacet.getData(context), facet, attr, visible); + doWOut( + (WKms) artifactFacet.getData(context), + artifactFacet, + attr, visible); } else if (name.equals(LONGITUDINAL_ANNOTATION)) { doAnnotations((FLYSAnnotation) artifactFacet.getData(context), - facet, attr, visible); + artifactFacet, attr, visible); } else if (FacetTypes.IS.MANUALPOINTS(name)) { doPoints(artifactFacet.getData(context), - artifactFacet.getFacetDescription(), + artifactFacet, attr, visible, YAXIS.W.idx); } else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -189,11 +189,14 @@ ) { doAnnotations( (FLYSAnnotation) artifactFacet.getData(context), - artifactFacet.getFacet(), attr, visible); + artifactFacet, + attr, + visible); } else if (FacetTypes.IS.MANUALPOINTS(name)) { - doPoints(artifactFacet.getData(context), - artifactFacet.getFacetDescription(), + doPoints( + artifactFacet.getData(context), + artifactFacet, attr, visible, YAXIS.W.idx); } else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -160,6 +160,7 @@ ) { String name = artifactFacet.getFacetName(); logger.debug("HistoricalDischargeCurveGenerator.doOut: " + name); + logger.debug("Theme description is: " + artifactFacet.getFacetDescription()); if (name.equals(HISTORICAL_DISCHARGE_Q)) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -12,7 +12,6 @@ import org.w3c.dom.Document; - import de.intevation.artifactdatabase.state.ArtifactAndFacet; import de.intevation.artifactdatabase.state.Facet; @@ -336,44 +335,70 @@ } if (name.equals(LONGITUDINAL_W)) { - doWOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible); + doWOut( + (WQKms) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); } else if (name.equals(LONGITUDINAL_Q)) { - doQOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible); + doQOut( + (WQKms) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); } else if (name.equals(LONGITUDINAL_ANNOTATION)) { - doAnnotations((FLYSAnnotation) artifactAndFacet.getData(context), - facet, attr, visible); + doAnnotations( + (FLYSAnnotation) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); } else if (name.equals(STATIC_WKMS) || name.equals(HEIGHTMARKS_POINTS) || name.equals(STATIC_WQKMS)) { - doWOut((WKms) artifactAndFacet.getData(context), facet, attr, visible); + doWOut( + (WKms) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); } else if (name.equals(STATIC_WQKMS_W)) { - doWOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible); + doWOut( + (WQKms) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); } else if (name.equals(STATIC_WQKMS_Q)) { - doQOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible); + doQOut( + (WQKms) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); } else if (name.equals(W_DIFFERENCES)) { doWDifferencesOut( (WKms) artifactAndFacet.getData(context), - facet, + artifactAndFacet, attr, visible); } else if (FacetTypes.IS.AREA(name)) { - doArea(artifactAndFacet.getData(context), - artifactAndFacet.getFacetDescription(), + doArea( + artifactAndFacet.getData(context), + artifactAndFacet, attr, visible); - } else if (FacetTypes.IS.MANUALPOINTS(name)) { - doPoints(artifactAndFacet.getData(context), - artifactAndFacet.getFacetDescription(), - attr, visible, YAXIS.W.idx); + doPoints( + artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible, + YAXIS.W.idx); } else { logger.warn("Unknown facet name: " + name); @@ -393,14 +418,14 @@ * @param visible The visibility of the curve. */ protected void doWOut( - WKms wkms, - Facet facet, - Document theme, - boolean visible + WKms wkms, + ArtifactAndFacet aandf, + Document theme, + boolean visible ) { logger.debug("LongitudinalSectionGenerator.doWOut"); - XYSeries series = new StyledXYSeries(facet.getDescription(), theme); + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); StyledSeriesBuilder.addPoints(series, wkms); @@ -419,7 +444,7 @@ */ protected void doWDifferencesOut( WKms wkms, - Facet facet, + ArtifactAndFacet aandf, Document theme, boolean visible ) { @@ -429,7 +454,7 @@ return; } - XYSeries series = new StyledXYSeries(facet.getDescription(), theme); + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); if (logger.isDebugEnabled()) { if (wkms.size() > 0) { @@ -462,13 +487,13 @@ */ protected void doQOut( WQKms wqkms, - Facet facet, + ArtifactAndFacet aandf, Document theme, boolean visible ) { logger.debug("LongitudinalSectionGenerator.doQOut"); - XYSeries series = new StyledXYSeries(facet.getDescription(), theme); + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); StyledSeriesBuilder.addPointsKmQ(series, wqkms); @@ -544,13 +569,15 @@ */ protected void doArea( Object o, - String seriesName, + ArtifactAndFacet aandf, Document theme, boolean visible ) { logger.debug("LongitudinalSectionGenerator.doArea"); StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); + String seriesName = aandf.getFacetDescription(); + AreaFacet.Data data = (AreaFacet.Data) o; XYSeries up = null;
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/NormalizedReferenceCurveGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/NormalizedReferenceCurveGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -189,9 +189,11 @@ doReferenceOut(artifactFacet.getData(context), theme, visible); } else if (FacetTypes.IS.MANUALPOINTS(name)) { - doPoints(artifactFacet.getData(context), - artifactFacet.getFacetDescription(), - theme, visible, YAXIS.W_M.idx); + doPoints( + artifactFacet.getData(context), + artifactFacet, + theme, + visible, YAXIS.W_M.idx); } else { logger.warn("Unknown facet name: " + name);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -189,9 +189,12 @@ doReferenceOut(artifactFacet.getData(context), theme, visible); } else if (FacetTypes.IS.MANUALPOINTS(name)) { - doPoints(artifactFacet.getData(context), - artifactFacet.getFacetDescription(), - theme, visible, YAXIS.W_M.idx); + doPoints( + artifactFacet.getData(context), + artifactFacet, + theme, + visible, + YAXIS.W_M.idx); } else { logger.warn("Unknown facet name: " + name);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Thu Feb 09 15:48:13 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Thu Feb 09 15:59:49 2012 +0000 @@ -36,6 +36,7 @@ import org.jfree.ui.RectangleInsets; import org.jfree.ui.TextAnchor; +import de.intevation.artifactdatabase.state.ArtifactAndFacet; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.jfree.FLYSAnnotation; @@ -882,16 +883,17 @@ */ protected void doAnnotations( FLYSAnnotation annotations, - Facet facet, + ArtifactAndFacet aandf, Document theme, boolean visible ){ logger.debug("doAnnotations"); + Facet facet = aandf.getFacet(); // Add all annotations to our annotation pool. annotations.setTheme(theme); if (facet != null) - annotations.setLabel(facet.getDescription()); + annotations.setLabel(aandf.getFacetDescription()); addAnnotations(annotations, visible); } @@ -901,11 +903,12 @@ */ protected void doPoints( Object o, - String seriesName, + ArtifactAndFacet aandf, Document theme, boolean visible, int axisIndex ) { + String seriesName = aandf.getFacetDescription(); XYSeries series = new StyledXYSeries(seriesName, theme); // Add text annotations for single points.