Ignore:
Timestamp:
Mar 1, 2010, 10:29:55 PM (14 years ago)
Author:
rvelices
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_gmaps/trunk/template/map.tpl

    r4070 r5018  
    3535document.is_debug = false;
    3636if ( document.location.search.match(/[\?&]debug/) ) {
    37   document.is_debug = true;
    38   document._window = window;
     37        document.is_debug = true;
     38        document._window = window;
    3939}
    4040 
     
    4848
    4949        map.addMapType( G_PHYSICAL_MAP );
    50         map.addControl(new GLargeMapControl());
     50        map.addControl(new GLargeMapControl3D());
    5151        map.addControl(new GHierarchicalMapTypeControl());
    5252        map.addControl(new GScaleControl());
     
    5757{/literal}
    5858                {if isset($initial_bounds)}
    59     var bounds = new GLatLngBounds( new GLatLng({$initial_bounds.s},{$initial_bounds.w}), new GLatLng({$initial_bounds.n},{$initial_bounds.e}) );
    60     map.setCenter( bounds.getCenter(), map.getBoundsZoomLevel( bounds ) );
     59                var bounds = new GLatLngBounds( new GLatLng({$initial_bounds.s},{$initial_bounds.w}), new GLatLng({$initial_bounds.n},{$initial_bounds.e}) );
     60                map.setCenter( bounds.getCenter(), map.getBoundsZoomLevel( bounds ) );
    6161                {/if}
    6262{literal}
    6363                if ( !map.isLoaded() )
    6464                        map.setCenter( new GLatLng(0,0), 2 );
    65   }
    66 
    67   try {
     65        }
     66
     67        try {
    6868                // the overview must be added after setting map center
    6969                var ovcontrol = new GOverviewMapControl(new GSize(165,165));
    7070                map.addControl(ovcontrol);
    71   }
    72   catch(e){ alert( e.message ); }
    73  
     71        }
     72        catch(e){ alert( e.message ); }
     73
    7474        map.enableScrollWheelZoom();
    7575        map.enableDoubleClickZoom();
    76  
     76
    7777        var pwgMarkerIcon = (function(){ {/literal}{$MAP_MARKER_ICON_JS}{literal} }).call(null);
    7878
     
    100100                GEvent.addListener(map, "infowindowopen", function() { GLog.write("infowindowopen");} );
    101101                GEvent.addListener(map, "infowindowclose", function() { GLog.write("infowindowclose");} );
    102   }
     102        }
    103103}
    104104
     
    120120        geocoder.getLocations(q, function(resp)
    121121          {
    122             if ( resp && resp.Status )
    123             {
    124               document._geoResponse = resp;
    125               if (resp.Status.code==200)
    126               {
    127                 var zoom = 2;
    128                 switch (resp.Placemark[0].AddressDetails.Accuracy)
    129                 {
    130                   case 1: zoom=5; break; //country
    131                   case 2: zoom=7; break; //region
    132                   case 3: zoom=8; break; //county
    133                   case 4: zoom=12; break; //town
    134                   case 5: zoom=13; break; //post code
    135                   case 6: zoom=14; break; //street
    136                   case 7: case 8: zoom=16; break; //intersection/exact
    137                 }
    138                 map.setCenter( new GLatLng( resp.Placemark[0].Point.coordinates[1], resp.Placemark[0].Point.coordinates[0] ), zoom);
    139               }
    140               else
    141                 alert("This address has not been found\nCode:"+resp.Status.code);
    142             }
     122                if ( resp && resp.Status )
     123                {
     124                  document._geoResponse = resp;
     125                  if (resp.Status.code==200)
     126                  {
     127                        var zoom = 2;
     128                        switch (resp.Placemark[0].AddressDetails.Accuracy)
     129                        {
     130                          case 1: zoom=5; break; //country
     131                          case 2: zoom=7; break; //region
     132                          case 3: zoom=8; break; //county
     133                          case 4: zoom=12; break; //town
     134                          case 5: zoom=13; break; //post code
     135                          case 6: zoom=14; break; //street
     136                          case 7: case 8: zoom=16; break; //intersection/exact
     137                        }
     138                        map.setCenter( new GLatLng( resp.Placemark[0].Point.coordinates[1], resp.Placemark[0].Point.coordinates[0] ), zoom);
     139                  }
     140                  else
     141                        alert("This address has not been found\nCode:"+resp.Status.code);
     142                }
    143143          });
    144144        return false;
Note: See TracChangeset for help on using the changeset viewer.