android - Draw Circle in ImageView when getting current location IndoorAtlas SDK -

i want current location , draw blue dot picture above. blue dot moving when current location change.
here code :
public void onserviceupdate(servicestate state) { msharedbuilder.setlength(0); msharedbuilder.append("location: ") .append(state.getroundtrip()).append("ms") .append(state.getgeopoint().getlatitude()) .append(state.getgeopoint().getlongitude()) .append(state.getmetricpoint().getx()) .append(state.getmetricpoint().gety()) .append(state.getimagepoint().geti()) .append(state.getimagepoint().getj()) .append(state.getheadingdegrees()) .append(state.getuncertainty()); double x1 = state.getmetricpoint().getx(); double y1 = state.getmetricpoint().gety(); float x = (float) x1; float y = (float) y1; paint paint = null; canvas.drawcircle(x,y,1,paint); } could me ? pictures in resource folder.
first, in case easier if use coordinates servicestate#getimagepoint() - these (i & j) coordinates of location in original floor plan. i.e. if original mapped & uploaded floor plan had dimensions 800x600, service might return position i:400,j:300 indicating in center of mapped area.
you cannot draw circle this: canvas.drawcircle(400, 300, radius, paint) - because depending on how image displayed (e.g. scaled) might drawing incorrect location.
you need take account image on screen , it's current dimensions, i.e. scaling ratio. e.g. if have display of size 1920x1080 , floor plan image of size 800x600 drawn centered , without scaling imageview occupies entire screen real estate (assume full 1920x1080 in portrait here), need draw current coordinate (400,300) canvas @ x: ((1080-800)/2)+400, y: ((1920-600/2)+300) = 540,960.
to draw accuracy blue dot (the semi-transparent larger circle), use uncertainty calculate circle radius.
Comments
Post a Comment