# HG changeset patch # User Ingo Weinzierl # Date 1305131498 0 # Node ID 3b83341e0cf49d29981cbd1e95f3974935af29c1 # Parent 24b53f9aa9dc349b8c87a4a78c78dc5a3d20472a ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side. flys-artifacts/trunk@1904 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 24b53f9aa9dc -r 3b83341e0cf4 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed May 11 09:51:54 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed May 11 16:31:38 2011 +0000 @@ -1,3 +1,12 @@ +2011-05-11 Ingo Weinzierl + + ISSUE-52 + + * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java: + The X-Axis of such a chart is inverted, if the head of the river is not + at kilometer 0. This type of charts always have the head of the river at + the left side. + 2011-05-10 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java: diff -r 24b53f9aa9dc -r 3b83341e0cf4 flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Wed May 11 09:51:54 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Wed May 11 16:31:38 2011 +0000 @@ -6,6 +6,7 @@ import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.chart.title.TextTitle; @@ -16,6 +17,9 @@ import de.intevation.artifacts.Artifact; +import de.intevation.flys.model.River; + +import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.model.WQKms; @@ -150,6 +154,28 @@ plot.setRangeAxis(2, qAxis); plot.mapDatasetToRangeAxis(1, 2); + + invertXAxis(plot.getDomainAxis()); + } + + + /** + * This method inverts the x-axis based on the kilometer information of the + * selected river. If the head of the river is at kilometer 0, the axis is + * not inverted, otherwise it is. + * + * @param xaxis The domain axis. + */ + protected void invertXAxis(ValueAxis xaxis) { + FLYSArtifact artifact = (FLYSArtifact) master; + River river = artifact.getRiver(); + + boolean up = river.getKmUp(); + + if (up) { + logger.info("Invert X-Axis."); + xaxis.setInverted(true); + } }