From efc6cac18e49cee959026359718f525048164bd7 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 22 Apr 2016 11:58:19 -0700 Subject: [PATCH] UI to show sector coverage maps, #37802 Conflicts: httemplate/browse/tower.html --- FS/FS/tower_sector.pm | 12 +++++++--- httemplate/browse/tower.html | 39 ++++++++++++++++---------------- httemplate/search/elements/gmap.html | 5 ++-- httemplate/search/sector.html | 27 ++++++++++++++++++---- httemplate/search/svc_broadband-map.html | 14 ++++++------ 5 files changed, 62 insertions(+), 35 deletions(-) diff --git a/FS/FS/tower_sector.pm b/FS/FS/tower_sector.pm index 9f5c1abbb..2b0efa3da 100644 --- a/FS/FS/tower_sector.pm +++ b/FS/FS/tower_sector.pm @@ -1,6 +1,7 @@ package FS::tower_sector; use Class::Load qw(load_class); +use File::Path qw(make_path); use Data::Dumper; use strict; @@ -270,13 +271,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, @@ -288,6 +293,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 e2f9fd0bd..ab6be3082 100644 --- a/httemplate/browse/tower.html +++ b/httemplate/browse/tower.html @@ -1,22 +1,23 @@ -<% include( 'elements/browse.html', - 'title' => 'Towers', - 'name' => 'towers', - 'menubar' => [ 'Add a new tower' => - $p.'edit/tower.html', - ], - 'query' => { 'table' => 'tower', }, - 'count_query' => 'SELECT COUNT(*) FROM tower', - 'disableable' => 1, - 'disabled_statuspos' => 1, - 'header' => [ 'Name', 'Location', 'Sectors', ], - 'fields' => [ $tower_sub, - $coord_sub, - $sector_sub, - ], - 'links' => [ ], - 'cell_style' => [ $tagdesc_style ], - ) -%> +<& elements/browse.html, + 'title' => 'Towers', + 'name' => 'towers', + 'menubar' => [ 'Add a new tower' => + $p.'edit/tower.html', + 'Sector coverage maps' => + $p.'search/sector.html', + ], + 'query' => { 'table' => 'tower', }, + 'count_query' => 'SELECT COUNT(*) FROM tower', + 'disableable' => 1, + 'disabled_statuspos' => 1, + 'header' => [ 'Name', 'Location', 'Sectors', ], + 'fields' => [ $tower_sub, + $coord_sub, + $sector_sub, + ], + 'links' => [ ], + 'cell_style' => [ $tagdesc_style ], +&> <%init> die "access denied" 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; }; }; -- 2.11.0