comparison flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java @ 4626:5b551e3a58d5

Add start and end km of current chart zoomlevel to the context and use these values to calculate the moving average.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 03 Dec 2012 17:10:08 +0100
parents 2e8638567c49
children d0b9b77fff9f
comparison
equal deleted inserted replaced
4625:d6d16b5ab2f0 4626:5b551e3a58d5
1 package de.intevation.flys.exports; 1 package de.intevation.flys.exports;
2
3 import java.util.Arrays;
2 4
3 import org.apache.log4j.Logger; 5 import org.apache.log4j.Logger;
4 6
5 import org.jfree.data.xy.XYSeries; 7 import org.jfree.data.xy.XYSeries;
6 8
9 import de.intevation.artifactdatabase.state.ArtifactAndFacet; 11 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
10 import de.intevation.artifactdatabase.state.Facet; 12 import de.intevation.artifactdatabase.state.Facet;
11 13
12 import de.intevation.flys.artifacts.FLYSArtifact; 14 import de.intevation.flys.artifacts.FLYSArtifact;
13 15
16 import de.intevation.flys.artifacts.access.FlowVelocityAccess;
14 import de.intevation.flys.artifacts.model.FacetTypes; 17 import de.intevation.flys.artifacts.model.FacetTypes;
15 import de.intevation.flys.artifacts.model.FlowVelocityData; 18 import de.intevation.flys.artifacts.model.FlowVelocityData;
16 import de.intevation.flys.model.FlowVelocityMeasurementValue; 19 import de.intevation.flys.model.FlowVelocityMeasurementValue;
17 20
21 import de.intevation.flys.jfree.Bounds;
22 import de.intevation.flys.jfree.DoubleBounds;
18 import de.intevation.flys.jfree.FLYSAnnotation; 23 import de.intevation.flys.jfree.FLYSAnnotation;
19 import de.intevation.flys.jfree.StyledXYSeries; 24 import de.intevation.flys.jfree.StyledXYSeries;
20 25
21 import de.intevation.flys.utils.FLYSUtils; 26 import de.intevation.flys.utils.FLYSUtils;
22 27
199 204
200 if (facet == null) { 205 if (facet == null) {
201 return; 206 return;
202 } 207 }
203 208
209 if (getXBounds(0) != null && getDomainAxisRange() != null) {
210 logger.debug(Arrays.toString(getDomainAxisRangeFromRequest()));
211 Bounds bounds =
212 calculateZoom(getXBounds(0), getDomainAxisRange());
213 context.putContextValue("startkm", bounds.getLower());
214 context.putContextValue("endkm", bounds.getUpper());
215 }
216 else if (getXBounds(0) != null && getDomainAxisRange() == null) {
217 context.putContextValue("startkm", getXBounds(0).getLower());
218 context.putContextValue("endkm", getXBounds(0).getUpper());
219 }
220 else if (getXBounds(0) == null && getDomainAxisRange() == null) {
221 FLYSArtifact artifact = (FLYSArtifact)artifactAndFacet.getArtifact();
222 FlowVelocityAccess access = new FlowVelocityAccess(artifact);
223 context.putContextValue("startkm", access.getLowerKM());
224 context.putContextValue("endkm", access.getUpperKM());
225 }
226 else if (getXBounds(0) == null && getDomainAxisRange() != null){
227 FLYSArtifact artifact = (FLYSArtifact)artifactAndFacet.getArtifact();
228 FlowVelocityAccess access = new FlowVelocityAccess(artifact);
229 Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM());
230 Bounds bounds =
231 calculateZoom(b, getDomainAxisRange());
232 context.putContextValue("startkm", bounds.getLower());
233 context.putContextValue("endkm", bounds.getUpper());
234 }
204 if (name.equals(FLOW_VELOCITY_MAINCHANNEL)) { 235 if (name.equals(FLOW_VELOCITY_MAINCHANNEL)) {
205 doMainChannelOut( 236 doMainChannelOut(
206 (FlowVelocityData) artifactAndFacet.getData(context), 237 (FlowVelocityData) artifactAndFacet.getData(context),
207 artifactAndFacet, 238 artifactAndFacet,
208 attr, 239 attr,

http://dive4elements.wald.intevation.org