Hi, I tried to write a function (looking at
the api v3 documentation) to integrate a StreetView custom panorama
with GWT:
/**
* @param e: element to use for the Street View panorama
* @param path: image path
* @param heading: horizontal angle
* @param zoom: panorama zoom
* @param pitch: vertical angle
* @param imageName: panorama image name
* @param forceSpheric: force panorama to be always spheric
* @return
*/
final public native JavaScriptObject streetView(Element e, String
path, int heading, int zoom, int pitch, String imageName, boolean
forceSpheric)/*-{
var panorama;
var mode='html4';
if (forceSpheric){
mode='html5';
}
// Return a pano image given the panoID.
function getCustomPanoramaTileUrl(pano,zoom,tileX,tileY) {
// Note: robust custom panorama methods would require tiled pano
data.
// Here we're just using a single tile, set to the tile size and
equal
// to the pano "world" size.
return path+imageName;
}
// Construct the appropriate StreetViewPanoramaData given
// the passed pano IDs.
function getCustomPanorama(pano,zoom,tileX,tileY) {
switch(pano) {
case 'reception':
return {
location: {
pano: 'reception',
description: ""
},
links: [],
// The text for the copyright control.
copyright: "",
// The definition of the tiles for this panorama.
tiles: {
tileSize: new $wnd.google.maps.Size(e.offsetWidth,
e.offsetHeight),
worldSize: new $wnd.google.maps.Size(e.offsetWidth,
e.offsetHeight),
// The heading in degrees at the origin of the panorama
// tile set.
centerHeading: 105,
getTileUrl: getCustomPanoramaTileUrl
}
};
break;
}
}
// Set up Street View and initially set it visible. Register the
// custom panorama provider function. Set the StreetView to display
// the custom panorama 'reception' which we check for below.
var panoOptions = {
pano: 'reception',
visible: true,
mode: mode,
addressControl: false,
panoProvider: getCustomPanorama
}
// panorama = new
$wnd.google.maps.StreetViewPanorama($doc.getElementById('panorama'),panoOptions);
// panorama = new
$wnd.google.maps.StreetViewPanorama([email protected]::getElement()
(), panoOptions);
panorama = new $wnd.google.maps.StreetViewPanorama(e,panoOptions);
panorama.setPov({
heading: heading,
zoom: zoom,
pitch: pitch
});
return panorama;
}-*/;
*********************************************
SimplePanel svPanel=new SimplePanel();
svPanel.setSize("300px", "200px");
JavaScriptObject pano= streetView(svPanel.getElement(),"/sv/", 200,
0,
0,"img.jpg", true);
But there's a problem:
it works only once! When I try to create a new panorama (after the
first time), I see a blank panorama and controls don't work.
What could be the error???
Thanks for your time and help! :)
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.