[Dive4elements-commits] [PATCH 2 of 2] Merged
Wald Commits
scm-commit at wald.intevation.org
Tue Nov 13 16:14:51 CET 2012
# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1352819684 -3600
# Node ID b5624ef2808f5ccc3333d379eddc5d65236fe16d
# Parent d9e3660fa46258289d93967e23f150b32c7b0645
# Parent 14885031d97465138a90629a467c5b55d78056de
Merged
diff -r d9e3660fa462 -r b5624ef2808f flys-artifacts/doc/conf/artifacts/winfo.xml
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml Tue Nov 13 16:14:44 2012 +0100
@@ -632,6 +632,17 @@
<facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
</facets>
</outputmode>
+ <outputmode name="cross_section" description="output.cross_section" mime-type="image/png" type="chart">
+ <facets>
+ <facet name="cross_section_water_line" description="facet.cross_section_water_line"/>
+ <facet name="cross_section" description="facet.cross_section"/>
+ <facet name="area" description="an area"/>
+ <facet name="cross_section.area" description="an area"/>
+ <facet name="cross_section.manualpoints" description="points"/>
+ <facet name="cross_section.manualline" description="line"/>
+ <facet name="hyk" description="hyks"/>
+ </facets>
+ </outputmode>
<outputmode name="extreme_wq_curve" description="output.extreme_wq_curve" mine-type="image/png" type="chart">
<facets>
<facet name="extreme_wq_curve" description="Extreme WQ curve"/>
diff -r d9e3660fa462 -r b5624ef2808f flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java Tue Nov 13 16:14:44 2012 +0100
@@ -12,6 +12,7 @@
import de.intevation.artifactdatabase.state.Facet;
import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallContext;
import de.intevation.artifacts.CallMeta;
import de.intevation.flys.artifacts.geom.Lines;
import de.intevation.flys.artifacts.model.FacetTypes;
@@ -128,12 +129,14 @@
* @param csl 'ground' against which to determine water surface.
* @param a (ignored in this implementation).
* @param b (ignored in this implementation).
+ * @param context (ignored in this implementation).
*/
@Override
public Lines.LineData getWaterLines(
int index,
FastCrossSectionLine csl,
- double a, double b
+ double a, double b,
+ CallContext context
) {
List<Point2D> points = csl.getPoints();
return Lines.createWaterLines(points, getLine(index));
diff -r d9e3660fa462 -r b5624ef2808f flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java Tue Nov 13 16:14:44 2012 +0100
@@ -7,6 +7,7 @@
import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallContext;
import de.intevation.artifacts.CallMeta;
import de.intevation.artifacts.common.utils.XMLUtils;
@@ -386,13 +387,14 @@
* @param csl FastCrossSectionLine to compute water surface agains.
* @param next The km of the next crosssectionline.
* @param prev The km of the previous crosssectionline.
+ * @param context Ignored in this implementation.
*
* @return an array holding coordinates of points of surface of water (
* in the form {{x1, x2}, {y1, y2}} ).
*/
@Override
public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl,
- double next, double prev
+ double next, double prev, CallContext context
) {
logger.debug("getWaterLines(" + idx + ")/" + identifier());
diff -r d9e3660fa462 -r b5624ef2808f flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Tue Nov 13 16:14:44 2012 +0100
@@ -28,7 +28,9 @@
import de.intevation.flys.artifacts.model.WW;
import de.intevation.flys.artifacts.model.WstValueTable;
import de.intevation.flys.artifacts.model.WstValueTableFactory;
+import de.intevation.flys.artifacts.model.extreme.ExtremeResult;
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
import de.intevation.flys.artifacts.states.LocationDistanceSelect;
import de.intevation.flys.model.DischargeTable;
@@ -157,21 +159,34 @@
//
// METHODS FOR RETRIEVING COMPUTED DATA FOR DIFFERENT CHART TYPES
//
+ //
+ /**
+ * Returns the data that is computed by a waterlevel computation.
+ *
+ * @return an array of data triples that consist of W, Q and Kms.
+ */
+ public CalculationResult getWaterlevelData() {
+ return this.getWaterlevelData(null);
+ }
/**
* Returns the data that is computed by a waterlevel computation.
*
* @return an array of data triples that consist of W, Q and Kms.
*/
- public CalculationResult getWaterlevelData()
+ public CalculationResult getWaterlevelData(CallContext context)
{
logger.debug("WINFOArtifact.getWaterlevelData");
- if (getDataAsString("calculation_mode")
- .equals("calc.discharge.longitudinal.section")
+ String calculationMode = getDataAsString("calculation_mode");
+
+ if (calculationMode.equals("calc.discharge.longitudinal.section")
) {
return getDischargeLongitudinalSectionData();
}
+ else if (calculationMode.equals("calc.extreme.curve")) {
+ return (CalculationResult) this.compute(context, ComputeType.ADVANCE, false);
+ }
River river = FLYSUtils.getRiver(this);
if (river == null) {
@@ -625,13 +640,22 @@
*/
@Override
public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl,
- double nextIgnored, double prevIgnored) {
+ double nextIgnored, double prevIgnored, CallContext context) {
logger.debug("getWaterLines(" + idx + ")");
List<Point2D> points = csl.getPoints();
// Need W at km
- WQKms [] wqkms = (WQKms[]) getWaterlevelData().getData();
+ Object waterlevelResult = getWaterlevelData(context).getData();
+ WQKms [] wqkms;
+
+ if (waterlevelResult instanceof ExtremeResult) {
+ wqkms = ((ExtremeResult) waterlevelResult).getWQKms();
+ }
+ else {
+ wqkms = (WQKms[]) waterlevelResult;
+ }
+
if (wqkms.length == 0) {
logger.error("No WQKms found.");
return Lines.createWaterLines(points, 0.0f);
@@ -643,12 +667,12 @@
return waterLineC(idx, csl);
}
+ // Find W at km, linear naive approach.
+ WQKms triple = wqkms[idx];
+
// Find index of km.
double wishKM = csl.getKm();
- // Find W at km, linear naive approach.
- WQKms triple = wqkms[idx];
-
if (triple.size() == 0) {
logger.warn("Calculation of waterline is empty.");
return Lines.createWaterLines(points, 0.0f);
diff -r d9e3660fa462 -r b5624ef2808f flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterLineArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterLineArtifact.java Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterLineArtifact.java Tue Nov 13 16:14:44 2012 +0100
@@ -1,7 +1,11 @@
package de.intevation.flys.artifacts;
+import de.intevation.artifacts.CallContext;
+
import de.intevation.flys.artifacts.geom.Lines;
import de.intevation.flys.model.FastCrossSectionLine;
+
+
/**
* Interface, Artifact can create WaterLines (Water against Cross-Profile).
*/
@@ -9,6 +13,11 @@
/** Get points that define a line of a (water)facet against a cross-
* section. */
- public Lines.LineData getWaterLines(int facetIdx, FastCrossSectionLine csl, double d, double w);
+ public Lines.LineData getWaterLines(
+ int facetIdx,
+ FastCrossSectionLine csl,
+ double d,
+ double w,
+ CallContext context);
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r d9e3660fa462 -r b5624ef2808f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java Tue Nov 13 16:14:44 2012 +0100
@@ -75,7 +75,8 @@
if (crossSection != null) {
return lineArtifact.getWaterLines(this.getIndex(),
- (FastCrossSectionLine) crossSection, (Double) nextKm, (Double) prevKm);
+ (FastCrossSectionLine) crossSection, (Double) nextKm,
+ (Double) prevKm, context);
}
else {
return new Lines.LineData(new double[][] {}, 0d,0d);
diff -r d9e3660fa462 -r b5624ef2808f flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java Tue Nov 13 16:14:44 2012 +0100
@@ -9,6 +9,7 @@
import de.intevation.flys.artifacts.access.ExtremeAccess;
import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet;
import de.intevation.flys.artifacts.model.DataFacet;
import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.ReportFacet;
@@ -88,9 +89,11 @@
i, LONGITUDINAL_W, name, ComputeType.ADVANCE, id, hash);
Facet q = new WaterlevelFacet(
i, LONGITUDINAL_Q, qname, ComputeType.ADVANCE, id, hash);
+ Facet csFacet = new CrossSectionWaterLineFacet(i, name);
facets.add(w);
facets.add(q);
+ facets.add(csFacet);
}
More information about the Dive4elements-commits
mailing list