Skip to content
Snippets Groups Projects
Commit 664083a6 authored by Jakob Severin Steffensen Hjelseth's avatar Jakob Severin Steffensen Hjelseth
Browse files

Merge branch '17-tin' into 'dev'

Resolve "TIN"

See merge request !49
parents 33f0501c cc95c520
No related branches found
No related tags found
2 merge requests!50Dev,!49Resolve "TIN"
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</div> </div>
<div id="buttons2" class="box2" style="display: none;"> <div id="buttons2" class="box2" style="display: none;">
<p style="width: 32vw;"></p> <p style="width: 32vw;"></p>
<button class="button">TIN</button> <button class="button" onclick="TIN()">TIN</button>
<button class="button" onclick="voronoi()">Voronoi</button> <button class="button" onclick="voronoi()">Voronoi</button>
</div> </div>
</div> </div>
...@@ -277,6 +277,7 @@ ...@@ -277,6 +277,7 @@
<script src="javascript/extract.js"></script> <script src="javascript/extract.js"></script>
<script src="javascript/mapChange.js"></script> <script src="javascript/mapChange.js"></script>
<script src="javascript/voronoi.js"></script> <script src="javascript/voronoi.js"></script>
<script src="javascript/tin.js"></script>
<!-- Imported js --> <!-- Imported js -->
<!-- <script src="https://unpkg.com/shpjs@latest/dist/shp.js"></script> --> <!-- <script src="https://unpkg.com/shpjs@latest/dist/shp.js"></script> -->
......
...@@ -23,6 +23,36 @@ var points = { ...@@ -23,6 +23,36 @@ var points = {
"name": "NTNU Dragvoll" "name": "NTNU Dragvoll"
} }
}, },
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.388918, 63.4203714]
},
"properties": {
"name": "NTNU Øya"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.4347967, 63.4235678]
},
"properties": {
"name": "NTNU Tyholt"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.4143153, 63.433756]
},
"properties": {
"name": "NTNU Solsiden"
}
},
{ {
"type": "Feature", "type": "Feature",
"geometry": { "geometry": {
...@@ -32,6 +62,106 @@ var points = { ...@@ -32,6 +62,106 @@ var points = {
"properties": { "properties": {
"name": "NTNU Moholt" "name": "NTNU Moholt"
} }
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.4032871, 63.4340888]
},
"properties": {
"name": "NTNU Olavskvartalet"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.4071882, 63.4107064]
},
"properties": {
"name": "NTNU Lerkendal og Valgrinda"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.3861107, 63.4288662]
},
"properties": {
"name": "NTNU Kalvskinnet"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.4540302, 63.4473022]
},
"properties": {
"name": "NTNU Ringve"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.3483128, 63.4415347]
},
"properties": {
"name": "NTNU Heggdalen"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.4492127, 63.4521411]
},
"properties": {
"name": "NTNU Østmarka"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.3981586, 63.4373727]
},
"properties": {
"name": "NTNU Brattørkaia"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.3992594, 63.4152944]
},
"properties": {
"name": "NTNU Elgeseter"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.4837531, 63.4393659]
},
"properties": {
"name": "NTNU Rotvoll"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.4660445, 63.42338]
},
"properties": {
"name": "NTNU Tunga"
}
} }
] ]
}; };
...@@ -92,6 +222,9 @@ function changeMap() { ...@@ -92,6 +222,9 @@ function changeMap() {
if (isVoronoi) { if (isVoronoi) {
voronoi(); voronoi();
} }
if (isTIN) {
TIN();
}
// Legger til kartlagene som lå i kartet før en byttet kartmodus: // Legger til kartlagene som lå i kartet før en byttet kartmodus:
while (layersOnMap.length > 0) { while (layersOnMap.length > 0) {
......
// Variabler:
var isTIN = false // Vises TIN'et i kartet?
// Selve TIN'et:
var TINPolygons = turf.tin(NTNU_points.toGeoJSON());
var TINGeoJSON = L.geoJSON(TINPolygons, {style: {"color": "orangered"}});
function TIN() {
if (isTIN) {
map.removeLayer(TINGeoJSON);
isTIN = false;
} else {
TINGeoJSON.addTo(map);
isTIN = true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment