[PATCH] Added new processor for fix derived curve
Wald Commits
scm-commit at wald.intevation.org
Fri Sep 5 16:54:54 CEST 2014
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1409928885 -7200
# Node ID de280599dd2fb2f45d82fadbaf7fcb9ee1c09f8a
# Parent 436512d9bd943318e1cdcefee78b5e7f659c315b
Added new processor for fix derived curve.
diff -r 436512d9bd94 -r de280599dd2f artifacts/doc/conf/generators/discharge-diagram-defaults.xml
--- a/artifacts/doc/conf/generators/discharge-diagram-defaults.xml Fri Sep 05 15:57:39 2014 +0200
+++ b/artifacts/doc/conf/generators/discharge-diagram-defaults.xml Fri Sep 05 16:54:45 2014 +0200
@@ -11,4 +11,5 @@
<processor class="org.dive4elements.river.exports.process.ComputedDischargeProcessor" axis="W"/>
<processor class="org.dive4elements.river.exports.process.HistoricalDischargeProcessor" axis="W"/>
<processor class="org.dive4elements.river.exports.process.FixWQProcessor" axis="W"/>
+ <processor class="org.dive4elements.river.exports.process.FixDerivedProcessor" axis="W"/>
</discharge-defaults>
diff -r 436512d9bd94 -r de280599dd2f artifacts/src/main/java/org/dive4elements/river/exports/process/FixDerivedProcessor.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixDerivedProcessor.java Fri Sep 05 16:54:45 2014 +0200
@@ -0,0 +1,58 @@
+package org.dive4elements.river.exports.process;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.model.fixings.FixDerivateFacet;
+import org.dive4elements.river.artifacts.model.fixings.FixFunction;
+import org.dive4elements.river.exports.DiagramGenerator;
+import org.dive4elements.river.jfree.JFreeUtil;
+import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.themes.ThemeDocument;
+
+
+public class FixDerivedProcessor
+extends DefaultProcessor
+implements FacetTypes
+{
+
+ private static Logger log = Logger.getLogger(FixDerivedProcessor.class);
+
+ public FixDerivedProcessor() {
+ }
+
+ @Override
+ public void doOut(
+ DiagramGenerator generator,
+ ArtifactAndFacet bundle,
+ ThemeDocument theme,
+ boolean visible
+ ) {
+ FixDerivateFacet facet = (FixDerivateFacet)bundle.getFacet();
+ FixFunction func = (FixFunction)facet.getData(
+ bundle.getArtifact(), generator.getCallContext());
+
+ if (func == null) {
+ log.warn("doOut: Facet does not contain FixFunction");
+ return;
+ }
+
+ double maxQ = func.getMaxQ();
+
+ if (maxQ > 0) {
+ StyledXYSeries series = JFreeUtil.sampleFunction2D(
+ func.getFunction(),
+ theme,
+ bundle.getFacetDescription(),
+ 500, // number of samples
+ 0.0 , // start
+ maxQ); // end
+ generator.addAxisSeries(series, axisName, visible);
+ }
+ }
+
+ @Override
+ public boolean canHandle(String facettype) {
+ return FIX_DERIVATE_CURVE.equals(facettype);
+ }
+}
More information about the Dive4Elements-commits
mailing list