修改单个定位点地图缩放比例
This commit is contained in:
@@ -323,9 +323,9 @@ class EmergencyFragment :
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
var newlist= mutableListOf<LocationResourceBean>()
|
var newlist = mutableListOf<LocationResourceBean>()
|
||||||
for (index in 0 until markerList.size) {
|
for (index in 0 until markerList.size) {
|
||||||
if(markerList[index].latitude>0.0&&markerList[index].longitude>0.0){
|
if (markerList[index].latitude > 0.0 && markerList[index].longitude > 0.0) {
|
||||||
newlist.add(markerList[index])
|
newlist.add(markerList[index])
|
||||||
val markerOption = MarkerOptions()
|
val markerOption = MarkerOptions()
|
||||||
markerOption.position(
|
markerOption.position(
|
||||||
@@ -348,7 +348,12 @@ class EmergencyFragment :
|
|||||||
mAMap?.addMarker(markerOption)
|
mAMap?.addMarker(markerOption)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MapUtils.setMapZoonlo(mAMap, 200, ArrayList(newlist))
|
|
||||||
|
if (markerList.size == 1) {
|
||||||
|
MapUtils.setMapZoonloAndZoom(mAMap, LatLng(markerList.get(0).latitude, markerList.get(0).longitude),11)
|
||||||
|
} else {
|
||||||
|
MapUtils.setMapZoonlo(mAMap, 200, ArrayList(newlist))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,12 @@ public class MapUtils {
|
|||||||
public static void setMapZoonlo(AMap map, int padding, LatLngBounds.Builder builder){
|
public static void setMapZoonlo(AMap map, int padding, LatLngBounds.Builder builder){
|
||||||
LatLngBounds bounds = builder.build();
|
LatLngBounds bounds = builder.build();
|
||||||
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding));
|
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setMapZoonloAndZoom(AMap map, LatLng latLng, int zoom){
|
||||||
|
map.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng,zoom));
|
||||||
|
}
|
||||||
|
|
||||||
public static void setMapZoonlo(AMap map, int padding, ArrayList<LocationResourceBean> list){
|
public static void setMapZoonlo(AMap map, int padding, ArrayList<LocationResourceBean> list){
|
||||||
LatLngBounds.Builder builder = LatLngBounds.builder();
|
LatLngBounds.Builder builder = LatLngBounds.builder();
|
||||||
if (list==null||list.size()==0) {
|
if (list==null||list.size()==0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user