-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
193 lines (172 loc) · 4.91 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
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
<!DOCTYPE html>
<html>
<head>
<title>Carmichael Lynch Streetview</title>
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map-canvas, #map_canvas {
height: 100%;
}
@media print {
html, body {
height: auto;
}
#map-canvas, #map_canvas {
height:650px;
}
}
#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?v=3.exp&sensor=false"></script>
<script>
var panorama;
// The panorama that will be used as the entry point to the custom
// panorama set.
var entryPanoId = null;
function initialize() {
// The latlng of the entry point to the Google office on the road. //lat:44.981077,lng:-93.2744
var cl = new google.maps.LatLng(44.981000, -93.2744);
// Set up the map and enable the Street View control.
var mapOptions = {
center: cl,
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
panorama = map.getStreetView();
// Set up Street View and initially set it visible. Register the
// custom panorama provider function.
var panoOptions = {
position: cl,
visible: true,
panoProvider: getCustomPanorama
};
panorama.setOptions(panoOptions);
// Create a StreetViewService object.
var streetviewService = new google.maps.StreetViewService();
// Compute the nearest panorama to the Google Sydney office
// using the service and store that pano ID.
var radius = 50;
streetviewService.getPanoramaByLocation(cl, radius,
function(result, status) {
if (status == google.maps.StreetViewStatus.OK) {
// We'll monitor the links_changed event to check if the current
// pano is either a custom pano or our entry pano.
google.maps.event.addListener(panorama, 'links_changed',
function() {
createCustomLinks(result.location.pano);
});
}
});
}
function getCustomPanoramaTileUrl(pano, zoom, tileX, tileY) {
// Return a pano image given the panoID.
//alert(pano);
return pano +'.jpg' //+ zoom + '-' + tileX + '-' +tileY + '.jpg';
}
function getCustomPanorama(pano) {
switch(pano) {
case 'pano1':
return {
location: {
pano: 'pano1',
description: 'Carmichael Lynch 12th Floor 1',
latLng: new google.maps.LatLng(44.981070, -93.2744)
},
links: [],
// The text for the copyright control.
copyright: 'Stanton & Google 2013',
// The definition of the tiles for this panorama.
tiles: {
tileSize: new google.maps.Size(1024, 768),
worldSize: new google.maps.Size(2048, 1024),
// The heading at the origin of the panorama tile set.
centerHeading: 105,
getTileUrl: getCustomPanoramaTileUrl
}
};
break;
case 'pano2':
return {
location: {
pano: 'pano2',
description: 'Carmichael Lynch 12th Floor 1',
latLng: new google.maps.LatLng(44.981070, -93.2744)
},
links: [],
// The text for the copyright control.
copyright: 'Stanton & Google 2013',
// The definition of the tiles for this panorama.
tiles: {
tileSize: new google.maps.Size(1024, 768),
worldSize: new google.maps.Size(2048, 1024),
// The heading at the origin of the panorama tile set.
centerHeading: 105,
getTileUrl: getCustomPanoramaTileUrl
}
};
break;
default:
return null;
}
}
function createCustomLinks(entryPanoId) {
var links = panorama.getLinks();
var panoId = panorama.getPano();
switch(panoId) {
case entryPanoId:
// Adding a link in the view from the entrance of the building to
// reception.
links.push({
heading: 25,
description : 'Carmichael Lynch',
pano : 'pano1'
});
break;
case 'pano1':
// Adding a link in the view from the entrance of the office
// with an arrow pointing at 100 degrees, with a text of 'Exit'
// and loading the street entrance of the building pano on click.
links.push({
heading: 0,
description : 'Exit',
pano : entryPanoId
},{
heading: 180,
description : '=> Pano 2',
pano : 'pano2'
});
break;
case 'pano2':
links.push({
heading: 15,
description : '=> Pano 1',
pano : 'pano1'
});
break;
// default
default:
return;
}
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>