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


Java LocationMode.NORMAL属性代码示例

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


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

示例1: initLocation

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,代码行数:18,代码来源:MainActivity.java

示例2: initLocation

private void initLocation() {

		mLocationMode = LocationMode.NORMAL;

		mLocationClient = new LocationClient(this);
		mLocationListener = new MyLocationListener();
		mLocationClient.registerLocationListener(mLocationListener);

		LocationClientOption option = new LocationClientOption();
		option.setCoorType("bd09ll");
		option.setIsNeedAddress(true);
		option.setOpenGps(true);
		option.setScanSpan(1000);// 设置定位一秒钟请求一次;

		mLocationClient.setLocOption(option);

		// 初始化图标
		mIconLocation = BitmapDescriptorFactory
				.fromResource(R.drawable.navi_map_gps_locked);

		myOrientationListener = new MyOrientationListener(context);

		myOrientationListener
				.setOnOrientationListener(new OnOrientationListener() {

					@Override
					public void onOrientationChanged(float x) {

						mCurrentX = x;
					}
				});

	}
 
开发者ID:chenyufeng1991,项目名称:BaiduMap-TrafficAssistant,代码行数:33,代码来源:MapActivity.java

示例3: initLocation

private void initLocation() {
	// Ĭ��ģʽ
	mLocationMode = LocationMode.NORMAL;

	mLocationClient = new LocationClient(view.getContext());
	// �������
	mLocationListener = new MyLocationListener();
	// ע��
	mLocationClient.registerLocationListener(mLocationListener);
	// ����һЩ��Ҫ������
	setLocationOption();

	// ��ʼ������ͼ��
	mIconLocation = BitmapDescriptorFactory
			.fromResource(R.drawable.map_daohang);

	myOrientationListener = new MyOrientationListener(mContext);
	myOrientationListener
			.setOnOrientationListener(new OnOrientationListener() {

				@Override
				public void onOrientationChanged(float x) {
					mCurrentX = x;
				}
			});

	mLocationClient.start();
}
 
开发者ID:scp504677840,项目名称:ExcellentWiFi,代码行数:28,代码来源:MapFragment.java

示例4: initLocation

private void initLocation() {
	locationmode = LocationMode.NORMAL;
	// 声明LocationClient类
	locationClient = new LocationClient(context);
	locationListener = new MyLocationListener();
	// 注册监听函数
	locationClient.registerLocationListener(locationListener);

	// 初始化图标
	mIconLocation = BitmapDescriptorFactory
			.fromResource(R.drawable.navi_map_gps_locked);
	myOrientationListener = new MyOrientationListener(context);
	myOrientationListener
			.setOnOrientationListener(new OnOrientationListener() {

				@Override
				public void onOrientationChanged(float x) {
					mCurrentX = x;
				}
			});

	LocationClientOption option = new LocationClientOption();
	// option.setLocationMode(LocationMode.Hight_Accuracy);//
	// 可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
	option.setCoorType("bd09ll");// 可选,默认gcj02,设置返回的定位结果坐标系
	option.setScanSpan(1000);// 可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的
	option.setIsNeedAddress(true);// 可选,设置是否需要地址信息,默认不需要
	option.setOpenGps(true);// 可选,默认false,设置是否使用gps
	// option.setLocationNotify(true);//
	// 可选,默认false,设置是否当gps有效时按照1S1次频率输出GPS结果
	// option.setIsNeedLocationDescribe(true);//
	// 可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近”
	// option.setIsNeedLocationPoiList(true);//
	// 可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
	// option.setIgnoreKillProcess(false);//
	// 可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死
	// option.SetIgnoreCacheException(false);//
	// 可选,默认false,设置是否收集CRASH信息,默认收集
	// option.setEnableSimulateGps(false);// 可选,默认false,设置是否需要过滤gps仿真结果,默认需要
	locationClient.setLocOption(option);
}
 
开发者ID:ljlgithup,项目名称:MapDemo,代码行数:41,代码来源:MainActivity.java

示例5: onOptionsItemSelected

