diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-30 01:36:20 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-30 01:36:20 +0100 |
commit | 6db910f24b1c25bb32369fafde79cf0da83abed0 (patch) | |
tree | 05289e963270d6f56f1a962cee929dfa66e89bf1 /perllib/FixMyStreet/Map/OSM.pm | |
parent | 81c55de7598ff15f56de6341727ed46f7f9eed18 (diff) |
Strategy/Format for updating pins as map is panned.
Diffstat (limited to 'perllib/FixMyStreet/Map/OSM.pm')
-rw-r--r-- | perllib/FixMyStreet/Map/OSM.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm index 9b968b4f6..05dc6ad39 100644 --- a/perllib/FixMyStreet/Map/OSM.pm +++ b/perllib/FixMyStreet/Map/OSM.pm @@ -95,6 +95,32 @@ sub display_map { }; } +sub map_pins { + my ($self, $c, $interval) = @_; + + my $bbox = $c->req->param('bbox'); + my ( $min_lon, $min_lat, $max_lon, $max_lat ) = split /,/, $bbox; + + my ( $around_map, $around_map_list, $nearby, $dist ) = + FixMyStreet::Map::map_features_bounds( $c, $min_lon, $min_lat, $max_lon, $max_lat, $interval ); + + # create a list of all the pins + my @pins = map { + # Here we might have a DB::Problem or a DB::Nearby, we always want the problem. + my $p = (ref $_ eq 'FixMyStreet::App::Model::DB::Nearby') ? $_->problem : $_; + #{ + # latitude => $p->latitude, + # longitude => $p->longitude, + # colour => $p->state eq 'fixed' ? 'green' : 'red', + # id => $p->id, + # title => $p->title, + #} + [ $p->latitude, $p->longitude, $p->state eq 'fixed' ? 'green' : 'red', $p->id, $p->title ] + } @$around_map, @$nearby; + + return (\@pins, $around_map_list, $nearby, $dist); +} + sub compass { my ( $x, $y, $z ) = @_; return { |