当前位置: 首页>>代码示例>>Java>>正文


Java MyLocationConfiguration类代码示例

本文整理汇总了Java中com.baidu.mapapi.map.MyLocationConfiguration的典型用法代码示例。如果您正苦于以下问题:Java MyLocationConfiguration类的具体用法?Java MyLocationConfiguration怎么用?Java MyLocationConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MyLocationConfiguration类属于com.baidu.mapapi.map包,在下文中一共展示了MyLocationConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initMapSetting

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
private void initMapSetting() {

        mMapView.showZoomControls(false);

        mBaiduMap = mMapView.getMap();
        // 开启定位图层
        mBaiduMap.setMyLocationEnabled(true);
        //设置指南针
//        UiSettings uiSettings = mBaiduMap.getUiSettings();
//        uiSettings.setCompassEnabled(true);

        mBaiduMap.setCompassPosition(new Point(660,60));

        //设置普通地图
        mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
        //设置定位图层配置信息,只有先允许定位图层后设置定位图层配置信息才会生效
        mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(
                MyLocationConfiguration.LocationMode.NORMAL, false, null));
        mBaiduMap.setBuildingsEnabled(false);

        //设置缩放级别
        MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(16.0f);
        mBaiduMap.setMapStatus(msu);

    }
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:26,代码来源:NearbyFragment.java

示例2: iniMap

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
/**
 * iniMap 初始化地图
 */
private void iniMap() {
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(3000);
    mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;

    // 缩放
    MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(14.0f);
    mBaiduMap.setMapStatus(msu);

    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, mCurrentMarker));
    mLocClient.setLocOption(option);
    mLocClient.start();
    initOverlay();

    // 开启线程,一直修改GPS坐标
    LocationUtil.startLocaton();
}
 
开发者ID:littleRich,项目名称:VirtualLocation,代码行数:23,代码来源:MainActivity.java

示例3: initLocation

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
private void initLocation() {
    // 开启定位图层
	mCurrentMode = LocationMode.NORMAL;
	 mBaiduMap
     .setMyLocationConfigeration(new MyLocationConfiguration(
             mCurrentMode, true, null));
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mLocClient = new LocationClient(this);
    myListener = new MyLocationListenner();
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(20000);
    mLocClient.setLocOption(option);
    mLocClient.start();
}
 
开发者ID:liningwang,项目名称:camera,代码行数:19,代码来源:MainActivity.java

示例4: onCreateView

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_map, container, false);
    // Inflate the layout for this fragment
    switchLocation = (Switch) view.findViewById(R.id.switchLocation);
    switchLBSTrace = (Switch) view.findViewById(R.id.switchLBSTrace);
    switchLocation.setOnCheckedChangeListener(this);
    switchLBSTrace.setOnCheckedChangeListener(this);
    mMapView = (TextureMapView) view.findViewById(R.id.bmapView);
    baiduMap = mMapView.getMap();
    baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, false, null));
    application.setMaxZoomLevel(baiduMap.getMaxZoomLevel());
    // 开启定位图层
    baiduMap.setMyLocationEnabled(true);
    baiduMap.setOnMarkerClickListener(this);
    //再次进入地图fragment时界面刷新
    if (application.latLng != null) {
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(application.getLatLng(), application.getMaxZoomLevel() - 2);
        baiduMap.animateMapStatus(u);//动画移动摄像头
        if (radarNearbyInfoList != null) {
            refreshMapUI();
        }
    }
    return view;
}
 
开发者ID:bitkylin,项目名称:MapForTour,代码行数:27,代码来源:MapFragment.java

示例5: onCheckedChanged

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
        case R.id.switchLBSTrace:
            if (isChecked) {
                polylineMyTrace = new PolylineOptions();
                refreshMapUI();
                mlistener.toolbarOperateCloseTrackOrOpenColor(true);
            } else {
                mlistener.toolbarOperateCloseTrackOrOpenColor(false);
            }
            break;
        case R.id.switchLocation:
            if (isChecked) {
                baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.FOLLOWING, false, null));
                baiduMap.animateMapStatus(MapStatusUpdateFactory.zoomTo(baiduMap.getMaxZoomLevel() - 2));
            } else
                baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, false, null));
            break;
    }
}
 