@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case R.id.id_map_common:
		// 普通地图
		mbaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
		break;
	case R.id.id_map_site:
		// 卫星地图
		mbaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);
		break;
	case R.id.id_map_traffic:
		// 实时交通图
		if (mbaiduMap.isTrafficEnabled()) {
			mbaiduMap.setTrafficEnabled(false);
			item.setTitle("实时交通(OFF)");
		} else {
			mbaiduMap.setTrafficEnabled(true);
			item.setTitle("实时交通(ON)");
		}
		break;
	case R.id.id_map_location:
		// 我的位置
		centerToMyLocation();
		break;
	case R.id.id_map_mocknav:
		// 模拟导航
		if (mDestLocation != null) {
			routeplanToNavi(false);
		} else {
			Toast.makeText(getApplicationContext(), "请先设置目标", 0).show();
		}
		break;
	case R.id.id_map_realnav:
		// 开始导航
		if (mDestLocation != null) {
			routeplanToNavi(true);
		} else {
			Toast.makeText(getApplicationContext(), "请先设置目标", 0).show();
		}
		break;
	case R.id.id_map_mode_common:
		locationmode = LocationMode.NORMAL;
		break;
	case R.id.id_map_mode_following:
		locationmode = LocationMode.FOLLOWING;
		break;
	case R.id.id_map_mode_compass:
		locationmode = LocationMode.COMPASS;
		break;
	case R.id.id_add_overlay:
		addOverlays(Info.infos);
		break;
	case R.id.id_remove_overlay:
		for (int i = 0; i < list.size(); i++) {
			list.get(i).remove();
		}
		list.clear();
		break;
	case R.id.id_map_hot:
		// 开启交通图
		if (mbaiduMap.isBaiduHeatMapEnabled()) {
			mbaiduMap.setBaiduHeatMapEnabled(false);
			item.setTitle("关闭热力地图(OFF)");
		} else {
			mbaiduMap.setBaiduHeatMapEnabled(true);
			item.setTitle("关闭热力地图(ON)");
		}
		break;
	default:
		break;
	}
	return super.onOptionsItemSelected(item);
}
 
开发者ID:ljlgithup,项目名称:MapDemo,代码行数:74,代码来源:MainActivity.java

示例6: onOptionsItemSelected

@Override
public boolean onOptionsItemSelected(MenuItem item) {
	// int id = item.getItemId();
	// if (id == R.id.action_settings) {
	// return true;
	// }

	int item_id = item.getItemId();
	// int isDisplayScreen = getWindow().getAttributes().flags;
	switch (item_id) {
	case R.id.map_common:
		mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);

		break;
	case R.id.map_satellite:
		mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);
		break;

	case R.id.map_traffic:
		if (mBaiduMap.isTrafficEnabled()) {
			mBaiduMap.setTrafficEnabled(false);
			item.setTitle("交通地图(on)");
		} else {
			mBaiduMap.setTrafficEnabled(true);
			item.setTitle("交通地图(off)");
		}
		break;

	case R.id.map_heat:

		if (mBaiduMap.isBaiduHeatMapEnabled()) {
			mBaiduMap.setBaiduHeatMapEnabled(false);
			item.setTitle("热力图(on)");
		} else {
			mBaiduMap.setBaiduHeatMapEnabled(true);
			item.setTitle("热力图(off)");
		}

		break;

	case R.id.display_fullscreen:

		if (isDisplayScreen == false) {// 当前非全屏,设置成全屏
			// requestWindowFeature(Window.FEATURE_NO_TITLE);
			// 此处不能取消标题栏,否则会出错;
			getWindow().setFlags(
					WindowManager.LayoutParams.FLAG_FULLSCREEN,
					WindowManager.LayoutParams.FLAG_FULLSCREEN);
			isDisplayScreen = true;
			item.setTitle("关闭全屏");
		} else {// 当前全屏,设置成非全屏
			getWindow().clearFlags(
					WindowManager.LayoutParams.FLAG_FULLSCREEN);
			item.setTitle("打开全屏");
			isDisplayScreen = false;
		}

		break;

	case R.id.id_map_location:
		centerToMyLocation();

		break;

	case R.id.id_map_mode_common:
		mLocationMode = LocationMode.NORMAL;

		break;

	case R.id.id_map_mode_following:
		mLocationMode = LocationMode.FOLLOWING;
		break;

	case R.id.id_map_mode_compass:
		mLocationMode = LocationMode.COMPASS;
		break;

	}
	return super.onOptionsItemSelected(item);
}
 
开发者ID:chenyufeng1991,项目名称:BaiduMap-TrafficAssistant,代码行数:80,代码来源:MapActivity.java

示例7: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	
	viewMap = inflater
			.inflate(R.layout.activity_location, container, false);

	requestLocButton = (Button) viewMap.findViewById(R.id.button1);
	mCurrentMode = LocationMode.NORMAL;
	requestLocButton.setText("定位");
	OnClickListener btnClickListener = new OnClickListener() {
		public void onClick(View v) {
			switch (mCurrentMode) {
			case NORMAL:
				// Intent intent = new Intent(LocationActivity.this,
				// RoutePlan.class);
				// startActivity(intent);
				// finish();
				requestLocButton.setText("跟随");
				mCurrentMode = LocationMode.FOLLOWING;
				mBaiduMap
						.setMyLocationConfigeration(new MyLocationConfiguration(
								mCurrentMode, true, mCurrentMarker));
				break;
			case COMPASS:
				requestLocButton.setText("普通");
				mCurrentMode = LocationMode.NORMAL;
				mBaiduMap
						.setMyLocationConfigeration(new MyLocationConfiguration(
								mCurrentMode, true, mCurrentMarker));
				break;
			case FOLLOWING:
				requestLocButton.setText("罗盘");
				mCurrentMode = LocationMode.COMPASS;
				mBaiduMap
						.setMyLocationConfigeration(new MyLocationConfiguration(
								mCurrentMode, true, mCurrentMarker));
				break;
			}
		}
	};
	requestLocButton.setOnClickListener(btnClickListener);

	// 地图初始化
	mMapView = (MapView) viewMap.findViewById(R.id.bmapView);
	mBaiduMap = mMapView.getMap();
	
	bdA = BitmapDescriptorFactory.fromResource(R.drawable.icon_marka);

	bdD = BitmapDescriptorFactory.fromResource(R.drawable.icon_markd);
	// 开启定位图层
	mBaiduMap.setMyLocationEnabled(true);
	// 定位初始化
	mLocClient = new LocationClient(viewMap.getContext());
	mLocClient.registerLocationListener(myListener);
	LocationClientOption option = new LocationClientOption();
	option.setOpenGps(true);// 打开gps
	option.setCoorType("bd09ll"); // 设置坐标类型
	option.setScanSpan(1000);
	mLocClient.setLocOption(option);
	mLocClient.start();

	return viewMap;
}
 
