我想显示一支小箭头作为我源代码标记的重叠, 指向目的地。 因此, 此箭头应该指向各个方向, 随着源位置的变化。 它就像指向目的地的源点所显示的指南针 。
有什么建议吗?
我想显示一支小箭头作为我源代码标记的重叠, 指向目的地。 因此, 此箭头应该指向各个方向, 随着源位置的变化。 它就像指向目的地的源点所显示的指南针 。
有什么建议吗?
我为类似问题找到的解决方案是使用代表箭头的标记图像。 然后我计算出源与目的地之间的角, 于是我用这个角度旋转标记 。 (为我的英语道歉 )
protected class yourOverlay extends Overlay{
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when){
super.draw(canvas, mapView, shadow);
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.arrow);
Point sourceCoords = new Point();
mapView.getProjection().toPixels(sourcePosition, sourceCoords);
int x = sourceCoords.x - bmp.getWidth()/2;
int y = sourceCoords.y - bmp.getHeight();
Point destinationCoords = new Point();
mapView.getProjection().toPixels(destinationPosition, destinationCoords);
double angle = Math.toDegrees(Math.atan2(sourceCoords.x - destinationCoords.x, sourceCoords.y - destinationCoords.y));
Matrix matrix = new Matrix();
matrix.postRotate(-(float)angle, bmp.getWidth()/2,bmp.getHeight());
matrix.postTranslate(x,y);
canvas.drawBitmap(bmp, matrix, new Paint());
return true;
}
}
I want to draw path from one location to other location. How to plot the path between two location. I have coordinates(latitude,longitude) for both location. How can i achieve this functionality? ...
Is there a quick and efficient way to get altitude (elevation) by longitude and latitude on the Android platform?
I would like to further annotate the custom markers I have placed on a MapView (using ItemizedOverlay) by displaying a simple text label that appears for a particular item when the onTap event is ...
I am trying to make a satellite view (via a MapView) without labels. How can I do this?
I have a mapview and i put an annotation which shows a custom title and subtitle pin. When the mapview starts the pin is visible but the title and subtitle are not. I have to press on the pin to show ...
Hi i have a problem. I have 2 viewcontroller, in the first there is a mapView that implements the function "calloutAccessoryControlTapped" to tap a button on an annotation on the mapView; in the ...
In my application I would like to mark different spots on a map. What I m now wondering is if there s a way to use a simple 9-patch image and add the spot s name as text to it or would I need to draw ...
would like to add a zoom control to the map. I also want to layout the position of the zoom Control instead of the default middle bottom position. I can do this by getZoomControl but it is deprecated. ...