com.baidu.mapapi.map.OverlayOptions Java Examples

The following examples show how to use com.baidu.mapapi.map.OverlayOptions. 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: BusLineOverlay.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
@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 #2
Source File: BaiduMapViewManager.java    From BaiduMapKit with MIT License 6 votes vote down vote up
/**
 * 显示地理标记
 *
 * @param mapView
 * @param array
 */
@ReactProp(name="marker")
public void setMarker(MapView mapView, ReadableArray array) {
    Log.d(TAG, "marker:" + array);
    if (array != null) {
        for (int i = 0; i < array.size(); i++) {
            ReadableArray sub = array.getArray(i);
            //定义Maker坐标点
            LatLng point = new LatLng(sub.getDouble(0), sub.getDouble(1));
            //构建Marker图标
            BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.icon_gcoding);
            //构建MarkerOption,用于在地图上添加Marker
            OverlayOptions option = new MarkerOptions()
                    .position(point)
                    .icon(bitmap)
                    .draggable(true);
            //在地图上添加Marker,并显示
            mapView.getMap().addOverlay(option);
        }
    }
}
 
Example #3
Source File: OverlayManager.java    From react-native-baidu-map with MIT License 6 votes vote down vote up
/**
 * 将所有Overlay 添加到地图上
 */
public final void addToMap() {
    if (mBaiduMap == null) {
        return;
    }

    removeFromMap();
    List<OverlayOptions> overlayOptions = getOverlayOptions();
    if (overlayOptions != null) {
        mOverlayOptionList.addAll(getOverlayOptions());
    }

    for (OverlayOptions option : mOverlayOptionList) {
        mOverlayList.add(mBaiduMap.addOverlay(option));
    }
}
 
Example #4
Source File: PoiOverlay.java    From react-native-baidu-map with MIT License 6 votes vote down vote up
@Override
public final List<OverlayOptions> getOverlayOptions() {
    if (mPoiResult == null || mPoiResult.getAllPoi() == null) {
        return null;
    }

    List<OverlayOptions> markerList = new ArrayList<>();
    int markerSize = 0;

    for (int i = 0; i < mPoiResult.getAllPoi().size() && markerSize < MAX_POI_SIZE; i++) {
        if (mPoiResult.getAllPoi().get(i).location == null) {
            continue;
        }

        markerSize++;
        Bundle bundle = new Bundle();
        bundle.putInt("index", i);
        markerList.add(new MarkerOptions()
            .icon(BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark" + markerSize + ".png"))
            .extraInfo(bundle)
            .position(mPoiResult.getAllPoi().get(i).location));
        
    }

    return markerList;
}
 
Example #5
Source File: IndoorPoiOverlay.java    From react-native-baidu-map with MIT License 6 votes vote down vote up
@Override
public final List<OverlayOptions> getOverlayOptions() {
    if (mIndoorPoiResult == null || mIndoorPoiResult.getmArrayPoiInfo() == null) {
        return null;
    }
    List<OverlayOptions> markerList = new ArrayList<OverlayOptions>();
    int markerSize = 0;
    for (int i = 0; i < mIndoorPoiResult.getmArrayPoiInfo().size()
            && markerSize < MAX_POI_SIZE; i++) {
        if (mIndoorPoiResult.getmArrayPoiInfo().get(i).latLng == null) {
            continue;
        }
        markerSize++;
        Bundle bundle = new Bundle();
        bundle.putInt("index", i);
        markerList.add(new MarkerOptions()
                .icon(BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark"
                        + markerSize + ".png")).extraInfo(bundle)
                .position(mIndoorPoiResult.getmArrayPoiInfo().get(i).latLng));

    }
    return markerList;
}
 
Example #6
Source File: OverlayManager.java    From Mobike with Apache License 2.0 6 votes vote down vote up
/**
 * 将所有Overlay 添加到地图上
 */
public final void addToMap() {
    if (mBaiduMap == null) {
        return;
    }

    removeFromMap();
    List<OverlayOptions> overlayOptions = getOverlayOptions();
    if (overlayOptions != null) {
        mOverlayOptionList.addAll(getOverlayOptions());
    }

    for (OverlayOptions option : mOverlayOptionList) {
        mOverlayList.add(mBaiduMap.addOverlay(option));
    }
}
 
