Mercurial > dive4elements > river
changeset 4801:6aa1b8abe2d3
MapInfoService now submits layer names as well as WMS urls.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Tue, 15 Jan 2013 13:32:14 +0100 |
parents | c6814695c82c |
children | 7dd5baca4f53 |
files | flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MapInfoService.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java |
diffstat | 2 files changed, 46 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MapInfoService.java Sun Jan 13 17:00:37 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MapInfoService.java Tue Jan 15 13:32:14 2013 +0100 @@ -1,29 +1,25 @@ package de.intevation.flys.artifacts.services; -import org.apache.log4j.Logger; - -import java.util.Map; -import java.util.HashMap; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.Element; - -import javax.xml.xpath.XPathConstants; - import com.vividsolutions.jts.geom.Envelope; +import de.intevation.artifactdatabase.XMLService; import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.GlobalContext; - import de.intevation.artifacts.common.ArtifactNamespaceContext; import de.intevation.artifacts.common.utils.Config; import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; +import de.intevation.flys.utils.GeometryUtils; -import de.intevation.artifactdatabase.XMLService; +import java.util.HashMap; +import java.util.Map; -import de.intevation.flys.utils.GeometryUtils; +import javax.xml.xpath.XPathConstants; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; /** * This service provides information about the supported rivers by this @@ -43,7 +39,7 @@ "/artifact-database/floodmap/river[@name=$river]/background-wms"; public static final String XPATH_RIVER_WMS = - "/artifact-database/floodmap/river[@name=$river]/river-wms/@url"; + "/artifact-database/floodmap/river[@name=$river]/river-wms"; /** The logger used in this service.*/ @@ -119,22 +115,38 @@ root.appendChild(srid); } - Element back = (Element)getNodeXPath(XPATH_RIVER_BACKGROUND, vars); - if (back != null) { - Element background = cr.create("background-wms"); - cr.addAttr(background, "url", back.getAttribute("url")); - cr.addAttr(background, "layers", back.getAttribute("layers")); - root.appendChild(background); + logger.debug("processXML: " + XMLUtils.toString(root)); + root.appendChild( + createWMSElement("background-wms", XPATH_RIVER_BACKGROUND, vars, cr)); + root.appendChild( + createWMSElement("river-wms", XPATH_RIVER_WMS, vars, cr)); + + return result; + } + + + protected Element createWMSElement( + String elementName, + String xpath, + Map<String, String> vars, + ElementCreator cr) + { + logger.debug("createWMSElement()"); + + Element el = cr.create(elementName); + Element wms = (Element)getNodeXPath(xpath, vars); + + if (wms != null) { + cr.addAttr(el, "url", wms.getAttribute("url")); + cr.addAttr(el, "layers", wms.getAttribute("layers")); + + logger.debug("createWMSElement: " + XMLUtils.toString(el)); + } + else { + logger.debug("createWMSElement: wms == null"); } - String wmsStr = getStringXPath(XPATH_RIVER_WMS, vars); - if (wmsStr != null && wmsStr.length() > 0) { - Element wms = cr.create("river-wms"); - cr.addAttr(wms, "url", wmsStr); - root.appendChild(wms); - } - - return result; + return el; }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Sun Jan 13 17:00:37 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Tue Jan 15 13:32:14 2013 +0100 @@ -2,7 +2,6 @@ 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; @@ -22,6 +21,8 @@ import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.client.services.MapInfoService; import de.intevation.flys.client.client.services.MapInfoServiceAsync; import de.intevation.flys.client.client.ui.map.FloodMap; @@ -58,6 +59,8 @@ public static final String UESK_BARRIERS = "uesk.barriers"; + /** The message class that provides i18n strings. */ + protected FLYSConstants MSG = GWT.create(FLYSConstants.class); public DigitizePanel() { } @@ -104,7 +107,7 @@ String msg = caught.getMessage(); GWT.log("Error while fetching MapInfo: " + msg); - SC.warn(MSG.getString(msg)); + SC.warn(FLYS.getExceptionString(MSG, caught)); } @Override