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-27 13:07:37 -0700
commitefc6cac18e49cee959026359718f525048164bd7 (patch)
tree7af9b7c29952b56aa6fe84cfa2be7ecffb2fcc60
parent1d2db1a7412b886a6120ebd527d6632bff27551d (diff)
UI to show sector coverage maps, #37802
Conflicts: httemplate/browse/tower.html
-rw-r--r--FS/FS/tower_sector.pm12
-rw-r--r--httemplate/browse/tower.html39
-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, 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;
+ }
</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 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;
};
};