aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Map/Bing.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@balti.ukcod.org.uk>2011-01-05 20:13:55 +0000
committerMatthew Somerville <matthew@balti.ukcod.org.uk>2011-01-05 20:13:55 +0000
commit7f834105f3ec090b7e8827460fee4847a65a03c7 (patch)
treec70ff9bb41af2799d3140120328e3481c0be99dd /perllib/FixMyStreet/Map/Bing.pm
parent30e74ddfb745b11a387baf61451f18eb7ba94808 (diff)
Prototype Bing stuff.
Diffstat (limited to 'perllib/FixMyStreet/Map/Bing.pm')
-rw-r--r--perllib/FixMyStreet/Map/Bing.pm71
1 files changed, 71 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Map/Bing.pm b/perllib/FixMyStreet/Map/Bing.pm
new file mode 100644
index 000000000..8446a10fd
--- /dev/null
+++ b/perllib/FixMyStreet/Map/Bing.pm
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+#
+# FixMyStreet:Map::Bing
+# Bing maps on FixMyStreet.
+#
+# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
+
+package FixMyStreet::Map;
+
+use strict;
+use mySociety::GeoUtil;
+use mySociety::Web qw(ent);
+
+sub header_js {
+ return '
+<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script>
+<script type="text/javascript" src="/js/map-bing.js"></script>
+';
+}
+
+# display_map Q PARAMS
+# PARAMS include:
+# EASTING, NORTHING for the centre point of the map
+# TYPE is 1 if the map is clickable, 2 if clickable and has a form upload,
+# 0 if not clickable
+# PINS is array of pins to show, location and colour
+# PRE/POST are HTML to show above/below map
+sub display_map {
+ my ($q, %params) = @_;
+ $params{pre} ||= '';
+ $params{post} ||= '';
+
+ foreach my $pin (@{$params{pins}}) {
+ }
+
+ my $out = FixMyStreet::Map::header($q, $params{type});
+ my ($lat, $lon) = mySociety::GeoUtil::national_grid_to_wgs84($params{easting}, $params{northing}, 'G');
+ my $copyright = _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010.');
+ $out .= <<EOF;
+<script type="text/javascript">
+var fixmystreet = {
+ 'lat': $lat,
+ 'lon': $lon
+}
+</script>
+<div id="map_box">
+ $params{pre}
+ <div id="map"></div>
+ <p id="copyright">$copyright</p>
+ $params{post}
+</div>
+<div id="side">
+EOF
+ return $out;
+}
+
+sub display_map_end {
+ my ($type) = @_;
+ my $out = '</div>';
+ $out .= '</form>' if ($type);
+ return $out;
+}
+
+sub display_pin {
+}
+
+sub map_pins {
+}
+
+1;