-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Frontend: Style changes and usability
- Loading branch information
Showing
9 changed files
with
208 additions
and
69 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<template> | ||
<div class="pt-4"> | ||
<div id="map-home" class="shadow"></div> | ||
</div> | ||
</template> | ||
<style> | ||
#map-home { | ||
height: calc(100vh - 125px); | ||
} | ||
</style> | ||
|
||
<script> | ||
import 'ol/ol.css'; | ||
import {fromLonLat} from 'ol/proj'; | ||
import Map from 'ol/Map.js'; | ||
import View from 'ol/View.js'; | ||
import Draw from 'ol/interaction/Draw.js'; | ||
import {Tile as TileLayer, Vector as VectorLayer} from 'ol/layer.js'; | ||
import {OSM, Vector as VectorSource} from 'ol/source.js'; | ||
import {Feature} from "ol"; | ||
import Circle from "ol/geom/Circle"; | ||
export default { | ||
data() { | ||
return { | ||
locations: [] | ||
} | ||
}, | ||
computed: { | ||
id() { | ||
return this.$route.params.id; | ||
} | ||
}, | ||
methods: { | ||
setupMap() | ||
{ | ||
var raster = new TileLayer({ | ||
source: new OSM() | ||
}); | ||
var source = new VectorSource({wrapX: false}); | ||
var vector = new VectorLayer({ | ||
source: source | ||
}); | ||
var map = new Map({ | ||
layers: [raster, vector], | ||
target: 'map-home', | ||
view: new View({ | ||
center: [-11000000, 4600000], | ||
zoom: 4 | ||
}) | ||
}); | ||
for (let i = 0; i < this.locations.length; i++) { | ||
let loc = this.locations[i]; | ||
let lon = parseFloat(loc.long); | ||
let lat = parseFloat(loc.lat); | ||
let radius = parseFloat(loc.radius); | ||
let coordinate = fromLonLat([lon, lat]); | ||
source.addFeature(new Feature(new Circle(coordinate, radius))); | ||
} | ||
} | ||
}, | ||
mounted() { | ||
fetch('/locations.json') | ||
.then((response) => { | ||
return response.json(); | ||
}) | ||
.then((data) => { | ||
this.locations = data; | ||
this.setupMap(); | ||
}); | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.