-
Notifications
You must be signed in to change notification settings - Fork 1
/
picker.js
executable file
·231 lines (210 loc) · 6.07 KB
/
picker.js
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/*
jQuery Document ready
*/
var map;
var flightPlanCoordinates;
var flightPath;
var markeri;
var markerf;
var myinitial;
var mylast;
var sended;
var sendst;
var tempini;
var tempend;
var newini;
var newend;
var calendar_output;
sendnrecieve();
function initp()
{
calendar_output = document.getElementById('date').value;
calendar_output = calendar_output.replace(" - "," * ")
calendar_output = calendar_output.split("*");
calendar_startdate = calendar_output[0];
calendar_enddate = calendar_output[1];
return[calendar_startdate,calendar_enddate]
};
function sendnrecieve(){
results = initp();
tempini = results[0];
tempend = results[1];
setInterval(function(){
results = initp();
newini = results[0];
newend = results[1];
if(newini!= tempini || newend!= tempend){
if(newini != tempini){
tempini = newini;
}else{
tempend = newend;
}
remake(newini,newend);
}
},1000);
}
function remake(param1,param2){
$.ajax({
url: 'php/readdates.php', //This is the current doc
type: "POST",
data: ({init: param1,end:param2}),
success: function(coordinates){
var entiredata = coordinates.split("*");
var coorC = [];
var latC = [];
var lonC = [];
var dateC = [];
var timeC = [];
var positionC = [];
for(i=0;i<entiredata.length;i++){
coorC = entiredata[i].split(" ");
latC.push(coorC[0]);
lonC.push(coorC[1]);
dateC.push(coorC[2]);
timeC.push(coorC[3]);
positionC.push(coorC[4]);
}
delete latC[latC.length-1];
delete lonC[lonC.length-1];
delete dateC[dateC.length-1];
delete timeC[timeC.length-1];
map.setOptions({styles: styles['retro']});7
var myLatLng = new google.maps.LatLng(latC[Math.round((latC.length - 2) / 2)],lonC[Math.round((lonC.length - 2) / 2)]);
var myOptions = {
scrollwheel: true,
draggable: true,
//disableDefaultUI: true,
mapTypeControl: false,
scaleControl: true,
zoomControl: true,
center:myLatLng,
zoom: 17
};
//Edit BLACK Polyline
flightPlanCoordinates = [{lat:Number(latC[latC.length-2]),lng:Number(lonC[latC.length-2])}];
for(i=1;i<latC.length-1;i++){
flightPlanCoordinates.push({lat:Number(latC[(latC.length-2)-i]),lng:Number(lonC[(latC.length-2)-i])});
}
flightBlack.setPath(flightPlanCoordinates);
// Locate initial point
myinitial = new google.maps.LatLng(latC[latC.length-2],lonC[latC.length-2]);
markeri.setPosition(myinitial);
//Locate last point
mylast = new google.maps.LatLng(latC[0],lonC[0]) ;
markerf.setPosition(mylast);
}
});
}
var styles = {
default: null,
retro: [
{elementType: 'geometry', stylers: [{color: '#ebe3cd'}]},
{elementType: 'labels.text.fill', stylers: [{color: '#523735'}]},
{elementType: 'labels.text.stroke', stylers: [{color: '#f5f1e6'}]},
{
featureType: 'administrative',
elementType: 'geometry.stroke',
stylers: [{color: '#c9b2a6'}]
},
{
featureType: 'administrative.land_parcel',
elementType: 'geometry.stroke',
stylers: [{color: '#dcd2be'}]
},
{
featureType: 'administrative.land_parcel',
elementType: 'labels.text.fill',
stylers: [{color: '#ae9e90'}]
},
{
featureType: 'landscape.natural',
elementType: 'geometry',
stylers: [{color: '#dfd2ae'}]
},
{
featureType: 'poi',
elementType: 'geometry',
stylers: [{color: '#dfd2ae'}]
},
{
featureType: 'poi',
elementType: 'labels.text.fill',
stylers: [{color: '#93817c'}]
},
{
featureType: 'poi.park',
elementType: 'geometry.fill',
stylers: [{color: '#a5b076'}]
},
{
featureType: 'poi.park',
elementType: 'labels.text.fill',
stylers: [{color: '#447530'}]
},
{
featureType: 'road',
elementType: 'geometry',
stylers: [{color: '#f5f1e6'}]
},
{
featureType: 'road.arterial',
elementType: 'geometry',
stylers: [{color: '#fdfcf8'}]
},
{
featureType: 'road.highway',
elementType: 'geometry',
stylers: [{color: '#f8c967'}]
},
{
featureType: 'road.highway',
elementType: 'geometry.stroke',
stylers: [{color: '#e9bc62'}]
},
{
featureType: 'road.highway.controlled_access',
elementType: 'geometry',
stylers: [{color: '#e98d58'}]
},
{
featureType: 'road.highway.controlled_access',
elementType: 'geometry.stroke',
stylers: [{color: '#db8555'}]
},
{
featureType: 'road.local',
elementType: 'labels.text.fill',
stylers: [{color: '#806b63'}]
},
{
featureType: 'transit.line',
elementType: 'geometry',
stylers: [{color: '#dfd2ae'}]
},
{
featureType: 'transit.line',
elementType: 'labels.text.fill',
stylers: [{color: '#8f7d77'}]
},
{
featureType: 'transit.line',
elementType: 'labels.text.stroke',
stylers: [{color: '#ebe3cd'}]
},
{
featureType: 'transit.station',
elementType: 'geometry',
stylers: [{color: '#dfd2ae'}]
},
{
featureType: 'water',
elementType: 'geometry.fill',
stylers: [{color: '#b9d3c2'}]
},
{
featureType: 'water',
elementType: 'labels.text.fill',
stylers: [{color: '#92998d'}]
}
]
};