comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixLongitudinalSectionGenerator.java @ 7081:3c4efd4b2c19 generator-refactoring

Simplyfy / unify "invert axis" logic - DataUtil now can check if two datasets are in the same direction - In the case of WKM data a no means that the Water flows Right to Left - If the water flows from right to left do inversion of diagrams
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 20 Sep 2013 17:36:11 +0200
parents e0311aa32efb
children 41567bf1e131
comparison
equal deleted inserted replaced
7080:02a704a37323 7081:3c4efd4b2c19
145 145
146 StyledSeriesBuilder.addStepPointsKmQ(series, wqkms); 146 StyledSeriesBuilder.addStepPointsKmQ(series, wqkms);
147 147
148 addAxisSeries(series, YAXIS.Q.idx, visible); 148 addAxisSeries(series, YAXIS.Q.idx, visible);
149 149
150 if (needInvertAxis(wqkms)) { 150 setInverted(wqkms.guessRTLData());
151 setInverted(true);
152 }
153 }
154
155 /**
156 * This method determines - taking JFreeCharts auto x value ordering into
157 * account - if the x axis need to be inverted. Waterlines in these charts
158 * should decrease.
159 *
160 * @param wkms The data object that stores the x and y values used for this
161 * chart.
162 */
163 public boolean needInvertAxis(WKms wkms) {
164 boolean wsUp = wkms.guessWaterIncreasing();
165 boolean kmUp = DataUtil.guessWaterIncreasing(wkms.allKms());
166 boolean inv = (wsUp && kmUp) || (!wsUp && !kmUp);
167
168 int size = wkms.size();
169
170 if (logger.isDebugEnabled()) {
171 logger.debug("(Wkms)Values : " + size);
172 if (size > 0) {
173 logger.debug("Start km: " + wkms.getKm(0));
174 logger.debug("End km: " + wkms.getKm(size-1));
175 }
176 logger.debug("wsUp: " + wsUp);
177 logger.debug("kmUp: " + kmUp);
178 logger.debug("inv: " + inv);
179 }
180
181 return inv;
182 } 151 }
183 152
184 @SuppressWarnings("unchecked") 153 @SuppressWarnings("unchecked")
185 protected void doSectorAverageDeviationOut( 154 protected void doSectorAverageDeviationOut(
186 ArtifactAndFacet aaf, 155 ArtifactAndFacet aaf,

http://dive4elements.wald.intevation.org