-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_gmaps.html
executable file
·133 lines (113 loc) · 3.1 KB
/
index_gmaps.html
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
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<title>Marker animations with <code>setTimeout()</code></title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
#panel {
position: absolute;
top: 5px;
left: 50%;
margin-left: -180px;
z-index: 5;
background-color: #fff;
padding: 5px;
border: 1px solid #999;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBDtF90e6_EaEKq_XEWsECavcyOndcfDuY&v=3.exp&sensor=false"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<script src="static/project.js"></script>
<script>
// If you're adding a number of markers, you may want to
// drop them on the map consecutively rather than all at once.
// This example shows how to use setTimeout() to space
// your markers' animation.
var berlin = new google.maps.LatLng(47, 1.5);
var neighborhoods = [];
suite();
function createPoint() {
var XOrigin =45 ;
// var XOrigin = $scope.latitude;
//alert (latitude);
var YOrigin = 1 ;
// var YOrigin = $scope.longitude ;
// console.log( angular.element(document.querySelector( '#panel' ) ).scope.latitude);
return new google.maps.LatLng(XOrigin, YOrigin)
}
function suite() {
for (var i = 0; i < 1; i++) {
neighborhoods.push(createPoint());
}
ite++;
}
var markers = [];
var iterator = 0;
var iteratorFin = -20;
var ite=0
var map;
var image = {
// Adresse de l'icône personnalisée
url: 'static/32px-Red_Point.gif',
// Taille de l'icône personnalisée
size: new google.maps.Size(25, 25),
// Origine de l'image, souvent (0, 0)
origin: new google.maps.Point(0,0),
// L'ancre de l'image. Correspond au point de l'image que l'on raccroche à la carte. Par exemple, si votre îcone est un drapeau, cela correspond à son mâts
anchor: new google.maps.Point(0, 0)
};
function initialize() {
var mapOptions = {
zoom: 6,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: berlin
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
}
function drop() {
for (var i = ite; i < (ite+1); i++) {
setTimeout(function() {
addMarker();
delMarker();
}, i*50);
}
}
function follow(){
suite();
drop();
}
function delMarker(){
if( iteratorFin >= 0){
markers[iteratorFin].setMap(null);
}
iteratorFin++;
}
function addMarker() {
markers.push(new google.maps.Marker({
position: neighborhoods[iterator],
map: map,
draggable: false,
icon: image
}));
iterator++;
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="boutons" style="margin-left: -52px">
<button id="drop" onclick="drop()">Drop Markers</button>
<button id="suite" onclick="follow()">AddList</button>
</div>
<div id="panel" style="margin-left: -400px" ng-controller="myController">
{{quoi}} / {{ou}}
</div>
<div id="map-canvas"></div>
</body>
</html>