changeset 734:1581ba78a360

client: prepare for fairway intersection for profile * Add calculation of features which intersect the extend of the profileLine as preparation for the more expensive detailed intersect operation.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 24 Sep 2018 09:56:51 +0200
parents e57955c1996f
children 83a9f04f1759
files client/src/map/Maplayer.vue
diffstat 1 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue	Mon Sep 24 09:23:09 2018 +0200
+++ b/client/src/map/Maplayer.vue	Mon Sep 24 09:56:51 2018 +0200
@@ -89,8 +89,9 @@
         inputLineString.transform("EPSG:3857", "EPSG:4326");
         var coords = inputLineString.getCoordinates();
         if (coords.length >= 2) {
+          var profileLine = new LineString([coords[0], coords[1]]);
           var feature = new Feature({
-            geometry: new LineString([coords[0], coords[1]]),
+            geometry: profileLine,
             // FIXME: hardcoded bottleneck and survey date
             bottleneck: "AT_Bottleneck_44",
             date: "2017-11-20"
@@ -105,10 +106,37 @@
             "Fairway Dimensions"
           ).data.getSource();
           console.log(vectorSource);
-          // vectorSource.forEachFeatureIntersectingExtent()
+
+          var diagStack = [];
+          vectorSource.forEachFeatureIntersectingExtent(
+            // need to use EPSG:3857 which is the proj of vectorSource
+            profileLine
+              .clone()
+              .transform("EPSG:4326", "EPSG:3857")
+              .getExtent(),
+            feature => {
+              // transform back to prepare for usage
+              var g = feature
+                .getGeometry()
+                .clone()
+                .transform("EPSG:3857", "EPSG:4326");
+              // console.log("intersecting:", g);
+              this.addToFairwayRectangle(profileLine, g, diagStack);
+            }
+          );
         }
       }
     },
+    addToFairwayRectangle(profileLine, fairwayGeometry, diagStack) {
+      // both geometries have to be in EPSG:4326
+      console.log(
+        "addToFairwayRectangle(",
+        profileLine,
+        fairwayGeometry,
+        diagStack,
+        ")"
+      );
+    },
     activateInteraction() {
       const interaction = this.createInteraction(this.drawMode);
       this.interaction = interaction;