Java Code Examples for com.amap.api.maps.AMap#moveCamera()

The following examples show how to use com.amap.api.maps.AMap#moveCamera() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AMapViewManager.java    From react-native-amap with MIT License 6 votes vote down vote up
@ReactProp(name = "region")
public void setRegion(MapView mapView, @Nullable ReadableMap region) {
    if (region == null) return;
    AMap map = mapView.getMap();
    Double lat = region.getDouble("latitude");
    Double lng = region.getDouble("longitude");
    Double lngDelta = region.getDouble("longitudeDelta");
    Double latDelta = region.getDouble("latitudeDelta");
    LatLngBounds bounds = new LatLngBounds(
        new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
        new LatLng(lat + latDelta / 2, lng + lngDelta / 2)  // northeast
    );
    if (mapView.getHeight() <= 0 || mapView.getWidth() <= 0) {
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 10));
        boundsToMove = bounds;
    } else {
        map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
    }
}
 
Example 2
Source File: ListViewAdapter.java    From TraceByAmap with MIT License 5 votes vote down vote up
public void addMarker(AMap aMap, LatLng D) {
    Marker marker2 = aMap.addMarker(new MarkerOptions().position(D).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));
    Marker marker1 = aMap.addMarker(new MarkerOptions().position(new LatLng(D.latitude + 0.00015, D.longitude)).icon(BitmapDescriptorFactory.fromResource(R.drawable.car)));
    marker1.setVisible(true);
    marker2.setVisible(true);
    aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(D, 18));
}
 
Example 3
Source File: MyRecycleViewAdapter.java    From TraceByAmap with MIT License 5 votes vote down vote up
public void addMarker(AMap aMap, LatLng D) {
    Marker marker2 = aMap.addMarker(new MarkerOptions().position(D).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));
    Marker marker1 = aMap.addMarker(new MarkerOptions().position(new LatLng(D.latitude + 0.00015, D.longitude)).icon(BitmapDescriptorFactory.fromResource(R.drawable.car)));
    marker1.setVisible(true);
    marker2.setVisible(true);
    aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(D, 18));
}
 
Example 4
Source File: ListViewAdapter.java    From TraceByAmap with MIT License 4 votes vote down vote up
private void addPolyline(AMap map, List<LatLng> polylinePoints) {
    map.addPolyline((new PolylineOptions())
            .addAll(polylinePoints)
            .width(10));
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(polylinePoints.get(0), 15));
}
 
Example 5
Source File: MyRecycleViewAdapter.java    From TraceByAmap with MIT License 4 votes vote down vote up
private void addPolyline(AMap map, List<LatLng> polylinePoints) {
    map.addPolyline((new PolylineOptions())
            .addAll(polylinePoints)
            .width(10));
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(polylinePoints.get(0), 15));
}
 
Example 6
Source File: CubeMapRender.java    From TraceByAmap with MIT License 4 votes vote down vote up
public CubeMapRender(AMap aMap) {
    this.aMap = aMap;

    aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(center,15));
}