diff options
Diffstat (limited to 'perllib/FixMyStreet/Map')
-rw-r--r-- | perllib/FixMyStreet/Map/OSM.pm | 26 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Tilma/Original.pm | 10 |
2 files changed, 35 insertions, 1 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 { diff --git a/perllib/FixMyStreet/Map/Tilma/Original.pm b/perllib/FixMyStreet/Map/Tilma/Original.pm index 6fa854cb2..0baa82011 100644 --- a/perllib/FixMyStreet/Map/Tilma/Original.pm +++ b/perllib/FixMyStreet/Map/Tilma/Original.pm @@ -96,7 +96,15 @@ sub display_pin { } sub map_pins { - my ($self, $c, $x, $y, $sx, $sy, $interval) = @_; + my ($self, $c, $interval) = @_; + + # Our current X/Y middle of visible map + my $x = ( $c->req->param('x') || 0 ) + 0; + my $y = ( $c->req->param('y') || 0 ) + 0; + + # Where we started as that's the (0,0) we have to work to + my $sx = ( $c->req->param('sx') || 0 ) + 0; + my $sy = ( $c->req->param('sy') || 0 ) + 0; my $e = tile_to_os($x); my $n = tile_to_os($y); |