2012-04-19 3 views
0

Google Earthのあるポイントから別のポイントに移動するときにGoogle Earthから同じ「バウンス」機能を実装する方法はありますか?例えば表示されている地震の間を切り替えると http://earthquakeproject.com/?earth となります。地球儀上の地点の間でGUIが「バウンス」します。同じことをhttp://earthquakeproject.com/?mapsで実行すると、その地点間を単にスライドします。私は2つの間で同じように感じる機能を望みます。Googleマップのポイント間にバウンスするapi

答えて

0

だから解決策を見つけることができなかったので、他の誰かが同じことをする必要がある場合に備えて、私はやってしまったのです。はい、私は...それは滑らかな印象かもしれ

を知って最初に私はその後

function sloc(lat,lon){ 
      sloc_obj.lat1=sloc_obj.lat2; 
      sloc_obj.lon1=sloc_obj.lon2; 
      sloc_obj.lat2=lat; 
      sloc_obj.lon2=lon; 
      var R = 6371; // km 
      var d = Math.acos(Math.sin(sloc_obj.lat1)*Math.sin(sloc_obj.lat2) + 
       Math.cos(sloc_obj.lat1)*Math.cos(sloc_obj.lat2) * 
       Math.cos(sloc_obj.lon2-sloc_obj.lon1)) * R; 

      if(d<1000){ 
       return 1; 
      } 
      if(d<5000){ 
       return 2; 
      } 
      if(d<10000){ 
       return 3; 
      } 
      return(4); 
     } 

距離を決定する機能を見つけて、1〜4までの相対ジャンプ量を思い付くことを使用しました私は、時間遅延アクションのセットをずらすことを使用...

var l1=$(this).data('lat'); 
        var l2=$(this).data('lon'); 
        //set up array for times actions 
        var cmd=[] 
        //get the zoom-level based on the distance between two lat/lon spots 
        var d=sloc(l1, l2); 
        //based on our max flyout level, populate our times commands 
        if(d>=1){cmd[cmd.length]="map.setZoom(5)";} 
        if(d>=2){cmd[cmd.length]="map.setZoom(4)";} 
        if(d>=3){cmd[cmd.length]="map.setZoom(3)";} 
        if(d>=4){cmd[cmd.length]="map.setZoom(2)";} 
        cmd[cmd.length]="map.panTo(new google.maps.LatLng("+l1+","+l2+"),"+(1+d)+");"; 
        if(d>=4){cmd[cmd.length]="map.setZoom(3)";} 
        if(d>=3){cmd[cmd.length]="map.setZoom(4)";} 
        if(d>=2){cmd[cmd.length]="map.setZoom(5)";} 
        if(d>=1){cmd[cmd.length]="map.setZoom(6)";} 
        timer_offset=0; 

        //get the number of steps for our cmd iterator. subtract 1 so we get the middle step in our math since the number of steps will always be odd 
        steps=cmd.length-1 
        //iterate over ALL the steps. 
        for(x=0;x<=steps+1;x++){ 
         //for the middle step, wait a bit more than normal 
         if(x>=steps/2){ 
          timer_offset=(100*d); 
         } 
         //at the end of the middle action pan, wait a bit even more than that 
         if(x>=(steps/2)+1){ 
          timer_offset=(100*d)+200; 
         } 
         //set our timeout 
         time=200+(x*100+timer_offset) 
         //load the command on the timeout 
         setTimeout(cmd[x],time); 
        } 

Iが終わって、その中で、合理的にスムーズな移行を出すこの方法では、実際に走行した距離の量を反映しています。私はこれをもっとうまくやってみようと思うでしょう。おそらくより対数的な使いやすさを備えていますが、フラットパニングよりも優れています。

関連する問題