diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/components/mapClickable.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/components/mapClickable.vue index 9687ea3..2e1f0a9 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/components/mapClickable.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/components/mapClickable.vue @@ -1,128 +1,78 @@ @@ -192,17 +142,6 @@ imageFillColor: '#444444', }), ] - - return function __pacmanStyleFunc(feature) { - switch (feature.getId()) { - case 'pacman': - return pacman - case 'pacman-path': - return path - case 'pacman-eye': - return eye - } - } }, /** * Cluster layer style function factory @@ -271,12 +210,12 @@ // now ol.Map instance is ready and we can work with it directly this.$refs.map.$map.getControls().extend([ new ScaleLine(), - new FullScreen(), - new OverviewMap({ - collapsed: false, - collapsible: true, - }), - new ZoomSlider(), + // new FullScreen(), + // new OverviewMap({ + // collapsed: false, + // collapsible: true, + // }), + // new ZoomSlider(), ]) }, // base layers @@ -306,6 +245,10 @@ this.drawType = undefined } }, + setCenter(position) { + this.center = position; + this.$emit('updatecoords', this.center); + } } @@ -330,33 +273,33 @@ }, panelOpen: true, mapVisible: true, - drawControls: [ - { - type: 'point', - label: 'Draw Point', - icon: 'map-marker', - }, - { - type: 'line-string', - label: 'Draw LineString', - icon: 'minus', - }, - { - type: 'polygon', - label: 'Draw Polygon', - icon: 'square-o', - }, - { - type: 'circle', - label: 'Draw Circle', - icon: 'circle-thin', - }, - { - type: undefined, - label: 'Stop drawing', - icon: 'times', - }, - ], + // drawControls: [ + // { + // type: 'point', + // label: 'Draw Point', + // icon: 'map-marker', + // }, + // { + // type: 'line-string', + // label: 'Draw LineString', + // icon: 'minus', + // }, + // { + // type: 'polygon', + // label: 'Draw Polygon', + // icon: 'square-o', + // }, + // { + // type: 'circle', + // label: 'Draw Circle', + // icon: 'circle-thin', + // }, + // { + // type: undefined, + // label: 'Stop drawing', + // icon: 'times', + // }, + // ], drawType: "point", drawnFeatures: [], // base layers @@ -366,28 +309,14 @@ title: 'OpenStreetMap', visible: true, }, - { - name: 'sputnik', - title: 'Sputnik Maps', - visible: false, - }, - // needs paid plan to get key - // { - // name: 'mapbox', - // title: 'Mapbox', - // }, - { - name: 'bingmaps', - title: 'Bing Maps', - apiKey: 'ArbsA9NX-AZmebC6VyXAnDqjXk6mo2wGCmeYM8EwyDaxKfQhUYyk0jtx6hX5fpMn', - imagerySet: 'CanvasGray', - visible: false, - }, ], // layers config } }, - mounted() { + created() { + if (!(this.coords === undefined || this.coords[0] === undefined || this.coords[1] === undefined)) { + this.center = this.coords; + } }, computed: { computedCoords: { @@ -400,7 +329,7 @@ } } - } + }, } diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue index edb0978..0242f20 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Cache.vue @@ -60,9 +60,11 @@ -

Hinweis: Ein Cache muss mindestens aus zwei Stationen bestehen (inklusive der Endstation).

+

Hinweis: Ein Cache muss mindestens aus zwei Stationen bestehen (inklusive der Endstation). +

- +

Endstation

@@ -95,7 +97,7 @@
- +
@@ -123,7 +125,7 @@ }, created: function () { console.log("isNewCache: " + this.isNewCache); - console.log("Route Params: " + this.$route.params.id); + //console.log("Route Params: " + this.$route.params.id); if (!this.isNewCache && !this.$store.getters['cacheCollector/GET_LOCK']) { this.$axios.get('/api/allCaches') .then((response) => { @@ -163,6 +165,7 @@ const station = this.$store.getters['cacheCollector/GET_ENDSTATION']; console.log(station); this.$store.commit('cacheCollector/SET_TEMPSTATION', station); + this.$store.commit('cacheCollector/SET_LOCK', true); this.$router.push({path: `/tempendstation/`}); // add parameter }, @@ -187,67 +190,65 @@ let cache = JSON.parse(JSON.stringify(this.computedCache)); console.log(cache); cache.stationen.push(this.computedEndstation); - console.log("isnewcache "+this.isNewCache) + console.log("isnewcache " + this.isNewCache) //Error messages - if(!this.validateRankingPoints()){ + if (!this.validateRankingPoints()) { let title = "Falsche Formatierung"; let msg = "Die Ranglistenpunkte müssen eine ganze Zahl sein"; this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); } - if(this.validateEverything()) { - if (this.isNewCache) { - console.log("CREATECACHE") - this.$axios.post('/api/createCache', cache) - .then((response) => { - console.log("POST api/createCache: " + response.statusText); - this.$store.commit('cacheCollector/RESET_NEW_CACHE'); - this.$router.push({path: '/overview'}); - }).catch((error) => { - let msg; - let title; - if (error.response) { - title = "Bitte Eingaben überprüfen!"; - msg = error.response.data; - } else if (error.request) { - title = "Verbindungsfehler!"; - msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" - console.log(error.request); - } else { - title = "Error"; - msg = error.message; - console.log('Error', error.message); - } - console.log(error.config); - this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); - }) - } else { - console.log("EDITCACHE") - this.$axios.put('/api/editCache', cache) - .then((response) => { - console.log("POST api/editCache: " + response.statusText); - this.$store.commit('cacheCollector/RESET_NEW_CACHE'); - this.$router.push({path: '/overview'}); - }).catch((error) => { - let msg; - let title; - if (error.response) { - title = "Bitte Eingaben überprüfen!"; - msg = error.response.data; - } else if (error.request) { - title = "Verbindungsfehler!"; - msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" - console.log(error.request); - } else { - title = "Error"; - msg = error.message; - console.log('Error', error.message); - } - console.log(error.config); - this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); - }) - } + if (this.isNewCache) { + console.log("CREATECACHE") + this.$axios.post('/api/createCache', cache) + .then((response) => { + console.log("POST api/createCache: " + response.statusText); + this.$store.commit('cacheCollector/RESET_NEW_CACHE'); + this.$router.push({path: '/overview'}); + }).catch((error) => { + let msg; + let title; + if (error.response) { + title = "Bitte Eingaben überprüfen!"; + msg = error.response.data; + } else if (error.request) { + title = "Verbindungsfehler!"; + msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" + console.log(error.request); + } else { + title = "Error"; + msg = error.message; + console.log('Error', error.message); + } + console.log(error.config); + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); + }) + } else { + console.log("EDITCACHE") + this.$axios.put('/api/editCache', cache) + .then((response) => { + console.log("POST api/editCache: " + response.statusText); + this.$store.commit('cacheCollector/RESET_NEW_CACHE'); + this.$router.push({path: '/overview'}); + }).catch((error) => { + let msg; + let title; + if (error.response) { + title = "Bitte Eingaben überprüfen!"; + msg = error.response.data; + } else if (error.request) { + title = "Verbindungsfehler!"; + msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" + console.log(error.request); + } else { + title = "Error"; + msg = error.message; + console.log('Error', error.message); + } + console.log(error.config); + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); + }) } }, validateRankingPoints: function () { @@ -255,7 +256,7 @@ let rps = String(this.computedCache.rankingPoints); return re.test(rps); }, - validateEverything(){ + validateEverything() { return this.validateRankingPoints(); } }, diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue index d9a004d..51e0e0e 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationEdit.vue @@ -1,53 +1,25 @@