Call Method Interaction
Method interaction is the interaction from the calling method of the program. The Maps SDK provides a number of interface methods for interacting with maps, such as moving maps, changing map center points, changing map zoom levels, changing map orientation, day view, and night view switching.
The interaction of these methods is basically based on the methods provided by the MapRenderer class. The MapRenderer instance is obtained by the mMapView.getMapRenderer() method.
Change the center point of the map
Change the center point of the map, and change the display area of the map to move the map. The sample code is as follows:
mRenderer.setWorldCenter(new Point(11639754, 3990758)); // Set the center point of the map
Change the zoom level of the map
Set the map zoom level, the larger the value, the more detailed the map displayed. If it is a floating point number, the engine will interpolate according to the scale of the two adjacent zoom levels. The map level has a total of 17 levels, ranging from 0-16. The sample code is as follows:
mRenderer.setZoomLevel(11); // Set the map zoom level
In addition to directly setting the zoom level of the map, the zoom level of the changed map provides the following two methods:
zoomOut(float zoomLevel) ; Zoom out the map, zoomLevel is the zoom level, which is to zoom out the zoom level on the current getZoomLevel().
zoomIn(float zoomLevel); Zoom in on the map, zoomLevel is the zoom level, that is, zoom in on the current getZoomLevel() level.
Change the orientation of the map
Set the orientation of the map to set the angle of the map. The engine specifies that the north is 0 degrees and the value ranges from 0 to 360 degrees. The sample code is as follows:
mRenderer.setHeading(0); // Set the interface of the map. 0 degrees is the north direction.
Switching between day view and night view
The switch between day and night view of the map is mainly done by setting the style of the map. The sample code is as follows:
mRenderer.setStyleClass("DEFAULT"); // Set the map to the default style, daytime style mRenderer.setStyleClass("night"); // Set the night style
Night mode effect: