java - Issue Converting Over To GMaps v2 for Android -


i'm trying convert old version of code gmaps v1.1 gmaps v2. having issues converting following mapcontroller code:

private mapcontroller mmapcontroller;  public void setcontroller(object controller) {   /*if( controller instanceof org.osmdroid.views.mapview )   {      mopenstreetmapviewcontrollersource = (org.osmdroid.views.mapview) controller;      mmapcontroller = null;   } else */if( controller instanceof mapcontroller )   {      mmapcontroller = (mapcontroller) controller;      mopenstreetmapviewcontrollersource = null;   } }  public void setzoom( int ) {   if( mmapcontroller != null )   {      mmapcontroller.setzoom( );   }   /*else if( mopenstreetmapviewcontrollersource != null )   {      mopenstreetmapviewcontrollersource.getcontroller().setzoom( );      mpostponedsetzoom = i;   }*/   else    {      throw new illegalstateexception( "no working controller available" );   } }  public void animateto( latlng point ) {   if( point.latitude*1000000 != 0 && point.longitude*1000000 != 0 )   {      if( mmapcontroller != null )      {         mmapcontroller.animateto( point );      }      /*else if( mopenstreetmapviewcontrollersource != null )      {         mopenstreetmapviewcontrollersource.getcontroller().animateto( new org.osmdroid.util.geopoint( point.getlatitudee6(), point.getlongitudee6() ) );         mpostponedsetcenterpoint = point;      }*/      else       {         throw new illegalstateexception( "no working controller available" );      }   } }  public void setcenter( latlng point ) {   if( point.latitude*1000000 != 0 && point.longitude*1000000 != 0 )   {      if( mmapcontroller != null )      {         mmapcontroller.setcenter( point );      }      /*else if( mopenstreetmapviewcontrollersource != null )      {         mopenstreetmapviewcontrollersource.getcontroller().setcenter( new org.osmdroid.util.geopoint( point.getlatitudee6(), point.getlongitudee6() ) );         mpostponedsetcenterpoint = point;      }*/   } }   public boolean zoomin() {   if( mmapcontroller != null )   {      return mmapcontroller.zoomin();  //use cameraupdatefactory zoomin() - https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/cameraupdatefactory   }   /*if( mopenstreetmapviewcontrollersource != null )   {      return mopenstreetmapviewcontrollersource.getcontroller().zoomin();   }*/   return false; }  public boolean zoomout() {   if( mmapcontroller != null )   {      return mmapcontroller.zoomout();  //use cameraupdatefactory zoomout() - https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/cameraupdatefactory   }   /*else if( mopenstreetmapviewcontrollersource != null )   {      return mopenstreetmapviewcontrollersource.getcontroller().zoomout();   }*/   return false; } 

here whole file i'm trying convert:

import android.util.log;  import com.google.android.gms.maps.model.latlng; //import com.google.android.maps.geopoint; import com.google.android.maps.mapcontroller;  public class mapcontrollerproxy {  private static final string tag = "ogt.mapcontrollerproxy"; private mapcontroller mmapcontroller; private org.osmdroid.views.mapview mopenstreetmapviewcontrollersource; private latlng mpostponedsetcenterpoint = null; private int mpostponedsetzoom = -1;  public mapcontrollerproxy() { }   public void setcontroller(object controller) {   /*if( controller instanceof org.osmdroid.views.mapview )   {      mopenstreetmapviewcontrollersource = (org.osmdroid.views.mapview) controller;      mmapcontroller = null;   } else */if( controller instanceof mapcontroller )   {      mmapcontroller = (mapcontroller) controller;      mopenstreetmapviewcontrollersource = null;   } }  public void setzoom( int ) {   if( mmapcontroller != null )   {      mmapcontroller.setzoom( );   }   /*else if( mopenstreetmapviewcontrollersource != null )   {      mopenstreetmapviewcontrollersource.getcontroller().setzoom( );      mpostponedsetzoom = i;   }*/   else    {      throw new illegalstateexception( "no working controller available" );   } }  public void animateto( latlng point ) {   if( point.latitude*1000000 != 0 && point.longitude*1000000 != 0 )   {      if( mmapcontroller != null )      {         mmapcontroller.animateto( point );      }      /*else if( mopenstreetmapviewcontrollersource != null )      {         mopenstreetmapviewcontrollersource.getcontroller().animateto( new org.osmdroid.util.geopoint( point.getlatitudee6(), point.getlongitudee6() ) );         mpostponedsetcenterpoint = point;      }*/      else       {         throw new illegalstateexception( "no working controller available" );      }   } }  public void setcenter( latlng point ) {   if( point.latitude*1000000 != 0 && point.longitude*1000000 != 0 )   {      if( mmapcontroller != null )      {         mmapcontroller.setcenter( point );      }      /*else if( mopenstreetmapviewcontrollersource != null )      {         mopenstreetmapviewcontrollersource.getcontroller().setcenter( new org.osmdroid.util.geopoint( point.getlatitudee6(), point.getlongitudee6() ) );         mpostponedsetcenterpoint = point;      }*/   } }   public boolean zoomin() {   if( mmapcontroller != null )   {      return mmapcontroller.zoomin();  //use cameraupdatefactory zoomin() - https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/cameraupdatefactory   }   /*if( mopenstreetmapviewcontrollersource != null )   {      return mopenstreetmapviewcontrollersource.getcontroller().zoomin();   }*/   return false; }  public boolean zoomout() {   if( mmapcontroller != null )   {      return mmapcontroller.zoomout();  //use cameraupdatefactory zoomout() - https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/cameraupdatefactory   }   /*else if( mopenstreetmapviewcontrollersource != null )   {      return mopenstreetmapviewcontrollersource.getcontroller().zoomout();   }*/   return false; }  public void executepostponedactions() {   if( mpostponedsetcenterpoint != null )   {      log.w( tag, "mpostponedsetcenterpoint"+ mpostponedsetcenterpoint);      setcenter( mpostponedsetcenterpoint );      mpostponedsetcenterpoint = null;   }   if( mpostponedsetzoom >= 0 )   {      log.w( tag, "mpostponedsetzoom"+ mpostponedsetcenterpoint);      setzoom( mpostponedsetzoom );      mpostponedsetzoom = -1;   } }  } 

what code can use replace mapcontroller functionality in conversion v2? suggestions helpful.

doing center map on point

cameraposition position = new cameraposition.builder()             .target(new latlng(lat,lon))             .zoom(zoom).build();           map.animatecamera(cameraupdatefactory.newcameraposition(position)); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -