summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-03-25 22:05:10 +0100
committerPeter Wu <peter@lekensteyn.nl>2015-03-25 22:05:10 +0100
commite590c206013bef0d991fa3e187b161f194323653 (patch)
tree274252f58b695d109b8c113ecc97a7d434836735 /js
parent1e05ce0dd20a627183b7fa0db95d8b74e600ee63 (diff)
downloadsite-e590c206013bef0d991fa3e187b161f194323653.tar.gz
Start with campus map
Diffstat (limited to 'js')
-rw-r--r--js/campus-coords.js78
-rw-r--r--js/campus.js39
2 files changed, 117 insertions, 0 deletions
diff --git a/js/campus-coords.js b/js/campus-coords.js
new file mode 100644
index 0000000..798bf69
--- /dev/null
+++ b/js/campus-coords.js
@@ -0,0 +1,78 @@
+define(function() {
+ 'use strict';
+ return [
+ {
+ "name": "Sportpark",
+ "coords": [
+ [355,134],
+ [355,221],
+ [648,221],
+ [648,134]
+ ]
+ }, {
+ "name" : "Zwarte doos",
+ "coords": [
+ [297,647],
+ [321,647],
+ [321,666],
+ [304,666],
+ [304,659],
+ [297,659],
+ ]
+ }, {
+ "name": "Metaforum",
+ "coords": [
+ [453,492],
+ [512,492],
+ [512,607],
+ [453,607],
+ ]
+ }, {
+ "name": "Auditorium",
+ "coords": [
+ [278,496],
+ [278,528],
+ [281,528],
+ [281,540],
+ [343,540],
+ [343,531],
+ [345,531],
+ [345,518],
+ [348,518],
+ [348,513],
+ [345,513],
+ [345,507],
+ [343,507],
+ [343,496],
+ [331,496],
+ [331,488],
+ [329,488],
+ [329,496],
+ ]
+ }, {
+ "name": "Hoofdgebouw",
+ "coords": [
+ [400,454],
+ [400,482],
+ [387,482],
+ [387,510],
+ [397,510],
+ [397,528],
+ [391,528],
+ [391,558],
+ [401,558],
+ [401,587],
+ [416,587],
+ [416,558],
+ [429,558],
+ [429,528],
+ [419,528],
+ [419,519],
+ [429,519],
+ [430,482],
+ [416,482],
+ [416,454],
+ ]
+ }
+ ];
+});
diff --git a/js/campus.js b/js/campus.js
new file mode 100644
index 0000000..941d5bb
--- /dev/null
+++ b/js/campus.js
@@ -0,0 +1,39 @@
+define(['campus-coords', 'd3'], function(coords, d3) {
+ 'use strict';
+
+ var imageUrl = 'images/campus.jpg';
+
+ function initSvg(svg) {
+ svg
+ .attr('width', 1280)
+ .attr('height', 893);
+
+ svg.append('image')
+ .attr('xlink:href', imageUrl)
+ .attr('width', 1280)
+ .attr('height', 893);
+
+ svg.append('g')
+ .selectAll('polygon')
+ .data(coords)
+ .enter()
+ .append('a')
+ .attr('xlink:href', function(d) {
+ return '#/campus/' + d.name;
+ })
+ .append('polygon')
+ .attr('class', 'building')
+ .attr('points', function(d) {
+ return d.coords.join(' ');
+ })
+ .append('title')
+ .text(function(d) {
+ return d.name;
+ });
+ }
+
+ return function() {
+ var svg = d3.select('#campus-map').append('svg');
+ initSvg(svg);
+ };
+});