Mercurial > gemma
changeset 716:22159077b564
client: add step to intersect with fairways
* Add comfort function getLayerByName() so that we do not spread
the number of the layer around in the code too much
* Add code the get the right vectorSource and the call that could be
used in the comment to prepare an intersection with the profile linestring.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 21 Sep 2018 14:48:32 +0200 |
parents | 23b68cd4bed3 |
children | bb0788567609 |
files | client/src/map/Maplayer.vue client/src/map/store.js |
diffstat | 2 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue Fri Sep 21 13:57:40 2018 +0200 +++ b/client/src/map/Maplayer.vue Fri Sep 21 14:48:32 2018 +0200 @@ -98,7 +98,14 @@ var gStr = new GeoJSON({ geometryName: "geometry" }).writeFeature( feature ); - console.log("Ready to start profile view with: ", gStr); + console.log("Ready to start profile view with: ", feature, gStr); + + // FIXME: assuming that we have the fairway dimensions loaded + var vectorSource = this.getLayerByName( + "Fairway Dimensions" + ).data.getSource(); + console.log(vectorSource); + // vectorSource.forEachFeatureIntersectingExtent() } } }, @@ -149,6 +156,13 @@ }); }; return loader; + }, + getLayerByName(name) { + for (let layer of this.layers) { + if (layer.name === name) { + return layer; + } + } } }, watch: {
--- a/client/src/map/store.js Fri Sep 21 13:57:40 2018 +0200 +++ b/client/src/map/store.js Fri Sep 21 14:48:32 2018 +0200 @@ -30,7 +30,7 @@ isVisible: true }, { - name: "Fairways Dimensions", + name: "Fairway Dimensions", data: new VectorLayer({ source: new VectorSource(), style: function(feature) {