开发者ID:bitkylin,项目名称:MapForTour,代码行数:22,代码来源:MapFragment.java

示例6: afterCreate

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
@Override
protected void afterCreate(Bundle savedInstanceState) {
    mBaiduMap = mapView.getMap();
    btn1.setOnClickListener(this);
    btn2.setOnClickListener(this);
    btn3.setOnClickListener(this);
    btn4.setOnClickListener(this);
    btn1.setChecked(true);
    tvLocation.setText("");
    mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
            mCurrentMode, true, mCurrentMarker));
    mBaiduMap.setMyLocationEnabled(true);// 开启定位图层
    mLocClient = new LocationClient(getActivity()); // 定位初始化
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setIsNeedAddress(true);
    option.setScanSpan(1000);
    mLocClient.setLocOption(option);
    mLocClient.start();
}
 
开发者ID:ByteJump,项目名称:MyApp,代码行数:24,代码来源:fragment1.java

示例7: onReceiveLocation

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data2 = new MyLocationData.Builder()
            .accuracy(location.getRadius())//精度
            .latitude(location.getLatitude())//纬度
            .longitude(location.getLongitude()).build();//经度
    mBaidumap.setMyLocationData(data2);
    //第三个参数设置自定义图标
    MyLocationConfiguration config =
            new MyLocationConfiguration(null, true, null);
    mBaidumap.setMyLocationConfigeration(config);
    //更新经纬度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaidumap.animateMapStatus(msu);
        isFirstIn = false;
    }
}
 
开发者ID:PengZhiPeng,项目名称:Mooc-map,代码行数:22,代码来源:RoutePlan.java

示例8: onReceiveLocation

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()
            .direction(100)//方向
            .accuracy(location.getRadius())//精度
            .latitude(location.getLatitude())//纬度
            .longitude(location.getLongitude()).build();//经度
    mBaiduMap.setMyLocationData(data);
    MyLocationConfiguration config =
            new MyLocationConfiguration(null, true, null);
    mBaiduMap.setMyLocationConfigeration(config);
    //更新经纬度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaiduMap.animateMapStatus(msu);
        isFirstIn = false;
    }
}
 
开发者ID:PengZhiPeng,项目名称:Mooc-map,代码行数:22,代码来源:MyLocationListener.java

示例9: initView

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
private void initView() {
    mMapView = (MapView) findViewById(R.id.id_bmapView);
    mBaiduMap = mMapView.getMap();
    MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(17.0f);//缩放等级17=100m
    mBaiduMap.setMapStatus(msu);
    mLocationMode = MyLocationConfiguration.LocationMode.NORMAL;
    //隐藏缩放控件和百度logo
    int childCount = mMapView.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = mMapView.getChildAt(i);
        if (child instanceof ZoomControls || child instanceof ImageView) {
            child.setVisibility(View.GONE);
        }
    }
    //改变比例尺的位置
    final int screenheight = this.getWindowManager().getDefaultDisplay().getHeight();
    mBaiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() {

        @Override
        public void onMapLoaded() {
            mMapView.setScaleControlPosition(new Point(200, screenheight - 307));
        }
    });
}
 
开发者ID:PengZhiPeng,项目名称:Mooc-map,代码行数:25,代码来源:MainActivity.java

