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


Java MyLocationData类代码示例

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


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

示例1: moveToMe

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
private void moveToMe(BDLocation location)
{
    MapStatusUpdate mapUpdate=MapStatusUpdateFactory.zoomTo(18);
    baiduMap.setMapStatus(mapUpdate);
    //开始移动
    MapStatusUpdate mapLatlng=MapStatusUpdateFactory.newLatLng(new LatLng(location.getLatitude(),location.getLongitude()));
    baiduMap.setMapStatus(mapLatlng);
    //显示我的位置
    MyLocationData.Builder locationBuilder=new MyLocationData.Builder();
    locationBuilder.latitude(location.getLatitude());
    locationBuilder.longitude(location.getLongitude());
    MyLocationData locationData=locationBuilder.build();
    baiduMap.setMyLocationData(locationData);
    //显示用户所在地附近
    Toast.makeText(this,"您当前在"+location.getAddrStr()+"附近",Toast.LENGTH_SHORT).show();
}
 
开发者ID:WindFromFarEast,项目名称:SmartButler,代码行数:17,代码来源:LocationActivity.java

示例2: navigateTo

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
public void navigateTo(BDLocation location){
    if(isFirstLocate){
        LatLng latLng=new LatLng(location.getLatitude(),location.getLongitude());
        showToast("定位到当前位置已执行");

        MapStatusUpdate    update=MapStatusUpdateFactory.zoomTo(8f);
        baiduMap.animateMapStatus(update);
        update= MapStatusUpdateFactory.newLatLng(latLng);
        baiduMap.animateMapStatus(update);

       isFirstLocate=false;
    }
    MyLocationData.Builder locationBuilder=new MyLocationData.Builder();
    locationBuilder.latitude(location.getLatitude());
    locationBuilder.longitude(location.getLongitude());
    baiduMap.setMyLocationData(locationBuilder.build());

}
 
开发者ID:MoonRiser,项目名称:MaterialLearning,代码行数:19,代码来源:BaiduMapActivity.java

示例3: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation bdLocation) {
    mLastLocationData=bdLocation;
    MyLocationData myLocationData=new MyLocationData.Builder()
            .accuracy(bdLocation.getRadius())
            .latitude(bdLocation.getLatitude())
            .longitude(bdLocation.getLongitude())
            .build();
    mBaiduMap.setMyLocationData(myLocationData);
    MapStatusUpdate msu1 = MapStatusUpdateFactory.zoomTo(15.0f);
    mBaiduMap.setMapStatus(msu1);

    if(isFirstIn){
        LatLng ll=new LatLng(bdLocation.getLatitude(),bdLocation.getLongitude());
        MapStatusUpdate msu=MapStatusUpdateFactory.newLatLng(ll);
        mBaiduMap.setMapStatus(msu);
        isFirstIn=false;
    }
}
 
开发者ID:organizationAllink,项目名称:wzyx-android-user,代码行数:20,代码来源:BaiduMapActivity.java

示例4: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
    // map view 销毁后不在处理新接收的位置
    if (location == null || mMapView == null) {
        return;
    }
    mCurrentLat = location.getLatitude();
    mCurrentLon = location.getLongitude();
    mCurrentAccracy = location.getRadius();
    locData = new MyLocationData.Builder()
            .accuracy(location.getRadius())
            // 此处设置开发者获取到的方向信息,顺时针0-360
            .direction(mCurrentDirection).latitude(location.getLatitude())
            .longitude(location.getLongitude()).build();
    mBaiduMap.setMyLocationData(locData);
    if (isFirstLoc) {
        isFirstLoc = false;
        LatLng ll = new LatLng(location.getLatitude(),
                location.getLongitude());
        MapStatus.Builder builder = new MapStatus.Builder();
        builder.target(ll).zoom(18.0f);
        mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:25,代码来源:LocationDemo.java

示例5: navigateTo

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:yiwent,项目名称:Mobike,代码行数:21,代码来源:MainActivity.java

示例6: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
    // map view 销毁后不在处理新接收的位置
    if (location == null || mMapView == null) {
        return;
    }
    MyLocationData locData = new MyLocationData.Builder()
            .accuracy(location.getRadius())
            // 此处设置开发者获取到的方向信息,顺时针0-360
            .direction(100).latitude(location.getLatitude())
            .longitude(location.getLongitude()).build();
    mBaiduMap.setMyLocationData(locData);
    if (isFirstLoc) {
        isFirstLoc = false;
        LatLng ll = new LatLng(location.getLatitude(),
                location.getLongitude());
        applicate=(Myapplication)getApplication();
        applicate.setLon(location.getLongitude());
        applicate.setLat(location.getLatitude());
        MapStatus.Builder builder = new MapStatus.Builder();
        builder.target(ll).zoom(18.0f);
        mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
    }
}
 
