aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Map/Tilma/OpenLayers.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-05-25 18:08:04 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-05-25 18:08:04 +0100
commit2e8794adaa69ea258b568b67b284eb143081b0cd (patch)
tree345a604e471df294c8201ba858446450969297f4 /perllib/FixMyStreet/Map/Tilma/OpenLayers.pm
parent349dd7c35e2ad5d1cef4c8e4a023ec3b17dd8d80 (diff)
Template the rest of the maps. Some more complete than others.
Diffstat (limited to 'perllib/FixMyStreet/Map/Tilma/OpenLayers.pm')
-rw-r--r--perllib/FixMyStreet/Map/Tilma/OpenLayers.pm44
1 files changed, 44 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Map/Tilma/OpenLayers.pm b/perllib/FixMyStreet/Map/Tilma/OpenLayers.pm
new file mode 100644
index 000000000..96d0975f2
--- /dev/null
+++ b/perllib/FixMyStreet/Map/Tilma/OpenLayers.pm
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+#
+# FixMyStreet:Map::Tilma::1_10k_OL
+# Using tilma.mysociety.org with OpenLayers
+#
+# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
+
+package FixMyStreet::Map::Tilma::OpenLayers;
+
+use strict;
+
+sub TILE_WIDTH() { return $FixMyStreet::Map::map_class->tile_width; }
+sub SCALE_FACTOR() { return $FixMyStreet::Map::map_class->scale_factor; }
+sub TILE_TYPE() { return $FixMyStreet::Map::map_class->tile_type; }
+
+sub header_js {
+ return '
+<script type="text/javascript" src="/jslib/OpenLayers-2.10/OpenLayers.js"></script>
+<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
+<script type="text/javascript" src="/js/map-tilma-ol.js"></script>
+<script type="text/javascript" src="/js/OpenLayers.Projection.OrdnanceSurvey.js"></script>
+';
+}
+
+# display_map C PARAMS
+# PARAMS include:
+# latitude, longitude for the centre point of the map
+# TYPE is 1 if the map is clickable, 0 otherwise.
+# PINS is array of pins to show, location and colour
+sub display_map {
+ my ($self, $c, %params) = @_;
+ $c->stash->{map} = {
+ %params,
+ type => 'tilma/openlayers',
+ tile_type => TILE_TYPE,
+ tilewidth => TILE_WIDTH,
+ watermark => $self->watermark(),
+ copyright => $self->copyright(),
+ maxResolution => SCALE_FACTOR / TILE_WIDTH,
+ };
+}
+
+1;