@@ -194,11 +194,21 @@ otp.modules.planner.PlannerModule =
194194 var this_ = this ;
195195 //TRANSLATORS: Context menu
196196 this . webapp . map . addContextMenuItem ( _tr ( "Set as Start Location" ) , function ( latlng ) {
197- this_ . setStartPoint ( latlng , true ) ;
197+ //raf reverse geocoding
198+ this_ . webapp . geocoders [ 0 ] . reverse ( latlng , function ( result ) {
199+ console . log ( "got result: " + result ) ;
200+ this_ . setStartPoint ( latlng , true , result ) ;
201+ } ) ;
202+ //this_.setStartPoint(latlng, true);
198203 } ) ;
199204 //TRANSLATORS: Context menu
200205 this . webapp . map . addContextMenuItem ( _tr ( "Set as End Location" ) , function ( latlng ) {
201- this_ . setEndPoint ( latlng , true ) ;
206+ //raf reverse geocoding
207+ this_ . webapp . geocoders [ 0 ] . reverse ( latlng , function ( result ) {
208+ console . log ( "got result: " + result ) ;
209+ this_ . setEndPoint ( latlng , true , result ) ;
210+ } ) ;
211+ //this_.setEndPoint(latlng, true);
202212 } ) ;
203213 } ,
204214
@@ -224,6 +234,7 @@ otp.modules.planner.PlannerModule =
224234 } ,
225235
226236 setStartPoint : function ( latlng , update , name ) {
237+ var this_ = this ;
227238 this . startName = ( typeof name !== 'undefined' ) ? name : null ;
228239 this . startLatLng = latlng ;
229240 if ( this . startMarker == null ) {
@@ -232,7 +243,12 @@ otp.modules.planner.PlannerModule =
232243 //this.startMarker.bindPopup('<strong>' + pgettext('popup', 'Start') + '</strong>');
233244 this . startMarker . on ( 'dragend' , $ . proxy ( function ( ) {
234245 this . webapp . hideSplash ( ) ;
235- this . setStartPoint ( this . startMarker . getLatLng ( ) , false ) ;
246+ //raf reverse geocoding
247+ this . webapp . geocoders [ 0 ] . reverse ( this . startMarker . getLatLng ( ) , function ( result ) {
248+ console . log ( "got result: " + result ) ;
249+ this_ . setStartPoint ( this_ . startMarker . getLatLng ( ) , true , result ) ;
250+ } ) ;
251+ //this.setStartPoint(this.startMarker.getLatLng(), false);
236252 this . invokeHandlers ( "startChanged" , [ this . startLatLng ] ) ;
237253 if ( typeof this . userPlanTripStart == 'function' ) this . userPlanTripStart ( ) ;
238254 this . planTripFunction . apply ( this ) ; //planTrip();
@@ -255,6 +271,7 @@ otp.modules.planner.PlannerModule =
255271 } ,
256272
257273 setEndPoint : function ( latlng , update , name ) {
274+ var this_ = this ;
258275 this . endName = ( typeof name !== 'undefined' ) ? name : null ;
259276 this . endLatLng = latlng ;
260277 if ( this . endMarker == null ) {
@@ -263,7 +280,12 @@ otp.modules.planner.PlannerModule =
263280 //this.endMarker.bindPopup('<strong>' + _tr('Destination') + '</strong>');
264281 this . endMarker . on ( 'dragend' , $ . proxy ( function ( ) {
265282 this . webapp . hideSplash ( ) ;
266- this . setEndPoint ( this . endMarker . getLatLng ( ) , false ) ;
283+ //raf reverse geocoding
284+ this . webapp . geocoders [ 0 ] . reverse ( this . endMarker . getLatLng ( ) , function ( result ) {
285+ console . log ( "got result: " + result ) ;
286+ this_ . setEndPoint ( this_ . endMarker . getLatLng ( ) , true , result ) ;
287+ } ) ;
288+ //this.setEndPoint(this.endMarker.getLatLng(), false);
267289 this . invokeHandlers ( "endChanged" , [ this . endLatLng ] ) ;
268290 if ( typeof this . userPlanTripStart == 'function' ) this . userPlanTripStart ( ) ;
269291 this . planTripFunction . apply ( this ) ; //this_.planTrip();
0 commit comments