com.baidu.mapapi.map.BaiduMap Java Examples
The following examples show how to use
com.baidu.mapapi.map.BaiduMap.
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: MainActivity.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
public void changeMap(View view) { //根据id switch (view.getId()) { case R.id.rb1: { //普通地图 mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); } break; case R.id.rb2: { //卫星地图 mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE); } break; } }
Example #2
Source File: OverlayText.java From react-native-baidu-map with MIT License | 6 votes |
@Override public void addTopMap(BaiduMap baiduMap) { TextOptions option = new TextOptions() .text(text) .position(position); if (fontSize != null) { option.fontSize(fontSize); } if (fontColor != null) { option.fontColor(fontColor); } if (bgColor != null) { option.bgColor(bgColor); } if (rotate != null) { option.rotate(rotate); } textOverlay = (Text) baiduMap.addOverlay(option); }
Example #3
Source File: SetFavoriteMapActivity.java From AssistantBySDK with Apache License 2.0 | 6 votes |
/** * 定位接收到的地址 **/ private void locationReceiveAddress() { if (receiveAddress == null) { return; } LatLng p = new LatLng(receiveAddress.getLatitude(), receiveAddress.getLongitude()); MarkerOptions markerOptions = new MarkerOptions(); /* 设置覆盖物图标 */ markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_openmap_focuse_mark)) .position(p) .visible(true); baiduMap.setOnMarkerClickListener(new BaiduMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { setSinglePoiDetail(); return true; } }); if (NetUtil.getInstance(SetFavoriteMapActivity.this).getCurrentNetType().equals(NetUtil.NetType.NETWORK_TYPE_NONE)) { // Snackbar.make(mAmosfPoiList,mAppConfig.getResources().getString(R.string.no_network), Snackbar.LENGTH_SHORT).show(); return; } /* 添加覆盖图层 */ baiduMap.addOverlay(markerOptions); baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(p, 17F)); }
Example #4
Source File: LocationActivity.java From imsdk-android with MIT License | 6 votes |
private void sendLocation() { int centerX = mapView.getWidth() / 2; int centerY = mapView.getHeight() / 2; Rect rect = new Rect(centerX - CLIP_WIDTH / 2, centerY - CLIP_HEIGHT / 2, centerX + CLIP_WIDTH / 2, centerY + CLIP_HEIGHT / 2); baiduMap.setMyLocationEnabled(false); baiduMap.snapshotScope(rect, new BaiduMap.SnapshotReadyCallback() { @Override public void onSnapshotReady(Bitmap bitmap) { File file = onMapScreenShot(bitmap); Intent resultIntent = new Intent(); resultIntent.putExtra(Constants.BundleKey.LATITUDE, latitude); resultIntent.putExtra(Constants.BundleKey.LONGITUDE, longitude); resultIntent.putExtra(Constants.BundleKey.ADDRESS, address); resultIntent.putExtra(Constants.BundleKey.LOCATION_NAME, name); resultIntent.putExtra(Constants.BundleKey.FILE_NAME, file.getAbsolutePath()); setResult(Activity.RESULT_OK, resultIntent); LocationActivity.this.finish(); } }); }
Example #5
Source File: MapPickerActivity.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case android.R.id.home: onBackPressed(); break; case R.id.menu_send: if (mLoactionLatLng != null) { int left = mWidth / 4; int top = (int) (mHeight - 1.1 * mWidth); Rect rect = new Rect(left, top, mWidth - left, mHeight - (int) (1.2 * top)); mBaiduMap.snapshotScope(rect, new BaiduMap.SnapshotReadyCallback() { @Override public void onSnapshotReady(Bitmap bitmap) { if (null != bitmap && null != conv) { String fileName = UUID.randomUUID().toString(); String path = BitmapLoader.saveBitmapToLocal(bitmap, fileName); Intent intent = new Intent(); intent.putExtra("latitude", mLatitude); intent.putExtra("longitude", mLongitude); intent.putExtra("mapview", mMapView.getMapLevel()); intent.putExtra("street", mStreet); intent.putExtra("path", path); setResult(JGApplication.RESULT_CODE_SEND_LOCATION, intent); finish(); } else { Toast.makeText(MapPickerActivity.this, getString(R.string.send_location_error), Toast.LENGTH_SHORT).show(); } } }); } break; } return super.onOptionsItemSelected(item); }
Example #6
Source File: OverlayPolyline.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void removeFromMap(BaiduMap baiduMap) { if (polyline != null) { polyline.remove(); polyline = null; } }
Example #7
Source File: MapListener.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void onMapStatusChange(MapStatus mapStatus) { sendEvent(mapView, "onMapStatusChange", getEventParams(mapStatus)); for (BaiduMap.OnMapStatusChangeListener mapStatusChangeListener : mapStatusChangeListeners) { mapStatusChangeListener.onMapStatusChange(mapStatus); } }
Example #8
Source File: ClusterManager.java From react-native-baidu-map with MIT License | 5 votes |
public ClusterManager(Context context, BaiduMap map, MarkerManager markerManager) { mMap = map; mMarkerManager = markerManager; mClusterMarkers = markerManager.newCollection(); mMarkers = markerManager.newCollection(); mRenderer = new DefaultClusterRenderer<T>(context, map, this); mAlgorithm = new PreCachingAlgorithmDecorator<T>(new NonHierarchicalDistanceBasedAlgorithm<T>()); mClusterTask = new ClusterTask(); mRenderer.onAdd(); }
Example #9
Source File: OverlayManager.java From react-native-baidu-map with MIT License | 5 votes |
/** * 通过一个BaiduMap 对象构造 * * @param baiduMap */ public OverlayManager(BaiduMap baiduMap) { mBaiduMap = baiduMap; // mBaiduMap.setOnMarkerClickListener(this); if (mOverlayOptionList == null) { mOverlayOptionList = new ArrayList<OverlayOptions>(); } if (mOverlayList == null) { mOverlayList = new ArrayList<Overlay>(); } }
Example #10
Source File: DefaultClusterRenderer.java From react-native-baidu-map with MIT License | 5 votes |
public DefaultClusterRenderer(Context context, BaiduMap map, ClusterManager<T> clusterManager) { mMap = map; mDensity = context.getResources().getDisplayMetrics().density; mIconGenerator = new IconGenerator(context); mIconGenerator.setContentView(makeSquareTextView(context)); mIconGenerator.setTextAppearance(R.style.ClusterIcon_TextAppearance); mIconGenerator.setBackground(makeClusterBackground()); mClusterManager = clusterManager; }
Example #11
Source File: MainActivity.java From BaiDuMapSelectDemo with Apache License 2.0 | 5 votes |
private void initMap() { mMapView = (MapView) findViewById(R.id.bmapView); mBaiduMap = mMapView.getMap(); mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); // 开启定位图层 mBaiduMap.setMyLocationEnabled(true); }
Example #12
Source File: AddressEditDelegate.java From FastWaiMai with MIT License | 5 votes |
private void initMap() { mBaiduMap = mMapView.getMap(); mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); // 开启定位图层 mBaiduMap.setMyLocationEnabled(true); mUiSettings = mBaiduMap.getUiSettings(); mUiSettings.setAllGesturesEnabled(false); }
Example #13
Source File: ClusterManager.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void onMapStatusChange(MapStatus mapStatus) { if (mRenderer instanceof BaiduMap.OnMapStatusChangeListener) { ((BaiduMap.OnMapStatusChangeListener) mRenderer).onMapStatusChange(mapStatus); } // Don't re-compute clusters if the map has just been panned/tilted/rotated. MapStatus position = mMap.getMapStatus(); if (mPreviousCameraPosition != null && mPreviousCameraPosition.zoom == position.zoom) { return; } mPreviousCameraPosition = mMap.getMapStatus(); cluster(); }
Example #14
Source File: OverlayCluster.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void addTopMap(BaiduMap baiduMap) { this.baiduMap = baiduMap; if (markerClusterManager == null) { markerClusterManager = new ClusterManager<>(getContext(), baiduMap); mapListener.addMapStatusChangeListener(markerClusterManager); Log.i("OverlayCluster", "addMapStatusChangeListener"); } refresh(); }
Example #15
Source File: OverlayPolygon.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void removeFromMap(BaiduMap baiduMap) { if (polygon != null) { polygon.remove(); polygon = null; } }
Example #16
Source File: OverlayPolygon.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void addTopMap(BaiduMap baiduMap) { PolygonOptions options = new PolygonOptions() .points(points) .stroke(stroke) .fillColor(fillColor); polygon = (Polygon) baiduMap.addOverlay(options); }
Example #17
Source File: OverlayText.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void removeFromMap(BaiduMap baiduMap) { if (textOverlay != null) { textOverlay.remove(); textOverlay = null; } }
Example #18
Source File: NearbyGroupWithRedPocketMapViewActivity.java From Social with Apache License 2.0 | 5 votes |
private void initView(){ infos = new ArrayList<RedPocketGroup>(); fab_home = (FloatingActionButton)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_fab_home); fab_home.setOnClickListener(this); if (is_first_page==1){ fab_home.setVisibility(View.GONE); }else{ fab_home.setVisibility(View.VISIBLE); } mapView = (MapView)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_mapview); mBaiduMap = mapView.getMap(); rl_mark_info_container = (RelativeLayout)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_mark_info_windows); rl_mark_info_container.setVisibility(View.INVISIBLE); mBaiduMap.setOnMapClickListener(new BaiduMap.OnMapClickListener() { @Override public void onMapClick(LatLng latLng) { rl_mark_info_container.setVisibility(View.INVISIBLE); } @Override public boolean onMapPoiClick(MapPoi mapPoi) { return false; } }); }
Example #19
Source File: OverlayArc.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void removeFromMap(BaiduMap baiduMap) { if (arc != null) { arc.remove(); arc = null; } }
Example #20
Source File: OverlayArc.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void addTopMap(BaiduMap baiduMap) { ArcOptions ooArc = new ArcOptions() .color(stroke.color) .width(stroke.strokeWidth) .points(points.getP1(), points.getP2(), points.getP3()); arc = (Arc) baiduMap.addOverlay(ooArc); }
Example #21
Source File: OverlayCircle.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void removeFromMap(BaiduMap baiduMap) { if (circle != null) { circle.remove(); circle = null; } }
Example #22
Source File: OverlayCircle.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void addTopMap(BaiduMap baiduMap) { CircleOptions options = new CircleOptions().fillColor(fillColor) .center(center).stroke(stroke) .radius(radius); circle = (Circle) baiduMap.addOverlay(options); }
Example #23
Source File: OverlayManager.java From Mobike with Apache License 2.0 | 5 votes |
/** * 通过一个BaiduMap 对象构造 * * @param baiduMap */ public OverlayManager(BaiduMap baiduMap) { mBaiduMap = baiduMap; // mBaiduMap.setOnMarkerClickListener(this); if (mOverlayOptionList == null) { mOverlayOptionList = new ArrayList<OverlayOptions>(); } if (mOverlayList == null) { mOverlayList = new ArrayList<Overlay>(); } }
Example #24
Source File: OverlayHeatMap.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void removeFromMap(BaiduMap baiduMap) { if (heatMap != null) { heatMap.removeHeatMap(); heatMap = null; } }
Example #25
Source File: OverlayHeatMap.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void addTopMap(BaiduMap baiduMap) { HeatMap.Builder build = new HeatMap.Builder() .data(points); if (gradient != null) { build.gradient(gradient); } heatMap = build.build(); baiduMap.addHeatMap(heatMap); }
Example #26
Source File: FreightTrackGoogleMapFragment.java From ESeal with Apache License 2.0 | 5 votes |
/** * 设置百度地图属性 */ private void setupBaiduMap() { bmapView.showZoomControls(false); //移除地图缩放控件 bmapView.removeViewAt(1); //移除百度地图Logo mBaiduMap = bmapView.getMap(); mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomTo(16)); mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(false); //取消俯视手势 }
Example #27
Source File: FreightTrackMapFragment.java From ESeal with Apache License 2.0 | 5 votes |
/** * 设置百度地图属性 */ private void setupBaiduMap() { bmapView.showZoomControls(false); //移除地图缩放控件 bmapView.removeViewAt(1); //移除百度地图Logo mBaiduMap = bmapView.getMap(); mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomTo(16)); mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(false); //取消俯视手势 }
Example #28
Source File: MainActivity.java From Mobike with Apache License 2.0 | 5 votes |
private void initMarkerClickEvent() { // 对Marker的点击 baiduMap.setOnMarkerClickListener(new BaiduMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(final Marker marker) { // 获得marker中的数据 if (marker != null && marker.getExtraInfo() != null) { BikeInfo bikeInfo = (BikeInfo) marker.getExtraInfo().get("info"); if (bikeInfo != null) updateBikeInfo(bikeInfo); } return true; } }); }
Example #29
Source File: FreightTrackMapWithWebViewFragment.java From ESeal with Apache License 2.0 | 5 votes |
/** * 设置百度地图属性 */ private void setupBaiduMap() { bmapView.showZoomControls(false); //移除地图缩放控件 bmapView.removeViewAt(1); //移除百度地图Logo mBaiduMap = bmapView.getMap(); mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomTo(16)); mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(false); //取消俯视手势 }
Example #30
Source File: FreightTrackBaiduMapFragment.java From ESeal with Apache License 2.0 | 5 votes |
/** * 设置百度地图属性 */ private void setupBaiduMap() { bmapView.showZoomControls(false); //移除地图缩放控件 bmapView.removeViewAt(1); //移除百度地图Logo mBaiduMap = bmapView.getMap(); mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomTo(16)); mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(false); //取消俯视手势 }