comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 422:3b83341e0cf4

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
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 11 May 2011 16:31:38 +0000
parents a0afdda4d4b9
children 88d9e1d75d64
comparison
equal deleted inserted replaced
421:24b53f9aa9dc 422:3b83341e0cf4
4 4
5 import org.apache.log4j.Logger; 5 import org.apache.log4j.Logger;
6 6
7 import org.jfree.chart.JFreeChart; 7 import org.jfree.chart.JFreeChart;
8 import org.jfree.chart.axis.NumberAxis; 8 import org.jfree.chart.axis.NumberAxis;
9 import org.jfree.chart.axis.ValueAxis;
9 import org.jfree.chart.plot.XYPlot; 10 import org.jfree.chart.plot.XYPlot;
10 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; 11 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
11 import org.jfree.chart.title.TextTitle; 12 import org.jfree.chart.title.TextTitle;
12 import org.jfree.data.xy.XYSeries; 13 import org.jfree.data.xy.XYSeries;
13 import org.jfree.data.xy.XYSeriesCollection; 14 import org.jfree.data.xy.XYSeriesCollection;
14 15
15 import org.w3c.dom.Document; 16 import org.w3c.dom.Document;
16 17
17 import de.intevation.artifacts.Artifact; 18 import de.intevation.artifacts.Artifact;
18 19
20 import de.intevation.flys.model.River;
21
22 import de.intevation.flys.artifacts.FLYSArtifact;
19 import de.intevation.flys.artifacts.WINFOArtifact; 23 import de.intevation.flys.artifacts.WINFOArtifact;
20 import de.intevation.flys.artifacts.model.WQKms; 24 import de.intevation.flys.artifacts.model.WQKms;
21 25
22 26
23 /** 27 /**
148 NumberAxis qAxis = new NumberAxis( 152 NumberAxis qAxis = new NumberAxis(
149 msg(I18N_2YAXIS_LABEL, I18N_2YAXIS_LABEL_DEFAULT)); 153 msg(I18N_2YAXIS_LABEL, I18N_2YAXIS_LABEL_DEFAULT));
150 154
151 plot.setRangeAxis(2, qAxis); 155 plot.setRangeAxis(2, qAxis);
152 plot.mapDatasetToRangeAxis(1, 2); 156 plot.mapDatasetToRangeAxis(1, 2);
157
158 invertXAxis(plot.getDomainAxis());
159 }
160
161
162 /**
163 * This method inverts the x-axis based on the kilometer information of the
164 * selected river. If the head of the river is at kilometer 0, the axis is
165 * not inverted, otherwise it is.
166 *
167 * @param xaxis The domain axis.
168 */
169 protected void invertXAxis(ValueAxis xaxis) {
170 FLYSArtifact artifact = (FLYSArtifact) master;
171 River river = artifact.getRiver();
172
173 boolean up = river.getKmUp();
174
175 if (up) {
176 logger.info("Invert X-Axis.");
177 xaxis.setInverted(true);
178 }
153 } 179 }
154 180
155 181
156 public void doOut(Artifact artifact, String facet, Document attr) { 182 public void doOut(Artifact artifact, String facet, Document attr) {
157 logger.debug("LongitudinalSectionGenerator.doOut: " + facet); 183 logger.debug("LongitudinalSectionGenerator.doOut: " + facet);

http://dive4elements.wald.intevation.org