com.baidu.mapapi.map.MarkerOptions Java Examples

The following examples show how to use com.baidu.mapapi.map.MarkerOptions. 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: 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 #4
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 #5
Source File: MainActivity.java    From Mobike with Apache License 2.0 6 votes vote down vote up
private void addOverLayout(double _latitude, double _longitude) {
    //先清除图层
    baiduMap.clear();
    mlocationClient.requestLocation();
    // 定义Maker坐标点
    LatLng point = new LatLng(_latitude, _longitude);
    // 构建MarkerOption,用于在地图上添加Marker
    MarkerOptions options = new MarkerOptions().position(point)
            .icon(dragLocationIcon);
    // 在地图上添加Marker,并显示
    baiduMap.addOverlay(options);
    infos.clear();
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_mobai, "001",
            "100米", "1分钟"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_youbai, "002",
            "200米", "2分钟"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_ofo, "003",
            "300米", "3分钟"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_xiaolan, "004",
            "400米", "4分钟"));
    BikeInfo bikeInfo = new BikeInfo(_latitude - 0.0005, _longitude - 0.0005, R.mipmap.bike_xiaolan, "005",
            "50米", "0.5分钟");
    infos.add(bikeInfo);
    addInfosOverlay(infos);
    initNearestBike(bikeInfo, new LatLng(_latitude - 0.0005, _longitude - 0.0005));
}
 
Example #6
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 #7
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 #8
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 #9
Source File: SetFavoriteMapActivity.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
/**
 * 定位接收到的地址
 **/
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 #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: 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 #13
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 #14
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 #15
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 #16
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);
}
 
Example #17
Source File: DefaultClusterRenderer.java    From react-native-baidu-map with MIT License 5 votes vote down vote up
/**
 * Called before the marker for a Cluster is added to the map.
 * The default implementation draws a circle with a rough count of the number of items.
 */
protected void onBeforeClusterRendered(Cluster<T> cluster, MarkerOptions markerOptions) {
    int bucket = getBucket(cluster);
    BitmapDescriptor descriptor = mIcons.get(bucket);
    if (descriptor == null) {
        mColoredCircleBackground.getPaint().setColor(getColor(bucket));
        descriptor = BitmapDescriptorFactory.fromBitmap(mIconGenerator.makeIcon(getClusterText(bucket)));
        mIcons.put(bucket, descriptor);
    }
    // TODO: consider adding anchor(.5, .5) (Individual markers will overlap more often)
    markerOptions.icon(descriptor);
}
 
Example #18
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 #19
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 #20
Source File: WalkingRouteOverlay.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public final List<OverlayOptions> getOverlayOptions() {
    if (mRouteLine == null) {
        return null;
    }

    List<OverlayOptions> overlayList = new ArrayList<>();

    // starting
    if (mRouteLine.getStarting() != null) {
        overlayList.add((new MarkerOptions()).title(mRouteLine.getStarting().getTitle()).position(mRouteLine.getStarting().getLocation()).icon(getStartMarker()).zIndex(20));
    }
    // terminal
    if (mRouteLine.getTerminal() != null) {
        overlayList.add((new MarkerOptions()).title(mRouteLine.getTerminal().getTitle()).position(mRouteLine.getTerminal().getLocation()).icon(getTerminalMarker()).zIndex(20));
    }

    // poly line list
    if (mRouteLine.getAllStep() != null
            && mRouteLine.getAllStep().size() > 0) {
        LatLng lastStepLastPoint = null;
        for (WalkingRouteLine.WalkingStep step : mRouteLine.getAllStep()) {
            List<LatLng> watPoints = step.getWayPoints();
            if (watPoints != null) {
                List<LatLng> points = new ArrayList<>();
                if (lastStepLastPoint != null) {
                    points.add(lastStepLastPoint);
                }
                points.addAll(watPoints);
                overlayList.add(new PolylineOptions().points(points).width(getRouteWidth()).color(getWalkColor()).zIndex(0));
                lastStepLastPoint = watPoints.get(watPoints.size() - 1);
            }
        }
        
    }

    return overlayList;
}
 
Example #21
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 #22
Source File: MapFragment.java    From MapForTour with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    application = (DeviceMessageApplication) getActivity().getApplication();
    //地图覆盖物初始化
    bitmapDescriptorMan = BitmapDescriptorFactory.fromResource(R.mipmap.map_portrait_mark_man_circle);
    bitmapDescriptorWoman = BitmapDescriptorFactory.fromResource(R.mipmap.map_portrait_mark_woman_circle);
    bmStart = BitmapDescriptorFactory.fromResource(R.mipmap.icon_start);
    bmEnd = BitmapDescriptorFactory.fromResource(R.mipmap.icon_end);
    option = new MarkerOptions();
    geoCoder = GeoCoder.newInstance();
    geoCoder.setOnGetGeoCodeResultListener(this);
    reverseGeoCodeOption = new ReverseGeoCodeOption();

    //管理员权限用户信息弹窗初始化
    viewOverlayItem = View.inflate(getContext(), R.layout.item_map_addoverlay_radarnearby_admin, null);
    tvAddOverlayItemUserID = (TextView) viewOverlayItem.findViewById(R.id.tvAddOverlayItemUserID);
    imageViewAddOverlayItem = (ImageView) viewOverlayItem.findViewById(R.id.imageViewAddOverlayItem);
    tvAddOverlayGeoCoder = (TextView) viewOverlayItem.findViewById(R.id.tvAddOverlayGeoCoder);
    tvAddOverlayItemDistance = (TextView) viewOverlayItem.findViewById(R.id.tvAddOverlayItemDistance);
    tvAddOverlayItemLatlng = (TextView) viewOverlayItem.findViewById(R.id.tvAddOverlayItemLatlng);
    layoutAddOverlayRadarNearbyItem = (LinearLayout) viewOverlayItem.findViewById(R.id.layoutAddOverlayRadarNearbyItem);
    btnAddOverlayItemTrackQuery = (Button) viewOverlayItem.findViewById(R.id.btnAddOverlayItemTrackQuery);
    btnAddOverlayItemGeoFencePlace = (Button) viewOverlayItem.findViewById(R.id.btnAddOverlayItemGeoFencePlace);
    btnAddOverlayItemTrackQuery.setOnClickListener(this);
    btnAddOverlayItemGeoFencePlace.setOnClickListener(this);


}
 
Example #23
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 #24
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 #25
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 #26
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 #27
Source File: BaiduMapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
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 #28
Source File: RouteDetailActivity.java    From Mobike with Apache License 2.0 5 votes vote down vote up
private void addOverLayout(LatLng startPosition, LatLng endPosition) {
    //先清除图层
    //        mBaiduMap.clear();
    // 定义Maker坐标点
    // 构建MarkerOption,用于在地图上添加Marker
    MarkerOptions options = new MarkerOptions().position(startPosition)
            .icon(startBmp);
    // 在地图上添加Marker,并显示
    routeBaiduMap.addOverlay(options);
    MarkerOptions options2 = new MarkerOptions().position(endPosition)
            .icon(endBmp);
    // 在地图上添加Marker,并显示
    routeBaiduMap.addOverlay(options2);

}
 
Example #29
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 #30
Source File: LocationActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
protected void startLocationAndSetIcon()
    {
        LatLng point = new LatLng(latitude, longitude);
        geoCoder.reverseGeoCode(new ReverseGeoCodeOption().location(point));
        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.notifyDataSetChanged();
    }