Mercurial > dive4elements > river
changeset 7162:4683bdf77ff9
Handle flow velocity measurements in the FlowVelocity processor
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 26 Sep 2013 10:38:21 +0200 |
parents | b7b839557282 |
children | 704a33c0f5a2 |
files | artifacts/src/main/java/org/dive4elements/river/exports/process/FlowVelocityProcessor.java |
diffstat | 1 files changed, 16 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FlowVelocityProcessor.java Thu Sep 26 10:37:24 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FlowVelocityProcessor.java Thu Sep 26 10:38:21 2013 +0200 @@ -18,6 +18,7 @@ import org.dive4elements.river.exports.StyledSeriesBuilder; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.themes.ThemeDocument; +import org.dive4elements.river.model.FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue; import org.dive4elements.river.artifacts.model.FlowVelocityData; @@ -40,21 +41,28 @@ CallContext context = generator.getCallContext(); XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); - FlowVelocityData data = (FlowVelocityData) bundle.getData(context); + String facetName = bundle.getFacetName(); + Object data = bundle.getData(context); if (data == null) { - /* Check was there in the old generator */ - logger.error("Flow velocity data is null. Bad facet."); + // Check has been here before so we keep it for security reasons + // this should never happen though. + logger.error("Data is null for facet: " + facetName); return; } - String facetName = bundle.getFacetName(); double [][] points; if (facetName.equals(FacetTypes.FLOW_VELOCITY_TOTALCHANNEL) || facetName.equals(FacetTypes.FLOW_VELOCITY_TOTALCHANNEL_FILTERED)) { - points = data.getTotalChannelPoints(); + FlowVelocityData fData = (FlowVelocityData) data; + points = fData.getTotalChannelPoints(); } else if (facetName.equals(FacetTypes.FLOW_VELOCITY_MAINCHANNEL) || facetName.equals(FacetTypes.FLOW_VELOCITY_MAINCHANNEL_FILTERED)) { - points = data.getMainChannelPoints(); // I hate facets! + FlowVelocityData fData = (FlowVelocityData) data; + points = fData.getMainChannelPoints(); // I hate facets! + } else if (facetName.equals(FacetTypes.FLOW_VELOCITY_MEASUREMENT)) { + FastFlowVelocityMeasurementValue fData = + (FastFlowVelocityMeasurementValue) data; + points = new double[][] {{fData.getStation()},{fData.getV()}}; } else { logger.error("Unknown facet name: " + facetName); return; @@ -69,7 +77,8 @@ return facettype.equals(FacetTypes.FLOW_VELOCITY_MAINCHANNEL_FILTERED) || facettype.equals(FacetTypes.FLOW_VELOCITY_MAINCHANNEL) || facettype.equals(FacetTypes.FLOW_VELOCITY_TOTALCHANNEL_FILTERED) || - facettype.equals(FacetTypes.FLOW_VELOCITY_TOTALCHANNEL); + facettype.equals(FacetTypes.FLOW_VELOCITY_TOTALCHANNEL) || + facettype.equals(FacetTypes.FLOW_VELOCITY_MEASUREMENT); } @Override