[Dive4elements-commits] [PATCH 1 of 3] Added bed quality facets to flow velocity datacage
Wald Commits
scm-commit at wald.intevation.org
Thu Apr 4 10:58:23 CEST 2013
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1365065746 -7200
# Node ID 38acd82feeac0528417da02b935e9430872a0df3
# Parent 12f4d088f088db2c3be7ced7ab28e4434f05d4c6
Added bed quality facets to flow velocity datacage.
* Added facets in artifact config.
* Added datacage config for bedquality facets.
* Added ouput methods for bedquality facets to generator.
diff -r 12f4d088f088 -r 38acd82feeac flys-artifacts/doc/conf/artifacts/minfo.xml
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml Wed Apr 03 23:16:11 2013 +0200
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml Thu Apr 04 10:55:46 2013 +0200
@@ -154,6 +154,9 @@
<facet name="flow_velocity.measurement" description="A facet for measured flow velocities"/>
<facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
<facet name="flow_velocity.manualpoints"/>
+ <facet name="bed_longitudinal_section.bed_diameter_toplayer"/>
+ <facet name="bed_longitudinal_section.bed_diameter_sublayer"/>
+ <facet name="bed_longitudinal_section.bedload_diameter"/>
</facets>
</outputmode>
<outputmode name="flow_velocity_export" description="output.flow_velocity_export" mime-type="text/plain" type="export">
diff -r 12f4d088f088 -r 38acd82feeac flys-artifacts/doc/conf/meta-data.xml
--- a/flys-artifacts/doc/conf/meta-data.xml Wed Apr 03 23:16:11 2013 +0200
+++ b/flys-artifacts/doc/conf/meta-data.xml Thu Apr 04 10:55:46 2013 +0200
@@ -2477,6 +2477,78 @@
</dc:context>
</dc:macro>
+ <dc:macro name="bedquality-bed">
+ <bed_quality_bed>
+ <dc:for-each>
+ <dc:context>
+ <dc:call-macro name="range-filter">
+ <dc:context>
+ <dc:statement>
+ SELECT a.gid AS aid,
+ f.id AS fid,
+ f.name AS facet_name,
+ f.num AS facet_num,
+ f.description AS facet_description
+ FROM outs AS o, facets AS f, artifacts AS a
+ WHERE
+ (f.name = 'bed_longitudinal_section.bed_diameter_toplayer'
+ OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND
+ f.out_id = o.id AND
+ o.artifact_id = ${a_id} AND
+ a.id = ${a_id}
+ </dc:statement>
+ <dc:for-each>
+ <dc:element name="${facet_name}">
+ <dc:attribute name="factory" value="minfo"/>
+ <dc:attribute name="description" value="${facet_description}"/>
+ <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+ <dc:attribute name="artifact-id" value="${aid}"/>
+ <dc:attribute name="out" value="bed_longitudinal_section"/>
+ </dc:element>
+ </dc:for-each>
+ </dc:context>
+ </dc:call-macro>
+ </dc:context>
+ </dc:for-each>
+ </bed_quality_bed>
+ </dc:macro>
+
+ <dc:macro name="bedquality-load">
+ <bed_quality_load>
+ <dc:for-each>
+ <dc:context>
+ <dc:call-macro name="range-filter">
+ <dc:context>
+ <dc:statement>
+ SELECT a.gid AS aid,
+ f.id AS fid,
+ f.name AS facet_name,
+ f.num AS facet_num,
+ f.description AS facet_description
+ FROM outs AS o, facets AS f, artifacts AS a
+ WHERE
+ f.name = 'bed_longitudinal_section.bedload_diameter' AND
+ f.out_id = o.id AND
+ o.artifact_id = ${a_id} AND
+ a.id = ${a_id}
+ </dc:statement>
+ <dc:for-each>
+ <dc:element name="${facet_name}">
+ <dc:attribute name="factory" value="minfo"/>
+ <dc:attribute name="description" value="${facet_description}"/>
+ <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+ <dc:attribute name="artifact-id" value="${aid}"/>
+ <dc:attribute name="out" value="bed_longitudinal_section"/>
+ </dc:element>
+ </dc:for-each>
+ </dc:context>
+ </dc:call-macro>
+ </dc:context>
+ </dc:for-each>
+ </bed_quality_load>
+ </dc:macro>
+
+
<dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
<dc:call-macro name="longitudinal"/>
</dc:if>
@@ -2522,6 +2594,12 @@
<dc:if test="dc:contains($artifact-outs, 'floodmap-hws')">
<dc:call-macro name="floodmap-hws-user"/>
</dc:if>
+ <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
+ <dc:call-macro name="bedquality-bed"/>
+ </dc:if>
+ <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
+ <dc:call-macro name="bedquality-load"/>
+ </dc:if>
</dc:context>
</dc:call-macro>
diff -r 12f4d088f088 -r 38acd82feeac flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Wed Apr 03 23:16:11 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Thu Apr 04 10:55:46 2013 +0200
@@ -16,6 +16,8 @@
import de.intevation.flys.artifacts.access.FlowVelocityAccess;
import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.FlowVelocityData;
+import de.intevation.flys.artifacts.model.minfo.BedDiameterResult;
+import de.intevation.flys.artifacts.model.minfo.BedloadDiameterResult;
import de.intevation.flys.model.FlowVelocityMeasurementValue;
import de.intevation.flys.jfree.Bounds;
@@ -38,7 +40,8 @@
public enum YAXIS {
V(0),
T(1),
- Q(2);
+ Q(2),
+ D(3);
/* TODO Q and Density will come as 4th and 3rd axis. */
protected int idx;
private YAXIS(int c) {
@@ -85,13 +88,14 @@
public static final String I18N_3YAXIS_LABEL =
"chart.flow_velocity.section.yaxis.third.label";
+ public static final String I18N_4YAXIS_LABEL = "chart.bedquality.yaxis.label.diameter";
public static final String I18N_CHART_TITLE_DEFAULT = "Geschwindigkeit- und Schubspannung";
public static final String I18N_XAXIS_LABEL_DEFAULT = "km";
public static final String I18N_YAXIS_LABEL_DEFAULT = "Geschwindigkeit v [m/s]";
public static final String I18N_2YAXIS_LABEL_DEFAULT = "Schubspannung Tau [N]";
public static final String I18N_3YAXIS_LABEL_DEFAULT = "Q [m³/s]";
-
+ public static final String I18N_4YAXIS_LABEL_DEFAULT = "Durchmesser [mm]";
@Override
protected YAxisWalker getYAxisWalker() {
@@ -152,6 +156,9 @@
else if (index == YAXIS.Q.idx) {
label = getQAxisLabel();
}
+ else if (index == YAXIS.D.idx) {
+ label = getDAxisLabel();
+ }
return label;
}
@@ -179,6 +186,12 @@
return msg(I18N_2YAXIS_LABEL, I18N_2YAXIS_LABEL_DEFAULT);
}
+ /**
+ * Get internationalized label for the y axis.
+ */
+ protected String getDAxisLabel() {
+ return msg(I18N_4YAXIS_LABEL, I18N_4YAXIS_LABEL_DEFAULT);
+ }
/**
* Produce output.
@@ -318,6 +331,27 @@
attr,
visible);
}
+ else if (name.equals(BED_QUALITY_BED_DIAMETER_SUBLAYER)) {
+ doBedQualitySubLayerOut(
+ (BedDiameterResult)artifactAndFacet.getData(context),
+ artifactAndFacet,
+ attr,
+ visible);
+ }
+ else if (name.equals(BED_QUALITY_BED_DIAMETER_TOPLAYER)) {
+ doBedQualityTopLayerOut(
+ (BedDiameterResult)artifactAndFacet.getData(context),
+ artifactAndFacet,
+ attr,
+ visible);
+ }
+ else if (name.equals(BED_QUALITY_BEDLOAD_DIAMETER)) {
+ doBedQualityLoadDiameter(
+ (BedloadDiameterResult)artifactAndFacet.getData(context),
+ artifactAndFacet,
+ attr,
+ visible);
+ }
else {
logger.warn("Unknown facet name: " + name);
return;
@@ -325,6 +359,42 @@
}
+ private void doBedQualityLoadDiameter(
+ BedloadDiameterResult data,
+ ArtifactAndFacet aandf,
+ Document attr,
+ boolean visible) {
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), attr);
+ StyledSeriesBuilder.addPoints(series, data.getDiameterData(), true);
+
+ addAxisSeries(series, YAXIS.D.idx, visible);
+ }
+
+
+ private void doBedQualityTopLayerOut(
+ BedDiameterResult data,
+ ArtifactAndFacet aandf,
+ Document attr,
+ boolean visible) {
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), attr);
+ StyledSeriesBuilder.addPoints(series, data.getDiameterSubData(), true);
+ addAxisSeries(series, YAXIS.D.idx, visible);
+ }
+
+
+ private void doBedQualitySubLayerOut(
+ BedDiameterResult data,
+ ArtifactAndFacet aandf,
+ Document attr,
+ boolean visible
+ ) {
+ logger.debug("Do beddiametersubout");
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), attr);
+ StyledSeriesBuilder.addPoints(series, data.getDiameterSubData(), true);
+ addAxisSeries(series, YAXIS.D.idx, visible);
+ }
+
+
/**
* Process the output for W facets in a longitudinal section curve.
*
More information about the Dive4elements-commits
mailing list