/** @param level value range 3~20 */ public void setZoomLevel(float level) { if (aMap != null) { if (level < aMap.getMinZoomLevel()) { level = aMap.getMinZoomLevel(); } else if (level > aMap.getMaxZoomLevel()) { level = aMap.getMaxZoomLevel(); } aMap.moveCamera(CameraUpdateFactory.zoomTo(level)); } }
public void setOverlayVisibleBounds(VisibleBoundsVO data) { if (mOverlays != null && mOverlays.size() > 0) { LatLngBounds.Builder builder = LatLngBounds.builder(); for (int i = 0; i < mOverlays.size(); i++) { LatLng item = mOverlays.get(i); builder.include(item); } aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), data.getPadding())); } }
public void setMarkerVisibleBounds(VisibleBoundsVO data) { List<Marker> list = aMap.getMapScreenMarkers(); if (list != null && list.size() > 0) { LatLngBounds.Builder builder = LatLngBounds.builder(); for (int i = 0; i < list.size(); i++) { LatLng item = list.get(i).getPosition(); builder.include(item); } aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), data.getPadding())); } }
/** 设置地图 */ private void setUpMap() { mMap.setOnMarkerClickListener(this); // 设置点击marker事件监听器 mMap.setInfoWindowAdapter(this); mMap.setOnInfoWindowClickListener(this); // 设置点击infoWindow事件监听器 mMap.setOnMapLoadedListener(this); // 设置map载入成功事件监听器 mMap.setOnCameraChangeListener(this); routeSearch = new RouteSearch(getActivity()); routeSearch.setRouteSearchListener(this); setLocation(); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(position_schoolLatLngs[0], 17.904732f)); startTextView = (AutoCompleteTextView) schoolView.findViewById(R.id.autotextview_roadsearch_start); startTextView.setFocusable(false); endTextView = (AutoCompleteTextView) schoolView.findViewById(R.id.autotextview_roadsearch_goals); endTextView.setFocusable(false); routeSearchImagebtn = (ImageButton) schoolView.findViewById(R.id.imagebtn_roadsearch_search); routeSearchImagebtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { strStart = startTextView.getText().toString().trim(); strEnd = endTextView.getText().toString().trim(); if (strStart == null || strStart.length() == 0) { Toast.makeText(getActivity(), "请选择起点", Toast.LENGTH_SHORT).show(); return; } if (strEnd == null || strEnd.length() == 0) { Toast.makeText(getActivity(), "请选择终点", Toast.LENGTH_SHORT).show(); return; } if (startPoint != null && endPoint != null) { if (NetworkUtils.isConnect(getActivity())) { progDialog = ProgressDialog.show(getActivity(), null, "正在搜索", true, true); searchRoute(); } else { Toast.makeText(getActivity(), "亲,请检查网络连接", Toast.LENGTH_SHORT).show(); } // searchRouteResult(startPoint, endPoint); } } }); }
public void overlook(float angle) { if (aMap != null) { aMap.moveCamera(CameraUpdateFactory.changeTilt(angle)); } }
public void rotate(float angle) { if (aMap != null) { aMap.moveCamera(CameraUpdateFactory.changeBearing(angle)); } }
public void zoomOut() { if (aMap != null) { aMap.moveCamera(CameraUpdateFactory.zoomOut()); } }
public void setCenter(double longitude, double latitude) { if (aMap != null) { LatLng latLng = new LatLng(latitude, longitude); aMap.moveCamera(CameraUpdateFactory.changeLatLng(latLng)); } }