# HG changeset patch # User Raimund Renkert # Date 1355410558 -3600 # Node ID d0b9b77fff9faa8e86e1a6cfa72396682a9e2a9b # Parent 87c938d082d6c78701444675dafbdd8f00f9eee2 Generate new facets to have raw and filtered data in flow velocity chart. diff -r 87c938d082d6 -r d0b9b77fff9f flys-artifacts/doc/conf/artifacts/minfo.xml --- a/flys-artifacts/doc/conf/artifacts/minfo.xml Thu Dec 13 15:54:49 2012 +0100 +++ b/flys-artifacts/doc/conf/artifacts/minfo.xml Thu Dec 13 15:55:58 2012 +0100 @@ -145,6 +145,9 @@ + + + diff -r 87c938d082d6 -r d0b9b77fff9f flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Thu Dec 13 15:54:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Thu Dec 13 15:55:58 2012 +0100 @@ -6,7 +6,9 @@ import org.apache.log4j.Logger; import de.intevation.artifactdatabase.state.Facet; +import de.intevation.artifactdatabase.state.FacetActivity; +import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.flys.artifacts.FLYSArtifact; @@ -17,6 +19,7 @@ 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.model.FlowVelocityFilterFacet; import de.intevation.flys.artifacts.resources.Resources; @@ -34,6 +37,15 @@ public static final String I18N_TAU_FACET = "facet.flow_velocity.tauchannel"; + public static final String I18N_MAINCHANNEL_FACET_RAW = + "facet.flow_velocity.mainchannel.raw"; + + public static final String I18N_TOTALCHANNEL_FACET_RAW = + "facet.flow_velocity.totalchannel.raw"; + + public static final String I18N_TAU_FACET_RAW = + "facet.flow_velocity.tauchannel.raw"; + public static final String I18N_DISCHARGE_FACET = "facet.flow_velocity.discharge"; @@ -72,7 +84,7 @@ newFacets.add(new FlowVelocityFacet( idx, FLOW_VELOCITY_MAINCHANNEL, - buildMainChannelName(artifact, context, d), + buildFacetName(artifact, context, d, I18N_MAINCHANNEL_FACET_RAW), ComputeType.ADVANCE, id, hash @@ -81,6 +93,22 @@ newFacets.add(new FlowVelocityFacet( idx, FLOW_VELOCITY_TAU, + buildFacetName(artifact, context, d, I18N_TAU_FACET_RAW), + ComputeType.ADVANCE, + id, + hash + )); + newFacets.add(new FlowVelocityFilterFacet( + idx, + FLOW_VELOCITY_MAINCHANNEL_FILTERED, + buildMainChannelName(artifact, context, d), + ComputeType.ADVANCE, + id, + hash + )); + newFacets.add(new FlowVelocityFilterFacet( + idx, + FLOW_VELOCITY_TAU_FILTERED, buildTauName(artifact, context, d), ComputeType.ADVANCE, id, @@ -91,17 +119,26 @@ newFacets.add(new FlowVelocityFacet( idx, FLOW_VELOCITY_TOTALCHANNEL, + buildFacetName(artifact, context, d, I18N_TOTALCHANNEL_FACET_RAW), + ComputeType.ADVANCE, + id, + hash + )); + newFacets.add(new FlowVelocityFilterFacet( + idx, + FLOW_VELOCITY_TOTALCHANNEL_FILTERED, buildTotalChannelName(artifact, context, d), ComputeType.ADVANCE, id, hash )); + } else if(d.getType().equals("main_total")) { newFacets.add(new FlowVelocityFacet( idx, FLOW_VELOCITY_MAINCHANNEL, - buildMainChannelName(artifact, context, d), + buildFacetName(artifact, context, d, I18N_MAINCHANNEL_FACET_RAW), ComputeType.ADVANCE, id, hash @@ -109,7 +146,7 @@ newFacets.add(new FlowVelocityFacet( idx, FLOW_VELOCITY_TAU, - buildTauName(artifact, context, d), + buildFacetName(artifact, context, d, I18N_TAU_FACET_RAW), ComputeType.ADVANCE, id, hash @@ -117,6 +154,30 @@ newFacets.add(new FlowVelocityFacet( idx, FLOW_VELOCITY_TOTALCHANNEL, + buildFacetName(artifact, context, d, I18N_TOTALCHANNEL_FACET_RAW), + ComputeType.ADVANCE, + id, + hash + )); + newFacets.add(new FlowVelocityFilterFacet( + idx, + FLOW_VELOCITY_MAINCHANNEL_FILTERED, + buildMainChannelName(artifact, context, d), + ComputeType.ADVANCE, + id, + hash + )); + newFacets.add(new FlowVelocityFilterFacet( + idx, + FLOW_VELOCITY_TAU_FILTERED, + buildTauName(artifact, context, d), + ComputeType.ADVANCE, + id, + hash + )); + newFacets.add(new FlowVelocityFilterFacet( + idx, + FLOW_VELOCITY_TOTALCHANNEL_FILTERED, buildTotalChannelName(artifact, context, d), ComputeType.ADVANCE, id, @@ -202,5 +263,29 @@ ) { return buildFacetName(flys, cc, data, I18N_TAU_FACET); } + + static { + // Active/deactivate facets. + FacetActivity.Registry.getInstance().register( + "minfo", + new FacetActivity() { + @Override + public Boolean isInitialActive( + Artifact artifact, + Facet facet, + String output + ) { + String name = facet.getName(); + if (name.equals(FLOW_VELOCITY_MAINCHANNEL) || + name.equals(FLOW_VELOCITY_TAU) || + name.equals(FLOW_VELOCITY_TOTALCHANNEL)) { + return Boolean.FALSE; + } + else { + return Boolean.TRUE; + } + } + }); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 87c938d082d6 -r d0b9b77fff9f flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Thu Dec 13 15:54:49 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Thu Dec 13 15:55:58 2012 +0100 @@ -246,6 +246,20 @@ attr, visible); } + else if (name.equals(FLOW_VELOCITY_MAINCHANNEL_FILTERED)) { + doMainChannelOut( + (FlowVelocityData) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); + } + else if (name.equals(FLOW_VELOCITY_TOTALCHANNEL_FILTERED)) { + doTotalChannelOut( + (FlowVelocityData) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); + } else if (name.equals(FLOW_VELOCITY_DISCHARGE)) { doQOut( (FlowVelocityData) artifactAndFacet.getData(context), @@ -260,6 +274,14 @@ attr, visible); } + else if (name.equals(FLOW_VELOCITY_TAU_FILTERED)) { + doTauOut( + (FlowVelocityData) artifactAndFacet.getData(context), + artifactAndFacet, + attr, + visible); + } + else if (name.equals(FLOW_VELOCITY_ANNOTATION)) { doAnnotations( (FLYSAnnotation) artifactAndFacet.getData(context),