Mercurial > gemma
changeset 628:ef9c733cc6aa
client: show more wfs layers
* Add waterway axis, waterway area and distance marks as fully loaded
WFS layers. Distance marks are disabled by default, with code
that honors the isVisible attribute. Code is duplicated, and marked
with FIXMEs.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Tue, 11 Sep 2018 17:52:20 +0200 |
parents | afd5595c8d8b |
children | 8278b2fb0c33 |
files | client/src/map/Maplayer.vue client/src/map/store.js |
diffstat | 2 files changed, 80 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue Tue Sep 11 17:31:07 2018 +0200 +++ b/client/src/map/Maplayer.vue Tue Sep 11 17:52:20 2018 +0200 @@ -85,7 +85,7 @@ }) }); - var featureRequest = new WFS().writeGetFeature({ + var featureRequest2 = new WFS().writeGetFeature({ // srsName: "urn:ogc:def:crs:EPSG::4326", srsName: "EPSG:3857", featureNS: "gemma", @@ -98,7 +98,7 @@ HTTP.post( "/internal/wfs", - new XMLSerializer().serializeToString(featureRequest), + new XMLSerializer().serializeToString(featureRequest2), { headers: { "X-Gemma-Auth": localStorage.getItem("token"), @@ -113,19 +113,16 @@ // that.openLayersMap.getView().fit(vectorSrc.getExtent()); }); - // FIXME this is hardwired for now to try for an external point layer - var featureRequest2 = new WFS().writeGetFeature({ - // srsName: "urn:ogc:def:crs:EPSG::4326", - // srsName: "EPSG:3857", - // featureNS: "gemma", + // FIXME hardwired for now + var featureRequest3 = new WFS().writeGetFeature({ featurePrefix: "ws-wamos", - featureTypes: ["hydro_boyspp"], + featureTypes: ["ienc_wtware"], outputFormat: "application/json" }); HTTP.post( "/external/d4d", - new XMLSerializer().serializeToString(featureRequest2), + new XMLSerializer().serializeToString(featureRequest3), { headers: { "X-Gemma-Auth": localStorage.getItem("token"), @@ -136,8 +133,51 @@ var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); var vectorSrc = that.layers[3].data.getSource(); vectorSrc.addFeatures(features); - // would scale to the extend of all resulting features - // that.openLayersMap.getView().fit(vectorSrc.getExtent()); + }); + + // FIXME hardwired for now + var featureRequest4 = new WFS().writeGetFeature({ + featurePrefix: "ws-wamos", + featureTypes: ["ienc_wtwaxs"], + outputFormat: "application/json" + }); + + HTTP.post( + "/external/d4d", + new XMLSerializer().serializeToString(featureRequest4), + { + headers: { + "X-Gemma-Auth": localStorage.getItem("token"), + "Content-type": "text/xml; charset=UTF-8" + } + } + ).then(function(response) { + var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); + var vectorSrc = that.layers[4].data.getSource(); + vectorSrc.addFeatures(features); + }); + + // FIXME this is hardwired for now to try for an external point layer + var featureRequest5 = new WFS().writeGetFeature({ + featurePrefix: "ws-wamos", + featureTypes: ["ienc_dismar"], + outputFormat: "application/json" + }); + + HTTP.post( + "/external/d4d", + new XMLSerializer().serializeToString(featureRequest5), + { + headers: { + "X-Gemma-Auth": localStorage.getItem("token"), + "Content-type": "text/xml; charset=UTF-8" + } + } + ).then(function(response) { + var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); + var vectorSrc = that.layers[5].data.getSource(); + that.layers[5].data.setVisible(that.layers[5].isVisible); + vectorSrc.addFeatures(features); }); } };
--- a/client/src/map/store.js Tue Sep 11 17:31:07 2018 +0200 +++ b/client/src/map/store.js Tue Sep 11 17:52:20 2018 +0200 @@ -41,7 +41,34 @@ isVisible: true }, { - name: "Buoy, special purpose/general", + name: "Waterway Area", + data: new VectorLayer({ + source: new VectorSource(), + style: new Style({ + stroke: new Stroke({ + color: "rgba(180, 140, 40, 1.0)", + width: 1.5 + }) + }) + }), + isVisible: true + }, + { + name: "Waterway Axis", + data: new VectorLayer({ + source: new VectorSource(), + style: new Style({ + stroke: new Stroke({ + color: "rgba(0, 0, 255, .5)", + lineDash: [5, 5], + width: 2 + }) + }) + }), + isVisible: true + }, + { + name: "Distance marks", data: new VectorLayer({ source: new VectorSource() /*, style: new Style({ @@ -52,7 +79,7 @@ }) */ }), - isVisible: true + isVisible: false } ] },