开发者ID:Jacklni,项目名称:MapLocation,代码行数:25,代码来源:MainActivity.java

示例7: updateBDMapStatus

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
private void updateBDMapStatus(BDLocation location) {
    final BaiduMap map = getBaiduMap();
    final BaiduMapPrefFragment provider = (BaiduMapPrefFragment)(getProvider().getMapProviderPreferences());
    final Context context = getActivity().getApplicationContext();

    int mapType = provider.getMapType(context);
    map.setMapType(mapType);

    MyLocationData locData = new MyLocationData.Builder()
            .accuracy(location.getRadius())
            .latitude(location.getLatitude())
            .longitude(location.getLongitude()).build();
    map.setMyLocationData(locData);

    LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
    MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
    map.animateMapStatus(u);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:19,代码来源:BaiduMapFragment.java

示例8: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
    // map view 销毁后不在处理新接收的位置
    if (location == null || mapView == null) {
        return;
    }
    tvLocation.setText(location.getAddrStr());
    MyLocationData locData = new MyLocationData.Builder()
            .accuracy(location.getRadius())
            // 此处设置开发者获取到的方向信息,顺时针0-360
            .direction(100).latitude(location.getLatitude())
            .longitude(location.getLongitude()).build();
    mBaiduMap.setMyLocationData(locData);
    if (isFirstLoc) {
        isFirstLoc = false;
        LatLng ll = new LatLng(location.getLatitude(),
                location.getLongitude());
        MapStatus.Builder builder = new MapStatus.Builder();
        builder.target(ll).zoom(18.0f);
        mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
    }
}
 
开发者ID:ByteJump,项目名称:MyApp,代码行数:23,代码来源:fragment1.java

示例9: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
    // map view 销毁后不在处理新接收的位置
    if (location == null || mMapView == null)
        return;
    MyLocationData locData = new MyLocationData.Builder()
            .accuracy(location.getRadius())
                    // 此处设置开发者获取到的方向信息,顺时针0-360
            .direction(100).latitude(location.getLatitude())
            .longitude(location.getLongitude()).build();
    getBaiduMap().setMyLocationData(locData);

    LatLong latlong = DroneHelper.BDLocationToCoord(locData);
    if (mPanMode.get() == AutoPanMode.USER) {
        updateCamera(latlong, (int) getBaiduMap().getMapStatus().zoom);
    }

    if (mLocationListener != null) {
        Location loc = new Location(new Coord2D(latlong.getLatitude(),latlong.getLongitude()),locData.direction,locData.speed,locData.satellitesNum>3);
        mLocationListener.onLocationChanged(loc);
    }


}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:25,代码来源:BaiduMapFragment.java

示例10: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的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

示例11: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的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

示例12: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的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

示例13: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的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

示例14: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
    // map view 销毁后不在处理新接收的位置
    if (location == null || mMapView == null)
        return;
    MyLocationData locData = new MyLocationData.Builder()
            .accuracy(location.getRadius())
                    // 此处设置开发者获取到的方向信息,顺时针0-360
            .direction(100).latitude(location.getLatitude())
            .longitude(location.getLongitude()).build();
    mBaiduMap.setMyLocationData(locData);
    if (isFirstLoc) {
        isFirstLoc = false;
        LatLng ll = new LatLng(location.getLatitude(),
                location.getLongitude());
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
        mBaiduMap.animateMapStatus(u);
    }
}
 
开发者ID:offbye,项目名称:PiBoat,代码行数:20,代码来源:SmallBaiduMap.java

示例15: onReceiveLocation

import com.baidu.mapapi.map.MyLocationData; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
	// map view 销毁后不在处理新接收的位置
	if (location == null || mMapView == null)
		return;
	MyLocationData locData = new MyLocationData.Builder()
			.accuracy(location.getRadius())
			// 此处设置开发者获取到的方向信息,顺时针0-360
			.direction(100).latitude(location.getLatitude())
			.longitude(location.getLongitude()).build();
	mBaiduMap.setMyLocationData(locData);
	if (isFirstLoc) {
		isFirstLoc = false;
		LatLng ll = new LatLng(location.getLatitude(),
				location.getLongitude());
		MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
		mBaiduMap.animateMapStatus(u);
	}
}
 
开发者ID:amazingokc,项目名称:BMap,代码行数:20,代码来源:LocationDemo.java


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