Changeset 12698 for extensions/rv_gmaps/trunk/template/data_loader.js
- Timestamp:
- Dec 6, 2011, 5:42:24 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_gmaps/trunk/template/data_loader.js
r8221 r12698 4 4 this.options = jQuery.fn.extend( 5 5 { 6 reload_data_timeout: 1800,7 rectangle_of_confusion: G_DEFAULT_ICON.iconSize6 reload_data_timeout: 500, 7 rectangle_of_confusion: new google.maps.Size(32,16) 8 8 } 9 9 , opts || {} ); … … 37 37 { 38 38 this._urlMapData = urlMapData; 39 google.maps. Event.bind( this._map, "movestart", this, this.clearTimerReloadData );40 google.maps. Event.bind( this._map, "moveend", this, this._onMapMoveEnd);41 this._loadData();39 google.maps.event.bind( this._map, "movestart", this, this.clearTimerReloadData ); 40 google.maps.event.bind( this._map, "idle", this, this._onIdle ); 41 //this._loadData(); 42 42 }, 43 43 … … 59 59 }, 60 60 61 _on MapMoveEnd: function()61 _onIdle: function() 62 62 { 63 63 this.clearTimerReloadData(); … … 78 78 79 79 var latRange = bounds.toSpan().lat(); 80 var latPrec = latRange * this.options.rectangle_of_confusion.height / this._map.get Size().height;80 var latPrec = latRange * this.options.rectangle_of_confusion.height / this._map.getDiv().offsetHeight; 81 81 82 82 var lonRange = bounds.toSpan().lng(); 83 var lonPrec = ( lonRange>=0 ? lonRange : 360-lonRange )* this.options.rectangle_of_confusion.width / this._map.get Size().width;83 var lonPrec = ( lonRange>=0 ? lonRange : 360-lonRange )* this.options.rectangle_of_confusion.width / this._map.getDiv().offsetWidth; 84 84 85 85 if ( this._previousLoadDataReq.box!=null ) 86 86 { // not the first time 87 if ( this._previousLoadDataReq.box.containsBounds( bounds ) ) 87 if ( this._previousLoadDataReq.box.contains( bounds.getNorthEast() ) 88 && this._previousLoadDataReq.box.contains( bounds.getSouthWest() )) 88 89 { 89 90 if ( this._previousLoadDataReq.resultBounds == null ) … … 109 110 110 111 var nd=0, sd=0, ed=0, wd=0; 111 if ( !bounds.isFullLat() )112 /*if ( !bounds.isFullLat() )*/ 112 113 { 113 114 nd = latRange*12/100; 114 115 sd = latRange*4/100; 115 116 } 116 if ( !bounds.isFullLng() )117 /*if ( !bounds.isFullLng() )*/ 117 118 { 118 119 ed = lonRange*9/100; … … 130 131 131 132 if (document.is_debug) { 132 google.maps.Log.write("sd="+sd+" wd="+wd+" nd="+nd+" ed="+ed); 133 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() ); 134 google.maps.Log.writeUrl( url ); 133 glog("sd="+sd+" wd="+wd+" nd="+nd+" ed="+ed); 134 glog( url ); 135 135 } 136 136 … … 141 141 142 142 try { 143 google.maps. Event.trigger( this, "dataloading" );143 google.maps.event.trigger( this, "dataloading" ); 144 144 jQuery.ajax( { 145 145 url: url, … … 151 151 this._dataLoading = false; 152 152 this._previousLoadDataReq.box=null; 153 google.maps. Event.trigger( this, "dataloadfailed", 600, e );153 google.maps.event.trigger( this, "dataloadfailed", 600, e ); 154 154 } 155 155 }, … … 164 164 throw new Error( "DATA DECODING ERROR" ); 165 165 this._previousLoadDataReq.resultBounds = resp.bounds; 166 if (document.is_debug && resp.debug) g oogle.maps.Log.write( resp.debug );167 google.maps. Event.trigger( this, "dataloaded", resp );166 if (document.is_debug && resp.debug) glog( resp.debug ); 167 google.maps.event.trigger( this, "dataloaded", resp ); 168 168 } 169 169 catch (e) { 170 170 this._previousLoadDataReq.box=null; 171 google.maps. Event.trigger( this, "dataloadfailed", responseCode, e );171 google.maps.event.trigger( this, "dataloadfailed", responseCode, e ); 172 172 var s = e.message; 173 173 s += '\n' + data.substr(0,1000); … … 182 182 { 183 183 try { 184 google.maps. Event.trigger( this, "dataloadfailed", textStatus + xhr.status, exc );184 google.maps.event.trigger( this, "dataloadfailed", textStatus + xhr.status, exc ); 185 185 } 186 186 catch (e) {
Note: See TracChangeset
for help on using the changeset viewer.