# HG changeset patch # User Andre Heinecke # Date 1387217390 -3600 # Node ID e47b1ea5baf4aecd9ac6b6d3b29a738c9ba2e6ca # Parent 9211f8cafe8a16ae874f6d4cdca0fc88e196e0e5 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge diff -r 9211f8cafe8a -r e47b1ea5baf4 artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java Mon Dec 16 19:08:39 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java Mon Dec 16 19:09:50 2013 +0100 @@ -27,6 +27,9 @@ import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; +import org.dive4elements.artifactdatabase.state.State; +import org.dive4elements.river.artifacts.GaugeDischargeCurveArtifact; + import org.apache.log4j.Logger; import org.jfree.chart.annotations.XYTextAnnotation; import org.jfree.chart.axis.ValueAxis; @@ -107,6 +110,20 @@ @Override protected void adjustAxes(XYPlot plot) { super.adjustAxes(plot); + // XXX Hacking around that there were two axes shown in official Gauge + // Discharge, the one from the WINFO module. + // This should be made unecessary in a Q Diagram refactoring with + // decent inheritance. + if (getMaster() instanceof GaugeDischargeCurveArtifact) { + GaugeDischargeCurveArtifact myMaster = + (GaugeDischargeCurveArtifact) getMaster(); + State state = myMaster.getCurrentState(context); + if (myMaster.STATIC_STATE_NAME.equals(state.getID())) { + return; + } + } + // End Hack + if (getCurrentGaugeDatum() != 0d) { // Show the W[*m] axis even if there is no data. plot.setRangeAxis(1, createYAxis(YAXIS.W.idx)); @@ -120,6 +137,11 @@ Bounds boundsInMGauge = getYBounds(YAXIS.W.idx); Bounds boundsInCM = getYBounds(YAXIS.WCm.idx); + if (boundsInMGauge == null || boundsInCM == null) { + // One axis does not exist. Nothing to sync + return; + } + // XXX Q-Symetry: I am assuming here that there can only // be a fixed Range for WinM as this is currently the only // thing that is configureable.