Mercurial > dive4elements > river
changeset 4739:5014a84c0c7d
Add "maptype" parameter to MapInfoService.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 02 Jan 2013 15:24:18 +0100 |
parents | d93748043cbc |
children | f6d0ad25f1ee |
files | flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java flys-client/src/main/java/de/intevation/flys/client/server/MapInfoServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/shared/model/MapInfo.java |
diffstat | 4 files changed, 47 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Wed Jan 02 15:15:45 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Wed Jan 02 15:24:18 2013 +0100 @@ -3,6 +3,7 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.AbsolutePanel; + import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.events.ParentMovedEvent; @@ -45,6 +46,7 @@ import de.intevation.flys.client.shared.model.ThemeList; import de.intevation.flys.client.shared.model.WMSLayer; +import java.util.HashMap; import java.util.List; import org.gwtopenmaps.openlayers.client.Bounds; @@ -94,6 +96,7 @@ protected VLayout rootLayout = new VLayout(); protected AbsolutePanel absPan = new AbsolutePanel(); protected FloodMap floodMap; + protected java.util.Map<String, String> wmsUrls = new HashMap<String, String>(); public MapOutputTab( @@ -437,14 +440,14 @@ public Layer createWMSLayer(Theme theme) { - if (theme == null) { + if (theme == null || !(theme instanceof AttributedTheme)) { return null; } AttributedTheme at = (AttributedTheme) theme; - //String type = at.getAttr("name"); - //String desc = at.getAttr("description"); + String name = at.getAttr("name"); + String desc = at.getAttr("description"); String url = at.getAttr("url"); String layers = at.getAttr("layers"); @@ -452,7 +455,7 @@ return null; } - //boolean baseLayer = type.equals("floodmap.wmsbackground"); + this.wmsUrls.put(name, url); WMSParams params = new WMSParams(); params.setLayers(layers); @@ -472,6 +475,11 @@ } + public java.util.Map<String, String> wmsUrls() { + return this.wmsUrls; + } + + protected MapToolbar createControlPanel() { return new MapToolbar(this, floodMap, false); }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java Wed Jan 02 15:15:45 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java Wed Jan 02 15:24:18 2013 +0100 @@ -1,6 +1,7 @@ package de.intevation.flys.client.client.ui.map; import com.google.gwt.core.client.GWT; + import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.util.BooleanCallback; import com.smartgwt.client.util.SC; @@ -175,11 +176,28 @@ if (layerZoom != null) { menu.addItem(layerZoom); } + //menu.addItem(createMapURLItem(records)); return menu; } + protected MenuItem createMapURLItem(final ListGridRecord[] records) { + final FacetRecord fr = (FacetRecord) records[0]; + final AttributedTheme at = (AttributedTheme) fr.getTheme(); + + MenuItem item = new MenuItem("WMS URL"); + item.addClickHandler(new ClickHandler() { + @Override + public void onClick(MenuItemClickEvent evt) { + SC.say(at.getAttr("url")); + } + }); + + return item; + } + + @Override protected MenuItem createRemoveItem(final ListGridRecord[] records) { MenuItem item = super.createRemoveItem(records);
--- a/flys-client/src/main/java/de/intevation/flys/client/server/MapInfoServiceImpl.java Wed Jan 02 15:15:45 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapInfoServiceImpl.java Wed Jan 02 15:24:18 2013 +0100 @@ -1,5 +1,6 @@ package de.intevation.flys.client.server; +import com.google.gwt.core.client.GWT; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import de.intevation.artifacts.common.utils.XMLUtils; @@ -43,7 +44,7 @@ public static final String XPATH_RIVER_WMS = "/mapinfo/river/river-wms/@url"; - public static final String XPATH_RIVER_WMS_LAYERS = + public static final String XPATH_RIVER_LAYERS = "/mapinfo/river/river-wms/@layers"; public static final String XPATH_WMS_URL = @@ -64,7 +65,7 @@ String url = getServletContext().getInitParameter("server-url"); - Document request = getRequestDocument(river);; + Document request = getRequestDocument(river, "rivermap"); HttpClient client = new HttpClientImpl(url, locale); @@ -87,19 +88,22 @@ } - public static Document getRequestDocument(String rivername) { + public static Document getRequestDocument(String rivername, String maptypeStr) { logger.debug("MapInfoServiceImpl.getRequestDocument"); Document request = XMLUtils.newDocument(); ElementCreator cr = new ElementCreator(request, null, null); - Element root = cr.create("mapinfo"); - Element river = cr.create("river"); + Element root = cr.create("mapinfo"); + Element river = cr.create("river"); + Element maptype = cr.create("maptype"); river.setTextContent(rivername); + maptype.setTextContent(maptypeStr); request.appendChild(root); root.appendChild(river); + root.appendChild(maptype); return request; } @@ -114,9 +118,9 @@ BBox bbox = BBox.getBBoxFromString(bboxS); 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); + String riverLayers = XMLUtils.xpathString(result, XPATH_RIVER_LAYERS, null); + String wmsURL = XMLUtils.xpathString(result, XPATH_WMS_URL, null); + String wmsLayers = XMLUtils.xpathString(result, XPATH_WMS_LAYERS, null); int srid = 4326; @@ -124,10 +128,11 @@ srid = Integer.parseInt(sridStr); } catch (NumberFormatException nfe) { - // do nothing + GWT.log("Could not parse SRID String: " + sridStr); } - return new MapInfo(river, srid, bbox, riverWMS, riverLayers, 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 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/MapInfo.java Wed Jan 02 15:15:45 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/MapInfo.java Wed Jan 02 15:24:18 2013 +0100 @@ -5,7 +5,7 @@ public class MapInfo implements Serializable { - private static final long serialVersionUID = 6691651140549280494L; + private static final long serialVersionUID = 6691651180549280493L; protected String river; protected int srid; @@ -65,7 +65,7 @@ public String getWmsLayers() { - return wmsLayers; + return this.wmsLayers; }