-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_en.html
More file actions
804 lines (730 loc) · 33.6 KB
/
main_en.html
File metadata and controls
804 lines (730 loc) · 33.6 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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
<!DOCTYPE html>
<html>
<head>
<title>ICEBOAT</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link href="resources/css/axure_rp_page.css" type="text/css" rel="stylesheet"/>
<link href="data/styles.css" type="text/css" rel="stylesheet"/>
<link href="css/main_en.css" type="text/css" rel="stylesheet"/>
<script src="resources/scripts/jquery-3.2.1.min.js"></script>
<script src="resources/scripts/axure/axQuery.js"></script>
<script src="resources/scripts/axure/globals.js"></script>
<script src="resources/scripts/axutils.js"></script>
<script src="resources/scripts/axure/annotation.js"></script>
<script src="resources/scripts/axure/axQuery.std.js"></script>
<script src="resources/scripts/axure/doc.js"></script>
<script src="resources/scripts/messagecenter.js"></script>
<script src="resources/scripts/axure/events.js"></script>
<script src="resources/scripts/axure/recording.js"></script>
<script src="resources/scripts/axure/action.js"></script>
<script src="resources/scripts/axure/expr.js"></script>
<script src="resources/scripts/axure/geometry.js"></script>
<script src="resources/scripts/axure/flyout.js"></script>
<script src="resources/scripts/axure/model.js"></script>
<script src="resources/scripts/axure/repeater.js"></script>
<script src="resources/scripts/axure/sto.js"></script>
<script src="resources/scripts/axure/utils.temp.js"></script>
<script src="resources/scripts/axure/variables.js"></script>
<script src="resources/scripts/axure/drag.js"></script>
<script src="resources/scripts/axure/move.js"></script>
<script src="resources/scripts/axure/visibility.js"></script>
<script src="resources/scripts/axure/style.js"></script>
<script src="resources/scripts/axure/adaptive.js"></script>
<script src="resources/scripts/axure/tree.js"></script>
<script src="resources/scripts/axure/init.temp.js"></script>
<script src="resources/scripts/axure/legacy.js"></script>
<script src="resources/scripts/axure/viewer.js"></script>
<script src="resources/scripts/axure/math.js"></script>
<script src="resources/scripts/axure/jquery.nicescroll.min.js"></script>
<script src="data/document.js"></script>
<script src="files/set_start_seoul/data.js"></script>
<script type="text/javascript">
$axure.utils.getTransparentGifPath = function() { return 'resources/images/transparent.gif'; };
$axure.utils.getOtherPath = function() { return 'resources/Other.html'; };
$axure.utils.getReloadPath = function() { return 'resources/reload.html'; };
</script>
</head>
<body>
<div id="base" class="">
<!-- Unnamed (Inline Frame) -->
<div id="u32" class="ax_default">
<iframe id="u32_input" scrolling="auto" frameborder="1" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<!-- dest_map (Inline Frame) -->
<div id="u33" class="ax_default ax_default_hidden" data-label="dest_map" style="display:none; visibility: hidden">
<iframe id="u33_input" data-label="dest_map" scrolling="auto" frameborder="1" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<!-- user_start (Group) -->
<div id="u34" class="ax_default ax_default_hidden" data-label="user_start" style="display:none; visibility: hidden" data-left="910" data-top="-11" data-width="490" data-height="611">
<!-- Input_Direction BG (Rectangle) -->
<div id="u35" class="ax_default shape" data-label="Input_Direction BG">
<div id="u35_div" class=""></div>
<div id="u35_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Background (Rectangle) -->
<div id="u36" class="ax_default shape" data-label="Background">
<div id="u36_div" class=""></div>
<div id="u36_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Rectangle 1 (Rectangle) -->
<div id="u37" class="ax_default shape" data-label="Rectangle 1">
<div id="u37_div" class=""></div>
<div id="u37_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- 목적지 (Rectangle) -->
<div id="u38" class="ax_default shape" data-label="목적지">
<img id="u38_img" class="img " src="images/index/목적지_u6.svg"/>
<div id="u38_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- 출발지 (Rectangle) -->
<div id="u39" class="ax_default shape" data-label="출발지">
<img id="u39_img" class="img " src="images/index/목적지_u6.svg"/>
<div id="u39_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Unnamed (Rectangle) -->
<div id="u40" class="ax_default shape">
<div id="u40_div" class=""></div>
<div id="u40_text" class="text ">
<p><span>DRAS</span></p>
</div>
</div>
<!-- Unnamed (Rectangle) -->
<div id="u41" class="ax_default shape">
<div id="u41_div" class=""></div>
<div id="u41_text" class="text ">
<p><span>Search for directions</span></p>
</div>
</div>
<!-- Ellipse 1 (Shape) -->
<div id="u42" class="ax_default shape" data-label="Ellipse 1">
<img id="u42_img" class="img " src="images/index/ellipse_1_u10.svg"/>
<div id="u42_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Ellipse 2 (Shape) -->
<div id="u43" class="ax_default shape" data-label="Ellipse 2">
<img id="u43_img" class="img " src="images/index/ellipse_1_u10.svg"/>
<div id="u43_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Arrow 2 (Shape) -->
<div id="u44" class="ax_default shape" data-label="Arrow 2">
<img id="u44_img" class="img " src="images/index/arrow_2_u12.svg"/>
<div id="u44_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Unnamed (Text Field) -->
<div id="u45" class="ax_default text_field">
<div id="u45_div" class=""></div>
<input id="u45_input" type="text" value="" class="u45_input"/>
</div>
<!-- Unnamed (Text Field) -->
<div id="u46" class="ax_default text_field">
<div id="u46_div" class=""></div>
<input id="u46_input" type="text" value="" class="u46_input"/>
</div>
</div>
<!-- 경로찾기_bt (Rectangle) -->
<div id="u47" class="ax_default primary_button ax_default_hidden" data-label="경로찾기_bt" style="display:none; visibility: hidden">
<div id="u47_div" class=""></div>
<div id="u47_text" onclick="change()" class="text ">
<p><span>Enter</span></p>
</div>
</div>
<!-- Rectangle 2 (Shape) -->
<div id="u49" class="ax_default shape" data-label="Rectangle 2">
<img id="u49_img" class="img " src="images/index/rectangle_2_u17.svg"/>
<div id="u49_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Unnamed (Group) -->
<div id="u50" class="ax_default" data-left="1150" data-top="526" data-width="200" data-height="64">
<!-- cctv 현황 (Rectangle) -->
<div id="u51" class="ax_default shape" data-label="cctv 현황">
<img id="u51_img" class="img " src="images/index/cctv_현황_u19.svg"/>
<div id="u51_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- bottomBar_CCTV정보 -->
<div id="u52" class="ax_default shape">
<div id="u52_div" class=""></div>
<div id="u52_text" class="text ">
<p><span>CCTV Info</span></p>
</div>
</div>
</div>
<!-- Unnamed (Group) -->
<div id="u53" class="ax_default" data-left="47" data-top="98" data-width="1545" data-height="492">
<!-- 경로찾기 (Rectangle) -->
<div id="u54" class="ax_default shape" data-label="경로찾기">
<img id="u54_img" class="img " src="images/index/경로찾기_u22.svg"/>
<div id="u54_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- bottomBar_경로찾기 -->
<div id="u55" class="ax_default shape">
<div id="u55_div" class=""></div>
<div id="u55_text" class="text ">
<p><span style="text-align:center">Find Route</span></p>
</div>
</div>
<!-- start (Rectangle) -->
<div id="u56" class="ax_default box_1" data-label="start">
<div id="u56_div" style="display:none; visibility: hidden" class=""></div>
<div id="u56_text" style="display:none; visibility: hidden" class="text ">
<p><span id='u53_data' style="display:none; visibility: hidden" >서울역</span></p>
</div>
</div>
<!-- end (Rectangle) -->
<div id="u57" class="ax_default box_1" data-label="end">
<div id="u57_div" style="display:none; visibility: hidden" class=""></div>
<div id="u57_text" style="display:none; visibility: hidden" class="text ">
<p><span id='u54_data' style="display:none; visibility: hidden" >종로3가역</span></p>
</div>
</div>
</div>
<!-- Unnamed (Group) -->
<div id="u58" class="ax_default" data-left="600" data-top="526" data-width="200" data-height="64">
<!-- cctv 현황 (Rectangle) -->
<div id="u59" class="ax_default shape" data-label="cctv 현황">
<img id="u59_img" class="img " src="images/index/cctv_현황_u19.svg"/>
<div id="u59_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- bottomBar_경로취소 -->
<div id="u60" class="ax_default shape">
<div id="u60_div" class=""></div>
<div id="u60_text" class="text ">
<p><span>Cancel Route</span></p>
</div>
</div>
</div>
<!-- map4 (Rectangle) -->
<div id="u61" class="ax_default box_1 ax_default_hidden" data-label="map4" style="display:none; visibility: hidden">
<div id="map" style="width: 695px; height:517px;"></div>
<div id="u61_div" class=""></div>
<div id="u61_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Ob_alarm (Group) -->
<div id="u62" class="ax_default" data-label="Ob_alarm" data-left="542" data-top="3" data-width="415" data-height="400">
<!-- FCM_web BG (Rectangle) -->
<div id="u63" class="ax_default shape" style="display:none; visibility: hidden" data-label="FCM_web BG">
<div id="u63_div" style="display:none; visibility: hidden" class=""></div>
<div id="u63_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Rectangle 1 (Rectangle) -->
<div id="u64" class="ax_default shape" data-label="Rectangle 1">
<div id="u64_div" style="display:none; visibility: hidden" class=""></div>
<div id="u64_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Notification (Rectangle) -->
<div id="u65" class="ax_default shape" data-label="Notification">
<div id="u65_div" class=""></div>
<div id="u65_text" style="display:none; visibility: hidden" class="text ">
<p><span>경로의 도로에 장애물이 있습니다. </span></p><p><span>주의하세요.</span></p>
</div>
</div>
<!-- Case (Rectangle) -->
<div id="u66" class="ax_default shape" data-label="Case">
<div id="u66_div" class=""></div>
<div id="u66_text" style="display:none; visibility: hidden" class="text ">
<p><span>Warning</span></p>
</div>
</div>
<!-- Case (Rectangle) -->
<div id="u67" class="ax_default shape" data-label="Case">
<div id="u67_div" class=""></div>
<div id="u67_text" style="display:none; visibility: hidden" class="text ">
<p><span>[청계 2가]</span></p>
</div>
</div>
<!-- 89 1 (Rectangle) -->
<div id="u68" class="ax_default shape" data-label="89 1">
<img id="u68_image" style="display:none; visibility: hidden" src='http://chaeyoung.pythonanywhere.com/media/situation_image/1212132115.png' width="414" height="232">
<div id="u68_div" style="display:none; visibility: hidden" class=""></div>
<div id="u68_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
</div>
<!-- Acc_alarm (Group) -->
<div id="u69" class="ax_default" data-label="Acc_alarm" data-left="988" data-top="0" data-width="415" data-height="400">
<!-- FCM_web BG (Rectangle) -->
<div id="u70" class="ax_default shape" style="display:none; visibility: hidden" data-label="FCM_web BG">
<div id="u70_div" style="display:none; visibility: hidden" class=""></div>
<div id="u70_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- ACC_alarm (Rectangle) -->
<div id="u71" class="ax_default shape" style="display:none; visibility: hidden" data-label="ACC_alarm">
<div id="u71_div" style="display:none; visibility: hidden" class=""></div>
<div id="u71_text" class="text " style="display:none; visibility: hidden">
<p></p>
</div>
</div>
<!-- Notification (Rectangle) -->
<div id="u72" class="ax_default shape" style="display:none; visibility: hidden" data-label="Notification">
<div id="u72_div" class=""></div>
<div id="u72_text" style="display:none; visibility: hidden" class="text ">
<p><span>경로의 교통사고가 났습니다. 주의하세요</span></p>
</div>
</div>
<!-- Case (Rectangle) -->
<div id="u73" class="ax_default shape" style="display:none; visibility: hidden" data-label="Case">
<div id="u73_div" class=""></div>
<div id="u73_text" style="display:none; visibility: hidden" class="text ">
<p><span>주의하세요.</span></p>
</div>
</div>
<!-- Case (Rectangle) -->
<div id="u74" class="ax_default shape" style="display:none; visibility: hidden" data-label="Case">
<div id="u74_div" class=""></div>
<div id="u74_text" style="display:none; visibility: hidden" class="text ">
<p><span>세종대로 사거리</span></p>
</div>
</div>
<!-- 89 1 (Rectangle) -->
<div id="u75" class="ax_default shape" data-label="89 1">
<img id="u75_image" style="display:none; visibility: hidden" src='http://chaeyoung.pythonanywhere.com/media/situation_image/121213710.png' width="414" height="232">
<div id="u75_div" style="display:none; visibility: hidden" class=""></div>
<div id="u75_text" class="text " style="display:none; visibility: hidden">
<p ></p>
</div>
</div>
</div>
</div>
<div id="floating-panel">
<input id="submit" type="button" value="Geocode">
</div>
<div id="map1" style="display:none; visibility: hidden" ></div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBRR9w1Z7KQddnMwfrFIsJqUpmvbw-wNC4&signed_in=true&callback=initMap"
async defer></script>
<script src="resources/scripts/axure/ios.js"></script>
<script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=rpbl1d7siz"></script>
<script>
var position_car = new naver.maps.LatLng(37.554646,126.9690018);// 광화문? 서울역인거같음..
var position_cctv1 = new naver.maps.LatLng(37.522583, 126.961311); // 세종대로4거리 cctv
var position_cctv2 = new naver.maps.LatLng(37.515105, 126.996357); //청계2가
var start_point = 0;
var end_point = 0;
var start_x = 37.55301699999999; //출발지 위도
var start_y = 126.972646; //출발지 경도
var end_x = 37.570432; //도착지 위도
var end_y = 126.9690019; //도착지 경도
var cctv1_color = 'CCTV3.png'; //cctv 색 변수로 바꾸기
var cctv2_color = 'CCTV3.png'; //cctv 색 변수로 바꾸기
function change() {
console.log('he');
start_point = document.getElementById("u53_data").innerHTML; //출발지
end_point = document.getElementById("u54_data").innerHTML; //도착지
console.log(start_point, end_point);
}
function initMap() {
var map = new google.maps.Map(document.getElementById('map1'), {
zoom: 10,
center: {lat: 17.3700, lng: 78.4800}
});
var geocoder = new google.maps.Geocoder();
document.getElementById('submit').addEventListener('click', function() {
geocodeAddress(geocoder, map);
});
document.getElementById('u47_text').addEventListener('click', function() {
geocodeAddress(geocoder, map);
});
}
function geocodeAddress(geocoder, resultsMap) {
geocoder.geocode({'address': start_point}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
resultsMap.setCenter(results[0].geometry.location);
console.log(start_point);
console.log(results[0].geometry.viewport);
console.log(results[0].geometry.viewport.Hb.g);
start_y = (results[0].geometry.viewport.Hb.g + results[0].geometry.viewport.Hb.i)/2;//위도
start_x = (results[0].geometry.viewport.tc.g + results[0].geometry.viewport.tc.i)/2;//경도
console.log(start_x, start_y);
reset()
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
geocoder.geocode({'address': end_point}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
resultsMap.setCenter(results[0].geometry.location);
console.log(end_point);
end_y = (results[0].geometry.viewport.Hb.g + results[0].geometry.viewport.Hb.i)/2;//위도
end_x = (results[0].geometry.viewport.tc.g + results[0].geometry.viewport.tc.i)/2;//경도
console.log(end_x, end_y)
reset()
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
function set_zoom(){
var width = end_x-start_x
var length = end_y-start_y
var center_x = start_x+width/2;
var center_y = start_y+length/2;
if(width<0){
width = width*(-1);
center_x = end_x+width/2;
}
if(length<0){
length = length*(-1);
center_y = end_y+length/2;
}
console.log(center_x,center_y);
console.log('확인',width, length);
max_num = Math.max(width, length);
position_car = new naver.maps.LatLng(center_x, center_y);
if (max_num >0.019){
console.log('in1');
return 14
}else {
console.log('in2');
return 15
}
}
function reset(){
var HOME_PATH = window.HOME_PATH || '.';
var map = new naver.maps.Map('map', {
center: position_car,
mapTypeControl: true,
zoom: set_zoom(),
mapTypeControlOptions: {
style: naver.maps.MapTypeControlStyle.DROPDOWN
}
});
var trafficLayer = new naver.maps.TrafficLayer({
interval: 300000 // 5분마다 새로고침 (최소값 5분)
});
var btn = $('#traffic');
naver.maps.Event.addListener(map, 'trafficLayer_changed', function(trafficLayer) {
if (trafficLayer) {
btn.addClass('control-on');
$("#autorefresh").parent().show();
$("#autorefresh")[0].checked = true;
} else {
btn.removeClass('control-on');
$("#autorefresh").parent().hide();
}
});
btn.on("click", function(e) {
e.preventDefault();
if (trafficLayer.getMap()) {
trafficLayer.setMap(null);
} else {
trafficLayer.setMap(map);
}
});
$("#autorefresh").on("click", function(e) {
var btn = $(this),
checked = btn.is(":checked");
if (checked) {
trafficLayer.startAutoRefresh();
} else {
trafficLayer.endAutoRefresh();
}
});
naver.maps.Event.once(map, 'init_stylemap', function() {
trafficLayer.setMap(map);
});
var markerOptions_car = {
position: position_car,
map: map,
icon: {
url: './images/CAR1.png',
size: new naver.maps.Size(21, 38),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
console.log(cctv1_color,cctv2_color);
var markerOptions_cctv1 = {
position: position_cctv1,
map: map,
icon: {
url: './images/'+cctv1_color,
size: new naver.maps.Size(29, 29),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var markerOptions_cctv2 = {
position: position_cctv2,
map: map,
icon: {
url: './images/'+cctv2_color,
size: new naver.maps.Size(29, 29),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var markerOptions_start = {
position: new naver.maps.LatLng(start_x, start_y),
map: map,
icon: {
url: './images/start_mark.png',
size: new naver.maps.Size(20, 28),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var markerOptions_end = {
position: new naver.maps.LatLng(end_x, end_y),
map: map,
icon: {
url: './images/end_mark.png',
size: new naver.maps.Size(20, 28),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var marker_car = new naver.maps.Marker(markerOptions_car);
var marker_cctv1 = new naver.maps.Marker(markerOptions_cctv1);
var marker_cctv2 = new naver.maps.Marker(markerOptions_cctv2);
var marker_start = new naver.maps.Marker(markerOptions_start);
var marker_end = new naver.maps.Marker(markerOptions_end);
}
//setTimeout(function(){location.reload()}, 30000)
//setTimeout(function(){location.reload()}, 10000) //화면 재실행 이런식으로 현재위치 갱신하려함.
</script>
<script src="https://www.gstatic.com/firebasejs/5.5.9/firebase.js"></script>
<script>
var test_x = 37.5655;
var test_y = 126.97;
var cctv1_image = 1;
var cctv2_image =1;
// Initialize Firebase
var config = {
apiKey: "AIzaSyBfLYQieTSNFJVghLmwPidH9eMLJ8sgafA",
authDomain: "push-server-56a52.firebaseapp.com",
databaseURL: "https://push-server-56a52.firebaseio.com",
projectId: "push-server-56a52",
storageBucket: "push-server-56a52.appspot.com",
messagingSenderId: "967213415011",
appId: "AIzaSyBfLYQieTSNFJVghLmwPidH9eMLJ8sgafA",
measurementId: "G-MDVS63TX7X"
};
firebase.initializeApp(config);
const messaging = firebase.messaging();
//token값 알아내기
messaging.requestPermission()
.then(function(){
console.log("Have permission");
return messaging.getToken();
})
.then(function(token){
console.log(token);
})
.catch(function(arr){
console.log("Error Occured");
});
messaging.onMessage(function(payload) {
if(payload.data.type == "acc"){
document.getElementById("u73_text").innerHTML = payload.data.title;
document.getElementById("u72_text").innerHTML = payload.data.body;
setTimeout(function() {
document.getElementById("u75_image").src = 'http://chaeyoung.pythonanywhere.com/media/situation_image/'+payload.data.image_name+'.png';
//http://chaeyoung.pythonanywhere.com/media/situation_image/1212132115.png
console.log('onMessage: acc ', payload);
//cctv1_image = payload.data.image_name;
check_range(payload.data.cctv_id_x,payload.data.cctv_id_y,payload.data.type,payload.data.image_name); // cctv 범위 확인해주는 함수
}, 3000);
}else if(payload.data.type == "ob"){
document.getElementById("u66_text").innerHTML = payload.data.title;
document.getElementById("u65_text").innerHTML = payload.data.body;
setTimeout(function() {
document.getElementById("u68_image").src = 'http://chaeyoung.pythonanywhere.com/media/situation_image/'+payload.data.image_name+'.png';
console.log('onMessage: ob ', payload);
//cctv2_image = payload.data.image_name;
check_range(payload.data.cctv_id_x,payload.data.cctv_id_y,payload.data.type,payload.data.image_name); // cctv 범위 확인해주는 함수
}, 3000);
}
});
// start_x, start_y 출발지 위도 경도, end_x, end_y 도착지 위도 경도 인지 물어보기
// point1-------point2
// - -
// - -
// point3-------point3
function check_range(cctv_id_x, cctv_id_y, type, image_name) {
console.log('범위 확인',cctv_id_x, cctv_id_y, type);
cctv_id_x *=1;
cctv_id_y *=1;
var point1 = start_x;
var point2 = end_x;
var point3 = start_y;
var point4 = end_y;
console.log(point1, point2, point3, point4)
var width = (end_x-start_x)/2;
if(width < 0){
width = width *(-1);
point1 = end_x;
point2 = start_x;
}
var length = (end_y-start_y)/2;
if(length < 0){
length = length*(-1);
point3 = end_y;
point4 = start_y;
}
console.log(point1, point2, point3, point4)
if (point1 <= cctv_id_x && cctv_id_x <= point2) {
if (point3 <= cctv_id_y && cctv_id_y <= point4) {
raise_notification(type)//해당 cctv가 범위안에 있으면 알람 불러주기
//alert('hello') if문 돌아가는거 확인. 지워야함.
} //cctv_id를 cctv_x, y 좌표값으로 보내주면 default값 좌표랑 비교해서 수행하려는데
} //cctv_id 변수를 어떤식으로 지정하는지 모르겠음, test_x y 대신 payload.data.cctv_x y 이런식으로 받으면 되는지 모르겠음.
}
function raise_notification(type, image_name){
console.log('알림확인',type)
if(type == 'acc'){
document.getElementById("u74_text").style.visibility = "visible"
document.getElementById("u74_text").style.display = "block"
document.getElementById("u73_text").style.visibility = "visible"
document.getElementById("u73_text").style.display = "block"
document.getElementById("u72_text").style.visibility = "visible"
document.getElementById("u72_text").style.display = "block"
document.getElementById("u75_image").style.visibility = "visible"
document.getElementById("u75_image").style.display = "block"
document.getElementById("u71_div").style.visibility = "visible"
document.getElementById("u71_div").style.display = "block"
document.getElementById("u70_div").style.visibility = "visible"
document.getElementById("u70_div").style.display = "block"
setTimeout(function() {
document.getElementById("u74_text").style.visibility = "hidden"
document.getElementById("u74_text").style.display = "none"
document.getElementById("u73_text").style.visibility = "hidden"
document.getElementById("u73_text").style.display = "none"
document.getElementById("u72_text").style.visibility = "hidden"
document.getElementById("u72_text").style.display = "none"
document.getElementById("u75_image").style.visibility = "hidden"
document.getElementById("u75_image").style.display = "none"
document.getElementById("u71_div").style.visibility = "hidden"
document.getElementById("u71_div").style.display = "none"
document.getElementById("u70_div").style.visibility = "hidden"
document.getElementById("u70_div").style.display = "none"
}, 4000);
cctv1_color = 'CCTV3.png';
reset();
markerOptions1 = {
position: position_cctv1,
map: map,
icon: {
url: './images/CCTV3.png',
size: new naver.maps.Size(29, 29),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var marker = new naver.maps.Marker(markerOptions1);
var contentString_cctv1 = [
'<div class="iw_inner">',
' <h3>세종대로 사거리 CCTV</h3>',
// ' <p><img src="'http://127.0.0.1:8000/media/situation_image/'+payload.data.image_name+'.png'" width="200" height="113" alt="" class="thumb" /></p>'
// fcm에서 받아오는 이미지 출력 스트링형태 만들고싶은데 잘 안되네
//"http://chaeyoung.pythonanywhere.com/situation_image/'+payload.data.image_name+'.png"
' <p><img src="http://chaeyoung.pythonanywhere.com/media/situation_image/121213710.png" width="200" height="113" alt="" class="thumb" /></p>',
'</div>'
].join('');
var infowindow = new naver.maps.InfoWindow({
content: contentString_cctv1
});
naver.maps.Event.addListener(marker, "click", function(e) {
if (infowindow.getMap()) {
infowindow.close();
} else {
infowindow.open(map, marker);
}
}); //cctv 클릭시 사고사진 출력
//색 바꿔주기
} else if(type == 'ob'){
document.getElementById("u67_text").style.visibility = "visible"
document.getElementById("u67_text").style.display = "block"
document.getElementById("u66_text").style.visibility = "visible"
document.getElementById("u66_text").style.display = "block"
document.getElementById("u65_text").style.visibility = "visible"
document.getElementById("u65_text").style.display = "block"
document.getElementById("u68_image").style.visibility = "visible"
document.getElementById("u68_image").style.display = "block"
document.getElementById("u64_div").style.visibility = "visible"
document.getElementById("u64_div").style.display = "block"
document.getElementById("u63_div").style.visibility = "visible"
document.getElementById("u63_div").style.display = "block"
setTimeout(function() {
document.getElementById("u67_text").style.visibility = "hidden"
document.getElementById("u67_text").style.display = "none"
document.getElementById("u66_text").style.visibility = "hidden"
document.getElementById("u66_text").style.display = "none"
document.getElementById("u65_text").style.visibility = "hidden"
document.getElementById("u65_text").style.display = "none"
document.getElementById("u68_image").style.visibility = "hidden"
document.getElementById("u68_image").style.display = "none"
document.getElementById("u64_div").style.visibility = "hidden"
document.getElementById("u64_div").style.display = "none"
document.getElementById("u63_div").style.visibility = "hidden"
document.getElementById("u63_div").style.display = "none"
}, 3000);
cctv2_color = 'CCTV3.png';
reset();
markerOptions3 = {
position: position_cctv2,
map: map,
icon: {
url: './images/CCTV3.png',
size: new naver.maps.Size(29, 29),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var marker = new naver.maps.Marker(markerOptions3);
}// cctv 색 바꿔주기
var contentString_cctv2 = [
'<div class="iw_inner">',
' <h3>세종대로 사거리 CCTV</h3>',
// ' <p><img src="'http://127.0.0.1:8000/media/situation_image/'+payload.data.image_name+'.png'" width="200" height="113" alt="" class="thumb" /></p>'
// fcm에서 받아오는 이미지 출력 만들고싶은데 잘 안되네
' <p><img src="http://chaeyoung.pythonanywhere.com/media/situation_image/121213710.png" width="200" height="113" alt="" class="thumb" /></p>',,
'</div>'
].join('');
var infowindow = new naver.maps.InfoWindow({
content: contentString_cctv2
});
naver.maps.Event.addListener(marker, "click", function(e) {
if (infowindow.getMap()) {
infowindow.close();
} else {
infowindow.open(map, marker);
}
}); //cctv클릭시 사고사진 출력
}
</script>
</body>
</html>