binex / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

mapController.animateTo(point2) dosent point to same location as for mapController.setCenter(point2); #278

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a IGeoPoint as follows
IGeoPoint point2 = new IGeoPoint() {
  public int getLatitudeE6() {
    return (int) (51.473988 * 1E6);
  }
  public int getLongitudeE6() {
    return (int) (-0.29294 * 1E6);
  }
};  

These are the values for Kew Gardens, UK

2. Use this point as mapController.animateTo(point2); 

This takes to wrong location.

3. Now use  mapController.setCenter(point2);
It points to correct location

What is the expected output? What do you see instead?

both API should point to same location
What version of the product are you using? On what operating system?
latest

Please provide any additional information below.

Original issue reported on code.google.com by raj.smo...@gmail.com on 6 Dec 2011 at 4:09

GoogleCodeExporter commented 8 years ago
Sorry Please replace IGeoPoint with GeoPoint... but still the issue gets 
reproduced

Original comment by raj.smo...@gmail.com on 6 Dec 2011 at 4:18

GoogleCodeExporter commented 8 years ago
I have the same issue. Calling multiple times to mapController.animateTo seems 
to move the map to the correct position sometimes, but is not an option :)

setCenter works as spected. Example :

<code>
public void onCreate(Bundle savedInstanceState)
{
   ....
   detectLocation();
}

private void detectLocation()
    {
        final Handler handler = new Handler();

        myLocationOverlay.runOnFirstFix(new Runnable()
        {
            public void run()
            {
                final GeoPoint l = myLocationOverlay.getMyLocation();
                handler.post(new Runnable()
                {
                    @Override
                    public void run()
                    {
                        if (l != null) {
                            Toast.makeText(getApplicationContext(), l.toString(), Toast.LENGTH_LONG).show();
                            mc.setZoom(15);
                            //mc.setCenter(l); // works
                                mc.animateTo(l); // bugged
                        }
                    }
                });
            }
        });
}

// App menu
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
    // Handle item selection
    switch (item.getItemId()) {
        case R.id.location:
            detectLocation();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
</code>

Original comment by gazer....@gmail.com on 28 Feb 2012 at 6:18