From: Mark Wells Date: Fri, 22 Apr 2016 18:58:19 +0000 (-0700) Subject: UI to show sector coverage maps, #37802 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=bc34518143fe485eec412e709271e681a1e41aac UI to show sector coverage maps, #37802 --- diff --git a/FS/FS/tower_sector.pm b/FS/FS/tower_sector.pm index 8b4c2221a..3fadc8685 100644 --- a/FS/FS/tower_sector.pm +++ b/FS/FS/tower_sector.pm @@ -2,6 +2,7 @@ package FS::tower_sector; use base qw( FS::Record ); use Class::Load qw(load_class); +use File::Path qw(make_path); use Data::Dumper; use strict; @@ -253,13 +254,17 @@ PARAMS must include 'sectornum'. sub process_generate_coverage { my $job = shift; my $param = shift; - warn Dumper($param); - $job->update_statustext('0,generating map'); + $job->update_statustext('0,generating map') if $job; my $sectornum = $param->{sectornum}; - my $sector = FS::tower_sector->by_key($sectornum); + my $sector = FS::tower_sector->by_key($sectornum) + or die "sector $sectornum does not exist"; my $tower = $sector->tower; load_class('Map::Splat'); + # since this is still experimental, put it somewhere we can find later + my $workdir = "$FS::UID::cache_dir/cache.$FS::UID::datasrc/" . + "generate_coverage/sector$sectornum-". time; + make_path($workdir); my $splat = Map::Splat->new( lon => $tower->longitude, lat => $tower->latitude, @@ -271,6 +276,7 @@ sub process_generate_coverage { v_width => $sector->v_width, max_loss => $sector->margin, min_loss => $sector->margin - 80, + dir => $workdir, ); $splat->calculate; diff --git a/httemplate/browse/tower.html b/httemplate/browse/tower.html index c8812e57b..16e44c6c0 100644 --- a/httemplate/browse/tower.html +++ b/httemplate/browse/tower.html @@ -3,6 +3,8 @@ 'name' => 'towers', 'menubar' => [ 'Add a new tower' => $p.'edit/tower.html', + 'Sector coverage maps' => + $p.'search/sector.html', 'Download CSV for towercoverage.com' => $p.'misc/tower-export.html?format=tc' ], diff --git a/httemplate/search/elements/gmap.html b/httemplate/search/elements/gmap.html index 632a32338..b7d135dd6 100644 --- a/httemplate/search/elements/gmap.html +++ b/httemplate/search/elements/gmap.html @@ -26,7 +26,7 @@ Generic Google Maps front end. }, # end of feature ], overlays => [ - { url => 'https://localhost/freeside/view/sector_overlay-png.html?102', + { url => 'https://localhost/freeside/view/sector_map-png.html?102', west => -130.0, east => -128.0, south => 10.0, @@ -85,7 +85,7 @@ var featureStyle = function(feature) { }; var map; -var overlays; +var overlays = []; function initMap() { var canvas = $('#map_canvas'); map = new google.maps.Map(canvas[0], { zoom: 6 }); @@ -133,6 +133,7 @@ function initMap() { delete x.url; var overlay = new google.maps.GroundOverlay( url, x ); overlay.setMap(map); + overlay.setOpacity(0.4); overlays.push(overlay); }); } diff --git a/httemplate/search/sector.html b/httemplate/search/sector.html index d03963237..037df10ea 100644 --- a/httemplate/search/sector.html +++ b/httemplate/search/sector.html @@ -11,8 +11,24 @@ font-weight: bold; color: green; } + .grid th { + padding-left: 3px; + padding-right: 3px; + padding-bottom: 2px; + border: none; + empty-cells: show; + font-size:90%; + border-bottom: 1px solid #999999; + } + .grid td { + padding-left: 3px; + padding-right: 3px; + padding-bottom: 2px; + border: none; + empty-cells: show; + } - +
@@ -20,9 +36,10 @@ +% my $row = 0; % foreach my $sector (@sectors) { % my $sectornum = $sector->sectornum; - + +% $row++; % } # foreach $sector
Tower / sector
<% $sector->description |h %> @@ -47,7 +64,8 @@ 'create_'.$sectornum, [ 'sectornum' ], $fsurl.'misc/sector-create_map.html', - { 'message' => 'Map generated' }, + { 'message' => 'Map generated', + 'url' => $cgi->self_url }, "sector$sectornum" &> @@ -58,11 +76,12 @@ % if ( length($sector->image) > 0 ) { - View map + View map—<% $sector->margin %>dB margin % }
diff --git a/httemplate/search/svc_broadband-map.html b/httemplate/search/svc_broadband-map.html index 64a7f98de..fe3c0950b 100755 --- a/httemplate/search/svc_broadband-map.html +++ b/httemplate/search/svc_broadband-map.html @@ -148,13 +148,13 @@ foreach my $tower (values(%towers)) { my @overlays; foreach my $sector (values %sectors) { if ( length($sector->image) > 0 ) { - push @overlays, - { url => $fsurl.'view/sector_map-png.cgi?' . $sector->sectornum, - west => $sector->west, - east => $sector->east, - south => $sector->south, - north => $sector->north, - }; + my $o = { + url => $fsurl.'view/sector_map-png.cgi?' . $sector->sectornum + }; + foreach (qw(south north west east)) { + $o->{$_} = $sector->get($_) + 0; + } + push @overlays, $o; }; };