开发者ID:haiyangxue,项目名称:EasyTracker,代码行数:64,代码来源:LocationFragment.java

示例8: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {

	viewMap = inflater
			.inflate(R.layout.activity_location, container, false);

	requestLocButton = (Button) viewMap.findViewById(R.id.button1);
	mCurrentMode = LocationMode.NORMAL;
	requestLocButton.setText("定位");
	OnClickListener btnClickListener = new OnClickListener() {
		public void onClick(View v) {
			switch (mCurrentMode) {
			case NORMAL:
				// Intent intent = new Intent(LocationActivity.this,
				// RoutePlan.class);
				// startActivity(intent);
				// finish();
				requestLocButton.setText("跟随");
				mCurrentMode = LocationMode.FOLLOWING;
				mBaiduMap
						.setMyLocationConfigeration(new MyLocationConfiguration(
								mCurrentMode, true, mCurrentMarker));
				break;
			case COMPASS:
				requestLocButton.setText("普通");
				mCurrentMode = LocationMode.NORMAL;
				mBaiduMap
						.setMyLocationConfigeration(new MyLocationConfiguration(
								mCurrentMode, true, mCurrentMarker));
				break;
			case FOLLOWING:
				requestLocButton.setText("罗盘");
				mCurrentMode = LocationMode.COMPASS;
				mBaiduMap
						.setMyLocationConfigeration(new MyLocationConfiguration(
								mCurrentMode, true, mCurrentMarker));
				break;
			}
		}
	};
	requestLocButton.setOnClickListener(btnClickListener);

	// 地图初始化
	mMapView = (MapView) viewMap.findViewById(R.id.bmapView);
	mBaiduMap = mMapView.getMap();

	bdA = BitmapDescriptorFactory.fromResource(R.drawable.icon_marka);

	bdD = BitmapDescriptorFactory.fromResource(R.drawable.icon_markd);
	// 开启定位图层
	mBaiduMap.setMyLocationEnabled(true);
	// 定位初始化
	mLocClient = new LocationClient(viewMap.getContext());
	mLocClient.registerLocationListener(myListener);
	LocationClientOption option = new LocationClientOption();
	option.setOpenGps(true);// 打开gps
	option.setCoorType("bd09ll"); // 设置坐标类型
	option.setScanSpan(1000);
	mLocClient.setLocOption(option);
	mLocClient.start();
	getMarkerLocation();
	return viewMap;
}
 
开发者ID:haiyangxue,项目名称:EasyTracker,代码行数:64,代码来源:TrackFragment.java

示例9: onOptionsItemSelected

@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	// ��ͨ
	case R.id.map_common:
		mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
		break;
	// ����
	case R.id.map_site:
		mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);
		break;
	// ʵʱ
	case R.id.map_traffic:
		// �Ƿ���ʾ��ʵʱ��ͼ
		if (mBaiduMap.isTrafficEnabled()) {
			mBaiduMap.setTrafficEnabled(false);
			item.setTitle("ʵʱ��ͨoff");
		} else {
			mBaiduMap.setTrafficEnabled(true);
			item.setTitle("ʵʱ��ͨon");
		}
		break;
	// �ҵ�λ��
	case R.id.map_location:
		centerToMyLocation();
		break;
	// ��ͨģʽ
	case R.id.map_sensormode_normal:
		mLocationMode = LocationMode.NORMAL;
		break;
	// ����ģʽ
	case R.id.map_sensormode_following:
		mLocationMode = LocationMode.FOLLOWING;
		break;
	// ����ģʽ
	case R.id.map_sensormode_compass:
		mLocationMode = LocationMode.COMPASS;
		break;
	// ������
	case R.id.map_add_overlay:
		addOverlay(getMarkerData());
		break;

	default:
		break;
	}
	return super.onOptionsItemSelected(item);
}
 
开发者ID:scp504677840,项目名称:ExcellentWiFi,代码行数:48,代码来源:MapFragment.java


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