Hi,
I have this snippet of code that generates overlays on my map:
GeoPoint Y = gpItems.get(j);
float orientation = orientItems.get(j);
Paint paint = new Paint();
Point pt = new Point();
mapView.getProjection().toPixels(Y, pt);
Bitmap bmp =
BitmapFactory.decodeResource(getResources(),R.drawable.overlay);
Matrix matrix = new Matrix();
matrix.postTranslate(-25, -25);
matrix.postRotate(orientation);
matrix.postTranslate(pt.x, pt.y);
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
int width = bmp.getWidth();
int height = bmp.getHeight();
Bitmap changedBitmap = Bitmap.createBitmap(bmp, 0, 0, width, height,
matrix, true);
BitmapDrawable icon = new BitmapDrawable(changedBitmap);
icon.setBounds(0, 0, icon.getIntrinsicWidth(),
icon.getIntrinsicHeight());
picOverlay overlay = new picOverlay(icon);
OverlayItem item = new OverlayItem(Y,"pic",null);
overlay.addItem(item);
On my picOverlay class I have onTap method with this snippet:
@Override
protected boolean onTap(int i) {
OverlayItem item=getItem(i);
GeoPoint geo=item.getPoint();
Point pt=mapView.getProjection().toPixels(geo, null);
My question is... is it possible to know exactly from which GeoPoint
( in this case Y ) the overlay was created? ... I want to perform an
HTTP request from onTap on which I compare the lat/long of the overlay
with the lat/long of the place the user tapped... but I can't seem to
get the numbers right.. longitude and latitude suffer approximations
during the convertions which is making my job impossible.. so if I
have access from the onTap method to the actual GeoPoint that
''created'' that overlay I could compare them...
Any help ?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en