Dear developers at Google Maps,

I'm discovering the system and am trying to develop some applications
using Google Maps and Google Streetview. One of them however, needs
feedback from the asynchronous Google Maps Streetview Photo loading
system, because the pov_changed callback seems to be in sync with the
streetviewpanorama interbal pov parameters, but not with the
visability of the requested photo. Please, could you have a look at
this? If that would be a great problem, do you have a good working
computerwait function for JavaScript that cooperates with the
asynchronous Google MapsStreetview Photo loader? I've tried many but
all seem to get stuck into script errors (at least at my testing
environment which is FireFox 3/6/10 at the moment of writing. Or maybe
better, someone has an idea how to make this kind of function work?

<pre>
/*

Project: GoogleMaps StreetView AutoPan Alghorythm

Author: Marcel Boeré
Country: Netherlands
Place: Leiden
Email: m.bo...@leidenvirtueel.nl
Status:  waiting some system updates from the development team */
Date: 13-okt-2010
Remarks: published to be used, to be refined by anyone and to bring
life to Google StreetView Panorama! */
*/

/* wait function for JavaScript used within the for loop below, ripped
from various developer sites
        but not working in cooperation with Google StreetViewPanorama Maps
   As you can see I put this function within the refresh loop, in
order to make the pan behave
   just like it does in normal manual mode (It could be there is a
limitation from the system like in the geocoder QUERY_OVER_LIMIT),
   so I added 1 second delay  but somehow this wait function is
totally ignored by the php loop, because nothing happens and debug
counters
   are all at their expected end values
*/

function pausecomp(milliseconds) {
        var dt = new Date();
        while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}

function streetview_pan()
{
/*      This function shows you a full pan of the area selected by your
current streetview latitude and longitude coordinates */
   You could use the following parameters: */
   clockwise: 1: shows you a pan in clockwise direction (left to
right); 0: counter clockwise
   degrees_per_step: 1-360 integer for now, but it might be StreetView
could accept and calculate with double values */
   example: setting this to 1 requires 360 photo requests from google
streetview, there should be some limit for this in the software making
it as 'heavy' as a 1080p Youtube video
   this is a value that should be tuned on different systems and also
GoogleMaps should be protected from misuse
   GoogleStreetViewService must be setup to return a parameter like
OVER_QUERY_LIMIT (as for Geocode) as for OVER_PHOTO_REQUEST or
something like that to avoid spam or misuse of the service
   total_steps is counted */
   increment: if clockwise the increment subtracts values from the
current one
   increment: if counterclockwise value is added to the current one
        pause_milliseconds: milliseconds to pause between refreshing of the
GoogleMaps StreetviewPanorama lat lng and heading related photograph.
   This is mainly the problem because the streetview photo's seem to
have asynchronous reads and do not report anything about their
readibility or visibility status to the system

   when you look at the POV (point Of View) control at your
StreetViewMap, the value for the POV heading is as follows:
   Clockwise at 12.00 until 06:00 the value will go from 0 until -180
   Then the value is swapped and values go from 180 until 0
        Just swapping the increment works anyway for changing the pan, this
must be internally corrected by googlemaps because it requires some
difficult logical thinking

        The button defined to call this streetview_pan function itself is
defined in html as follows:
                $button_bar = "<a href='javascript:streetview_pan()'>Auto 
Pan</a>";
you can print this variable out with echo $button_bar;

        Of Course you can add all parameters which are defined here inside
the function as optional parameters for the function call to
streetview_pan.
   The function call then looks like this:
   function streetview_pan(clockwise, degrees_per_step,
pause_milliseconds), you must remove the assignments to these
paramters within the original function
   Of course you need to pass these variables from your html button to
javascript

*/


   var msg_display = document.getElementById("map_msg_display"); //
this element is defined in the php-based html renderer for the content
as <div id="map_msg_display"></div> Javascript could change its
content called InnerHTML
        if(panorama) { // unluckily this variable is global outside this
function until I understand the system of pointer caching in Java:(
           var pov = panorama.getPov();
      var clockwise = 1; // this is an option
      var degrees_per_step = 10;
      var total_steps = 360 / degrees_per_step;
                var pov_heading = pov.heading;
                var heading_initial = pov.heading;
      var increment = degrees_per_step;
      var pause_milliseconds = 1000; // 1000 milliseconds is one
second
      if(clockwise == 0) {
                        increment = -increment;
      }
      google.maps.event.addListener(panorama, "pov_changed",
function() {
                        // debug press return after arrow-> alert('pov changed 
here');
      });
/*
// this is the format of your newly to be developed functions as I
would like to see it:
      google.maps.event.addListener(panorama,
"streetview_tile_loaded", function(e) {
                        // debug press return after arrow->     alert('the 
requested tile has
been loaded');
      });
      google.maps.event.addListener(panorama,
"streetview_tile_visible", function(e) {
                        // debug press return after arrow-> alert('the 
requested tile has
been loaded and is visible');
      });
*/
      for(var step=0;step<=total_steps;step++) {
                        pov_heading = pov_heading - increment;
         panorama.setPov(
            {
               heading: pov_heading,
               zoom: pov.zoom,
               pitch: pov.pitch
            }
         );
         pausecomp(1200);
                }
        }
}
</pre>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to