Skip to content

Instantly share code, notes, and snippets.

@RicSwirrl
Created January 19, 2012 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RicSwirrl/1639783 to your computer and use it in GitHub Desktop.
Save RicSwirrl/1639783 to your computer and use it in GitHub Desktop.
MapManager Constructor
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
window.swirrl.log(lsoaData);
$(self).trigger('finished');
});
// if there was an error getting any data, finish the request,
// but don't remember the tiles ... so we can try again next time.
$(this).bind('dataError', function() {
// we only want to do this once -
// but getting boundaries or lsoa data (sparql) could raise this
if (!errored) {
errored = true;
window.swirrl.log('data error!');
prevTiles = []; // blank out the prevTiles
$(this).trigger('finished'); // tell people we're done
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment