-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
145 lines (119 loc) · 4.61 KB
/
index.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
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Harta Muzeelor din Romania</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&v=3"></script>
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script type="text/javascript">
var side_bar_html = "";
var gmarkers = [];
var map = null;
var markerclusterer = null;
// A function to create the marker and set up the event window function
function createMarker(latlng, name, html, nume,descrierea) {
var contentString = html;
var marker = new google.maps.Marker({
position: latlng,
// map: map,
title: nume,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
var infoWindowContent = '<div class="info_content">' +
'<h3>' + nume +'</h3>' +
'<p>'+descrierea+ '</p>' +
'</div>';
var infoWindow = new google.maps.InfoWindow({
content: infoWindowContent,
maxWidth: 350,
maxHeight: 350
});
google.maps.event.addListener(marker, 'click', function() {
infoWindow.open(map, marker);
});
// save the info we need to use later for the side_bar
gmarkers.push(marker);
// add a line to the side_bar html
side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length-1) + ')">' + name + '<\/a><br>';
}
function myclick(i) {
google.maps.event.trigger(gmarkers[i], "click");
}
function CenterControl(controlDiv, map) {
// Set CSS for the control border
var controlUI = document.createElement('div');
controlUI.style.backgroundColor = '#fff';
controlUI.style.border = '2px solid #fff';
controlUI.style.borderRadius = '3px';
controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';
controlUI.style.cursor = 'pointer';
controlUI.style.marginBottom = '22px';
controlUI.style.textAlign = 'center';
controlUI.title = 'Click to recenter the map';
controlDiv.appendChild(controlUI);
// Set CSS for the control interior
var controlText = document.createElement('div');
controlText.style.color = 'rgb(25,25,25)';
controlText.style.fontFamily = 'Roboto,Arial,sans-serif';
controlText.style.fontSize = '16px';
controlText.style.lineHeight = '38px';
controlText.style.paddingLeft = '5px';
controlText.style.paddingRight = '5px';
controlText.innerHTML = 'Calculeaza Traseu';
controlUI.appendChild(controlText);
// Setup the click event listeners: simply set the map to
// Chicago
google.maps.event.addDomListener(controlUI, 'click', function() {
window.open("smt.html","_blank")
});
}
function initialize()
{
var myOptions = {
zoom: 7,
center: new google.maps.LatLng(45.907787,25.359741),
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var centerControlDiv = document.createElement('div');
var centerControl = new CenterControl(centerControlDiv, map);
centerControlDiv.index = 1;
map.controls[google.maps.ControlPosition.BOTTOM_LEFT].push(centerControlDiv);
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
$.getJSON("lista_muzeelor.json", function(muzeu) {
id = 0
for(var key in muzeu)
{
var muzeuCrt = muzeu[key];
lat = muzeuCrt.latitudine;
lng = muzeuCrt.longitudine;
var point = new google.maps.LatLng(lat,lng);
country = "Romania";
id += 1;
var html="<b>"+country+"</b><br>"+id;
// create the marker
var marker = createMarker(point,country+" "+id,html,muzeuCrt.denumirea, muzeuCrt.descrierea);
}
markerCluster = new MarkerClusterer(map, gmarkers);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<body >
<div id="map_canvas" style="height: 100%"> </div>
</body>
</html>