-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset_start_seoul.html
More file actions
754 lines (678 loc) · 30.8 KB
/
set_start_seoul.html
File metadata and controls
754 lines (678 loc) · 30.8 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
<!DOCTYPE html>
<html>
<head>
<title>set_start_seoul</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="files/set_start_seoul/styles.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>IceBoat</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>길찾기 검색</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>경로 찾기</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>
<!-- Unnamed (Rectangle) -->
<div id="u52" class="ax_default shape">
<div id="u52_div" class=""></div>
<div id="u52_text" class="text ">
<p><span>CCTV 현황</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>
<!-- Unnamed (Rectangle) -->
<div id="u55" class="ax_default shape">
<div id="u55_div" class=""></div>
<div id="u55_text" class="text ">
<p><span>경로찾기</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" >dddd</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" >dddd</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>
<!-- Unnamed (Rectangle) -->
<div id="u60" class="ax_default shape">
<div id="u60_div" class=""></div>
<div id="u60_text" class="text ">
<p><span>경로취소</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>주의하세요.</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">
<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">
<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=AIzaSyDRW4jYiIHAQnayCnEwDA3uFwbJFgfThec&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 start_point = 0;
var end_point = 0;
var start_x; //출발지 위도
var start_y; //출발지 경도
var end_x; //도착지 위도
var end_y; //도착지 경도
function change() {
console.log('he');
start_point = document.getElementById("u53_data").innerHTML; //출발지
end_point = document.getElementById("u54_data").innerHTML; //도착지
//console.log(document.getElementById("u50").innerHTML);
//console.log(document.getElementById("u53").innerHTML, document.getElementById("u54").innerHTML);
//console.log(document.getElementById("u53_data").innerHTML, 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);
start_x = (results[0].geometry.viewport.Wa.j + results[0].geometry.viewport.Wa.i)/2;//위도
start_y = (results[0].geometry.viewport.Sa.j + results[0].geometry.viewport.Sa.i)/2;//경도
console.log(start_x, start_y);
} 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_x = (results[0].geometry.viewport.Wa.j + results[0].geometry.viewport.Wa.i)/2;//위도
end_y = (results[0].geometry.viewport.Sa.j + results[0].geometry.viewport.Sa.i)/2;//경도
console.log(end_x, end_y)
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
var HOME_PATH = window.HOME_PATH || '.';
var map = new naver.maps.Map('map', {
center: new naver.maps.LatLng(37.554646,126.9690018),
mapTypeControl: true,
zoom: 14,
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 contentString = [
'<div class="iw_inner">',
' <h3>세종대로 사거리 CCTV</h3>',
' <p><img src="'+ HOME_PATH +'/images/car_accident.jpg" width="200" height="113" alt="" class="thumb" /></p>',
'</div>'
].join('');
var position = new naver.maps.LatLng(37.554646,126.9690018);// 광화문
var position1 = new naver.maps.LatLng(37.570226, 126.976920);
var position2 = new naver.maps.LatLng(37.515168,126.996125);
var position3 = new naver.maps.LatLng(37.569834, 127.002028); //청계2가
var position4 = new naver.maps.LatLng(37.554589,126.969092); //출발지 위치
var position5 = new naver.maps.LatLng(37.570388,126.992113); //도착지 위치
var start_url = "https://www.google.co.kr/maps/search/%EC%84%9C%EC%9A%B8%EC%97%AD/@37.5536387,126.97137,16z/data=!3m1!4b1";
var urlData = start_url.substring(start_url.indexOf("@") + 1);
var startinfo = urlData.split(','); //startinfo
//url에서 prameter 가져오는 방법.
//set_start_seoul에서 map4로 div id=u34_text(출발지) 와 div id=u33_text(목적지)값 받아오는 방법 시도중...
var test_url = "https://www.google.co.kr/maps/search/"+$('u34_text').html()+"/@37.5536387,126.97137,16z/data=!3m1!4b1";
var urlData2 = test_url.substring(test_url.indexOf("@") + 1);
var testinfo = urlData2.split(','); //아예 다시 시도해봐야 될듯함. 구글지도 검색 url을 axure로 안보이는 창을 연다음 그 값을 var test_url에 입력하여 시도해봐야될듯.
var markerOptions = {
position: position,
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)
}
};
var markerOptions1 = {
position: position1,
map: map,
icon: {
url: './images/CCTV1.png',
size: new naver.maps.Size(29, 29),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var markerOptions2 = {
position: position2,
map: map,
icon: {
url: './images/CCTV2.png',
size: new naver.maps.Size(29, 29),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var markerOptions3 = {
position: position3,
map: map,
icon: {
url: './images/CCTV1.png',
size: new naver.maps.Size(29, 29),
origin: new naver.maps.Point(0, 0),
anchor: new naver.maps.Point(11, 35)
}
};
var markerOptions4 = {
position: position4,
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 markerOptions5 = {
position: position5,
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 = new naver.maps.Marker(markerOptions);
var marker1 = new naver.maps.Marker(markerOptions1);
var marker = new naver.maps.Marker(markerOptions2);
var marker = new naver.maps.Marker(markerOptions3);
var marker = new naver.maps.Marker(markerOptions4);
var marker = new naver.maps.Marker(markerOptions5);
var infowindow = new naver.maps.InfoWindow({
content: contentString
});
naver.maps.Event.addListener(marker1, "click", function(e) {
if (infowindow.getMap()) {
infowindow.close();
} else {
infowindow.open(map, marker1);
}
});
//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;
// 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("u79_text").innerHTML = payload.data.title;
document.getElementById("u78_text").innerHTML = payload.data.body;
setTimeout(function() {
document.getElementById("u81_div").src = 'http://127.0.0.1:8000/media/situation_image/'+payload.data.image_name+'.png';
console.log('onMessage: ', payload);
check_range(payload.data.cctv_id_x,payload.data.cctv_id_y,payload.data.type); // cctv 범위 확인해주는 함수
}, 3000);
}else if(payload.data.type == "ob"){
document.getElementById("u72_text").innerHTML = payload.data.title;
document.getElementById("u73_text").innerHTML = payload.data.body;
setTimeout(function() {
document.getElementById("u74_div").src = 'http://127.0.0.1:8000/media/situation_image/'+payload.data.image_name+'.png';
console.log('onMessage: ', payload);
check_range(payload.data.cctv_id_x,payload.data.cctv_id_y,payload.data.type); // cctv 범위 확인해주는 함수
}, 3000);
}
});
// start_x, start_y 출발지 위도 경도, end_x, end_y 도착지 위도 경도 인지 물어보기
// point1-------point2
// - -
// - -
// point3-------point3
function check_range(cctv_id_x, cctv_id_y, type) {
var point1, point2, point3, point4 = start_x, end_x, start_y, end_y;
var width = (start_x-end_x)/2;
if(width < 0){
width = width *(-1);
point1, point2 = end_x, start_x;
}
var length = (start_y-end_y)/2;
if(length < 0){
length = length*(-1);
point3, point4 = end_y, start_y;
}
if (point1-width <= cctv_id_x && cctv_id_x <= point2+width) {
if (point3-length <= cctv_id_y && cctv_id_y <= point4-length) {
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){
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_div").style.visibility = "visible"
document.getElementById("u75_div").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_div").style.visibility = "hidden"
document.getElementById("u75_div").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"
}, 3000);
markerOptions1 = {
position: position1,
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(markerOptions);
//색 바꿔주기
} 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_div").style.visibility = "visible"
document.getElementById("u68_div").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_div").style.visibility = "hidden"
document.getElementById("u68_div").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);
markerOptions3 = {
position: position3,
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 색 바꿔주기
}
</script>
</body>
</html>