[Dive4elements-commits] [PATCH] Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS
Wald Commits
scm-commit at wald.intevation.org
Wed Jan 16 22:54:05 CET 2013
# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1358373238 -3600
# Node ID 8062b571884d104050d42397e2bc9b0b31f9d086
# Parent 05ff91146ddd9eca499fc9d0a13ef9d226a21bac
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
diff -r 05ff91146ddd -r 8062b571884d flys-artifacts/doc/conf/mapserver/river-mapfile.vm
--- a/flys-artifacts/doc/conf/mapserver/river-mapfile.vm Wed Jan 16 11:39:37 2013 +0100
+++ b/flys-artifacts/doc/conf/mapserver/river-mapfile.vm Wed Jan 16 22:53:58 2013 +0100
@@ -3,7 +3,7 @@
STATUS ON
SIZE 600 400
MAXSIZE 4000
- EXTENT 3233232.55407617 5303455.37850183 3421524.44644752 5585825.50888523
+ #EXTENT 3233232.55407617 5303455.37850183 3421524.44644752 5585825.50888523
UNITS DD
SHAPEPATH "$SHAPEFILEPATH"
FONTSET "$CONFIGDIR/mapserver/fontset.txt"
@@ -13,13 +13,13 @@
"init=epsg:31467"
END
- DEBUG 5
+ DEBUG 3
CONFIG "MS_ERRORFILE" "log/rivers.log"
WEB
METADATA
"wms_title" "FLYS Rivers Web Map Service"
- "wms_onlineresource" "$MAPSERVERURL"
+ #"wms_onlineresource" "http://localhost:7777/river-wms" # "$MAPSERVERURL"
"wms_accessconstraints" "none"
"wms_fees" "none"
"wms_addresstype" "postal"
diff -r 05ff91146ddd -r 8062b571884d flys-artifacts/doc/conf/mapserver/riveraxis-layer.vm
--- a/flys-artifacts/doc/conf/mapserver/riveraxis-layer.vm Wed Jan 16 11:39:37 2013 +0100
+++ b/flys-artifacts/doc/conf/mapserver/riveraxis-layer.vm Wed Jan 16 22:53:58 2013 +0100
@@ -20,10 +20,6 @@
LABELITEM $LAYER.getLabelItem()
#end
- PROJECTION
- "init=epsg:31467"
- END
-
METADATA
"wms_title" "$LAYER.getTitle()"
"gml_include_items" "all"
@@ -36,7 +32,7 @@
$LAYER.getStyle()
#else
CLASS
- NAME ""
+ NAME "unnamedclass"
STYLE
SIZE 5
OUTLINECOLOR "#000000"
@@ -52,6 +48,7 @@
OFFSET 2 2
END
#end
+
END
- #end
+ #end
END
\ No newline at end of file
diff -r 05ff91146ddd -r 8062b571884d flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java Wed Jan 16 11:39:37 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java Wed Jan 16 22:53:58 2013 +0100
@@ -1,8 +1,12 @@
package de.intevation.flys.utils;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.LineString;
+
import de.intevation.flys.artifacts.model.LayerInfo;
import de.intevation.flys.artifacts.model.RiverFactory;
import de.intevation.flys.model.River;
+import de.intevation.flys.model.RiverAxis;
import java.io.File;
import java.io.FileNotFoundException;
@@ -48,11 +52,26 @@
List<String> riverFiles = new ArrayList<String>();
for (River river : rivers) {
+ // We expect that every river has only one RiverAxis.
+ // This is not correct but currently the case here, see
+ // RiverAxis.java.
+ List<RiverAxis> riverAxis = RiverAxis.getRiverAxis(river.getName());
+ if (riverAxis == null) {
+ logger.warn("River " + river.getName() + " has no river axis!");
+ continue;
+ }
+ LineString geom = riverAxis.get(0).getGeom();
+ Envelope extent = geom.getEnvelopeInternal();
+
createRiverAxisLayer(
river.getName(),
river.getId(),
- "41677",
- "-10000 -10000 10000 10000");
+ Integer.toString(geom.getSRID()),
+ extent.getMinX() + " " +
+ extent.getMinY() + " " +
+ extent.getMaxX() + " " +
+ extent.getMaxY());
+
riverFiles.add("river-" + river.getName() + ".map");
}
writeMapfile(riverFiles);
@@ -64,7 +83,7 @@
layerInfo.setSrid(srid);
layerInfo.setExtent(extend);
layerInfo.setType("line");
- layerInfo.setData("geom FROM river_axis"); // FIXME: Use templates for that
+ layerInfo.setData("geom FROM river_axes"); // FIXME: Use templates for that
layerInfo.setFilter("river_id = " + riverID);
layerInfo.setTitle(riverName + " RiverAxis");
diff -r 05ff91146ddd -r 8062b571884d flys-backend/src/main/java/de/intevation/flys/model/River.java
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java Wed Jan 16 11:39:37 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java Wed Jan 16 22:53:58 2013 +0100
@@ -1,31 +1,29 @@
package de.intevation.flys.model;
+import de.intevation.flys.backend.SessionHolder;
+
import java.io.Serializable;
-
import java.math.BigDecimal;
import java.math.MathContext;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
-import javax.persistence.SequenceGenerator;
+import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
-import javax.persistence.JoinColumn;
-import javax.persistence.GenerationType;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
-import java.util.List;
-import java.util.Comparator;
-import java.util.Map;
-import java.util.TreeMap;
-
+import org.hibernate.Query;
import org.hibernate.Session;
-import org.hibernate.Query;
-
-import de.intevation.flys.backend.SessionHolder;
@Entity
@@ -37,7 +35,7 @@
public static final double EPSILON = 1e-5;
- public static final Comparator KM_CMP = new Comparator<Double>() {
+ public static final Comparator<Double> KM_CMP = new Comparator<Double>() {
@Override
public int compare(Double a, Double b) {
double diff = a - b;
@@ -147,6 +145,7 @@
+ @Override
public String toString() {
return name != null ? name : "";
}
More information about the Dive4elements-commits
mailing list