# HG changeset patch # User Felix Wolfsteller # Date 1352453237 -3600 # Node ID b66285ece774da42b4e5d0036bdb6ae751750f49 # Parent 3395f8c6b030de439ede46a84bfb84dc960de3a4 For FlowV.-Artifacts, use given id, fetch data and display via facet and generator. diff -r 3395f8c6b030 -r b66285ece774 flys-artifacts/src/main/java/de/intevation/flys/artifacts/FlowVelocityMeasurementArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FlowVelocityMeasurementArtifact.java Fri Nov 09 10:25:41 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FlowVelocityMeasurementArtifact.java Fri Nov 09 10:27:17 2012 +0100 @@ -15,6 +15,7 @@ import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.flys.model.FlowVelocityMeasurement; +import de.intevation.flys.model.FlowVelocityMeasurementValue; import de.intevation.flys.artifacts.model.minfo.FlowVelocityMeasurementFacet; import de.intevation.flys.artifacts.model.minfo.FlowVelocityMeasurementFactory; import de.intevation.flys.artifacts.states.StaticState; @@ -48,6 +49,7 @@ /** One and only state to be in. */ protected transient State state = null; + protected String DATA_NAME = "ID"; /** * Trivial Constructor. @@ -106,15 +108,15 @@ if (code != null) { // parse code, interact with factory, add real facets. // store relevant parts of code as data. + Facet facet = new FlowVelocityMeasurementFacet( + FLOW_VELOCITY_MEASUREMENT, + "flowvelocity-name"); + + fs.add(facet); + facets.put(state.getID(), fs); + addStringData(DATA_NAME, code); } - Facet facet = new FlowVelocityMeasurementFacet( - FLOW_VELOCITY_MEASUREMENT, - "flowvelocity-name"); - - fs.add(facet); - facets.put(state.getID(), fs); - spawnState(); super.setup(identifier, factory, context, callMeta, data); } @@ -180,5 +182,15 @@ { logger.debug("initialize"); } + + + /** Get the db-unbound flow velocity measurement value with given + * id. */ + public FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue + getFlowVelocityMeasurementValue() + { + return FlowVelocityMeasurementFactory.getFlowVelocityMeasurement( + Integer.parseInt(getDataAsString(DATA_NAME))); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 3395f8c6b030 -r b66285ece774 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/FlowVelocityMeasurementFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/FlowVelocityMeasurementFacet.java Fri Nov 09 10:25:41 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/FlowVelocityMeasurementFacet.java Fri Nov 09 10:27:17 2012 +0100 @@ -36,8 +36,7 @@ public Object getData(Artifact artifact, CallContext context) { FlowVelocityMeasurementArtifact staticData = (FlowVelocityMeasurementArtifact) artifact; - //TODO: impl like return staticData.getVelocity(); - return null; + return staticData.getFlowVelocityMeasurementValue(); } diff -r 3395f8c6b030 -r b66285ece774 flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Fri Nov 09 10:25:41 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Fri Nov 09 10:27:17 2012 +0100 @@ -13,6 +13,7 @@ import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.FlowVelocityData; +import de.intevation.flys.model.FlowVelocityMeasurementValue; import de.intevation.flys.jfree.FLYSAnnotation; import de.intevation.flys.jfree.StyledXYSeries; @@ -274,6 +275,8 @@ addAxisSeries(series, YAXIS.V.idx, visible); } + + /** Handle VWQKms. */ protected void doVPointOut ( Object data, ArtifactAndFacet aandf, @@ -284,7 +287,11 @@ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); - StyledSeriesBuilder.addPoints(series, new double[][] {{10},{10}}, true); + FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue + value = (FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue) + data; + + StyledSeriesBuilder.addPoints(series, new double[][] {{value.getStation()},{value.getV()}}, true); addAxisSeries(series, YAXIS.V.idx, visible); }