-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathxcplan_uk.js
More file actions
105 lines (96 loc) · 2.63 KB
/
xcplan_uk.js
File metadata and controls
105 lines (96 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
'use strict';
function getPoints() {
$.getJSON("getbgapoints.php", function(data) {
tpinfo = data;
maketps();
});
}
function zoomTo(tpval) {
var i;
var length=tpval.length;
var list=[];
tpval=tpval.toUpperCase();
for(i =0;i < tpinfo.length; i++) {
if(tpinfo[i].trigraph.substr(0,3).toUpperCase()===tpval) {
list.push(tpinfo[i]);
}
}
if(list.length===0) {
alert("Turning point not found");
}
else {
map.panTo({lat:list[0].latitude,lng: list[0].longitude});
map.setZoom(12);
}
}
function getAirspace() {
var i;
var newPolypts = [];
var newPolybases = [];
var newCircles = [];
var newCirclebases = [];
var clipalt = $('#airclip').val();
var j;
$.post("localairspace.php", {
country: "uk"
},
function(data, status) {
if (status === "success") {
for (i = 0; i < data.polygons.length; i++) {
airspacePolygons[i] = new google.maps.Polygon(airDrawOptions);
airspacePolygons[i].setPaths(data.polygons[i].coords);
polygonBases[i] = data.polygons[i].base;
}
for (j = 0; j < data.circles.length; j++) {
airspaceCircles[j] = new google.maps.Circle(airDrawOptions);
airspaceCircles[j].setRadius(1000 * data.circles[j].radius);
airspaceCircles[j].setCenter(data.circles[j].centre);
circleBases[j] = data.circles[j].base;
}
changeBase();
}
}, "json");
}
$(document).ready(function() {
var myStyles = [{
"featureType": "poi",
"elementType": "labels",
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "transit",
"elementType": "labels",
"stylers": [{
"visibility": "off"
}]
}];
var mapOpt = {
center: new google.maps.LatLng(53.5, -1),
zoom: 7,
maxZoom: 18,
mapTypeId: google.maps.MapTypeId.TERRAIN,
streetViewControl: false,
styles: myStyles
};
map = new google.maps.Map($('#map').get(0), mapOpt);
makeTpMarkers();
map.addListener('idle', function() {
if (labelsShowing) {
showLabels();
}
});
$('#acceptor').click(function() {
$('#disclaimer').hide();
getAirspace();
getPoints();
$('.printbutton').prop("disabled", true);
$('#maincontrol').show();
});
$('#help').click(function() {
window.open("ukplanhelp.html", "_blank");
});
$('#about').click(function() {
window.open("ukplanabout.html", "_blank");
});
});