Draw over google map v2 android -


i created android app draw free shapes on google map v2. idea of app combines 2 apps, 1 draw free shapes , other normal google map v2 app.

this link last question app , contains code

the app works me have new problem. problem when draw line on specific location on map , convert control map , drag it, found line keep in place in view , map moves under line , leads line in location not location want.

is there way make line steady in location draw in , when drag map line dragged location?

hope got mean.

for example if drawing line on mapview using canvas need x,y points of start , end point.

then following code can change x,y points latitude , longitude.

public boolean ontouchevent(motionevent event) {     int x = (int)event.getx();               int y = (int)event.gety();      geopoint geopoint = mapview.getprojection().frompixels(x, y); } 

then resgister listener on mapvierw this.

map.setoncamerachangelistener(new oncamerachangelistener() {      @override     public void oncamerachange(cameraposition arg0) {         // move camera.      here remove view screen , lat long of visible region       passing x,y points of 4 regions in `mapview.getprojection().frompixels(x,y)` , check if latitude , longitude of line within range if yes drawline following code.       float pistex;      float pistey;      projection projection = this.mapview.getprojection();       point pt = new point();      geopoint gie = new geopoint(latitude,longitude);      rect rec = mapview.getscreenrect(new rect());      projection.topixels(gie, pt);      pistex = pt.x-rec.left; // car x screen coord      pistey = pt.y-rec.top; // car y screen coord       draw line between 2 (x,y) points.     }   }); 

hope can make clear , can understand want say.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -