Mercurial > dive4elements > river
changeset 4464:b66285ece774
For FlowV.-Artifacts, use given id, fetch data and display via facet and generator.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 09 Nov 2012 10:27:17 +0100 |
parents | 3395f8c6b030 |
children | ffed8687e2b1 |
files | flys-artifacts/src/main/java/de/intevation/flys/artifacts/FlowVelocityMeasurementArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/FlowVelocityMeasurementFacet.java flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java |
diffstat | 3 files changed, 28 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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 :
--- 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(); }
--- 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); }