comparison client/src/map/Maplayer.vue @ 764:a6a8fe89eb84

client: add hooks for identify mode * Add hooks for single mouse click if the interaction is not enabled. For example get the d4d WMS url for getfeatureinfo and display it.
author Bernhard Reiter <bernhard@intevation.de>
date Tue, 25 Sep 2018 15:23:15 +0200
parents 105c421f99b1
children c1baaff348b0
comparison
equal deleted inserted replaced
763:d05bc3e34338 764:a6a8fe89eb84
175 }, 175 },
176 activateInteraction() { 176 activateInteraction() {
177 const interaction = this.createInteraction(this.drawMode); 177 const interaction = this.createInteraction(this.drawMode);
178 this.interaction = interaction; 178 this.interaction = interaction;
179 this.openLayersMap.addInteraction(interaction); 179 this.openLayersMap.addInteraction(interaction);
180 },
181 activateIdentifyMode() {
182 this.openLayersMap.on("singleclick", event => {
183 // console.log("single click on map:", event);
184 this.identify(
185 event.coordinate,
186 this.getLayerByName("Inland ECDIS chart Danube").data.getSource()
187 );
188 });
189 },
190 identify(coordinate, wmsSource) {
191 // console.log(coordinate, wmsSource);
192 //var viewResolution = this.openLayersMap.view.getResolution();
193 var url = wmsSource.getGetFeatureInfoUrl(
194 coordinate,
195 100,
196 "EPSG:3857",
197 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d
198 { INFO_FORMAT: "text/plain" }
199 );
200
201 if (url) {
202 // cannot directly query here because of SOP
203 console.log(url);
204 }
180 }, 205 },
181 buildVectorLoader(featureRequestOptions, endpoint, vectorSource) { 206 buildVectorLoader(featureRequestOptions, endpoint, vectorSource) {
182 // build a function to be used for VectorSource.setLoader() 207 // build a function to be used for VectorSource.setLoader()
183 // make use of WFS().writeGetFeature to build the request 208 // make use of WFS().writeGetFeature to build the request
184 // and use our HTTP library to actually do it 209 // and use our HTTP library to actually do it
355 "/external/d4d", 380 "/external/d4d",
356 layer.data.getSource() 381 layer.data.getSource()
357 ) 382 )
358 ); 383 );
359 layer.data.setVisible(layer.isVisible); 384 layer.data.setVisible(layer.isVisible);
385
386 this.activateIdentifyMode();
360 } 387 }
361 }; 388 };
362 </script> 389 </script>