Changeset 6651 for extensions/rv_gmaps/trunk/template/data_loader.js
- Timestamp:
- Jul 2, 2010, 6:53:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_gmaps/trunk/template/data_loader.js
r6400 r6651 8 8 } 9 9 , 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 ); 11 11 if (this.options.rectangle_of_confusion.width<16) this.options.rectangle_of_confusion.width=16; 12 12 if (this.options.rectangle_of_confusion.height<16) this.options.rectangle_of_confusion.height=16; … … 37 37 { 38 38 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 ); 41 41 this._loadData(); 42 42 }, … … 77 77 var bounds = this._map.getBounds(); 78 78 79 // BEGIN BUG in maps api 2.185 up to "today" 2.193 - when map wraps horizontally more than 360 deg - the getBounds is wrong80 /*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 BUG88 79 var latRange = bounds.toSpan().lat(); 89 80 var latPrec = latRange * this.options.rectangle_of_confusion.height / this._map.getSize().height; … … 107 98 ) 108 99 { 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)); 110 101 return; 111 102 } … … 129 120 } 130 121 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) ) ); 135 129 136 130 var url = this._urlMapData; … … 140 134 141 135 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 ); 144 139 } 145 140 … … 150 145 151 146 try { 152 GEvent.trigger( this, "dataloading" );147 google.maps.Event.trigger( this, "dataloading" ); 153 148 GDownloadUrl(url, this._onDataReceived.bind(this) ); 154 149 } … … 156 151 this._dataLoading = false; 157 152 this._previousLoadDataReq.box=null; 158 GEvent.trigger( this, "dataloadfailed", 600, e );153 google.maps.Event.trigger( this, "dataloadfailed", 600, e ); 159 154 } 160 155 }, … … 168 163 { 169 164 this._previousLoadDataReq.box=null; 170 GEvent.trigger( this, "dataloadfailed", responseCode, null );165 google.maps.Event.trigger( this, "dataloadfailed", responseCode, null ); 171 166 } 172 167 else … … 178 173 179 174 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 ); 182 177 } 183 178 catch (e) { 184 179 this._previousLoadDataReq.box=null; 185 GEvent.trigger( this, "dataloadfailed", responseCode, e );180 google.maps.Event.trigger( this, "dataloadfailed", responseCode, e ); 186 181 var s = e.message; 187 182 s += '\n' + data.substr(0,1000);
Note: See TracChangeset
for help on using the changeset viewer.