2016-04-13 12 views
0

Haritaları geçerli konum işaretçisi çevresinde döndürmem gerekiyor. Geçerli yer işareti haritanın bagajına yerleştirilecektir. Bir resimdeki gibi.osmdroid haritasını rastgele döndürme noktasında döndürme

+0

ihtiyaçlarınızı açıklayınız. Bir çeşit statik haritaya ihtiyacınız var mı? –

+0

Merhaba! Yanıt için teşekkür ederim. Ben zaten çözüm buldum, ama bu en kötü varyant olabilir :) Bu kodu geliştirebilirseniz harika olurdu – BadEugene

cevap

0

Map with location marker Bu kod ile benim görev çözüldü:

//rotate map 
map.setMapOrientation(angle); 

//center to current location 
GeoPoint point = mMyLocationNewOverlay.getMyLocation(); 
if (point == null) return; 
mapController.setCenter(point); 

//calculate translation 
float bottomPadding = map.getHeight() * 0.1f; 
float radius = map.getHeight()/2 - bottomPadding; 
double deltaW = Math.sin(Math.toRadians(angle)); 
double deltaH = Math.cos(Math.toRadians(angle)); 

int width = map.getWidth()/2 - (int)(radius * deltaW); 
int height = map.getHeight()/2 - (int)(radius * deltaH); 

//Move current location marker to bottom of the map 
Projection projection = map.getProjection(); 
GeoPoint centerPoint = (GeoPoint) projection.fromPixels(width, height); 
mapController.setCenter(centerPoint); 
İlgili konular