Ignore:
Timestamp:
Jul 2, 2010, 6:53:40 AM (14 years ago)
Author:
rvelices
Message:

rv_gmaps - start using google.maps JS namespace + upgrade prototype.js

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_gmaps/trunk/template/data_loader.js

    r6400 r6651  
    88                }
    99                , opts || {} );
    10         this.options.rectangle_of_confusion = new GSize( this.options.rectangle_of_confusion.width, this.options.rectangle_of_confusion.height );
     10        this.options.rectangle_of_confusion = new google.maps.Size( this.options.rectangle_of_confusion.width, this.options.rectangle_of_confusion.height );
    1111        if (this.options.rectangle_of_confusion.width<16) this.options.rectangle_of_confusion.width=16;
    1212        if (this.options.rectangle_of_confusion.height<16) this.options.rectangle_of_confusion.height=16;
     
    3737{
    3838        this._urlMapData = urlMapData;
    39         GEvent.bind( this._map, "movestart", this, this.clearTimerReloadData );
    40         GEvent.bind( this._map, "moveend", this, this._onMapMoveEnd );
     39        google.maps.Event.bind( this._map, "movestart", this, this.clearTimerReloadData );
     40        google.maps.Event.bind( this._map, "moveend", this, this._onMapMoveEnd );
    4141        this._loadData();
    4242},
     
    7777        var bounds = this._map.getBounds();
    7878
    79         // BEGIN BUG in maps api 2.185 up to "today" 2.193 - when map wraps horizontally more than 360 deg - the getBounds is wrong
    80         /*if ( this._map.getZoom() <= 2 || this._map.getZoom() == 3 && this._map.getSize().width > 1000 )
    81         {
    82                 bounds = new GLatLngBounds(
    83                                 new GLatLng( bounds.getSouthWest().lat(),  -180 ),
    84                                 new GLatLng( bounds.getNorthEast().lat(),  180 )
    85                         );
    86         }*/
    87         // END BUG
    8879        var latRange = bounds.toSpan().lat();
    8980        var latPrec = latRange * this.options.rectangle_of_confusion.height / this._map.getSize().height;
     
    10798                                        )
    10899                                {
    109                                         if (document.is_debug) GLog.write('no load: zoom crt: '+this._map.getZoom()+'; prev: '+this._previousLoadDataReq.zoom+'; target: '+this._map.getBoundsZoomLevel(this._previousLoadDataReq.resultBounds));
     100                                        if (document.is_debug) google.maps.Log.write('no load: zoom crt: '+this._map.getZoom()+'; prev: '+this._previousLoadDataReq.zoom+'; target: '+this._map.getBoundsZoomLevel(this._previousLoadDataReq.resultBounds));
    110101                                        return;
    111102                                }
     
    129120        }
    130121        var digits = Math.max( getLatLonDigits(latRange,4,2), getLatLonDigits(lonRange,4,2) );
    131         var box = new GLatLngBounds(
    132                         new GLatLng( Math.roundN(bounds.getSouthWest().lat()-sd,digits), Math.roundN( bounds.getSouthWest().lng()-wd,digits ) ),
    133                         new GLatLng( Math.roundN(bounds.getNorthEast().lat()+nd,digits), Math.roundN( bounds.getNorthEast().lng()+ed,digits) )
    134                 );
     122        /*var box = new google.maps.LatLngBounds(
     123                        new google.maps.LatLng( Math.roundN(bounds.getSouthWest().lat()-sd,digits), Math.roundN( bounds.getSouthWest().lng()-wd,digits ) ),
     124                        new google.maps.LatLng( Math.roundN(bounds.getNorthEast().lat()+nd,digits), Math.roundN( bounds.getNorthEast().lng()+ed,digits) )
     125                );*/
     126        var box = new google.maps.LatLngBounds( bounds.getSouthWest(), bounds.getNorthEast() );
     127        box.extend( new google.maps.LatLng( Math.roundN(bounds.getSouthWest().lat()-sd,digits), Math.roundN( bounds.getSouthWest().lng()-wd,digits ) ) );
     128        box.extend( new google.maps.LatLng( Math.roundN(bounds.getNorthEast().lat()+nd,digits), Math.roundN( bounds.getNorthEast().lng()+ed,digits) ) );
    135129
    136130        var url = this._urlMapData;
     
    140134
    141135        if (document.is_debug) {
    142                 GLog.write( "bounds: " + this._map.getBounds().getSouthWest().toUrlValue() + " " + this._map.getBounds().getNorthEast().toUrlValue() +"; zoom: "+this._map.getZoom() +"; size: "+this._map.getSize().toString() +"; c: "+this._map.getCenter().toUrlValue() );
    143                 GLog.writeUrl( url );
     136                google.maps.Log.write("sd="+sd+" wd="+wd+" nd="+nd+" ed="+ed);
     137                google.maps.Log.write( "bounds: " + this._map.getBounds().getSouthWest().toUrlValue() + " " + this._map.getBounds().getNorthEast().toUrlValue() +"; zoom: "+this._map.getZoom() +"; size: "+this._map.getSize().toString() +"; c: "+this._map.getCenter().toUrlValue() );
     138                google.maps.Log.writeUrl( url );
    144139        }
    145140
     
    150145
    151146        try {
    152                 GEvent.trigger( this, "dataloading" );
     147                google.maps.Event.trigger( this, "dataloading" );
    153148                GDownloadUrl(url, this._onDataReceived.bind(this) );
    154149        }
     
    156151                this._dataLoading = false;
    157152                this._previousLoadDataReq.box=null;
    158                 GEvent.trigger( this, "dataloadfailed", 600, e );
     153                google.maps.Event.trigger( this, "dataloadfailed", 600, e );
    159154        }
    160155},
     
    168163                {
    169164                        this._previousLoadDataReq.box=null;
    170                         GEvent.trigger( this, "dataloadfailed", responseCode, null );
     165                        google.maps.Event.trigger( this, "dataloadfailed", responseCode, null );
    171166                }
    172167                else
     
    178173
    179174                        this._previousLoadDataReq.resultBounds = resp.bounds;
    180                         if (document.is_debug && resp.debug) GLog.write( resp.debug );
    181                         GEvent.trigger( this, "dataloaded", resp );
     175                        if (document.is_debug && resp.debug) google.maps.Log.write( resp.debug );
     176                        google.maps.Event.trigger( this, "dataloaded", resp );
    182177                }
    183178                catch (e)       {
    184179                        this._previousLoadDataReq.box=null;
    185                         GEvent.trigger( this, "dataloadfailed", responseCode, e );
     180                        google.maps.Event.trigger( this, "dataloadfailed", responseCode, e );
    186181                        var s = e.message;
    187182                        s += '\n' + data.substr(0,1000);
Note: See TracChangeset for help on using the changeset viewer.