This file contains hidden or 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
(function() { | |
// the constructor. | |
var MapManager = function(googleMap, initialScoreDomain) { | |
self = this; | |
map = googleMap; | |
scoreDomain = initialScoreDomain; | |
}; | |
// public API |
This file contains hidden or 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
<head> | |
<!-- other stuff here ... --> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> | |
<script src="javascripts/raphael.js"></script> | |
<script src="javascripts/swirrl.js"></script> | |
<script src="javascripts/swirrl/map-manager.js"></script> | |
</head> |
This file contains hidden or 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
// public api. | |
MapManager.prototype = { | |
refresh: function() { | |
$(this).trigger('started'); | |
var tiles = getTiles(); | |
getBoundaryData(tiles); | |
} | |
} |
This file contains hidden or 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
// private functions | |
// ... | |
var getBoundaryData = function(tiles) { | |
var noOfTiles = tiles.length; | |
// nothing to do. | |
if(noOfTiles == 0) { |
This file contains hidden or 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
// private variables | |
var map | |
, scoreDomain | |
, boundaryData = {} // map of tiles -> data | |
, self; |
This file contains hidden or 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).bind('boundaryDataRetrieved', function() { | |
refreshPolygons(); | |
}); | |
$(this).bind('dataError', function() { | |
$(this).trigger('finished'); // tell people we're done | |
}); |
This file contains hidden or 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
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
SELECT ?lsoa ?notation ?label ?lat ?long ?score | |
WHERE { | |
GRAPH <http://opendatacommunities.org/id/graph/geography/lsoa> { | |
?lsoa a <http://opendatacommunities.org/def/geography#LSOA> . | |
?lsoa geo:lat ?lat . | |
?lsoa geo:long ?long . | |
?lsoa <http://www.w3.org/2004/02/skos/core#notation> ?notation . |
This file contains hidden or 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
(function() { | |
// the constructor. | |
var MapManager = function(googleMap, initialScoreDomain) { | |
} | |
// public API | |
MapManager.prototype = { | |
} |
This file contains hidden or 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
var MapManager = function(googleMap, initialScoreDomain) { | |
self = this; | |
map = googleMap; | |
scoreDomain = initialScoreDomain; | |
$(this).bind('lsoaDataRetrieved', function() { | |
lsoaDataRetrieved = true; | |
// TODO: this is where we'll refresh the polygons on the map, later. | |
// for now, just log out the lsoa data, and say we've done |
This file contains hidden or 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
MapManager.prototype = { | |
refresh: function() { | |
$(this).trigger('started'); | |
errored = false; | |
// clear these variables for this refresh | |
if (map.getZoom() > minZoom) { | |
$(this).trigger('zoomOK'); | |
var tiles = getTiles(); |