Commit 1ccd0ed4 authored by jkerr's avatar jkerr
Browse files

Added buttons to map, still need listeners

parent 4b8cd313
var Map = (function () {
pub = {};
var map;;
var map;
/** Setup Function **/
pub.setup = function() {
map = L.map('map').setView([-45.858578, 170.527263], 17.45);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
......@@ -11,35 +13,37 @@ var Map = (function () {
"OpenStreetMap contributors</a> CC-BY-SA"
}).addTo(map);
/** Adds buttons above map **/
$("#mapContainer").prepend("<button id='mapShowAll'>Show All</button>" +
"<button id='mapShowRes'>Show Restaurants</button>" +
"<button id='mapShowAttr'>Show Attractions</button>");
// NEED TO ADD EVENTS TO BUTTONS HERE
drawIcons("all");
}
/** Draws all icons of given type to map, of all if "all" is given **/
function drawIcons(type) {
$.getJSON("scripts/data/POI.json", function(data) {
for (i = 0; i < data.features.length; i++) {
cFeature = data.features[i];
geo = cFeature.geometry;
properties = cFeature.properties;
type = cFeature.type;
cType = cFeature.type;
createMarker(geo, properties);
console.log("Feature "+i+":");
console.log("Geometry: ");
console.log(geo);
console.log("Properties:");
console.log(properties);
console.log("Type:");
console.log(type);
console.log("------------------");
if (type === "all" || cType === type || cType === "camp") {
createMarker(geo, properties);
}
}
});
centralMarker = L.marker([170.5153065919876,-45.90540437585189]).addTo(map);
map.on("click", onMapClick);
map.on("click", onMapClick); // NEEDS REMOVED!!!
}
/** Creates a marker with given geo and properties data **/
function createMarker(geo, properties) {
marker = L.marker(geo.coordinates).addTo(map);
if (geo.polygon === true) {
......
......@@ -39,7 +39,7 @@
/* Header & Header bar Elements*/
html {
background-color: var(--white);
min-width: 780px;
min-width: 950px;
}
body {
margin: 0;
......@@ -114,9 +114,12 @@ h1 a:hover {
main {
overflow: hidden;
width: auto;
margin: 30px;
border: solid 1px;
padding: 20px;
margin: auto;
max-width: 1300px;
/*Style*/
background-color: var(--lightblue);
}
......@@ -141,7 +144,6 @@ main section {
margin: 0;
}
#placedinfo p {
font-family: Quicksand, serif;
margin: 0;
}
/* Booking form*/
......@@ -190,7 +192,7 @@ main section {
overflow: hidden;
}
#map {
height: 100%;
height: 500px;
}
#foundBox {
background-color: var(--white);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment