summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-04-22 11:58:19 -0700
committerMark Wells <mark@freeside.biz>2016-04-26 12:21:55 -0700
commit50e995d8cac4bd4de8e254d7f8f1e885e9ef242e (patch)
tree98f2388bbccc7cf9d3672d38608144d6b86c0470
parentdbc1708a990566955eefe3437eb97a1340904f65 (diff)
UI to show sector coverage maps, #37802
-rw-r--r--FS/FS/tower_sector.pm12
-rw-r--r--httemplate/browse/tower.html2
-rw-r--r--httemplate/search/elements/gmap.html5
-rw-r--r--httemplate/search/sector.html27
-rwxr-xr-xhttemplate/search/svc_broadband-map.html14
5 files changed, 44 insertions, 16 deletions
diff --git a/FS/FS/tower_sector.pm b/FS/FS/tower_sector.pm
index 8b4c222..3fadc86 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 c8812e5..16e44c6 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 632a323..b7d135d 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 d039632..037df10 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;
+ }
</style>
-<table class="grid">
+<table class="grid" style="border-spacing: 0px">
<thead>
<tr>
<th>Tower / sector</th>
@@ -20,9 +36,10 @@
</tr>
</thead>
<tbody>
+% my $row = 0;
% foreach my $sector (@sectors) {
% my $sectornum = $sector->sectornum;
- <tr>
+ <tr class="row<% $row % 2 %>">
<td>
<a href="<% $fsurl %>edit/tower.html?<% $sector->towernum |h %>">
<% $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"
&>
<a class="createmap" href="#" onclick="sector<% $sectornum %>process()">
@@ -58,11 +76,12 @@
<td>
% if ( length($sector->image) > 0 ) {
<a class="viewmap" href="<% $fsurl %>search/svc_broadband-map.html?sectornum=<% $sectornum %>">
- View map
+ View map&mdash;<% $sector->margin %>dB margin
</a>
% }
</td>
</tr>
+% $row++;
% } # foreach $sector
</tbody>
</table>
diff --git a/httemplate/search/svc_broadband-map.html b/httemplate/search/svc_broadband-map.html
index 64a7f98..fe3c095 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;
};
};