com.baidu.mapapi.model.LatLng Java Examples
The following examples show how to use
com.baidu.mapapi.model.LatLng.
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: MapPickerActivity.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { // 通知是适配器第position个item被选择了 mAdapter.setNotifyTip(position); mAdapter.notifyDataSetChanged(); BitmapDescriptor mSelectIco = BitmapDescriptorFactory .fromResource(R.drawable.picker_map_geo_icon); mBaiduMap.clear(); PoiInfo info = (PoiInfo) mAdapter.getItem(position); LatLng la = info.location; // 动画跳转 MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(la); mBaiduMap.animateMapStatus(u); // 添加覆盖物 OverlayOptions ooA = new MarkerOptions().position(la) .icon(mSelectIco).anchor(0.5f, 0.5f); mBaiduMap.addOverlay(ooA); mLoactionLatLng = info.location; mAddress = info.address; mName = info.name; mCity = info.city; mLatitude = info.location.latitude; mLongitude = info.location.longitude; mStreet = info.name;//地图对应位置文字描述 }
Example #2
Source File: BaiduBusFragment.java From BmapLite with GNU General Public License v3.0 | 6 votes |
public void reRoute(Bundle bundle) { if (null != bundle) { mPoiStart = bundle.getParcelable("start"); mPoiEnd = bundle.getParcelable("end"); } if (null == mPoiStart) { mPoiStart = BApp.MY_LOCATION; } if (null != BApp.MY_LOCATION && "我的位置".equals(mPoiStart.getName())) { mPoiStart = BApp.MY_LOCATION; } if (null != mPoiStart && null != mPoiEnd) { PlanNode stNode = PlanNode.withLocation(new LatLng(mPoiStart.getLatitude(), mPoiStart.getLongitude())); PlanNode enNode = PlanNode.withLocation(new LatLng(mPoiEnd.getLatitude(), mPoiEnd.getLongitude())); RoutePlanSearch planSearch = RoutePlanSearch.newInstance(); planSearch.setOnGetRoutePlanResultListener(this); planSearch.masstransitSearch(new MassTransitRoutePlanOption().from(stNode).to(enNode)); } }
Example #3
Source File: BaiduMapFragment.java From BmapLite with GNU General Public License v3.0 | 6 votes |
@Override public void onMapClick(LatLng latLng) { if (mIsModeRanging) { MyPoiModel poi = new MyPoiModel(TypeMap.TYPE_BAIDU); poi.setLatitude(latLng.latitude); poi.setLongitude(latLng.longitude); if (null == mPoiList) { mPoiList = new ArrayList<>(); } mPoiList.add(poi); makeRangingMarker(poi); setRangingPolyLine(); } else { ((MainActivity) getActivity()).showPoiLay(null, -1); } }
Example #4
Source File: BaiduMapFragment.java From BmapLite with GNU General Public License v3.0 | 6 votes |
public void getFavoriteList() { if (null != mFavMarkerList && !mFavMarkerList.isEmpty()) { for (Overlay o : mFavMarkerList) { o.remove(); } mFavMarkerList.clear(); } if (null != mFavoriteInteracter) { List<MyPoiModel> favoriteList = mFavoriteInteracter.getFavoriteList(); if (null != favoriteList && !favoriteList.isEmpty()) { for (MyPoiModel poi : favoriteList) { //构建Marker图标 BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.ic_grade_point); //构建MarkerOption,用于在地图上添加Marker OverlayOptions option = new MarkerOptions().title(poi.getName()).position(new LatLng(poi.getLatitude(), poi.getLongitude())).icon(bitmap).animateType(MarkerOptions.MarkerAnimateType.none).anchor(0.5f, 0.5f); //在地图上添加Marker,并显示 mFavMarkerList.add(mBaiduMap.addOverlay(option)); } } } }
Example #5
Source File: NavUtil.java From Mobike with Apache License 2.0 | 6 votes |
/** * 启动百度地图骑行导航(Native) */ private static void startBikingNavi(Activity activity, LatLng startLL, LatLng endLL) { //距离太近toast提示(100米内) double dis = DistanceUtil.getDistance(new LatLng(startLL.latitude, startLL.longitude), new LatLng(endLL.latitude, endLL.longitude)); if (dis <= 100) { Toast.makeText(activity, "起点、途经点、终点距离太近", Toast.LENGTH_SHORT).show(); return; } // 构建 导航参数 NaviParaOption para = new NaviParaOption() .startPoint(startLL).endPoint(endLL); try { BaiduMapNavigation.openBaiduMapBikeNavi(para, activity); } catch (BaiduMapAppNotSupportNaviException e) { e.printStackTrace(); } }
Example #6
Source File: SearchAddressAdapter.java From FastWaiMai with MIT License | 6 votes |
@Override protected void convert(BaseViewHolder helper, PoiInfo item) { final ImageView ivPointImage = helper.getView(R.id.iv_point); final TextView tvName = helper.getView(R.id.tv_name); final TextView tvAddress = helper.getView(R.id.tv_address); final TextView tvDistance = helper.getView(R.id.tv_distance); LatLng latLng = item.getLocation(); double distance = DistanceUtil.getDistance(currentLatLng, latLng); if(helper.getPosition() == 0){ ivPointImage.setImageResource(R.drawable.point_orange); tvName.setTextColor(Latte.getApplication().getResources().getColor(R.color.orange)); }else{ ivPointImage.setImageResource(R.drawable.point_gray); tvName.setTextColor(Latte.getApplication().getResources().getColor(R.color.black)); } tvName.setText(item.getName()); tvAddress.setText(item.getAddress()); tvDistance.setText(formatDistance(distance)); }
Example #7
Source File: AddressEditDelegate.java From FastWaiMai with MIT License | 6 votes |
/** * 根据收货地址的位置在地图上移动"我"的位置 */ private void navigateTo(double longitude, double latitude) { if (isFirstLocation) { currentLatLng = new LatLng(latitude, longitude); MapStatus.Builder builder = new MapStatus.Builder(); MapStatus mapStatus = builder.target(currentLatLng).zoom(17.0f).build(); mBaiduMap.animateMapStatus(MapStatusUpdateFactory .newMapStatus(mapStatus)); isFirstLocation = false; //反向地理解析(含有poi列表) mGeoCoder.reverseGeoCode(new ReverseGeoCodeOption() .location(currentLatLng)); } MyLocationData.Builder locationBuilder = new MyLocationData.Builder(); locationBuilder.latitude(latitude); locationBuilder.longitude(longitude); MyLocationData locationData = locationBuilder.build(); mBaiduMap.setMyLocationData(locationData); }
Example #8
Source File: LocationDelegate.java From FastWaiMai with MIT License | 6 votes |
@Override public void onReceiveLocation(BDLocation location) { if (location == null){ return; } if (location.getLocType() == BDLocation.TypeGpsLocation || location.getLocType() == BDLocation.TypeNetWorkLocation) { currentAddr = location.getAddrStr(); //当前所在位置 LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude()); mGeoCoder.reverseGeoCode(new ReverseGeoCodeOption() .location(currentLatLng) .radius(radius)); } }
Example #9
Source File: MainActivity.java From BaiDuMapSelectDemo with Apache License 2.0 | 6 votes |
/** * 根据获取到的位置在地图上移动“我”的位置 * * @param location */ private void navigateTo(BDLocation location) { double longitude = location.getLongitude(); double latitude = location.getLatitude(); String address = location.getAddrStr(); if (isFirstLocation) { currentLatLng = new LatLng(latitude, longitude); MapStatus.Builder builder = new MapStatus.Builder(); MapStatus mapStatus = builder.target(currentLatLng).zoom(17.0f).build(); mBaiduMap.animateMapStatus(MapStatusUpdateFactory .newMapStatus(mapStatus)); isFirstLocation = false; //反向地理解析(含有poi列表) mGeoCoder.reverseGeoCode(new ReverseGeoCodeOption() .location(currentLatLng)); } MyLocationData.Builder locationBuilder = new MyLocationData.Builder(); locationBuilder.latitude(location.getLatitude()); locationBuilder.longitude(location.getLongitude()); MyLocationData locationData = locationBuilder.build(); mBaiduMap.setMyLocationData(locationData); }
Example #10
Source File: NaviConfirmPointActivity.java From AssistantBySDK with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(NaviPointHolder holder, int position) { PoiInfo poiInfo = list.get(position); holder.mTpiNameText.setText((position + 1) + "." + poiInfo.name); holder.mTpiAddressText.setText(poiInfo.address); if (addMode) { holder.mTpiItemConfirmText.setText("添加"); holder.mTpiDistanceText.setVisibility(View.GONE); } else { holder.mTpiItemConfirmText.setText("出发"); holder.mTpiDistanceText.setVisibility(View.VISIBLE); double distance = DistanceUtil.getDistance(new LatLng(address.getLatitude(), address.getLongitude()), poiInfo.location) / 1000; holder.mTpiDistanceText.setText(String.format("%.1f", distance) + "km"); } holder.mTpiTargetConfirmBt.setTag(position); holder.itemView.setTag(position); }
Example #11
Source File: MainActivity.java From Mobike with Apache License 2.0 | 6 votes |
/** * des:地图跳到指定位置 * * @param location */ private void navigateTo(BDLocation location) { if (isFirstLocation) { LatLng ll = new LatLng(location.getLatitude(), location.getLongitude()); MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(ll); baiduMap.animateMapStatus(update); update = MapStatusUpdateFactory.zoomTo(18f); baiduMap.animateMapStatus(update); isFirstLocation = false; } MyLocationData.Builder builder = new MyLocationData.Builder(); builder.latitude(location.getLatitude()); builder.longitude(location.getLongitude()); MyLocationData data = builder.build(); baiduMap.setMyLocationData(data); }
Example #12
Source File: BusLineOverlay.java From BmapLite with GNU General Public License v3.0 | 6 votes |
@Override public final List<OverlayOptions> getOverlayOptions() { if (mBusLineResult == null || mBusLineResult.getStations() == null) { return null; } List<OverlayOptions> overlayOptionses = new ArrayList<>(); for (BusLineResult.BusStation station : mBusLineResult.getStations()) { overlayOptionses.add(new MarkerOptions().title(station.getTitle()).position(station.getLocation()).zIndex(20).anchor(0.5f, 0.5f).icon(getStationMarker())); } List<LatLng> points = new ArrayList<>(); for (BusLineResult.BusStep step : mBusLineResult.getSteps()) { if (step.getWayPoints() != null) { points.addAll(step.getWayPoints()); } } if (points.size() > 0) { overlayOptionses.add(new PolylineOptions().width(getRouteWidth()).color(getBusColor()).zIndex(0).points(points)); } return overlayOptionses; }
Example #13
Source File: NaviConfirmPointActivity.java From AssistantBySDK with Apache License 2.0 | 6 votes |
/** * 将所有BaiduAddress对象信息填充到poi搜索信息集合中 **/ public void setListReverse() { int al = aList.size(); list.clear(); int l = Math.min(al, 10); for (int i = 0; i < l; i++) { PoiInfo poiInfo = new PoiInfo(); poiInfo.name = aList.get(i).getName(); poiInfo.uid = aList.get(i).getUid(); poiInfo.address = aList.get(i).getAddress(); poiInfo.city = aList.get(i).getCity(); poiInfo.phoneNum = aList.get(i).getPhoneNum(); poiInfo.postCode = aList.get(i).getPostCode(); poiInfo.type = PoiInfo.POITYPE.POINT; poiInfo.location = new LatLng(aList.get(i).getLatitude(), aList.get(i).getLongitude()); list.add(poiInfo); } }
Example #14
Source File: NavUtil.java From Mobike with Apache License 2.0 | 6 votes |
/** * 启动高德地图驾车路线规划 */ public static void startGaodeNavi(Activity activity, LatLng pt1, LatLng pt2, String start_place) { try { Intent intent = new Intent(); double sLat = pt1.latitude, sLon = pt1.longitude, eLat = pt2.latitude, eLon = pt2.longitude; String poiAddress = MyLocationManager.getInstance().getAddress(); Log.d("gaolei", "poiAddress---------gaode-----------" + poiAddress); intent.setData(android.net.Uri .parse("androidamap://navi?sourceApplication=yongche&poiname=" + start_place + "&lat=" + eLat + "&lon=" + eLon + "&dev=0&style=2")); intent.addCategory("android.intent.category.DEFAULT"); intent.setPackage("com.autonavi.minimap"); activity.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }
Example #15
Source File: SetFavoriteMapActivity.java From AssistantBySDK with Apache License 2.0 | 6 votes |
/** * 将所有BaiduAddress对象信息填充到poi搜索信息集合中 **/ public void setListReverse() { int al = aList.size(); list.clear(); int l = Math.min(al, 10); for (int i = 0; i < l; i++) { PoiInfo poiInfo = new PoiInfo(); poiInfo.name = aList.get(i).getName(); poiInfo.uid = aList.get(i).getUid(); poiInfo.address = aList.get(i).getAddress(); poiInfo.city = aList.get(i).getCity(); poiInfo.phoneNum = aList.get(i).getPhoneNum(); poiInfo.postCode = aList.get(i).getPostCode(); poiInfo.type = PoiInfo.POITYPE.POINT; poiInfo.location = new LatLng(aList.get(i).getLatitude(), aList.get(i).getLongitude()); list.add(poiInfo); } }
Example #16
Source File: Activity_Location.java From FoodOrdering with Apache License 2.0 | 6 votes |
private void navigateTo(BDLocation location) { longitude = location.getLongitude(); latitude = location.getLatitude(); tv_longitude.setText(longitude + ""); tv_latitude.setText(latitude + ""); address = location.getAddrStr(); tv_address.setText(address); if (isFirstLocation) { latLng = new LatLng(latitude, longitude); MapStatus.Builder builder = new MapStatus.Builder(); MapStatus mapStatus = builder.target(latLng).zoom(15.0f).build(); mBaiduMap.animateMapStatus(MapStatusUpdateFactory .newMapStatus(mapStatus)); isFirstLocation = false; } MyLocationData.Builder locationBuilder = new MyLocationData.Builder(); locationBuilder.latitude(location.getLatitude()); locationBuilder.longitude(location.getLongitude()); MyLocationData locationData = locationBuilder.build(); mBaiduMap.setMyLocationData(locationData); }
Example #17
Source File: LocationActivity.java From imsdk-android with MIT License | 6 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PoiInfo info = (PoiInfo) adapter.getItem(position); if (info == null) { return; } name = info.name; address = info.address; latitude = info.location.latitude; longitude = info.location.longitude; LatLng point = new LatLng(latitude, longitude); OverlayOptions options = new MarkerOptions().draggable(false) .position(point) .icon(BitmapDescriptorFactory.fromResource(R.drawable.atom_ui_map_mark)); if (overlay != null) { overlay.remove(); } overlay = baiduMap.addOverlay(options); adapter.setCheckPosition(position); adapter.notifyDataSetChanged(); }
Example #18
Source File: BaiduMapFragment.java From BmapLite with Apache License 2.0 | 6 votes |
@Override public void onMapClick(LatLng latLng) { if (mIsModeRanging) { MyPoiModel poi = new MyPoiModel(TypeMap.TYPE_BAIDU); poi.setLatitude(latLng.latitude); poi.setLongitude(latLng.longitude); if (null == mPoiList) { mPoiList = new ArrayList<>(); } mPoiList.add(poi); makeRangingMarker(poi); setRangingPolyLine(); } else { ((MainActivity) getActivity()).showPoiLay(null, -1); } }
Example #19
Source File: BaiduMapFragment.java From BmapLite with Apache License 2.0 | 6 votes |
public void getFavoriteList() { if (null != mFavMarkerList && !mFavMarkerList.isEmpty()) { for (Overlay o : mFavMarkerList) { o.remove(); } mFavMarkerList.clear(); } if (null != mFavoriteInteracter) { List<MyPoiModel> favoriteList = mFavoriteInteracter.getFavoriteList(); if (null != favoriteList && !favoriteList.isEmpty()) { for (MyPoiModel poi : favoriteList) { //构建Marker图标 BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.ic_grade_point); //构建MarkerOption,用于在地图上添加Marker OverlayOptions option = new MarkerOptions().title(poi.getName()).position(new LatLng(poi.getLatitude(), poi.getLongitude())).icon(bitmap).animateType(MarkerOptions.MarkerAnimateType.none).anchor(0.5f, 0.5f); //在地图上添加Marker,并显示 mFavMarkerList.add(mBaiduMap.addOverlay(option)); } } } }
Example #20
Source File: TrafficShowPresenter.java From AssistantBySDK with Apache License 2.0 | 6 votes |
public void setListReverse() { int al = aList.size(); poiInfoList.clear(); int l = Math.min(al, 10); for (int i = 0; i < l; i++) { PoiInfo poiInfo = new PoiInfo(); poiInfo.name = aList.get(i).getName(); poiInfo.uid = aList.get(i).getUid(); poiInfo.address = aList.get(i).getAddress(); poiInfo.city = aList.get(i).getCity(); poiInfo.phoneNum = aList.get(i).getPhoneNum(); poiInfo.postCode = aList.get(i).getPostCode(); poiInfo.type = PoiInfo.POITYPE.POINT; poiInfo.location = new LatLng(aList.get(i).getLatitude(), aList.get(i).getLongitude()); poiInfoList.add(poiInfo); } }
Example #21
Source File: BaiduMapSelectPoiFragment.java From BmapLite with Apache License 2.0 | 5 votes |
private void setCacheMapStatus() { CacheInteracter cacheInteracter = new CacheInteracter(getActivity()); LatLng latLng = new LatLng(cacheInteracter.getLatitude(), cacheInteracter.getLongitude()); MapStatus.Builder builder = new MapStatus.Builder(); builder.target(latLng).zoom(14.5f); mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); }
Example #22
Source File: FavoriteInteracter.java From BmapLite with Apache License 2.0 | 5 votes |
public int addFavorite(MyPoiModel poi) { //构造一个点信息,pt和poiName是必填项 FavoritePoiInfo info = new FavoritePoiInfo() .poiName(poi.getName()) .pt(new LatLng(poi.getLatitude(), poi.getLongitude())) .addr(poi.getAddress()) .cityName(poi.getCity()) .uid(poi.getUid()); return mFavoriteManagerBaidu.add(info); }
Example #23
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 #24
Source File: TrafficShowPresenter.java From AssistantBySDK with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(NaviPointHolder holder, int position) { PoiInfo poiInfo = poiInfoList.get(position); holder.mTpiNameText.setText((position + 1) + "." + poiInfo.name); holder.mTpiAddressText.setText(poiInfo.address); holder.mTpiItemConfirmText.setText("出发"); holder.mTpiDistanceText.setVisibility(View.VISIBLE); double distance = DistanceUtil.getDistance(new LatLng(address.getLatitude(), address.getLongitude()), poiInfo.location) / 1000; holder.mTpiDistanceText.setText(String.format("%.1f", distance) + "km"); holder.mTpiTargetConfirmBt.setTag(position); holder.itemView.setTag(position); }
Example #25
Source File: BaiduMapFragment.java From BmapLite with Apache License 2.0 | 5 votes |
private void makeRangingMarker(MyPoiModel poi) { //构建Marker图标 ImageView imageView = new ImageView(getActivity()); imageView.setImageResource(R.drawable.shape_point); BitmapDescriptor bitmap = BitmapDescriptorFactory.fromView(imageView); //构建MarkerOption,用于在地图上添加Marker OverlayOptions option = new MarkerOptions().title(poi.getName()) .position(new LatLng(poi.getLatitude(), poi.getLongitude())).icon(bitmap) .animateType(MarkerOptions.MarkerAnimateType.none).anchor(0.5f, 0.5f); //在地图上添加Marker,并显示 Overlay marker = mBaiduMap.addOverlay(option); mOverlayList.add(marker); }
Example #26
Source File: TrafficShowPresenter.java From AssistantBySDK with Apache License 2.0 | 5 votes |
private void setPoiPosition() { if (aList.size() == 0 || poiOverlay == null) return; if (aList.size() == 1) { MapStatus.Builder builder = new MapStatus.Builder(); builder.target(new LatLng(aList.get(0).getLatitude(), aList.get(0).getLongitude())) .targetScreen(new Point(baiduMap.getMapStatus().targetScreen.x, baiduMap.getMapStatus().targetScreen.y / 4)) .zoom(17F); baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); } else poiOverlay.zoomToSpan(); }
Example #27
Source File: TrafficShowPresenter.java From AssistantBySDK with Apache License 2.0 | 5 votes |
public void setOverlayOptions(List<BaiduAddress> list) { if (list == null || list.size() == 0) return; overlayOptionses = new ArrayList<>(); int l = Math.min(list.size(), 10); for (int i = 0; i < l; ++i) { Bundle bundle = new Bundle(); bundle.putInt("index", i); overlayOptionses.add((new MarkerOptions()).icon( BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark" + (i + 1) + ".png")). extraInfo(bundle). position(new LatLng(list.get(i).getLatitude(), list.get(i).getLongitude()))); } }
Example #28
Source File: MainActivity.java From Mobike with Apache License 2.0 | 5 votes |
@Override public void onReceiveLocation(BDLocation bdLocation) { if (bdLocation == null || baiduMap == null) { return; } mBDLocation = bdLocation; MyLocationData locData = new MyLocationData.Builder() .accuracy(bdLocation.getRadius()) .direction(mCurrentX)//设定图标方向 // 此处设置开发者获取到的方向信息,顺时针0-360 .latitude(bdLocation.getLatitude()) .longitude(bdLocation.getLongitude()).build(); if (isNeedCurrentlocation) baiduMap.setMyLocationData(locData); currentLatitude = bdLocation.getLatitude(); currentLongitude = bdLocation.getLongitude(); mTvLocationInfo.setText(bdLocation.getAddrStr()); currentLL = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude()); MyLocationManager.getInstance().setCurrentLL(currentLL); MyLocationManager.getInstance().setAddress(bdLocation.getAddrStr()); startNodeStr = PlanNode.withLocation(currentLL); //option.setScanSpan(5000),每隔5000ms这个方法就会调用一次,而有些我们只想调用一次,所以要判断一下isFirstLoc if (isFirstLocation) { isFirstLocation = false; LatLng ll = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude()); MapStatus.Builder builder = new MapStatus.Builder(); //地图缩放比设置为18 builder.target(ll).zoom(18.0f); baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); changeLatitude = bdLocation.getLatitude(); changeLongitude = bdLocation.getLongitude(); if (!isServiceLive) { addOverLayout(currentLatitude, currentLongitude); } } }
Example #29
Source File: BaiduMapFragment.java From BmapLite with Apache License 2.0 | 5 votes |
private void makeMarker(MyPoiModel poi, boolean isClear) { // if (isClear) { // clearMarker(); // } // // //构建Marker图标 // BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.icon_gcoding); // //构建MarkerOption,用于在地图上添加Marker // OverlayOptions option = new MarkerOptions().title(poi.getName()).position(poi.getLatLngBaidu(getActivity())).icon(bitmap).animateType(MarkerOptions.MarkerAnimateType.none); // //在地图上添加Marker,并显示 // mBaiduMap.addOverlay(option); // // MapStatus.Builder builder = new MapStatus.Builder(); // builder.target(poi.getLatLngBaidu(getActivity())); // mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); makeMarker(poi, isClear, 0); int distance = 0; if (null != BApp.MY_LOCATION) { distance = (int) DistanceUtil.getDistance(new LatLng(BApp.MY_LOCATION.getLatitude(), BApp.MY_LOCATION.getLongitude()), new LatLng(poi.getLatitude(), poi.getLongitude())); } ((MainActivity) getActivity()).showPoiLay(poi, distance); }
Example #30
Source File: BaiduMapRouteFragment.java From BmapLite with GNU General Public License v3.0 | 5 votes |
@Override public void onMapClick(LatLng latLng) { ((RouteActivity) getActivity()).showToolbar(); if (mBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) { mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } }