changeset 2279:7f3bc4c39956

Merged.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 14 Feb 2019 17:39:29 +0100
parents a3e7e727209a (current diff) ad9ede1a9e11 (diff)
children e9112939581e
files
diffstat 6 files changed, 102 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Maplayer.vue	Thu Feb 14 16:32:31 2019 +0100
+++ b/client/src/components/Maplayer.vue	Thu Feb 14 17:39:29 2019 +0100
@@ -39,6 +39,7 @@
 import { equalTo } from "ol/format/filter.js";
 import { Stroke, Style, Fill } from "ol/style.js";
 import { displayError } from "@/lib/errors.js";
+import { LAYERS } from "@/store/map.js";
 
 /* for the sake of debugging */
 /* eslint-disable no-console */
@@ -210,9 +211,13 @@
     // TODO make display of layers more dynamic, e.g. from a list
 
     // load different fairway dimension layers (level of service)
-    ["1", "2", "3"].forEach(los => {
+    [
+      LAYERS.FAIRWAYDIMENSIONSLOS1,
+      LAYERS.FAIRWAYDIMENSIONSLOS2,
+      LAYERS.FAIRWAYDIMENSIONSLOS3
+    ].forEach((los, i) => {
       // loading the full WFS layer without bboxStrategy
-      var source = this.getVSourceByName("Fairway Dimensions LOS " + los);
+      var source = this.getVSourceByName(los);
       /*eslint-disable no-unused-vars */
       var loader = function(extent, resolution, projection) {
         var featureRequest = new WFS().writeGetFeature({
@@ -221,7 +226,7 @@
           featurePrefix: "gemma",
           featureTypes: ["fairway_dimensions"],
           outputFormat: "application/json",
-          filter: equalTo("level_of_service", los)
+          filter: equalTo("level_of_service", i + 1)
         });
 
         featureRequest["outputFormat"] = "application/json";
@@ -245,7 +250,7 @@
         });
       };
 
-      layer = this.getLayerByName("Fairway Dimensions LOS " + los);
+      layer = this.getLayerByName(los);
       layer.data.getSource().setLoader(loader);
     });
 
--- a/client/src/components/importqueue/Importqueue.vue	Thu Feb 14 16:32:31 2019 +0100
+++ b/client/src/components/importqueue/Importqueue.vue	Thu Feb 14 17:39:29 2019 +0100
@@ -274,7 +274,7 @@
 }
 
 .enqueued {
-  width: 20%;
+  width: 15%;
 }
 
 .user {
@@ -282,7 +282,7 @@
 }
 
 .signer {
-  width: 20%;
+  width: 15%;
 }
 
 .kind {
@@ -290,7 +290,7 @@
 }
 
 .state {
-  width: 20%;
+  width: 15%;
 }
 
 .details thead {
--- a/client/src/components/importqueue/Importqueuedetail.vue	Thu Feb 14 16:32:31 2019 +0100
+++ b/client/src/components/importqueue/Importqueuedetail.vue	Thu Feb 14 17:39:29 2019 +0100
@@ -289,7 +289,7 @@
 }
 
 .enqueued {
-  width: 20%;
+  width: 15%;
 }
 
 .user {
@@ -297,7 +297,7 @@
 }
 
 .signer {
-  width: 20%;
+  width: 15%;
 }
 
 .kind {
@@ -305,7 +305,7 @@
 }
 
 .state {
-  width: 20%;
+  width: 15%;
 }
 
 .details {
--- a/client/src/lib/geo.js	Thu Feb 14 16:32:31 2019 +0100
+++ b/client/src/lib/geo.js	Thu Feb 14 17:39:29 2019 +0100
@@ -24,7 +24,8 @@
 import distance from "@turf/distance";
 import {
   lineString as turfLineString,
-  polygon as turfPolygon
+  polygon as turfPolygon,
+  point as turfPoint
 } from "@turf/helpers";
 import lineSplit from "@turf/line-split";
 import lineSlice from "@turf/line-slice";
@@ -199,16 +200,15 @@
     );
     startPoint = line1.geometry.coordinates[0];
     endPoint = line1.geometry.coordinates[1];