Example #7
Source File: PoiOverlay.java    From Mobike with Apache License 2.0 6 votes vote down vote up
@Override
public final List<OverlayOptions> getOverlayOptions() {
    if (mPoiResult == null || mPoiResult.getAllPoi() == null) {
        return null;
    }
    List<OverlayOptions> markerList = new ArrayList<OverlayOptions>();
    int markerSize = 0;
    for (int i = 0; i < mPoiResult.getAllPoi().size()
            && markerSize < MAX_POI_SIZE; i++) {
        if (mPoiResult.getAllPoi().get(i).location == null) {
            continue;
        }
        markerSize++;
        Bundle bundle = new Bundle();
        bundle.putInt("index", i);
        markerList.add(new MarkerOptions()
                .icon(BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark"
                        + markerSize + ".png")).extraInfo(bundle)
                .position(mPoiResult.getAllPoi().get(i).location));
        
    }
    return markerList;
}
 
Example #8
Source File: IndoorPoiOverlay.java    From Mobike with Apache License 2.0 6 votes vote down vote up
@Override
public final List<OverlayOptions> getOverlayOptions() {
    if (mIndoorPoiResult == null || mIndoorPoiResult.getmArrayPoiInfo() == null) {
        return null;
    }
    List<OverlayOptions> markerList = new ArrayList<OverlayOptions>();
    int markerSize = 0;
    for (int i = 0; i < mIndoorPoiResult.getmArrayPoiInfo().size()
            && markerSize < MAX_POI_SIZE; i++) {
        if (mIndoorPoiResult.getmArrayPoiInfo().get(i).latLng == null) {
            continue;
        }
        markerSize++;
        Bundle bundle = new Bundle();
        bundle.putInt("index", i);
        markerList.add(new MarkerOptions()
                .icon(BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark"
                        + markerSize + ".png")).extraInfo(bundle)
                .position(mIndoorPoiResult.getmArrayPoiInfo().get(i).latLng));

    }
    return markerList;
}
 
Example #9
Source File: MapPickerActivity.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@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 #10
Source File: LocationActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
@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 #11
Source File: BaiduMapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
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 #12
Source File: OverlayManager.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
/**
 * 将所有Overlay 添加到地图上
 */
public final void addToMap() {
    if (mBaiduMap == null) {
        return;
    }

    removeFromMap();
    List<OverlayOptions> overlayOptions = getOverlayOptions();
    if (overlayOptions != null) {
        mOverlayOptionList.addAll(getOverlayOptions());
    }

    for (OverlayOptions option : mOverlayOptionList) {
        mOverlayList.add(mBaiduMap.addOverlay(option));
    }
}
 
Example #13
Source File: BaiduMapFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
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 #14
Source File: BusLineOverlay.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
@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 #15
Source File: OverlayManager.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 将所有Overlay 添加到地图上
 */
public final void addToMap() {
    if (mBaiduMap == null) {
        return;
    }

    removeFromMap();
    List<OverlayOptions> overlayOptions = getOverlayOptions();
    if (overlayOptions != null) {
        mOverlayOptionList.addAll(getOverlayOptions());
    }

    for (OverlayOptions option : mOverlayOptionList) {
        mOverlayList.add(mBaiduMap.addOverlay(option));
    }
}
 
Example #16
Source File: EaseBaiduMapActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceiveLocation(BDLocation location) {
	if (location == null) {
		return;
	}
	Log.d("map", "On location change received:" + location);
	Log.d("map", "addr:" + location.getAddrStr());
	sendButton.setEnabled(true);
	if (progressDialog != null) {
		progressDialog.dismiss();
	}

	if (lastLocation != null) {
		if (lastLocation.getLatitude() == location.getLatitude() && lastLocation.getLongitude() == location.getLongitude()) {
			Log.d("map", "same location, skip refresh");
			// mMapView.refresh(); //need this refresh?
			return;
		}
	}
	lastLocation = location;
	mBaiduMap.clear();
	LatLng llA = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
	CoordinateConverter converter= new CoordinateConverter();
	converter.coord(llA);
	converter.from(CoordinateConverter.CoordType.COMMON);
	LatLng convertLatLng = converter.convert();
	OverlayOptions ooA = new MarkerOptions().position(convertLatLng).icon(BitmapDescriptorFactory
			.fromResource(R.drawable.ease_icon_marka))
			.zIndex(4).draggable(true);
	mBaiduMap.addOverlay(ooA);
	MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
	mBaiduMap.animateMapStatus(u);
}
 
Example #17
Source File: BusLineOverlay.java    From Mobike with Apache License 2.0 5 votes vote down vote up
@Override
public final List<OverlayOptions> getOverlayOptions() {

    if (mBusLineResult == null || mBusLineResult.getStations() == null) {
        return null;
    }
    List<OverlayOptions> overlayOptionses = new ArrayList<OverlayOptions>();
    for (BusLineResult.BusStation station : mBusLineResult.getStations()) {
        overlayOptionses.add(new MarkerOptions()
                .position(station.getLocation())
                        .zIndex(10)
                                .anchor(0.5f, 0.5f)
                                        .icon(BitmapDescriptorFactory
                                                .fromAssetWithDpi("Icon_bus_station.png")));
    }

    List<LatLng> points = new ArrayList<LatLng>();
    for (BusLineResult.BusStep step : mBusLineResult.getSteps()) {
        if (step.getWayPoints() != null) {
            points.addAll(step.getWayPoints());
        }
    }
    if (points.size() > 0) {
        overlayOptionses
                .add(new PolylineOptions().width(10)
                        .color(Color.argb(178, 0, 78, 255)).zIndex(0)
                                .points(points));
    }
    return overlayOptionses;
}
 
Example #18
Source File: OverlayManager.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
/**
 * 通过一个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 #19
Source File: FreightTrackBaiduMapFragment.java    From ESeal with Apache License 2.0 5 votes vote down vote up
private void showBaiduMap(LocationDetail locationDetail) {
    if (locationDetail == null || locationDetail.isInvalid()) {
        return;
    }
    LatLng lng = locationDetail.getLatLng();

    OverlayOptions markerOptions = new MarkerOptions().flat(true).icon(BitmapDescriptorFactory
            .fromResource(R.drawable.ic_location_on_white_48dp)).position(lng);
    mMoveMarker = (Marker) mBaiduMap.addOverlay(markerOptions);

    //设置中心点
    mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(lng, 16));
}
 
Example #20
Source File: FreightTrackMapWithWebViewFragment.java    From ESeal with Apache License 2.0 5 votes vote down vote up
@Override
public void showBaiduMap(LocationDetail locationDetail) {
    if (locationDetail == null || locationDetail.isInvalid()) {
        return;
    }
    LatLng lng = locationDetail.getLatLng();

    OverlayOptions markerOptions = new MarkerOptions().flat(true).icon(BitmapDescriptorFactory
            .fromResource(R.drawable.ic_location_on_white_48dp)).position(lng);
    mMoveMarker = (Marker) mBaiduMap.addOverlay(markerOptions);

    //设置中心点
    mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(lng, 16));
}
 
Example #21
Source File: FreightTrackMapFragment.java    From ESeal with Apache License 2.0 5 votes vote down vote up
private void showBaiduMap(LocationDetail locationDetail) {
    if (locationDetail == null || locationDetail.isInvalid()) {
        return;
    }
    LatLng lng = locationDetail.getLatLng();

    OverlayOptions markerOptions = new MarkerOptions().flat(true).icon(BitmapDescriptorFactory
            .fromResource(R.drawable.ic_location_on_white_48dp)).position(lng);
    mMoveMarker = (Marker) mBaiduMap.addOverlay(markerOptions);

    //设置中心点
    mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(lng, 16));
}
 
Example #22
Source File: FreightTrackGoogleMapFragment.java    From ESeal with Apache License 2.0 5 votes vote down vote up
private void showBaiduMap(LocationDetail locationDetail) {
    if (locationDetail == null || locationDetail.isInvalid()) {
        return;
    }
    LatLng lng = locationDetail.getLatLng();

    OverlayOptions markerOptions = new MarkerOptions().flat(true).icon(BitmapDescriptorFactory
            .fromResource(R.drawable.ic_location_on_white_48dp)).position(lng);
    mMoveMarker = (Marker) mBaiduMap.addOverlay(markerOptions);

    //设置中心点
    mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(lng, 16));
}
 
Example #23
Source File: EaseBaiduMapActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
private void showMap(double latitude, double longtitude, String address) {
	sendButton.setVisibility(View.GONE);
	LatLng llA = new LatLng(latitude, longtitude);
	CoordinateConverter converter= new CoordinateConverter();
	converter.coord(llA);
	converter.from(CoordinateConverter.CoordType.COMMON);
	LatLng convertLatLng = converter.convert();
	OverlayOptions ooA = new MarkerOptions().position(convertLatLng).icon(BitmapDescriptorFactory
			.fromResource(R.drawable.ease_icon_marka))
			.zIndex(4).draggable(true);
	mBaiduMap.addOverlay(ooA);
	MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
	mBaiduMap.animateMapStatus(u);
}
 
Example #24
Source File: OverlayManager.java    From Mobike with Apache License 2.0 5 votes vote down vote up
/**
 * 通过一个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 #25
Source File: LocationActivity.java    From Conquer with Apache License 2.0 5 votes vote down vote up
private void initBaiduMap() {
	// 地图初始化
	mMapView = (MapView) findViewById(R.id.bmapView);
	mBaiduMap = mMapView.getMap();
	// 设置缩放级别
	mBaiduMap.setMaxAndMinZoomLevel(18, 13);
	// 注册 SDK 广播监听者
	IntentFilter iFilter = new IntentFilter();
	iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR);
	iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR);
	mReceiver = new BaiduReceiver();
	registerReceiver(mReceiver, iFilter);

	Intent intent = getIntent();
	String type = intent.getStringExtra("type");
	if (type.equals("select")) {// 选择发送位置
		// initTopBarForBoth("位置", R.drawable.btn_login_selector, "发送", new
		// onRightImageButtonClickListener() {
		// @Override
		// public void onClick() {
		// // TODO Auto-generated method stub
		// gotoChatPage();
		// }
		// });
		// mHeaderLayout.getRightImageButton().setEnabled(false);
		initLocClient();
	} else {// 查看当前位置
		// initTopBarForLeft("位置");
		Bundle b = intent.getExtras();
		LatLng latlng = new LatLng(b.getDouble("latitude"), b.getDouble("longtitude"));// 维度在前,经度在后
		mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(latlng));
		// 显示当前位置图标
		OverlayOptions ooA = new MarkerOptions().position(latlng).icon(bdgeo).zIndex(9);
		mBaiduMap.addOverlay(ooA);
	}

	mSearch = GeoCoder.newInstance();
	mSearch.setOnGetGeoCodeResultListener(this);

}
 
Example #26
Source File: BusLineOverlay.java    From react-native-baidu-map with MIT License 5 votes vote down vote up
@Override
public final List<OverlayOptions> getOverlayOptions() {

    if (mBusLineResult == null || mBusLineResult.getStations() == null) {
        return null;
    }
    List<OverlayOptions> overlayOptionses = new ArrayList<OverlayOptions>();
    for (BusLineResult.BusStation station : mBusLineResult.getStations()) {
        overlayOptionses.add(new MarkerOptions()
                .position(station.getLocation())
                        .zIndex(10)
                                .anchor(0.5f, 0.5f)
                                        .icon(BitmapDescriptorFactory
                                                .fromAssetWithDpi("Icon_bus_station.png")));
    }

    List<LatLng> points = new ArrayList<LatLng>();
    for (BusLineResult.BusStep step : mBusLineResult.getSteps()) {
        if (step.getWayPoints() != null) {
            points.addAll(step.getWayPoints());
        }
    }
    if (points.size() > 0) {
        overlayOptionses
                .add(new PolylineOptions().width(10)
                        .color(Color.argb(178, 0, 78, 255)).zIndex(0)
                                .points(points));
    }
    return overlayOptionses;
}
 
Example #27
Source File: OverlayManager.java    From react-native-baidu-map with MIT License 5 votes vote down vote up
/**
 * 通过一个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 #28
Source File: BaiduMapActivity.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onReceiveLocation(BDLocation location) {
	if (location == null) {
		return;
	}
	Log.d("map", "On location change received:" + location);
	Log.d("map", "addr:" + location.getAddrStr());
	sendButton.setEnabled(true);
	if (progressDialog != null) {
		progressDialog.dismiss();
	}

	if (lastLocation != null) {
		if (lastLocation.getLatitude() == location.getLatitude() && lastLocation.getLongitude() == location.getLongitude()) {
			Log.d("map", "same location, skip refresh");
			// mMapView.refresh(); //need this refresh?
			return;
		}
	}
	lastLocation = location;
	mBaiduMap.clear();
	LatLng llA = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
	CoordinateConverter converter= new CoordinateConverter();
	converter.coord(llA);
	converter.from(CoordinateConverter.CoordType.COMMON);
	LatLng convertLatLng = converter.convert();
	OverlayOptions ooA = new MarkerOptions().position(convertLatLng).icon(BitmapDescriptorFactory
			.fromResource(R.drawable.icon_marka))
			.zIndex(4).draggable(true);
	mBaiduMap.addOverlay(ooA);
	MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
	mBaiduMap.animateMapStatus(u);
}
 
Example #29
Source File: OverlayManager.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 通过一个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 #30
Source File: BaiduMapActivity.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
private void showMap(double latitude, double longtitude, String address) {
	sendButton.setVisibility(View.GONE);
	LatLng llA = new LatLng(latitude, longtitude);
	CoordinateConverter converter= new CoordinateConverter();
	converter.coord(llA);
	converter.from(CoordinateConverter.CoordType.COMMON);
	LatLng convertLatLng = converter.convert();
	OverlayOptions ooA = new MarkerOptions().position(convertLatLng).icon(BitmapDescriptorFactory
			.fromResource(R.drawable.icon_marka))
			.zIndex(4).draggable(true);
	mBaiduMap.addOverlay(ooA);
	MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
	mBaiduMap.animateMapStatus(u);
}