Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java @ 2706:d8444fcb4e44
Create chart facets for flow velocity calculation and a chart generator for this.
flys-artifacts/trunk@4424 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 16 May 2012 12:39:13 +0000 |
parents | 4c00cf83fff1 |
children | b888c5eb65b3 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Wed May 16 10:52:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Wed May 16 12:39:13 2012 +0000 @@ -16,6 +16,8 @@ import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.FlowVelocityCalculation; import de.intevation.flys.artifacts.model.FlowVelocityData; +import de.intevation.flys.artifacts.model.FlowVelocityFacet; +import de.intevation.flys.artifacts.resources.Resources; public class FlowVelocityState extends DefaultState implements FacetTypes { @@ -23,6 +25,16 @@ private static Logger logger = Logger.getLogger(FlowVelocityState.class); + public static final String I18N_MAINCHANNEL_FACET = + "facet.flow_velocity.mainchannel"; + + public static final String I18N_TOTALCHANNEL_FACET = + "facet.flow_velocity.totalchannel"; + + public static final String I18N_TAU_FACET = + "facet.flow_velocity.tauchannel"; + + @Override public Object computeAdvance( FLYSArtifact artifact, @@ -47,11 +59,40 @@ logger.debug("Calculated " + data.length + " FlowVelocityData objects"); - String id = getID(); + String id = getID(); + int idx = 0; for (FlowVelocityData d: data) { logger.error("TODO: Implement Facet creation for chart!"); + newFacets.add(new FlowVelocityFacet( + idx, + FLOW_VELOCITY_MAINCHANNEL, + buildMainChannelName(artifact, context, d), + ComputeType.ADVANCE, + id, + hash + )); + + newFacets.add(new FlowVelocityFacet( + idx, + FLOW_VELOCITY_TOTALCHANNEL, + buildTotalChannelName(artifact, context, d), + ComputeType.ADVANCE, + id, + hash + )); + + newFacets.add(new FlowVelocityFacet( + idx, + FLOW_VELOCITY_TAU, + buildTauName(artifact, context, d), + ComputeType.ADVANCE, + id, + hash + )); + + idx++; } Facet csv = new DataFacet( @@ -67,5 +108,50 @@ return res; } + + + protected String buildFacetName( + FLYSArtifact flys, + CallContext cc, + FlowVelocityData data, + String resourceId + ) { + Object[] args = new Object[] { + data.getZone() + }; + + return Resources.getMsg( + cc.getMeta(), + resourceId, + resourceId, + args); + } + + + protected String buildMainChannelName( + FLYSArtifact flys, + CallContext cc, + FlowVelocityData data + ) { + return buildFacetName(flys, cc, data, I18N_MAINCHANNEL_FACET); + } + + + protected String buildTotalChannelName( + FLYSArtifact flys, + CallContext cc, + FlowVelocityData data + ) { + return buildFacetName(flys, cc, data, I18N_TOTALCHANNEL_FACET); + } + + + protected String buildTauName( + FLYSArtifact flys, + CallContext cc, + FlowVelocityData data + ) { + return buildFacetName(flys, cc, data, I18N_TAU_FACET); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :