[Dive4elements-commits] [PATCH 2 of 2] Merged
Wald Commits
scm-commit at wald.intevation.org
Wed Dec 5 12:54:46 CET 2012
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1354708772 -3600
# Node ID 105463e2234f4d1f426e578b27ace28be583d204
# Parent dae7e6388a47485e687ce3b3b0edcc4ebbbf6a96
# Parent c2e23c3f29c7cd84cbadeb9f8d7a88aebc421b02
Merged.
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/doc/conf/conf.xml
--- a/flys-artifacts/doc/conf/conf.xml Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/doc/conf/conf.xml Wed Dec 05 12:59:32 2012 +0100
@@ -393,4 +393,12 @@
<configuration>${artifacts.config.dir}/themes.xml</configuration>
</themes>
</flys>
+
+ <options>
+ <zoom-scales>
+ <zoom-scale river="Elbe" range="50" radius="1" />
+ <zoom-scale river="Elbe" range="100" radius="5" />
+ <zoom-scale river="Elbe" range="500" radius="10" />
+ </zoom-scales>
+ </options>
</artifact-database>
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/doc/mapserver/river-mapfile.vm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/doc/mapserver/river-mapfile.vm Wed Dec 05 12:59:32 2012 +0100
@@ -0,0 +1,60 @@
+MAP
+ NAME "River $RIVERNAME"
+ STATUS ON
+ SIZE 600 400
+ MAXSIZE 4000
+ EXTENT 3233232.55407617 5303455.37850183 3421524.44644752 5585825.50888523
+ UNITS DD
+ SHAPEPATH "$SHAPEFILEPATH"
+ FONTSET "$CONFIGDIR/mapserver/fontset.txt"
+ SYMBOLSET "$CONFIGDIR/mapserver/symbols.sym"
+ IMAGECOLOR 255 255 255
+ PROJECTION
+ "init=epsg:31467"
+ END
+
+ DEBUG 5
+ CONFIG "MS_ERRORFILE" "log/river-$RIVERNAME.log"
+
+ WEB
+ METADATA
+ "wms_title" "FLYS $RIVERNAME Web Map Service"
+ "wms_onlineresource" "$MAPSERVERURL"
+ "wms_accessconstraints" "none"
+ "wms_fees" "none"
+ "wms_addresstype" "postal"
+ "wms_address" "Any Street"
+ "wms_city" "Any City"
+ "wms_stateorprovince" "Any state"
+ "wms_postcode" "My Postalcode"
+ "wms_country" "Any Country"
+ "wms_contactperson" "Any Person"
+ "wms_contactorganization" "Any Orga"
+ "wms_contactelectronicmailaddress" "any-email at example.com"
+ "wms_contactvoicetelephone" "Any's telephone number"
+ "wms_srs" "EPSG:4326 EPSG:31466 EPSG:31467"
+ "wms_feature_info_mime_type" "text/html"
+ "ows_enable_request" "*"
+ END
+ END
+
+ LEGEND
+ KEYSIZE 20 20
+ STATUS ON
+ TRANSPARENT ON
+
+ LABEL
+ COLOR 150 150 150
+ OUTLINECOLOR 255 255 255
+ TYPE truetype
+ FONT "FreeSans"
+ SIZE 12
+ POSITION AUTO
+ END
+ END
+
+ ## Don't change the following lines.
+ #foreach ($LAYER in $LAYERS)
+ include "$LAYER"
+ #end
+END
\ No newline at end of file
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/doc/mapserver/riveraxis-layer.vm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/doc/mapserver/riveraxis-layer.vm Wed Dec 05 12:59:32 2012 +0100
@@ -0,0 +1,58 @@
+LAYER
+ NAME "$LAYER.getName()"
+ TYPE $LAYER.getType()
+
+ CONNECTIONTYPE $LAYER.getConnectionType()
+ CONNECTION "$LAYER.getConnection()"
+
+ DATA "$LAYER.getData()"
+ FILTER "$LAYER.getFilter()"
+ EXTENT $LAYER.getExtent()
+
+ STATUS ON
+ TEMPLATE map.html
+ TOLERANCE 10
+ DUMP TRUE
+ #if( $LAYER.getGroup() )
+ GROUP "$LAYER.getGroup()"
+ #end
+
+ #if ( $LAYER.getLabelItem() )
+ LABELITEM $LAYER.getLabelItem()
+ #end
+
+ PROJECTION
+ "init=epsg:31467"
+ END
+
+ METADATA
+ "wms_title" "$LAYER.getTitle()"
+ "gml_include_items" "all"
+ #if ( $LAYER.getGroupTitle() )
+ "wms_group_title" "$LAYER.getGroupTitle()"
+ #end
+ END
+
+ #if ( $LAYER.getStyle() )
+ $LAYER.getStyle()
+ #else
+ CLASS
+ NAME ""
+ STYLE
+ SIZE 5
+ OUTLINECOLOR "#000000"
+ END
+ #if ( $LAYER.getLabelItem() )
+ LABEL
+ ANGLE auto
+ SIZE 10
+ COLOR "#000000"
+ TYPE truetype
+ FONT LiberationSans-Italic
+ POSITION ur
+ OFFSET 2 2
+ END
+ #end
+ END
+ #end
+END
\ No newline at end of file
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java Wed Dec 05 12:59:32 2012 +0100
@@ -27,6 +27,7 @@
import de.intevation.artifactdatabase.transition.TransitionEngine;
import de.intevation.flys.artifacts.model.Module;
+import de.intevation.flys.artifacts.model.ZoomScale;
import de.intevation.flys.artifacts.states.StateFactory;
import de.intevation.flys.artifacts.transitions.TransitionFactory;
import de.intevation.flys.themes.Theme;
@@ -84,6 +85,8 @@
public static final String XPATH_MODULES = "/artifact-database/modules/module";
+ private static final String XPATH_ZOOM_SCALES = "/artifact-database/options/zoom-scales/zoom-scale";
+
/**
* Creates a new FLYSArtifactContext object and initialize all
* components required by the application.
@@ -101,11 +104,56 @@
configureThemesMappings(config, context);
configureRiverWMS(config, context);
configureModules(config, context);
+ configureZoomScales(config, context);
return context;
}
+ private void configureZoomScales(Document config, FLYSContext context) {
+ NodeList list = (NodeList)XMLUtils.xpath(
+ config,
+ XPATH_ZOOM_SCALES,
+ XPathConstants.NODESET);
+ ZoomScale scale = new ZoomScale();
+ for (int i = 0; i < list.getLength(); i++) {
+ Element element = (Element)list.item(i);
+ String river = "default";
+ double range = 0d;
+ double radius = 10d;
+ if (element.hasAttribute("river")) {
+ river = element.getAttribute("river");
+ }
+ if (!element.hasAttribute("range")) {
+ continue;
+ }
+ else {
+ String r = element.getAttribute("range");
+ try {
+ range = Double.parseDouble(r);
+ }
+ catch (NumberFormatException nfe) {
+ continue;
+ }
+ }
+ if (!element.hasAttribute("radius")) {
+ continue;
+ }
+ else {
+ String r = element.getAttribute("radius");
+ try {
+ radius = Double.parseDouble(r);
+ }
+ catch (NumberFormatException nfe) {
+ continue;
+ }
+ }
+ scale.addRange(river, range, radius);
+ }
+ context.put("zoomscale", scale);
+ }
+
+
/**
* This method initializes the transition configuration.
*
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/MovingAverage.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/MovingAverage.java Wed Dec 05 12:59:32 2012 +0100
@@ -0,0 +1,66 @@
+package de.intevation.flys.artifacts.math;
+
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+
+public class MovingAverage
+{
+
+ public static double[][] simple(double[][] values, double radius) {
+ TreeMap<Double, Double> map = toMap(values);
+ int N = map.size();
+ double [] xs = new double[N];
+ double [] ys = new double[N];
+ int ndx = 0;
+ for (double x: map.keySet()) {
+ SortedMap<Double, Double> range =
+ map.subMap(x-radius, true, x+radius, true);
+ double avg = 0d;
+ for (double v: range.values()) {
+ avg += v;
+ }
+ avg /= range.size();
+ xs[ndx] = x;
+ ys[ndx] = avg;
+ ndx++;
+ }
+ return new double [][] { xs, ys };
+ }
+
+ public static double[][] weighted(double[][] values, double radius) {
+ TreeMap<Double, Double> map = toMap(values);
+ int N = map.size();
+ double [] xs = new double[N];
+ double [] ys = new double[N];
+ int ndx = 0;
+ double _1radius = 1d/radius;
+ for (double x: map.keySet()) {
+ double avg = 0d;
+ double weights = 0d;
+ for (Map.Entry<Double, Double> e:
+ map.subMap(x-radius, false, x+radius, false).entrySet()
+ ) {
+ double weight = 1d - Math.abs(x - e.getKey())*_1radius;
+ avg += weight*e.getValue();
+ weights += weight;
+ }
+ avg /= weights;
+ xs[ndx] = x;
+ ys[ndx] = avg;
+ ndx++;
+ }
+ return new double [][] { xs, ys };
+ }
+
+ private static TreeMap<Double, Double> toMap(double[][] values) {
+ TreeMap<Double, Double> map = new TreeMap<Double, Double>();
+ double [] xs = values[0];
+ double [] ys = values[1];
+ for (int i = 0; i < xs.length; i++) {
+ map.put(xs[i], ys[i]);
+ }
+ return map;
+ }
+}
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java Wed Dec 05 12:59:32 2012 +0100
@@ -58,6 +58,7 @@
if (mainIds != null) {
for (int id: mainIds) {
DischargeZone zone = DischargeZone.getDischargeZoneById(id);
+ zone.putType("main");
if (zone != null) {
zones.add(zone);
@@ -68,9 +69,16 @@
if (totalIds != null) {
for (int id: totalIds) {
DischargeZone zone = DischargeZone.getDischargeZoneById(id);
-
if (zone != null) {
- zones.add(zone);
+ int ndx = zones.indexOf(zone);
+ if (zones.contains(zone) &&
+ zones.get(ndx).fetchType().equals("main")) {
+ zone.putType("main_total");
+ }
+ else {
+ zone.putType("total");
+ zones.add(zone);
+ }
}
}
}
@@ -133,6 +141,7 @@
String lo = zone.getLowerDischarge();
String hi = zone.getUpperDischarge();
+ data.setType(zone.fetchType());
if (lo.equals(hi)) {
data.setZone(lo);
}
@@ -152,7 +161,6 @@
logger.debug("Prepare data for km range: " + kmLo + " - " + kmHi);
FlowVelocityData[] data = new FlowVelocityData[models.size()];
-
for (int i = 0, n = models.size(); i < n; i++) {
FlowVelocityData d = new FlowVelocityData();
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityData.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityData.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityData.java Wed Dec 05 12:59:32 2012 +0100
@@ -13,7 +13,7 @@
private TDoubleArrayList tauMain;
private TDoubleArrayList q;
private String zone;
-
+ private String type;
protected FlowVelocityData() {
this.km = new TDoubleArrayList();
@@ -72,6 +72,14 @@
return zone;
}
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
public int size() {
return km.size();
}
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityFacet.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityFacet.java Wed Dec 05 12:59:32 2012 +0100
@@ -7,11 +7,14 @@
import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.RiverAccess;
+import de.intevation.flys.artifacts.context.FLYSContext;
+
+import de.intevation.flys.artifacts.math.MovingAverage;
import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
import org.apache.log4j.Logger;
-
/**
* Facet of a FlowVelocity curve.
*/
@@ -39,13 +42,36 @@
public Object getData(Artifact artifact, CallContext context) {
logger.debug("Get data for flow velocity at index: " + index);
+ Double start = (Double)context.getContextValue("startkm");
+ Double end = (Double)context.getContextValue("endkm");
FLYSArtifact flys = (FLYSArtifact) artifact;
CalculationResult res = (CalculationResult)
flys.compute(context, hash, stateId, type, false);
FlowVelocityData[] data = (FlowVelocityData[]) res.getData();
+ if(start != null && end != null) {
+ FLYSContext fc = (FLYSContext)context.globalContext();
+ ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+ RiverAccess access = new RiverAccess((FLYSArtifact)artifact);
+ String river = access.getRiver();
+ double radius = scales.getRadius(river, start, end);
+ FlowVelocityData oldData = data[index];
+ FlowVelocityData newData = new FlowVelocityData();
+ double[][] q = oldData.getQPoints();
+ double[][] totalV = MovingAverage.weighted(oldData.getTotalChannelPoints(), radius);
+ double[][] mainV = MovingAverage.weighted(oldData.getMainChannelPoints(), radius);
+ double[][] tau = MovingAverage.weighted(oldData.getTauPoints(), radius);
+ for(int j = 0; j < q[0].length; j++) {
+ newData.addKM(q[0][j]);
+ newData.addQ(q[1][j]);
+ newData.addTauMain(tau[1][j]);
+ newData.addVMain(mainV[1][j]);
+ newData.addVTotal(totalV[1][j]);
+ }
+ return newData;
+ }
return data[index];
}
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ZoomScale.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ZoomScale.java Wed Dec 05 12:59:32 2012 +0100
@@ -0,0 +1,75 @@
+package de.intevation.flys.artifacts.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.artifacts.math.Linear;
+
+
+public class ZoomScale
+{
+ private static Logger logger = Logger.getLogger(ZoomScale.class);
+
+ private HashMap<String, TreeMap<Double, Double>> rivers;
+
+ public ZoomScale() {
+ this.rivers = new HashMap<String, TreeMap<Double, Double>>();
+ }
+
+ public ZoomScale(String river) {
+ this();
+ rivers.put(river, new TreeMap<Double, Double>());
+ }
+
+ public double getRadius(String river, double lower, double upper) {
+ double range = Math.abs(upper) - Math.abs(lower);
+ TreeMap<Double, Double> ranges = rivers.get(river);
+ if (ranges == null) {
+ return 0.001;
+ }
+ Map.Entry<Double, Double> next = ranges.higherEntry(range);
+ Map.Entry<Double, Double> prev = ranges.lowerEntry(range);
+ double x0 = 0d;
+ double x1 = 0d;
+ double y0 = 0d;
+ double y1 = 0d;
+ if (prev == null && next != null) {
+ x1 = next.getKey();
+ y1 = next.getValue();
+ }
+ else if (prev != null && next == null) {
+ return prev.getValue();
+ }
+ else {
+ x0 = prev.getKey();
+ x1 = next.getKey();
+ y0 = prev.getValue();
+ y1 = next.getValue();
+ }
+ return Linear.linear(range, x0, x1, y0, y1);
+ }
+
+ public void addRiver(String river) {
+ if (!this.rivers.containsKey(river)) {
+ this.rivers.put(river, new TreeMap<Double, Double>());
+ }
+ }
+
+ public Set<String> getRivers() {
+ return this.rivers.keySet();
+ }
+
+ public void addRange(String river, double range, double radius) {
+ if (this.rivers.containsKey(river)) {
+ this.rivers.get(river).put(range, radius);
+ }
+ else {
+ this.rivers.put(river, new TreeMap<Double, Double>());
+ this.rivers.get(river).put(range, radius);
+ }
+ }
+}
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java Wed Dec 05 12:59:32 2012 +0100
@@ -6,8 +6,12 @@
import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.CallContext;
import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.RiverAccess;
+import de.intevation.flys.artifacts.context.FLYSContext;
import de.intevation.flys.artifacts.model.CalculationResult;
import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.math.MovingAverage;
+import de.intevation.flys.artifacts.model.ZoomScale;
import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
@@ -32,9 +36,33 @@
CalculationResult res = (CalculationResult) flys.compute(context, hash,
stateId, type, false);
- Object[] data =
+ BedDiffEpochResult[] data =
(BedDiffEpochResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+ Double start = (Double)context.getContextValue("startkm");
+ Double end = (Double)context.getContextValue("endkm");
+ if(start != null && end != null) {
+ FLYSContext fc = (FLYSContext)context.globalContext();
+ ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+ RiverAccess access = new RiverAccess((FLYSArtifact)artifact);
+ String river = access.getRiver();
+
+ double radius = scales.getRadius(river, start, end);
+ BedDiffEpochResult oldData = data[index];
+ BedDiffEpochResult newData = new BedDiffEpochResult();
+ newData.setStart(oldData.getStart());
+ newData.setEnd(oldData.getEnd());
+ double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius);
+ double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius);
+ double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius);
+ for(int j = 0; j < diffs[0].length; j++) {
+ newData.addKm(diffs[0][j]);
+ newData.addDifference(diffs[1][j]);
+ newData.addHeight1(heights1[1][j]);
+ newData.addHeight2(heights2[1][j]);
+ }
+ return newData;
+ }
return data != null && data.length > index ? data[index] : null;
}
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochResult.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochResult.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochResult.java Wed Dec 05 12:59:32 2012 +0100
@@ -33,6 +33,14 @@
return this.start;
}
+ public void setStart(Date value) {
+ this.start = value;
+ }
+
+ public void setEnd(Date value) {
+ this.end = value;
+ }
+
public Date getEnd() {
return this.end;
}
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.java Wed Dec 05 12:59:32 2012 +0100
@@ -6,8 +6,12 @@
import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.CallContext;
import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.RiverAccess;
+import de.intevation.flys.artifacts.context.FLYSContext;
import de.intevation.flys.artifacts.model.CalculationResult;
import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.math.MovingAverage;
+import de.intevation.flys.artifacts.model.ZoomScale;
import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
@@ -32,9 +36,36 @@
CalculationResult res = (CalculationResult) flys.compute(context, hash,
stateId, type, false);
- Object[] data =
+ BedDiffYearResult[] data =
(BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+ Double start = (Double)context.getContextValue("startkm");
+ Double end = (Double)context.getContextValue("endkm");
+ if(start != null && end != null) {
+ FLYSContext fc = (FLYSContext)context.globalContext();
+ ZoomScale scales = (ZoomScale)fc.get("zoomscale");
+ RiverAccess access = new RiverAccess((FLYSArtifact)artifact);
+ String river = access.getRiver();
+ double radius = scales.getRadius(river, start, end);
+ BedDiffYearResult oldData = data[index];
+ BedDiffYearResult newData = new BedDiffYearResult();
+ newData.setStart(oldData.getStart());
+ newData.setEnd(oldData.getEnd());
+ double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius);
+ double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius);
+ double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius);
+ double[][] morph = oldData.getMorphWidthData();
+ double[][] year = MovingAverage.weighted(oldData.getHeightPerYearData(), radius);
+ for(int j = 0; j < diffs[0].length; j++) {
+ newData.addKm(diffs[0][j]);
+ newData.addBedHeights(year[1][j]);
+ newData.addMorphWidth(morph[1][j]);
+ newData.addDifference(diffs[1][j]);
+ newData.addHeight1(heights1[1][j]);
+ newData.addHeight2(heights2[1][j]);
+ }
+ return newData;
+ }
return data != null && data.length > index ? data[index] : null;
}
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearResult.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearResult.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearResult.java Wed Dec 05 12:59:32 2012 +0100
@@ -57,10 +57,26 @@
return this.start;
}
+ public void setStart(int value) {
+ this.start = value;
+ }
+
+ public void setEnd(int value) {
+ this.end = value;
+ }
+
public int getEnd() {
return this.end;
}
+ public void addMorphWidth(double value) {
+ this.morphWidth.add(value);
+ }
+
+ public void addBedHeights(double value) {
+ this.bedHeights.add(value);
+ }
+
public double[][] getMorphWidthData() {
return new double[][] {
kms.toNativeArray(),
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDifferencesResult.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDifferencesResult.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDifferencesResult.java Wed Dec 05 12:59:32 2012 +0100
@@ -17,7 +17,8 @@
public BedDifferencesResult () {
kms = new TDoubleArrayList();
differences = new TDoubleArrayList();
-
+ height1 = new TDoubleArrayList();
+ height2 = new TDoubleArrayList();
}
public BedDifferencesResult(
@@ -40,6 +41,22 @@
return this.differences;
}
+ public void addKm(double value) {
+ this.kms.add(value);
+ }
+
+ public void addDifference(double value) {
+ this.differences.add(value);
+ }
+
+ public void addHeight1(double value) {
+ this.height1.add(value);
+ }
+
+ public void addHeight2(double value) {
+ this.height2.add(value);
+ }
+
public double[][] getDifferencesData() {
return new double[][] {
kms.toNativeArray(),
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java Wed Dec 05 12:59:32 2012 +0100
@@ -194,8 +194,8 @@
double avCap = calculateAverage(cm, diameter);
double avSub = calculateAverage(sm, diameter);
location.add(km);
- avDiameterCap.add(avCap);
- avDiameterSub.add(avSub);
+ avDiameterCap.add(avCap * 1000);// bring to mm.
+ avDiameterSub.add(avSub * 1000);
}
return new BedDiameterResult(
diameter,
diff -r dae7e6388a47 -r 105463e2234f 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 Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Wed Dec 05 12:59:32 2012 +0100
@@ -68,34 +68,61 @@
int idx = 0;
for (FlowVelocityData d: data) {
- logger.error("TODO: Implement Facet creation for chart!");
+ if (d.getType().equals("main")) {
+ newFacets.add(new FlowVelocityFacet(
+ idx,
+ FLOW_VELOCITY_MAINCHANNEL,
+ buildMainChannelName(artifact, context, d),
+ ComputeType.ADVANCE,
+ id,
+ hash
+ ));
- newFacets.add(new FlowVelocityFacet(
- idx,
- FLOW_VELOCITY_MAINCHANNEL,
- buildMainChannelName(artifact, context, d),
- ComputeType.ADVANCE,
- id,
- hash
- ));
-
- newFacets.add(new FlowVelocityFacet(
- idx,
- FLOW_VELOCITY_TOTALCHANNEL,
- buildTotalChannelName(artifact, context, d),
- ComputeType.ADVANCE,
- id,
- hash
- ));
-
- newFacets.add(new FlowVelocityFacet(
- idx,
- FLOW_VELOCITY_TAU,
- buildTauName(artifact, context, d),
- ComputeType.ADVANCE,
- id,
- hash
- ));
+ newFacets.add(new FlowVelocityFacet(
+ idx,
+ FLOW_VELOCITY_TAU,
+ buildTauName(artifact, context, d),
+ ComputeType.ADVANCE,
+ id,
+ hash
+ ));
+ }
+ else if (d.getType().equals("total")) {
+ newFacets.add(new FlowVelocityFacet(
+ idx,
+ FLOW_VELOCITY_TOTALCHANNEL,
+ 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),
+ ComputeType.ADVANCE,
+ id,
+ hash
+ ));
+ newFacets.add(new FlowVelocityFacet(
+ idx,
+ FLOW_VELOCITY_TAU,
+ buildTauName(artifact, context, d),
+ ComputeType.ADVANCE,
+ id,
+ hash
+ ));
+ newFacets.add(new FlowVelocityFacet(
+ idx,
+ FLOW_VELOCITY_TOTALCHANNEL,
+ buildTotalChannelName(artifact, context, d),
+ ComputeType.ADVANCE,
+ id,
+ hash
+ ));
+ }
newFacets.add(new FlowVelocityFacet(
idx,
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java Wed Dec 05 12:59:32 2012 +0100
@@ -1,5 +1,7 @@
package de.intevation.flys.exports;
+import java.util.Arrays;
+
import org.apache.log4j.Logger;
import org.jfree.data.xy.XYSeries;
@@ -11,10 +13,13 @@
import de.intevation.flys.artifacts.FLYSArtifact;
+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.model.FlowVelocityMeasurementValue;
+import de.intevation.flys.jfree.Bounds;
+import de.intevation.flys.jfree.DoubleBounds;
import de.intevation.flys.jfree.FLYSAnnotation;
import de.intevation.flys.jfree.StyledXYSeries;
@@ -201,6 +206,32 @@
return;
}
+ if (getXBounds(0) != null && getDomainAxisRange() != null) {
+ logger.debug(Arrays.toString(getDomainAxisRangeFromRequest()));
+ Bounds bounds =
+ calculateZoom(getXBounds(0), getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
+ else if (getXBounds(0) != null && getDomainAxisRange() == null) {
+ context.putContextValue("startkm", getXBounds(0).getLower());
+ context.putContextValue("endkm", getXBounds(0).getUpper());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() == null) {
+ FLYSArtifact artifact = (FLYSArtifact)artifactAndFacet.getArtifact();
+ FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+ context.putContextValue("startkm", access.getLowerKM());
+ context.putContextValue("endkm", access.getUpperKM());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() != null){
+ FLYSArtifact artifact = (FLYSArtifact)artifactAndFacet.getArtifact();
+ FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+ Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM());
+ Bounds bounds =
+ calculateZoom(b, getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
if (name.equals(FLOW_VELOCITY_MAINCHANNEL)) {
doMainChannelOut(
(FlowVelocityData) artifactAndFacet.getData(context),
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java Wed Dec 05 12:59:32 2012 +0100
@@ -137,7 +137,7 @@
mfg.createUeskLayer(
flys,
(WSPLGENLayerFacet) wms,
- ThemeUtil.createWSPLGENStyle(attr),
+ ThemeUtil.createDynamicMapserverStyle(attr),
context);
}
else {
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Wed Dec 05 12:59:32 2012 +0100
@@ -781,22 +781,7 @@
}
if (x != null) {
- double min = bounds.getLower().doubleValue();
- double max = bounds.getUpper().doubleValue();
-
- if (logger.isDebugEnabled()) {
- logger.debug("Minimum is: " + min);
- logger.debug("Maximum is: " + max);
- logger.debug("Lower zoom is: " + x.getLowerBound());
- logger.debug("Upper zoom is: " + x.getUpperBound());
- }
-
- double diff = max > min ? max - min : min - max;
-
- DoubleBounds computed = new DoubleBounds(
- min + x.getLowerBound() * diff,
- min + x.getUpperBound() * diff);
-
+ Bounds computed = calculateZoom(bounds, x);
computed.applyBounds(axis, AXIS_SPACE);
logger.debug("Zoom axis to: " + computed);
@@ -808,6 +793,31 @@
return false;
}
+ /**
+ * Calculates the start and end km for zoomed charts.
+ * @param bounds The given total bounds (unzoomed).
+ * @param range The range specifying the zoom.
+ *
+ * @return The start and end km for the zoomed chart.
+ */
+ protected Bounds calculateZoom(Bounds bounds, Range range) {
+ double min = bounds.getLower().doubleValue();
+ double max = bounds.getUpper().doubleValue();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Minimum is: " + min);
+ logger.debug("Maximum is: " + max);
+ logger.debug("Lower zoom is: " + range.getLowerBound());
+ logger.debug("Upper zoom is: " + range.getUpperBound());
+ }
+
+ double diff = max > min ? max - min : min - max;
+
+ DoubleBounds computed = new DoubleBounds(
+ min + range.getLowerBound() * diff,
+ min + range.getUpperBound() * diff);
+ return computed;
+ }
/**
* Extract the minimum and maximum values for x and y axes
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java Wed Dec 05 12:59:32 2012 +0100
@@ -8,10 +8,13 @@
import de.intevation.artifactdatabase.state.Facet;
import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult;
+import de.intevation.flys.artifacts.model.minfo.BedDifferencesResult;
import de.intevation.flys.exports.StyledSeriesBuilder;
import de.intevation.flys.exports.fixings.FixChartGenerator;
import de.intevation.flys.exports.process.KMIndexProcessor;
import de.intevation.flys.exports.process.Processor;
+import de.intevation.flys.jfree.Bounds;
+import de.intevation.flys.jfree.DoubleBounds;
import de.intevation.flys.jfree.FLYSAnnotation;
import de.intevation.flys.jfree.StyledXYSeries;
@@ -79,6 +82,29 @@
return;
}
+ if (getXBounds(0) != null && getDomainAxisRange() != null) {
+ Bounds bounds =
+ calculateZoom(getXBounds(0), getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
+ else if (getXBounds(0) != null && getDomainAxisRange() == null) {
+ context.putContextValue("startkm", getXBounds(0).getLower());
+ context.putContextValue("endkm", getXBounds(0).getUpper());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() == null) {
+ BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
+ context.putContextValue("startkm", data.getKms().min());
+ context.putContextValue("endkm", data.getKms().max());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() != null){
+ BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
+ Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max());
+ Bounds bounds =
+ calculateZoom(b, getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
Processor processor = new KMIndexProcessor();
if (name.equals(BED_DIFFERENCE_HEIGHT_YEAR)) {
doBedDifferenceYearOut(
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java Wed Dec 05 12:59:32 2012 +0100
@@ -6,12 +6,16 @@
import de.intevation.artifactdatabase.state.ArtifactAndFacet;
import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.FlowVelocityAccess;
import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult;
import de.intevation.flys.exports.StyledSeriesBuilder;
import de.intevation.flys.exports.fixings.FixChartGenerator;
import de.intevation.flys.exports.process.KMIndexProcessor;
import de.intevation.flys.exports.process.Processor;
+import de.intevation.flys.jfree.Bounds;
+import de.intevation.flys.jfree.DoubleBounds;
import de.intevation.flys.jfree.FLYSAnnotation;
import de.intevation.flys.jfree.StyledXYSeries;
@@ -82,6 +86,31 @@
return;
}
+ if (getXBounds(0) != null && getDomainAxisRange() != null) {
+ Bounds bounds =
+ calculateZoom(getXBounds(0), getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
+ else if (getXBounds(0) != null && getDomainAxisRange() == null) {
+ context.putContextValue("startkm", getXBounds(0).getLower());
+ context.putContextValue("endkm", getXBounds(0).getUpper());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() == null) {
+ FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact();
+ FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+ context.putContextValue("startkm", access.getLowerKM());
+ context.putContextValue("endkm", access.getUpperKM());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() != null){
+ FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact();
+ FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+ Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM());
+ Bounds bounds =
+ calculateZoom(b, getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
Processor processor = new KMIndexProcessor();
if (name.equals(BED_DIFFERENCE_EPOCH)) {
doBedDifferenceEpochOut(
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java Wed Dec 05 12:59:32 2012 +0100
@@ -6,12 +6,18 @@
import de.intevation.artifactdatabase.state.ArtifactAndFacet;
import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.BedDifferencesAccess;
+import de.intevation.flys.artifacts.access.FlowVelocityAccess;
import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult;
+import de.intevation.flys.artifacts.model.minfo.BedDifferencesResult;
import de.intevation.flys.exports.StyledSeriesBuilder;
import de.intevation.flys.exports.fixings.FixChartGenerator;
import de.intevation.flys.exports.process.KMIndexProcessor;
import de.intevation.flys.exports.process.Processor;
+import de.intevation.flys.jfree.Bounds;
+import de.intevation.flys.jfree.DoubleBounds;
import de.intevation.flys.jfree.FLYSAnnotation;
import de.intevation.flys.jfree.StyledXYSeries;
@@ -83,6 +89,29 @@
return;
}
+ if (getXBounds(0) != null && getDomainAxisRange() != null) {
+ Bounds bounds =
+ calculateZoom(getXBounds(0), getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
+ else if (getXBounds(0) != null && getDomainAxisRange() == null) {
+ context.putContextValue("startkm", getXBounds(0).getLower());
+ context.putContextValue("endkm", getXBounds(0).getUpper());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() == null) {
+ BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
+ context.putContextValue("startkm", data.getKms().min());
+ context.putContextValue("endkm", data.getKms().max());
+ }
+ else if (getXBounds(0) == null && getDomainAxisRange() != null){
+ BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
+ Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max());
+ Bounds bounds =
+ calculateZoom(b, getDomainAxisRange());
+ context.putContextValue("startkm", bounds.getLower());
+ context.putContextValue("endkm", bounds.getUpper());
+ }
Processor processor = new KMIndexProcessor();
if (name.equals(BED_DIFFERENCE_YEAR)) {
doBedDifferenceYearOut(
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java Wed Dec 05 12:59:32 2012 +0100
@@ -43,7 +43,7 @@
public static final String I18N_CHART_TITLE_DEFAULT = "Sohlen Längsschnitt";
public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km";
- public static final String I18N_YAXIS_LABEL_DEFAULT = "Durchmesser [m]";
+ public static final String I18N_YAXIS_LABEL_DEFAULT = "Durchmesser [mm]";
public static final String I18N_SECOND_YAXIS_LABEL_DEFAULT = "Porosität [%]";
public static final String I18N_THIRD_YAXIS_LABEL_DEFAULT = "Dichte [t/m^3]";
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Wed Dec 05 12:59:32 2012 +0100
@@ -46,7 +46,13 @@
import de.intevation.flys.model.River;
-/** static helper methods to e.g. access FLYSArtifacts data. */
+/**
+ * Static helper methods to e.g. access FLYSArtifacts data.
+ *
+ * @deprecated Don't use FLYSUtils to get data from an {@link Artifact} anymore.
+ * Instead use and/or create a {@link Access} class hierarchy.
+ **/
+ at Deprecated
public class FLYSUtils {
/** The logger that is used in this utility. */
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java Wed Dec 05 12:59:32 2012 +0100
@@ -235,9 +235,11 @@
}
catch (FileNotFoundException fnfe) {
// this is bad
+ logger.warn(fnfe, fnfe);
}
catch (IOException ioe) {
// this is also bad
+ logger.warn(ioe, ioe);
}
return context;
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Wed Dec 05 12:59:32 2012 +0100
@@ -623,7 +623,14 @@
}
- public static String createWSPLGENStyle(Document theme) {
+ /**
+ * Creates a MapserverStyle from the given XML theme.
+ * This method uses a start- and endcolor to interpolate a
+ * given number of color classes for the MapserverStyle.
+ * @param theme
+ * @return String representation of the MapserverStyle
+ */
+ public static String createDynamicMapserverStyle(Document theme) {
MapserverStyle ms = new MapserverStyle();
String strStartColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_STARTCOLOR, null);
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/resources/messages.properties
--- a/flys-artifacts/src/main/resources/messages.properties Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/resources/messages.properties Wed Dec 05 12:59:32 2012 +0100
@@ -201,7 +201,7 @@
chart.bedquality.title=Bed Longitudinal Section
chart.bedquality.xaxis.label=River-Km
-chart.bedquality.yaxis.label=Diameter [m]
+chart.bedquality.yaxis.label=Diameter [mm]
chart.bedquality.yaxis.label.porosity=Porosity [%]
chart.bedquality.yaxis.label.density=Density [t/m\u00b3]
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/resources/messages_de.properties
--- a/flys-artifacts/src/main/resources/messages_de.properties Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/resources/messages_de.properties Wed Dec 05 12:59:32 2012 +0100
@@ -202,7 +202,7 @@
chart.bedquality.title=Sohlen L\u00e4ngsschnitt
chart.bedquality.xaxis.label=Fluss-Km
-chart.bedquality.yaxis.label=Durchmesser [m]
+chart.bedquality.yaxis.label=Durchmesser [mm]
chart.bedquality.yaxis.label.porosity=Porosit\u00e4t [%]
chart.bedquality.yaxis.label.density=Dichte [t/m\u00b3]
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/resources/messages_de_DE.properties
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Wed Dec 05 12:59:32 2012 +0100
@@ -201,7 +201,7 @@
chart.bedquality.title=Sohlen L\u00e4ngsschnitt
chart.bedquality.xaxis.label=Fluss-Km
-chart.bedquality.yaxis.label=Durchmesser [m]
+chart.bedquality.yaxis.label=Durchmesser [mm]
chart.bedquality.yaxis.label.porosity=Porosit\u00e4t [%]
chart.bedquality.yaxis.label.density=Dichte [t/m\u00b3]
diff -r dae7e6388a47 -r 105463e2234f flys-artifacts/src/main/resources/messages_en.properties
--- a/flys-artifacts/src/main/resources/messages_en.properties Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-artifacts/src/main/resources/messages_en.properties Wed Dec 05 12:59:32 2012 +0100
@@ -203,7 +203,7 @@
chart.bedquality.title=Bed Longitudinal Section
chart.bedquality.xaxis.label=River-Km
-chart.bedquality.yaxis.label=Diameter [m]
+chart.bedquality.yaxis.label=Diameter [mm]
chart.bedquality.yaxis.label.porosity=Porosity [%]
chart.bedquality.yaxis.label.density=Density [t/m\u00b3]
diff -r dae7e6388a47 -r 105463e2234f flys-backend/src/main/java/de/intevation/flys/model/DischargeZone.java
--- a/flys-backend/src/main/java/de/intevation/flys/model/DischargeZone.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/DischargeZone.java Wed Dec 05 12:59:32 2012 +0100
@@ -40,6 +40,7 @@
private String lowerDischarge;
private String upperDischarge;
+ private String type;
public DischargeZone() {
}
@@ -122,6 +123,13 @@
this.upperDischarge = upperDischarge;
}
+ public void putType(String type) {
+ this.type = type;
+ }
+
+ public String fetchType() {
+ return this.type;
+ }
public static List<DischargeZone> getDischargeZones(River river) {
Session session = SessionHolder.HOLDER.get();
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Wed Dec 05 12:59:32 2012 +0100
@@ -2,6 +2,7 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
+
import com.smartgwt.client.types.Encoding;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.util.SC;
@@ -161,7 +162,6 @@
defaultSet = true;
}
- // I was here.
for (DataItem item: d.getItems()) {
if (!defaultSet && first) {
initial.put(d.getLabel(), item.getStringValue());
@@ -246,7 +246,7 @@
parameterList.registerCollectionViewTabHandler(this);
WMS axis = getLayer(
- mapInfo.getWmsUrl(), "FLYS-Map", // FIXME: Make layer name configurable
+ mapInfo.getWmsUrl(), mapInfo.getWmsLayers(),
mapInfo.getProjection(), false);
WMS back = getLayer(
mapInfo.getBackgroundWmsUrl(), mapInfo.getBackgroundWmsLayers(),
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java Wed Dec 05 12:59:32 2012 +0100
@@ -263,16 +263,23 @@
}
ListGridRecord[] records = listGrid.getRecords();
- for (ListGridRecord record: records) {
+ Map<String, List<String>> result = new HashMap<String, List<String>>();
+ for (ListGridRecord record : records) {
for (int i = 0, n = columnNames.size(); i < n; i++) {
String columnName = columnNames.get(i);
- List<String> chosenItems = selected.get(columnName);
if (Boolean.valueOf(record.getAttribute(columnName)) == true) {
- chosenItems.add(record.getAttribute(columnName + "-value"));
+ if (result.containsKey(columnName)) {
+ result.get(columnName).add(record.getAttribute(columnName + "-value"));
+ }
+ else {
+ List<String> items = new ArrayList<String>();
+ items.add(record.getAttribute(columnName + "-value"));
+ result.put(columnName, items);
+ }
}
}
}
- return selected;
+ return result;
}
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java Wed Dec 05 12:59:32 2012 +0100
@@ -176,11 +176,20 @@
GWT.log ("validation. validation. validation. ");
List<String> errors = new ArrayList<String>();
// Early stop on one (only) error.
+ boolean ok = false;
for (Map.Entry<String, List<String>> entry : matrix.getSelection().entrySet()) {
+ /* single entries are allowed!!
if (entry.getValue() == null || entry.getValue().size() == 0) {
errors.add(MESSAGES.error_values_needed());
return errors;
}
+ */
+ if (entry.getValue() != null && entry.getValue().size() > 0) {
+ ok = true;
+ }
+ }
+ if (!ok) {
+ errors.add(MESSAGES.error_values_needed());
}
return errors;
}
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java Wed Dec 05 12:59:32 2012 +0100
@@ -5,6 +5,8 @@
import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.ImgButton;
import com.smartgwt.client.widgets.events.ClickEvent;
@@ -22,8 +24,9 @@
public class ThemeNavigationPanel extends Canvas {
public static final int PANEL_MARGIN = 5;
- public static final int BUTTON_HEIGHT = 25;
+ public static final int BUTTON_HEIGHT = 20;
public static final int BUTTON_MARGIN = 5;
+ private static final int BOTTON_WIDTH = 20;
protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
@@ -43,16 +46,32 @@
layout.setWidth100();
layout.setHeight(BUTTON_HEIGHT);
layout.setMembersMargin(BUTTON_MARGIN);
+ layout.setDefaultLayoutAlign(VerticalAlignment.CENTER);
+ layout.setDefaultLayoutAlign(Alignment.CENTER);
Canvas cu = createButton(MSG.theme_top(), OnMoveEvent.TOP);
Canvas u = createButton(MSG.theme_up(), OnMoveEvent.UP);
Canvas d = createButton(MSG.theme_down(), OnMoveEvent.DOWN);
Canvas cd = createButton(MSG.theme_bottom(), OnMoveEvent.BOTTOM);
- layout.addMember(cu);
- layout.addMember(u);
- layout.addMember(d);
- layout.addMember(cd);
+ HLayout left = new HLayout();
+ left.setMembersMargin(BUTTON_MARGIN);
+ left.setLayoutAlign(Alignment.LEFT);
+ left.setDefaultLayoutAlign(Alignment.LEFT);
+ left.setAlign(Alignment.LEFT);
+ left.addMember(cu);
+ left.addMember(u);
+
+ HLayout right = new HLayout();
+ right.setMembersMargin(BUTTON_MARGIN);
+ right.setLayoutAlign(Alignment.RIGHT);
+ right.setDefaultLayoutAlign(Alignment.RIGHT);
+ right.setAlign(Alignment.RIGHT);
+ right.addMember(d);
+ right.addMember(cd);
+
+ layout.addMember(left);
+ layout.addMember(right);
addChild(layout);
}
@@ -63,17 +82,17 @@
ImgButton b = new ImgButton();
b.setSrc(url);
+ b.setWidth(BOTTON_WIDTH);
b.setHeight(BUTTON_HEIGHT);
- b.setWidth(40);
- b.setIconHeight(BUTTON_HEIGHT-10);
+ b.setIconHeight(BUTTON_HEIGHT);
+ b.setIconWidth(BOTTON_WIDTH);
b.setShowDown(false);
b.setShowRollOver(false);
b.setShowDisabled(false);
b.setShowDisabledIcon(true);
b.setShowDownIcon(false);
b.setShowFocusedIcon(false);
- b.setBackgroundColor("f2f2f2");
- b.setBorder("1px solid #A6ABB4");
+ b.setValign(VerticalAlignment.CENTER);
b.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java
--- a/flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java Wed Dec 05 12:59:32 2012 +0100
@@ -37,7 +37,7 @@
String url = getServletContext().getInitParameter("server-url");
- Document request = createFileXML(req);;
+ Document request = createFileXML(req);
if (request == null) {
return;
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/java/de/intevation/flys/client/server/MapInfoServiceImpl.java
--- a/flys-client/src/main/java/de/intevation/flys/client/server/MapInfoServiceImpl.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapInfoServiceImpl.java Wed Dec 05 12:59:32 2012 +0100
@@ -1,24 +1,20 @@
package de.intevation.flys.client.server;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import org.apache.log4j.Logger;
-
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import de.intevation.artifacts.common.utils.XMLUtils;
import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
-
import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
import de.intevation.artifacts.httpclient.http.HttpClient;
import de.intevation.artifacts.httpclient.http.HttpClientImpl;
-
+import de.intevation.flys.client.client.services.MapInfoService;
import de.intevation.flys.client.shared.exceptions.ServerException;
import de.intevation.flys.client.shared.model.BBox;
import de.intevation.flys.client.shared.model.MapInfo;
-import de.intevation.flys.client.client.services.MapInfoService;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
/**
@@ -47,6 +43,9 @@
public static final String XPATH_RIVER_WMS =
"/mapinfo/river/river-wms/@url";
+ public static final String XPATH_RIVER_WMS_LAYERS =
+ "/mapinfo/river/river-wms/@layers";
+
public static final String XPATH_WMS_URL =
"/mapinfo/river/background-wms/@url";
@@ -57,6 +56,7 @@
"mapinfo_service_no_result";
+ @Override
public MapInfo getMapInfo(String locale, String river)
throws ServerException
{
@@ -113,7 +113,8 @@
String bboxS = XMLUtils.xpathString(result, XPATH_BBOX, null);
BBox bbox = BBox.getBBoxFromString(bboxS);
- String riverWMS = XMLUtils.xpathString(result, XPATH_RIVER_WMS, null);
+ String riverWMS = XMLUtils.xpathString(result, XPATH_RIVER_WMS, null);
+ String riverLayers = XMLUtils.xpathString(result, XPATH_RIVER_WMS_LAYERS, null);
String wmsURL = XMLUtils.xpathString(result, XPATH_WMS_URL, null);
String wmsLayers = XMLUtils.xpathString(result, XPATH_WMS_LAYERS, null);
@@ -126,7 +127,7 @@
// do nothing
}
- return new MapInfo(river, srid, bbox, riverWMS, wmsURL, wmsLayers);
+ return new MapInfo(river, srid, bbox, riverWMS, riverLayers, wmsURL, wmsLayers);
}
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/java/de/intevation/flys/client/server/features/XMLFileFeatures.java
--- a/flys-client/src/main/java/de/intevation/flys/client/server/features/XMLFileFeatures.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/features/XMLFileFeatures.java Wed Dec 05 12:59:32 2012 +0100
@@ -32,7 +32,7 @@
public XMLFileFeatures(String filename) throws IOException {
FileInputStream finput = new FileInputStream(filename);
-
+ logger.debug("XMLFileFeatures: " + filename);
try {
Document doc = XMLUtils.parseDocument(finput);
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/java/de/intevation/flys/client/shared/model/MapInfo.java
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/MapInfo.java Mon Dec 03 11:02:28 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/MapInfo.java Wed Dec 05 12:59:32 2012 +0100
@@ -5,12 +5,13 @@
public class MapInfo implements Serializable {
- private static final long serialVersionUID = 6691651140549280493L;
+ private static final long serialVersionUID = 6691651140549280494L;
protected String river;
protected int srid;
protected BBox bbox;
protected String wmsUrl;
+ protected String wmsLayers;
protected String backgroundWmsUrl;
protected String backgroundWmsLayers;
@@ -24,6 +25,7 @@
int srid,
BBox bbox,
String wmsUrl,
+ String wmsLayers,
String backgroundWmsUrl,
String backgroundWmsLayers)
{
@@ -31,6 +33,7 @@
this.srid = srid;
this.bbox = bbox;
this.wmsUrl = wmsUrl;
+ this.wmsLayers = wmsLayers;
this.backgroundWmsUrl = backgroundWmsUrl;
this.backgroundWmsLayers = backgroundWmsLayers;
}
@@ -61,6 +64,11 @@
}
+ public String getWmsLayers() {
+ return wmsLayers;
+ }
+
+
public String getBackgroundWmsUrl() {
return backgroundWmsUrl;
}
diff -r dae7e6388a47 -r 105463e2234f flys-client/src/main/webapp/images/bfg_logo_small.png
Binary file flys-client/src/main/webapp/images/bfg_logo_small.png has changed
More information about the Dive4elements-commits
mailing list