示例10: onReceiveLocation

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()
            .direction(mCurrentX)//更新当前方向
            .accuracy(400.0f)//精度
            .latitude(location.getLatitude())//纬度
            .longitude(location.getLongitude()).build();//经度
    mBaiduMap.setMyLocationData(data);
    //可在第三个参数设置自定义图标
    MyLocationConfiguration config =
            new MyLocationConfiguration(mLocationMode, true, null);
    mBaiduMap.setMyLocationConfigeration(config);
    //更新经纬度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    mCity = location.getCity();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaiduMap.animateMapStatus(msu);
        isFirstIn = false;
        Toast.makeText(context, location.getAddrStr(), Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:PengZhiPeng,项目名称:Mooc-map,代码行数:25,代码来源:MainActivity.java

示例11: onReceiveLocation

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
	MyLocationData data = new MyLocationData.Builder()
			.accuracy(location.getRadius())//精度
			.latitude(location.getLatitude())//纬度
			.longitude(location.getLongitude()).build();//经度
	mBaiduMap.setMyLocationData(data);
	//可在第三个参数设置自定义图标
	MyLocationConfiguration config =
			new MyLocationConfiguration(null, true, null);
	mBaiduMap.setMyLocationConfigeration(config);
	//更新经纬度
	mLatitude = location.getLatitude();
	mLongtitude = location.getLongitude();
	if (isFirstIn) {
		LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
		MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
		mBaiduMap.animateMapStatus(msu);
		isFirstIn = false;
	}
}
 
开发者ID:PengZhiPeng,项目名称:Mooc-map,代码行数:22,代码来源:BusLineSearch.java

示例12: initMapAndLoc

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
private void initMapAndLoc() {
    // 地图初始化
    mMapView = (MapView) findViewById(R.id.bmapView);
    mBaiduMap = mMapView.getMap();
    // 开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(1000);
    mLocClient.setLocOption(option);
    mLocClient.start();

    mBaiduMap
            .setMyLocationConfigeration(new MyLocationConfiguration(
                    mCurrentMode, true, mCurrentMarker));

}
 
开发者ID:offbye,项目名称:PiBoat,代码行数:22,代码来源:MapActivity.java

示例13: initMapAndLoc

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
private void initMapAndLoc() {
    MyLocationConfiguration.LocationMode mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
    // 开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mLocClient = new LocationClient(context);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(1000);
    mLocClient.setLocOption(option);
    mLocClient.start();

    mBaiduMap
            .setMyLocationConfigeration(new MyLocationConfiguration(
                    mCurrentMode, true, mCurrentMarker));

}
 
开发者ID:offbye,项目名称:PiBoat,代码行数:20,代码来源:SmallBaiduMap.java

示例14: initMap

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
private void initMap() {
    // 地图初始化
    mMapView = (MapView) findViewById(R.id.id_bmapView);
    mBaiduMap = mMapView.getMap();
    // 开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mlocationClient = new LocationClient(this);
    mlocationClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(5000);//设置onReceiveLocation()获取位置的频率
    option.setIsNeedAddress(true);//如想获得具体位置就需要设置为true
    mlocationClient.setLocOption(option);
    mlocationClient.start();
    mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
            mCurrentMode, true, null));
    myOrientationListener = new MyOrientationListener(this);
    //通过接口回调来实现实时方向的改变
    myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() {
        @Override
        public void onOrientationChanged(float x) {
            mCurrentX = x;
        }
    });
    myOrientationListener.start();
    mSearch = RoutePlanSearch.newInstance();
    mSearch.setOnGetRoutePlanResultListener(this);
    initMarkerClickEvent();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:MainActivity.java

示例15: initLocation

import com.baidu.mapapi.map.MyLocationConfiguration; //导入依赖的package包/类
private void initLocation() {
    mLocationClient=new LocationClient(getApplicationContext());
    myLocationListener = new MyLocationListener();
    mLocationClient.registerLocationListener(myLocationListener);
    mIconLocation= fromResource(R.drawable.ic_place);
    LocationClientOption option=new LocationClientOption();
    option.setCoorType("BD09LL");
    option.setIsNeedAddress(true);
    option.setScanSpan(1000);
    mLocationClient.setLocOption(option);
    MyLocationConfiguration config=new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL,true,mIconLocation);
    mBaiduMap.setMyLocationConfiguration(config);
}
 
开发者ID:organizationAllink,项目名称:wzyx-android-user,代码行数:14,代码来源:BaiduMapActivity.java


注:本文中的com.baidu.mapapi.map.MyLocationConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。