本文整理汇总了Java中com.baidu.mapapi.search.route.PlanNode.withLocation方法的典型用法代码示例。如果您正苦于以下问题:Java PlanNode.withLocation方法的具体用法?Java PlanNode.withLocation怎么用?Java PlanNode.withLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.baidu.mapapi.search.route.PlanNode
的用法示例。
在下文中一共展示了PlanNode.withLocation方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateBikeInfo
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
private void updateBikeInfo(BikeInfo bikeInfo) {
if (!hasPlanRoute) {
if (isNeedLogin) {
mBtLoginOrorder.setText("请登录后骑车");
} else {
mBtLoginOrorder.setText("预约骑车");
}
mLogin.setVisibility(View.GONE);
mTvLocationInfo.setVisibility(View.VISIBLE);
mBtLoginOrorder.setVisibility(View.VISIBLE);
mBikeInfoBoard.setVisibility(View.VISIBLE);
mLoBikeInfo.setVisibility(View.VISIBLE);
mMinute.setText(bikeInfo.getTime());
mTvDistance.setText(bikeInfo.getDistance());
bInfo = bikeInfo;
endNodeStr = PlanNode.withLocation(new LatLng(bikeInfo.getLatitude(), bikeInfo.getLongitude()));
drawPlanRoute(endNodeStr);
}
}
示例2: onMapStatusChangeFinish
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
public void onMapStatusChangeFinish(MapStatus mapStatus) {
String _str = mapStatus.toString();
String _regex = "target lat: (.*)\ntarget lng";
String _regex2 = "target lng: (.*)\ntarget screen x";
changeLatitude = Double.parseDouble(latlng(_regex, _str));
changeLongitude = Double.parseDouble(latlng(_regex2, _str));
LatLng changeLL = new LatLng(changeLatitude, changeLongitude);
startNodeStr = PlanNode.withLocation(changeLL);
Log.d(TAG, "changeLatitude-----change--------" + changeLatitude);
Log.d(TAG, "changeLongitude-----change--------" + changeLongitude);
if (!isNeedCurrentlocation) {
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(changeLL);
baiduMap.setMapStatus(u);
if (Math.hypot((changeLatitude - currentLatitude),
(changeLongitude - currentLongitude)) > 0.00001) {
Logger.d(Math.hypot((changeLatitude - currentLatitude),
(changeLongitude - currentLongitude)));
if (routeOverlay != null)
routeOverlay.removeFromMap();
addOverLayout(changeLatitude, changeLongitude);
}
}
}
示例3: initView
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
private void initView() {
iv_back = (ImageView) findViewById(R.id.iv_back);
iv_back.setVisibility(View.VISIBLE);
iv_back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
finish();
}
});
mMapView = (MapView) findViewById(R.id.bmapView);
mMapView.showScaleControl(false);
mMapView.showZoomControls(false);
mBaiduMap = mMapView.getMap();
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
Intent intent = getIntent();
LatLng locLatLng = new LatLng(intent.getDoubleExtra("locLat", 0), intent.getDoubleExtra("locLon", 0));
LatLng desLatLng = new LatLng(intent.getDoubleExtra("lat", 0), intent.getDoubleExtra("lon", 0));
PlanNode st = PlanNode.withLocation(locLatLng);
PlanNode en = PlanNode.withLocation(desLatLng);
mSearch.drivingSearch(new DrivingRoutePlanOption().from(st).to(en));
}
示例4: onReceiveLocation
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
@Override
public void onReceiveLocation(BDLocation bdLocation) {
// map view 销毁后不在处理新接收的位置
if (bdLocation == null || mMapView == null) {
return;
}
MyLocationData locData = new MyLocationData.Builder()
.accuracy(bdLocation.getRadius())
.direction(mCurrentX)//设定图标方向 // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(bdLocation.getLatitude())
.longitude(bdLocation.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
currentLatitude = bdLocation.getLatitude();
currentLongitude = bdLocation.getLongitude();
current_addr.setText(bdLocation.getAddrStr());
currentLL = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
LocationManager.getInstance().setCurrentLL(currentLL);
LocationManager.getInstance().setAddress(bdLocation.getAddrStr());
startNodeStr = PlanNode.withLocation(currentLL);
//option.setScanSpan(5000),每隔5000ms这个方法就会调用一次,而有些我们只想调用一次,所以要判断一下isFirstLoc
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
//地图缩放比设置为18
builder.target(ll).zoom(18.0f);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
changeLatitude = bdLocation.getLatitude();
changeLongitude = bdLocation.getLongitude();
if (!isServiceLive) {
addOverLayout(currentLatitude, currentLongitude);
}
}
}
示例5: onMapStatusChangeFinish
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
public void onMapStatusChangeFinish(MapStatus mapStatus) {
String _str = mapStatus.toString();
String _regex = "target lat: (.*)\ntarget lng";
String _regex2 = "target lng: (.*)\ntarget screen x";
changeLatitude = Double.parseDouble(latlng(_regex, _str));
changeLongitude = Double.parseDouble(latlng(_regex2, _str));
LatLng changeLL = new LatLng(changeLatitude, changeLongitude);
startNodeStr = PlanNode.withLocation(changeLL);
Log.d("gaolei", "changeLatitude-----change--------" + changeLatitude);
Log.d("gaolei", "changeLongitude-----change--------" + changeLongitude);
}
示例6: updateBikeInfo
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
private void updateBikeInfo(BikeInfo bikeInfo) {
if (!hasPlanRoute) {
bike_layout.setVisibility(View.VISIBLE);
bike_time.setText(bikeInfo.getTime());
bike_distance.setText(bikeInfo.getDistance());
bInfo = bikeInfo;
endNodeStr = PlanNode.withLocation(new LatLng(bikeInfo.getLatitude(), bikeInfo.getLongitude()));
drawPlanRoute(endNodeStr);
}
}
示例7: onReceiveLocation
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
@Override
public void onReceiveLocation(BDLocation bdLocation) {
if (bdLocation == null || baiduMap == null) {
return;
}
mBDLocation = bdLocation;
MyLocationData locData = new MyLocationData.Builder()
.accuracy(bdLocation.getRadius())
.direction(mCurrentX)//设定图标方向 // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(bdLocation.getLatitude())
.longitude(bdLocation.getLongitude()).build();
if (isNeedCurrentlocation)
baiduMap.setMyLocationData(locData);
currentLatitude = bdLocation.getLatitude();
currentLongitude = bdLocation.getLongitude();
mTvLocationInfo.setText(bdLocation.getAddrStr());
currentLL = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
MyLocationManager.getInstance().setCurrentLL(currentLL);
MyLocationManager.getInstance().setAddress(bdLocation.getAddrStr());
startNodeStr = PlanNode.withLocation(currentLL);
//option.setScanSpan(5000),每隔5000ms这个方法就会调用一次,而有些我们只想调用一次,所以要判断一下isFirstLoc
if (isFirstLocation) {
isFirstLocation = false;
LatLng ll = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
//地图缩放比设置为18
builder.target(ll).zoom(18.0f);
baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
changeLatitude = bdLocation.getLatitude();
changeLongitude = bdLocation.getLongitude();
if (!isServiceLive) {
addOverLayout(currentLatitude, currentLongitude);
}
}
}
示例8: run
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
@Override
public void run() {
DialogUtil.dissMissLoading();
//设定中心点坐标
double lat0 = 0;
double lng0 = 0;
if (isFrom) {
//自定义出发地坐标
lat0 = Double.valueOf(map.get("lat0"));
lng0 = Double.valueOf(map.get("lng0"));
}
//目的地坐标
double lat = Double.valueOf(map.get("lat"));
double lng = Double.valueOf(map.get("lng"));
myLatLng = new LatLng(lat, lng);
MarkerOptions markerOptions = new MarkerOptions().position(myLatLng).icon(bd);
mBaiduMap.addOverlay(markerOptions);
mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
//改变地图状态
mBaiduMap.setMapStatus(mMapStatusUpdate);
LatLng stlatLng;
if (isFrom) {
stlatLng = new LatLng(lat0, lng0);
} else {
stlatLng = new LatLng(Const.LATITUDE_OF_MY_LOCATION, Const.LONGITUDE_OF_MY_LOCATION);
}
LatLng enlatLng = new LatLng(lat, lng);
PlanNode stNode = PlanNode.withLocation(stlatLng);
PlanNode enNode = PlanNode.withLocation(enlatLng);
mSearch.walkingSearch((new WalkingRoutePlanOption())
.from(stNode)
.to(enNode));
}
示例9: searchRoute
import com.baidu.mapapi.search.route.PlanNode; //导入方法依赖的package包/类
/**
* 定位起点,输入终点
* @param startLocation
* @param endPosition
* @throws Exception
*/
private void searchRoute(LatLng startLocation, String endPosition) throws Exception{
Log.i(TAG+" searchRoute", "(Location, Position)");
PlanNode stNode = PlanNode.withLocation(startLocation);
PlanNode enNode = PlanNode.withCityNameAndPlaceName(OneBusApplication.CURRENT_CITY, endPosition);
searchRoute0(stNode,enNode);
}