Skip to content
This repository was archived by the owner on Dec 6, 2019. It is now read-only.

Commit 9a5acdc

Browse files
Nabeel Shahzadnabeelio
authored andcommitted
Update acars map
1 parent c4d535d commit 9a5acdc

File tree

6 files changed

+277
-282
lines changed

6 files changed

+277
-282
lines changed

core/app.config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
# Google Map Options
101101
Config::Set('MAP_WIDTH', '800px');
102102
Config::Set('MAP_HEIGHT', '600px');
103-
Config::Set('MAP_TYPE', 'G_PHYSICAL_MAP');
103+
Config::Set('MAP_TYPE', 'OpenStreetMap.Mapnik');
104104
Config::Set('MAP_LINE_COLOR', '#ff0000');
105105
Config::Set('MAP_CENTER_LAT', '45.484400');
106106
Config::Set('MAP_CENTER_LNG', '-62.334821');

core/classes/ezdb/ezdb.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,16 @@ public static function init($type='mysqli')
8888
{
8989
$class_name = strtolower('ezdb_'.$type);
9090
include dirname(__FILE__).DIRECTORY_SEPARATOR.$class_name.'.class.php';
91-
91+
9292
if(!self::$DB = new $class_name())
9393
{
9494
self::$error = self::$DB->error;
9595
self::$errno = self::$DB->errno;
96-
96+
9797
return false;
9898
}
99-
99+
100+
self::set_caching(Config::Get('DBASE_USE_CACHE'));
100101
return true;
101102
}
102103

core/templates/acarsmap.tpl

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,6 @@
2020
* table.acarsmap tbody tr.odd { }
2121
*/
2222
?>
23-
<script type="text/javascript">
24-
<?php
25-
/* These are the settings for the Google map. You can see the
26-
Google API reference if you want to add more options.
27-
28-
There's two options I've added:
29-
30-
autozoom: This will automatically center in on/zoom
31-
so all your current flights are visible. If false,
32-
then the zoom and center you specify will be used instead
33-
34-
refreshTime: Time, in seconds * 1000 to refresh the map.
35-
The default is 10000 (10 seconds)
36-
*/
37-
?>
38-
var acars_map_defaults = {
39-
autozoom: true,
40-
zoom: 4,
41-
center: new google.maps.LatLng("<?php echo Config::Get('MAP_CENTER_LAT'); ?>", "<?php echo Config::Get('MAP_CENTER_LNG'); ?>"),
42-
mapTypeId: google.maps.MapTypeId.TERRAIN,
43-
refreshTime: 10000
44-
};
45-
</script>
4623
<div class="mapcenter" align="center">
4724
<div id="acarsmap" style="width:<?php echo Config::Get('MAP_WIDTH');?>; height: <?php echo Config::Get('MAP_HEIGHT')?>"></div>
4825
</div>
@@ -64,7 +41,8 @@ var acars_map_defaults = {
6441
</thead>
6542
<tbody id="pilotlist"></tbody>
6643
</table>
67-
<script type="text/javascript" src="<?php echo fileurl('/lib/js/acarsmap.js');?>"></script>
44+
<script src="<?php echo SITE_URL?>/lib/js/base_map.js"></script>
45+
<script src="<?php echo SITE_URL?>/lib/js/acarsmap.js"></script>
6846
<?php
6947
/* This is the template which is used in the table above, for each row.
7048
Be careful modifying it. You can simply add/remove columns, combine
@@ -155,3 +133,29 @@ var acars_map_defaults = {
155133
<% } %>
156134
</span>
157135
</script>
136+
<script type="text/javascript">
137+
<?php
138+
/* These are the settings for the Google map. You can see the
139+
Google API reference if you want to add more options.
140+
141+
There's two options I've added:
142+
143+
autozoom: This will automatically center in on/zoom
144+
so all your current flights are visible. If false,
145+
then the zoom and center you specify will be used instead
146+
147+
refreshTime: Time, in seconds * 1000 to refresh the map.
148+
The default is 10000 (10 seconds)
149+
*/
150+
?>
151+
const opts = {
152+
render_elem: 'acarsmap',
153+
provider: '<?php echo Config::Get("MAP_TYPE"); ?>',
154+
autozoom: true,
155+
zoom: 5,
156+
center: L.latLng("<?php echo Config::Get('MAP_CENTER_LAT'); ?>", "<?php echo Config::Get('MAP_CENTER_LNG'); ?>"),
157+
refreshTime: 10000
158+
};
159+
160+
renderAcarsMap(opts);
161+
</script>

core/templates/route_map.tpl

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,19 @@ if(isset($schedule))
6969
7070
const map = createMap({
7171
render_elem: 'routemap',
72+
provider: '<?php echo Config::Get("MAP_TYPE"); ?>',
7273
});
7374
7475
const depCoords = L.latLng(<?php echo $mapdata->deplat?>, <?php echo $mapdata->deplng;?>);
7576
const depMarker = L.marker(depCoords, {
76-
icon: L.icon({ iconUrl: depicon, iconSize: [35, 35] })
77+
icon: MapFeatures.icons.departure,
7778
}).bindPopup("<?php echo $mapdata->depname;?>").addTo(map);
7879
7980
const arrCoords = L.latLng(<?php echo $mapdata->arrlat?>, <?php echo $mapdata->arrlng;?>);
8081
const arrMarker = L.marker(arrCoords, {
81-
icon: L.icon({ iconUrl: arricon, iconSize: [35, 35] })
82+
icon: MapFeatures.icons.arrival,
8283
}).bindPopup("<?php echo $mapdata->arrname;?>").addTo(map);
8384
84-
const icon_vor = L.icon({
85-
iconUrl: "<?php echo fileurl('/lib/images/icon_vor.png') ?>",
86-
iconSize: [19, 20],
87-
})
88-
const icon_fix = L.icon({
89-
iconUrl: "<?php echo fileurl('/lib/images/icon_fix.png') ?>",
90-
iconSize: [12, 15],
91-
})
92-
9385
// for drawing the line
9486
let points = [];
9587
points.push(depCoords);
@@ -98,9 +90,9 @@ points.push(depCoords);
9890
if(is_array($mapdata->route_details)) {
9991
foreach($mapdata->route_details as $route) {
10092
if($route->type == NAV_VOR)
101-
$icon = 'icon_vor';
93+
$icon = 'MapFeatures.icons.vor';
10294
else
103-
$icon = 'icon_fix';
95+
$icon = 'MapFeatures.icons.fix';
10496
10597
// Build info array for the bubble
10698
?>

0 commit comments

Comments
 (0)