[PATCH] Add metadata to bedheight facets in bed height differences
Wald Commits
scm-commit at wald.intevation.org
Tue Sep 16 11:33:12 CEST 2014
# HG changeset patch
# User "Tom Gottfried <tom at intevation.de>"
# Date 1410859988 -7200
# Node ID 5c3b36b519d01dfcb9a3d517a37d9dd057763ff5
# Parent c57b0400ac980154380dc50ef666d62d6c33f4a7
Add metadata to bedheight facets in bed height differences.
diff -r c57b0400ac98 -r 5c3b36b519d0 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Mon Sep 15 15:38:16 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Tue Sep 16 11:33:08 2014 +0200
@@ -44,7 +44,7 @@
if (pair[0].getYear() == null || pair[1].getYear() == null) {
addProblem("beddiff.missing.year");
}
- results[i] = calculateYearDifference(pair);
+ results[i] = calculateYearDifference(pair, heightIds[i]);
}
return new CalculationResult(results, this);
@@ -59,7 +59,8 @@
}
private BedDiffYearResult calculateYearDifference(
- BedHeightSingleData[] pair
+ BedHeightSingleData[] pair,
+ int[] ids
) {
log.debug("BedDiffCalculation.calculateYearDifference");
BedHeightSingleData s1 = pair[0];
@@ -125,7 +126,9 @@
s1.getYear(),
s2.getYear(),
s1.getName(),
- s2.getName());
+ s2.getName(),
+ ids[0],
+ ids[1]);
}
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r c57b0400ac98 -r 5c3b36b519d0 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFacet.java Mon Sep 15 15:38:16 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFacet.java Tue Sep 16 11:33:08 2014 +0200
@@ -4,7 +4,12 @@
import org.dive4elements.artifactdatabase.state.Facet;
import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.model.BedHeightSingle;
+
import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.resources.Resources;
import org.dive4elements.river.artifacts.model.CalculationResult;
import org.dive4elements.river.artifacts.model.DataFacet;
import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -40,6 +45,22 @@
if (resultData != null && resultData.length > index) {
BedDiffYearResult data = resultData[index];
+
+ BedHeightSingle first = BedHeightSingle.getBedHeightSingleById(
+ data.getIdFirst());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.cur.elevation"),
+ first.getCurElevationModel().getName());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.old.elevation"),
+ first.getOldElevationModel().getName());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.river.elevation"),
+ new RiverAccess(flys).getRiver().getWstUnit().getName());
+
return data.getHeights1Data();
}
return null;
diff -r c57b0400ac98 -r 5c3b36b519d0 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFilterFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFilterFacet.java Mon Sep 15 15:38:16 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFilterFacet.java Tue Sep 16 11:33:08 2014 +0200
@@ -13,6 +13,9 @@
import org.dive4elements.artifactdatabase.state.Facet;
import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.model.BedHeightSingle;
+
import org.dive4elements.river.artifacts.D4EArtifact;
import org.dive4elements.river.artifacts.access.RiverAccess;
import org.dive4elements.river.artifacts.context.RiverContext;
@@ -64,6 +67,22 @@
this.metaData.put(
Resources.getMsg(context.getMeta(),
"chart.subtitle.radius", new Object[] { radius }), "");
+
+ BedHeightSingle first = BedHeightSingle.getBedHeightSingleById(
+ oldData.getIdFirst());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.cur.elevation"),
+ first.getCurElevationModel().getName());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.old.elevation"),
+ first.getOldElevationModel().getName());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.river.elevation"),
+ access.getRiver().getWstUnit().getName());
+
return heights;
}
return null;
diff -r c57b0400ac98 -r 5c3b36b519d0 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFacet.java Mon Sep 15 15:38:16 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFacet.java Tue Sep 16 11:33:08 2014 +0200
@@ -4,7 +4,12 @@
import org.dive4elements.artifactdatabase.state.Facet;
import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.model.BedHeightSingle;
+
import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.resources.Resources;
import org.dive4elements.river.artifacts.model.CalculationResult;
import org.dive4elements.river.artifacts.model.DataFacet;
import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -40,6 +45,22 @@
if (resultData != null && resultData.length > index) {
BedDiffYearResult data = resultData[index];
+
+ BedHeightSingle second = BedHeightSingle.getBedHeightSingleById(
+ data.getIdSecond());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.cur.elevation"),
+ second.getCurElevationModel().getName());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.old.elevation"),
+ second.getOldElevationModel().getName());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.river.elevation"),
+ new RiverAccess(flys).getRiver().getWstUnit().getName());
+
return data.getHeights2Data();
}
return null;
diff -r c57b0400ac98 -r 5c3b36b519d0 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFilterFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFilterFacet.java Mon Sep 15 15:38:16 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFilterFacet.java Tue Sep 16 11:33:08 2014 +0200
@@ -13,6 +13,9 @@
import org.dive4elements.artifactdatabase.state.Facet;
import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.model.BedHeightSingle;
+
import org.dive4elements.river.artifacts.D4EArtifact;
import org.dive4elements.river.artifacts.access.RiverAccess;
import org.dive4elements.river.artifacts.context.RiverContext;
@@ -64,6 +67,22 @@
this.metaData.put(
Resources.getMsg(context.getMeta(),
"chart.subtitle.radius", new Object[] { radius }), "");
+
+ BedHeightSingle second = BedHeightSingle.getBedHeightSingleById(
+ oldData.getIdSecond());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.cur.elevation"),
+ second.getCurElevationModel().getName());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.old.elevation"),
+ second.getOldElevationModel().getName());
+ this.addMetaData(Resources.getMsg(
+ context.getMeta(),
+ "meta.bedheight.river.elevation"),
+ access.getRiver().getWstUnit().getName());
+
return heights;
}
return null;
diff -r c57b0400ac98 -r 5c3b36b519d0 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java Mon Sep 15 15:38:16 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java Tue Sep 16 11:33:08 2014 +0200
@@ -24,6 +24,8 @@
protected Integer end;
protected String nameFirst;
protected String nameSecond;
+ protected int idFirst;
+ protected int idSecond;
public BedDiffYearResult () {
super();
@@ -54,7 +56,9 @@
Integer start,
Integer end,
String nameFirst,
- String nameSecond
+ String nameSecond,
+ int idFirst,
+ int idSecond
) {
super(kms, differences, heights1, heights2);
this.diffsPerYear = diffsPerYear;
@@ -66,6 +70,8 @@
this.end = end;
this.nameFirst = nameFirst;
this.nameSecond = nameSecond;
+ this.idFirst = idFirst;
+ this.idSecond = idSecond;
}
public TDoubleArrayList getBedHeights() {
@@ -114,6 +120,16 @@
return this.nameSecond;
}
+ /** Get id of the first BedHeight (minuend). */
+ public int getIdFirst() {
+ return this.idFirst;
+ }
+
+ /** Get id of the second BedHeight (subtrahend). */
+ public int getIdSecond() {
+ return this.idSecond;
+ }
+
public void addMorphWidth1(double value) {
this.morphWidth1.add(value);
}
diff -r c57b0400ac98 -r 5c3b36b519d0 artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java Mon Sep 15 15:38:16 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java Tue Sep 16 11:33:08 2014 +0200
@@ -226,7 +226,7 @@
ComputeType.ADVANCE,
stateId,
hash));
- newFacets.add(new BedDiffHeightSubFilterFacet(
+ newFacets.add(new BedDiffHeightSubFilterFacet(
idx,
BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED,
createBedDiffHeightDescription(
More information about the Dive4Elements-commits
mailing list