<span class="keyword">function</span> init() {
init_pano();
init_map();
}
<span class="keyword">function</span> init_pano() {
hyperlapse = <span class="keyword">new</span> Hyperlapse(document.getElementById(<span class="str">'pano'</span>), {
lookat: <span class="keyword">new</span> google.maps.LatLng(<span class="num">34.81046439863342</span>,<span class="num">135.54278864373018</span>),
zoom: <span class="num">1</span>,
use_lookat: <span class="keyword">true</span>,
elevation: <span class="num">50</span>
});
hyperlapse.onError = <span class="keyword">function</span>(e) {
document.getElementById(<span class="str">"stat"</span>).value = <span class="str">"error"</span>;
console.log(e);
};
hyperlapse.onRouteComplete = <span class="keyword">function</span>(e) {
document.getElementById(<span class="str">"stat"</span>).value = <span class="str">"route complete:もうすぐですよぉ"</span>;
hyperlapse.load();
};
hyperlapse.onLoadComplete = <span class="keyword">function</span>(e) {
document.getElementById(<span class="str">"stat"</span>).value = <span class="str">"load complete:準備できました"</span>;
};
hyperlapse.onFrame = <span class="keyword">function</span>(e) {
<span class="keyword">var</span> ido = hyperlapse.getCurrentPoint().location.lat();
<span class="keyword">var</span> keido = hyperlapse.getCurrentPoint().location.lng();
document.getElementById(<span class="str">"stat"</span>).value = ido + <span class="str">","</span> + keido;
camera_icon.setPosition(<span class="keyword">new</span> google.maps.LatLng(ido,keido));
};
<span class="rem">// Google Maps API stuff here...</span>
<span class="keyword">var</span> directions_service = <span class="keyword">new</span> google.maps.DirectionsService();
<span class="keyword">var</span> route = {
request:{
origin: <span class="keyword">new</span> google.maps.LatLng(<span class="num">34.8109665019401</span>,<span class="num">135.54000451077272</span>,<span class="num">37</span>),
destination: <span class="keyword">new</span> google.maps.LatLng(<span class="num">34.81131885331175</span>,<span class="num">135.54204298962404</span>),
travelMode: google.maps.DirectionsTravelMode.DRIVING
}
};
directions_service.route(route.request, <span class="keyword">function</span>(response, status) {
<span class="keyword">if</span> (status == google.maps.DirectionsStatus.OK) {
document.getElementById(<span class="str">"stat"</span>).value = <span class="str">"direction status:ただいま準備中"</span>;
hyperlapse.generate( {route:response} );
} <span class="keyword">else</span> {
document.getElementById(<span class="str">"stat"</span>).value = status;
}
});
}
<span class="keyword">function</span> init_map() {
<span class="keyword">var</span> mapOpt = {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: <span class="keyword">new</span> google.maps.LatLng(<span class="num">34.8109665019401</span>,<span class="num">135.54000451077272</span>),
zoom: <span class="num">17</span>
};
map = <span class="keyword">new</span> google.maps.Map(document.getElementById(<span class="str">"map"</span>), mapOpt);
geocoder = <span class="keyword">new</span> google.maps.Geocoder();
camera_icon = <span class="keyword">new</span> google.maps.Marker({
position: <span class="keyword">new</span> google.maps.LatLng(<span class="num">34.8109665019401</span>,<span class="num">135.54000451077272</span>),
icon:<span class="str">'img/camera.png'</span>,
map: map
});
}
Leave a Reply