[Dive4elements-commits] [PATCH] Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact
Wald Commits
scm-commit at wald.intevation.org
Thu Jan 24 15:04:07 CET 2013
# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1359036241 -3600
# Node ID dc0d37715e1654a47e47fbac05d230cc91585715
# Parent f2e7f07f608d4ff4ca7abe368799c30fbc2bb34f
Floodmap uses the static River-WMS instead of User-WMS via RiverAxisArtifact.
diff -r f2e7f07f608d -r dc0d37715e16 flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java Thu Jan 24 10:02:45 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java Thu Jan 24 15:04:01 2013 +0100
@@ -1,32 +1,27 @@
package de.intevation.flys.artifacts;
-import org.apache.log4j.Logger;
-
-import java.util.List;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallMeta;
-import de.intevation.artifacts.CallContext;
-
-import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
-
import de.intevation.artifactdatabase.ProtocolUtils;
import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifactdatabase.state.Output;
import de.intevation.artifactdatabase.state.State;
import de.intevation.artifactdatabase.state.StateEngine;
-import de.intevation.artifactdatabase.state.Output;
-
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
+import de.intevation.flys.artifacts.RiverAxisArtifact.RiverAxisState;
+import de.intevation.flys.artifacts.context.FLYSContext;
+import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
+import de.intevation.flys.artifacts.states.DefaultState;
import de.intevation.flys.model.River;
import de.intevation.flys.utils.FLYSUtils;
import de.intevation.flys.utils.MapUtils;
-import de.intevation.flys.artifacts.RiverAxisArtifact.RiverAxisState;
-import de.intevation.flys.artifacts.states.DefaultState;
-import de.intevation.flys.artifacts.context.FLYSContext;
-import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
public class MapArtifact extends FLYSArtifact {
@@ -164,6 +159,7 @@
getUrl());
String name = type + "-" + artifact.identifier();
+
facet.addLayer(name);
facet.setExtent(getExtent(false));
facet.setOriginalExtent(getExtent(true));
diff -r f2e7f07f608d -r dc0d37715e16 flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java Thu Jan 24 10:02:45 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java Thu Jan 24 15:04:01 2013 +0100
@@ -1,29 +1,25 @@
package de.intevation.flys.artifacts;
-import java.util.List;
-
-import org.w3c.dom.Document;
-
-import org.apache.log4j.Logger;
-
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallMeta;
-
import de.intevation.artifactdatabase.state.DefaultOutput;
import de.intevation.artifactdatabase.state.Facet;
import de.intevation.artifactdatabase.state.State;
-
-import de.intevation.flys.model.River;
-
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.RiverFactory;
+import de.intevation.flys.model.River;
import de.intevation.flys.utils.FLYSUtils;
import de.intevation.flys.utils.GeometryUtils;
+import java.util.List;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+
+ at Deprecated
public class RiverAxisArtifact extends WMSDBArtifact {
public static final String NAME = "riveraxis";
@@ -87,6 +83,7 @@
riverId = 0;
}
+ @Override
public int getRiverId() {
if (riverId == 0) {
String ids = artifact.getDataAsString("ids");
@@ -108,8 +105,13 @@
}
@Override
+ protected String getLayer() {
+ return RiverFactory.getRiver(getRiverId()).getName();
+ }
+
+ @Override
protected String getUrl() {
- return FLYSUtils.getUserWMSUrl(artifact.identifier());
+ return FLYSUtils.getRiverWMSUrl();
}
@Override
diff -r f2e7f07f608d -r dc0d37715e16 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java Thu Jan 24 10:02:45 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java Thu Jan 24 15:04:01 2013 +0100
@@ -3,32 +3,23 @@
import com.vividsolutions.jts.geom.Envelope;
import de.intevation.artifactdatabase.data.DefaultStateData;
-
import de.intevation.artifactdatabase.state.Facet;
import de.intevation.artifactdatabase.state.State;
-
import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.ArtifactFactory;
import de.intevation.artifacts.CallMeta;
-
import de.intevation.artifacts.common.utils.FileTools;
-
import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
-
import de.intevation.flys.artifacts.resources.Resources;
-
import de.intevation.flys.artifacts.states.DefaultState;
-
import de.intevation.flys.utils.FLYSUtils;
import de.intevation.flys.utils.MapUtils;
import java.io.File;
-
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
-
import org.w3c.dom.Document;
@@ -136,9 +127,7 @@
getID(), hash,
getUrl());
- String name = type + "-" + artifact.identifier();
-
- facet.addLayer(name);
+ facet.addLayer(getLayer());
facet.setExtent(getExtent());
facet.setOriginalExtent(getExtent(true));
facet.setSrid(getSrid());
@@ -174,6 +163,12 @@
return riverId;
}
+ protected String getLayer() {
+ String type = getFacetType();
+ String name = type + "-" + artifact.identifier();
+ return name;
+ }
+
/**
* Returns the name of the WMS layer. This method extracts the name
* from 'ids' data string. It is expected, that the 'ids' string is
diff -r f2e7f07f608d -r dc0d37715e16 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Jan 24 10:02:45 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Jan 24 15:04:01 2013 +0100
@@ -157,6 +157,7 @@
String FLOODMAP_BARRIERS = "floodmap.barriers";
String FLOODMAP_USERSHAPE = "floodmap.usershape";
String FLOODMAP_RIVERAXIS = "floodmap.riveraxis";
+ @Deprecated
String FLOODMAP_WMSBACKGROUND = "floodmap.wmsbackground";
String FLOODMAP_KMS = "floodmap.kms";
String FLOODMAP_QPS = "floodmap.qps";
diff -r f2e7f07f608d -r dc0d37715e16 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Thu Jan 24 10:02:45 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Thu Jan 24 15:04:01 2013 +0100
@@ -28,6 +28,7 @@
import de.intevation.flys.model.DGM;
import de.intevation.flys.model.Floodplain;
import de.intevation.flys.model.RiverAxis;
+import de.intevation.flys.utils.ArtifactMapfileGenerator;
import de.intevation.flys.utils.FLYSUtils;
import de.intevation.flys.utils.GeometryUtils;
import de.intevation.flys.utils.MapfileGenerator;
@@ -102,6 +103,14 @@
copyShapeDir(orig, owner);
modifyFacets(orig, owner, context, callMeta);
+
+ ArtifactMapfileGenerator amfg = new ArtifactMapfileGenerator();
+ try {
+ amfg.generate();
+ }
+ catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
}
diff -r f2e7f07f608d -r dc0d37715e16 flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java Thu Jan 24 10:02:45 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java Thu Jan 24 15:04:01 2013 +0100
@@ -117,6 +117,7 @@
createUserShapeLayer(flys, wms);
}
else {
+ logger.debug("doOut: createDatabaseLayer for facet name: " + name);
createDatabaseLayer(flys, wms, attr);
}
}
diff -r f2e7f07f608d -r dc0d37715e16 flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Thu Jan 24 10:02:45 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Thu Jan 24 15:04:01 2013 +0100
@@ -5,11 +5,10 @@
import de.intevation.artifacts.CallContext;
import de.intevation.artifacts.common.utils.Config;
import de.intevation.artifacts.common.utils.XMLUtils;
-
-import de.intevation.flys.artifacts.access.RangeAccess;
import de.intevation.flys.artifacts.FLYSArtifact;
import de.intevation.flys.artifacts.StaticWKmsArtifact;
import de.intevation.flys.artifacts.WINFOArtifact;
+import de.intevation.flys.artifacts.access.RangeAccess;
import de.intevation.flys.artifacts.context.FLYSContext;
import de.intevation.flys.artifacts.model.LocationProvider;
import de.intevation.flys.artifacts.model.RiverFactory;
@@ -82,6 +81,9 @@
public static final String XPATH_FLOODMAP_MAPSERVER_URL =
"/artifact-database/floodmap/mapserver/server/@path";
+ public static final String XPATH_RIVERMAP_MAPSERVER_URL =
+ "/artifact-database/rivermap/mapserver/server/@path";
+
public static final String XPATH_FLOODMAP_MAPFILE_PATH =
"/artifact-database/floodmap/mapserver/mapfile/@path";
@@ -658,6 +660,14 @@
}
+ public static String getRiverWMSUrl() {
+ String url = getXPathString(XPATH_RIVERMAP_MAPSERVER_URL);
+ url = url.endsWith("/") ? url + "river-wms" : url + "/" + "river-wms";
+
+ return url;
+ }
+
+
/**
* This method returns the description for a given <i>km</i> for a specific
* river. The river is provided by the FLYSArtifact <i>flys</i>.
diff -r f2e7f07f608d -r dc0d37715e16 flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Thu Jan 24 10:02:45 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java Thu Jan 24 15:04:01 2013 +0100
@@ -721,6 +721,10 @@
String symbol = getSymbol(theme);
String backcolor = getLabelBackgroundColorString(theme);
String linecolor = getLineColorString(theme);
+ if (linecolor == null || "".equals(linecolor)) {
+ logger.warn("createMapserverStyle: linecolor String is empty");
+ linecolor = "0,128,255";
+ }
int linewidth = parseLineWidth(theme);
@@ -729,10 +733,10 @@
Clazz c = new Clazz(" ");
Style s = new Style();
- s.setOutlineColor(linecolor.replace(",", ""));
+ s.setOutlineColor(linecolor.replace(",", " "));
if (backcolor != null && backcolor.length() > 0) {
- s.setColor(backcolor.replace(",", ""));
+ s.setColor(backcolor.replace(",", " "));
}
s.setSize(linewidth);
@@ -744,7 +748,7 @@
if (textcolor != null && textcolor.length() > 0 && textsize > 0) {
Label l = new Label();
- l.setColor(textcolor.replace(",", ""));
+ l.setColor(textcolor.replace(",", " "));
l.setSize(textsize);
c.addItem(l);
}
More information about the Dive4elements-commits
mailing list