/** * adjust the map to all points that just place the query scope * @param centerLatLng Center point * @param range Query range (m) */ private void adjustcamera (Latlng centerlatlng,int range) { //http://www.eoeandroid.com/blog-1107295-47621.html//the scale at the current zoom level //"per pixel represents" + scale + "M" Float scale = g_amap.getscaleperpixel (); //represents the number of pixels in range (m) int pixel = math.round (Range / scale), //Small scale, small zoom level (large scale), with loss of precision Projection Projection = g_amap.getprojection (); //converts the center point of the map to a point on the screen Point center = Projection.toscreenlocation (CENTERLATLNG); //gets the left and right two points from the center point to pixel pixels (the point on the screen point right = new point (CENTER.X + PIXEL, CENTER.Y); point left = new Point (CENTER.X - PIXEL, CENTER.Y); //converts points on the screen to points on the map latlng rightlatlng = projection.fromscreenlocation (Right); latlng leftlatlng = projection.fromscreenlocation (left); latlngbounds Bounds = latlngbounds.builder (). Include (RIGHTLATLNG). Include (LEFTLATLNG). build ();//bounds.contains () ; G_amap.getmapscreenmarkers ();//Adjust visual range //amap.movecamera (Cameraupdatefactory.newlatlngbounds ( Latlngbounds.builder (). Include (RIGHTLATLNG). Include (LEFTLATLNG). Build (), 10)); }}
Code snippet, click on the area to display the points on the area
LATLNG latlng = Marker.getposition ();//zoom level FLOAT zoom = G_amap.getcameraposition (). zoom;//"per pixel represents" + scale + "M" Float scal E = G_amap.getscaleperpixel (); Float range = scale * ZOOM; Circle Circle = g_amap.addcircle (New circleoptions (). Center (LATLNG). Radius (range). Strokecolor (Getresources (). GetColor (R.color.color_translate)). FillColor (Getresources (). GetColor (R.color.color_translate)). Strokewidth (2)) ;
"Android" Gold map zoom levels and pixels and points on the map are converted to dots on the screen