I have a map application using an in-house map engine on Android. I'm
working on a rotating Map view that rotates the map based on the
phone's orientation using the Sensor Service. All works fine with the
exception of dragging the map when the phone is pointing other than
North. For example, if the phone is facing West, dragging the Map up
still moves the Map to the South versus East as would be expected.  I
assume translating the canvas is one possible solution but I'm
honestly not sure the correct way to do this to swap the axes without
disrupting the coordinate system needed by the map tiles.

Here is the code I'm using to rotate the Canvas:

public void dispatchDraw(Canvas canvas)
{
    canvas.save(Canvas.MATRIX_SAVE_FLAG);
    // mHeading is the orientation from the Sensor
    canvas.rotate(-mHeading, origin[X],origin[Y]);


    mCanvas.delegate = canvas;
    super.dispatchDraw(mCanvas);
    canvas.restore();
}

What is the best approach to make dragging the map consistent
regardless of the phones orientation? The sensormanager has a
"remapcoordinates()" method but it's not clear to me exactly how to
use it.  I've searched the web and posted to StackOverflow to try and
figure this out...no luck so far.  Any pointers would be greatly
appreciated!  Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to