-  } else if (booleanWithin(line, polygon)) {
+  } else if (
+    booleanContains(polygon, turfPoint(line.geometry.coordinates[0])) &&
+    booleanContains(polygon, turfPoint(line.geometry.coordinates[1]))
+  ) {
     startPoint = line.geometry.coordinates[0];
     endPoint = line.geometry.coordinates[1];
   } else {
     let split = lineSplit(line, polygon);
     for (let feature of split.features) {
-      if (booleanWithin(feature, polygon)) {
-        startPoint = feature.geometry.coordinates[0];
-        endPoint = feature.geometry.coordinates[1];
-      }
       if (booleanContains(polygon, feature)) {
         startPoint = feature.geometry.coordinates[0];
         endPoint = feature.geometry.coordinates[1];
--- a/client/src/store/map.js	Thu Feb 14 16:32:31 2019 +0100
+++ b/client/src/store/map.js	Thu Feb 14 17:39:29 2019 +0100
@@ -38,9 +38,9 @@
   INLANDECDIS: "Inland ECDIS chart Danube",
   WATERWAYAREA: "Waterway Area",
   STRETCHES: "Stretches",
-  FAIRWAYDIMENSIONSLOS1: "Fairway Dimensions LOS 1",
-  FAIRWAYDIMENSIONSLOS2: "Fairway Dimensions LOS 2",
-  FAIRWAYDIMENSIONSLOS3: "Fairway Dimensions LOS 3",
+  FAIRWAYDIMENSIONSLOS1: "LOS 1 Fairway Dimensions",
+  FAIRWAYDIMENSIONSLOS2: "LOS 2 Fairway Dimensions",
+  FAIRWAYDIMENSIONSLOS3: "LOS 3 Fairway Dimensions",
   WATERWAYAXIS: "Waterway Axis",
   WATERWAYPROFILES: "Waterway Profiles",
   BOTTLENECKS: "Bottlenecks",
--- a/client/tests/e2e/specs/import.js	Thu Feb 14 16:32:31 2019 +0100
+++ b/client/tests/e2e/specs/import.js	Thu Feb 14 17:39:29 2019 +0100
@@ -87,5 +87,83 @@
       .click(".trigger")
       .click("button[type='submit']")
       .end();
+  },
+  "Import Fairway Dimensions": browser => {
+    browser
+      .url(process.env.VUE_DEV_SERVER_URL)
+      .waitForElementVisible("#app", 5000)
+      .setValue("input[id='inputUsername']", "sophie")
+      .setValue("input[id='inputPassword']", "so2Phie4")
+      .click("button[type='submit']")
+      .pause(1000)
+      .click(".menubutton")
+      .pause(1000)
+      .click("a[href='#/importschedule']")
+      .pause(600)
+      .click(".newbutton")
+      .pause(600)
+      .click("#importtype option:nth-child(6)")
+      .pause(600)
+      .setValue(
+        "input[type='url']",
+        "https://service.d4d-portal.info/wamos/wfs"
+      )
+      .setValue(".featuretype", "ws-wamos:hydro_fairwy")
+      .setValue(".sortby", "hydro_scamin")
+      .setValue(".depth", "250")
+      .setValue(".minwidth", "80")
+      .setValue(".maxwidth", "150")
+      .setValue(".sourceorganization", "D4D Portal")
+      .click(".trigger")
+      .click("button[type='submit']")
+      .end();
+  },
+  "Import Waterway Axis": browser => {
+    browser
+      .url(process.env.VUE_DEV_SERVER_URL)
+      .waitForElementVisible("#app", 5000)
+      .setValue("input[id='inputUsername']", "sophie")
+      .setValue("input[id='inputPassword']", "so2Phie4")
+      .click("button[type='submit']")
+      .pause(1000)
+      .click(".menubutton")
+      .pause(1000)
+      .click("a[href='#/importschedule']")
+      .pause(600)
+      .click(".newbutton")
+      .pause(600)
+      .click("#importtype option:nth-child(2)")
+      .pause(600)
+      .setValue(
+        "input[type='url']",
+        "https://service.d4d-portal.info/wamos/wfs"
+      )
+      .setValue(".featuretype", "ws-wamos:ienc_wtwaxs")
+      .setValue(".sortby", "hydro_scamin")
+      .end();
+  },
+  "Import Waterway Area ": browser => {
+    browser
+      .url(process.env.VUE_DEV_SERVER_URL)
+      .waitForElementVisible("#app", 5000)
+      .setValue("input[id='inputUsername']", "sophie")
+      .setValue("input[id='inputPassword']", "so2Phie4")
+      .click("button[type='submit']")
+      .pause(1000)
+      .click(".menubutton")
+      .pause(1000)
+      .click("a[href='#/importschedule']")
+      .pause(600)
+      .click(".newbutton")
+      .pause(600)
+      .click("#importtype option:nth-child(5)")
+      .pause(600)
+      .setValue(
+        "input[type='url']",
+        "https://service.d4d-portal.info/wamos/wfs"
+      )
+      .setValue(".featuretype", "ws-wamos:ienc_wtware")
+      .setValue(".sortby", "hydro_scamin")
+      .end();
   }
 };