本文整理汇总了Java中com.baidu.navisdk.adapter.BNRoutePlanNode类的典型用法代码示例。如果您正苦于以下问题:Java BNRoutePlanNode类的具体用法?Java BNRoutePlanNode怎么用?Java BNRoutePlanNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BNRoutePlanNode类属于com.baidu.navisdk.adapter包,在下文中一共展示了BNRoutePlanNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: routePlan
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
/**
* 根据导航节点和偏好计算路线
**/
public void routePlan(ArrayList<BNRoutePlanNode> nodes, int preference) {
switchLineCaculate = 0;
for (int calculateMode : BASE_CALCULATE_MODES) {
if (preference != calculateMode) {
/* 将算路偏好放入队列中 */
routeModes.offer(calculateMode);
}
}
/* 最后放入选中算路偏好 */
routeModes.offer(preference);
this.nodes = nodes;
this.preference = routeModes.poll();
RouteModel.clearCache();
RouteGuider.get().routePlan(nodes, this.preference, routePlanObserver);
zoomToRouteBound(nodes.get(0), nodes.get(nodes.size() - 1));
selectLineState = true;
}
示例2: calculate
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
private void calculate() {
lock.lock();
try {
BNRoutePlanNode sn = new BNRoutePlanNode(gcAddress.getLongitude(), gcAddress.getLatitude(), gcAddress.getAddressDetail(), "");
BNRoutePlanNode tn = new BNRoutePlanNode(target.getLongitude(), target.getLatitude(), target.getName(), target.getAddress());
routeInputs.clear();
routeInputs.add(sn);
routeInputs.add(tn);
BNRoutePlanerProxy.getInstance().setObserver(this);
int prefrence = BaiduNaviManager.RoutePlanPreference.ROUTE_PLAN_MOD_RECOMMEND;
BNRoutePlanerProxy.getInstance().setCalcPrference(prefrence);
RouteGuider.get().routePlan(routeInputs, prefrence, this);
condition.await();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
Log.i(TAG, "end..............................");
lock.unlock();
}
}
示例3: updateCompany
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
/**
* 更新去公司视图
*/
@Override
public void updateCompany() {
companyAddress = mNaviDao.getHomeOrCompanyAddress(mAppConfig.getResources().getString(R.string.company));
goCompanyNodes.clear();
if (companyAddress != null) {
// 计算两点之间的距离
/* boolean countable = DistanceUtil.getDistance(new LatLng(address.getLatitude(), address.getLongitude()),
new LatLng(companyAddress.getLatitude(), companyAddress.getLongitude())) > 1000;*/
BNRoutePlanNode start = new BNRoutePlanNode(address.getLongitude(), address.getLatitude(), address.getAddressDetail(), "");
BNRoutePlanNode end = new BNRoutePlanNode(companyAddress.getLongitude(), companyAddress.getLatitude(), companyAddress.getName(), "");
goCompanyNodes.add(start);
goCompanyNodes.add(end);
}
}
示例4: createHandler
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
private void createHandler() {
if (hd == null) {
hd = new Handler(getMainLooper()) {
public void handleMessage(android.os.Message msg) {
if (msg.what == MSG_SHOW) {
addCustomizedLayerItems();
} else if (msg.what == MSG_HIDE) {
BNRouteGuideManager.getInstance().showCustomizedLayer(false);
} else if (msg.what == MSG_RESET_NODE) {
BNRouteGuideManager.getInstance().resetEndNodeInNavi(
new BNRoutePlanNode(116.21142, 40.85087, "百度大厦11", null, CoordinateType.GCJ02));
}
};
};
}
}
示例5: onJumpToNavigator
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
@Override
public void onJumpToNavigator() {
/*
* 设置途径点以及resetEndNode会回调该接口
*/
for (Activity ac : activityList) {
if (ac.getClass().getName().endsWith("BNDemoGuideActivity")) {
return;
}
}
Intent intent = new Intent(RoadNAVActivity.this, BNDemoGuideActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable(ROUTE_PLAN_NODE, (BNRoutePlanNode) mBNRoutePlanNode);
intent.putExtras(bundle);
startActivity(intent);
}
示例6: createHandler
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
private void createHandler() {
if (hd == null) {
hd = new Handler(getMainLooper()) {
public void handleMessage(android.os.Message msg) {
if (msg.what == MSG_SHOW) {
addCustomizedLayerItems();
} else if (msg.what == MSG_HIDE) {
BNRouteGuideManager.getInstance().showCustomizedLayer(false);
} else if (msg.what == MSG_RESET_NODE) {
BNRouteGuideManager.getInstance().resetEndNodeInNavi(
new BNRoutePlanNode(116.21142, 40.85087, "百度大厦11", null, BNRoutePlanNode.CoordinateType.GCJ02));
}
}
};
}
}
示例7: initSearch
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
/**
* 初始化搜索
*/
private void initSearch() {
fromAddress = etFrom.getText().toString().trim();
endAddress = etEnd.getText().toString().trim();
if (!TextUtils.isEmpty(fromAddress) && !TextUtils.isEmpty(endAddress)) {
DialogUtil.showLoading(MapActivity.this);
if (fromAddress.equals("我的位置")) {
isFrom = false;
sNode = new BNRoutePlanNode(Const.LONGITUDE_OF_MY_LOCATION, Const.LATITUDE_OF_MY_LOCATION, "我的位置", null, BNRoutePlanNode.CoordinateType.BD09LL);
new Thread(getEndLatitude).start();
} else {
isFrom = true;
new Thread(getFromLatitude).start();
}
} else {
DialogUtil.showToast(MapActivity.this, "请输入出发地和目的地", Toast.LENGTH_SHORT);
}
}
示例8: launchNavigatorViaPoints
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
private static void launchNavigatorViaPoints(final Activity activity, LatLng startLL, LatLng endLL) {
//这里给出一个起终点示例,实际应用中可以通过POI检索、外部POI来源等方式获取起终点坐标
final BNRoutePlanNode sNode = new BNRoutePlanNode(startLL.longitude, startLL.latitude, null, "从这里开始", BNRoutePlanNode.CoordinateType.BD09LL);
final BNRoutePlanNode eNode = new BNRoutePlanNode(endLL.longitude, endLL.latitude, null, "到这里结束", BNRoutePlanNode.CoordinateType.BD09LL);
if (sNode != null && eNode != null) {
List<BNRoutePlanNode> points = new ArrayList<BNRoutePlanNode>();
points.add(sNode);
points.add(eNode);
//距离太近toast提示(100米内)
double dis = DistanceUtil.getDistance(new LatLng(sNode.getLatitude(), sNode.getLongitude()), new LatLng(eNode.getLatitude(), eNode.getLongitude()));
if (dis <= 100) {
Toast.makeText(activity, "起点、途经点、终点距离太近", Toast.LENGTH_SHORT).show();
return;
}
BaiduNaviManager.getInstance().launchNavigator(activity, points, 1, true, new BaiduNaviManager.RoutePlanListener() {
public void onJumpToNavigator() {
/*
* 设置途径点以及resetEndNode会回调该接口
*/
for (Activity ac : activityList) {
if (ac.getClass().getName().endsWith("BNDemoGuideActivity")) {
return;
}
}
Intent intent = new Intent(activity, BDInnerNaviActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable(ROUTE_PLAN_NODE, (BNRoutePlanNode) sNode);
intent.putExtras(bundle);
activity.startActivity(intent);
}
public void onRoutePlanFailed() {
// TODO Auto-generated method stub
Toast.makeText(activity, "算路失败", Toast.LENGTH_SHORT).show();
}
});
}
}
示例9: routePlanSingle
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
public void routePlanSingle(ArrayList<BNRoutePlanNode> nodes, int preference) {
switchLineCaculate = BNavigatorProxy.getInstance().isNaviBegin() ? 2 : 1;
routeModes.clear();
this.nodes = nodes;
this.preference = preference;
RouteModel.clearCache();
RouteGuider.get().routePlan(nodes, this.preference, routePlanObserver);
//zoomToRouteBound(nodes.get(0), nodes.get(nodes.size()-1));
selectLineState = true;
}
示例10: zoomToRouteBound
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
public void zoomToRouteBound(BNRoutePlanNode start, BNRoutePlanNode end) {
LatLng ws = new LatLng(start.getLatitude(), start.getLongitude());
LatLng we = new LatLng(start.getLatitude(), end.getLongitude());
int hd = (int) DistanceUtil.getDistance(ws, we);
LatLng hs = new LatLng(start.getLatitude(), start.getLongitude());
LatLng he = new LatLng(end.getLatitude(), start.getLongitude());
int vd = (int) DistanceUtil.getDistance(hs, he);
//Log.e(TAG,"hd="+hd+",vd="+vd);
int level = getScales(hd, vd, Math.min(start.getLatitude(), end.getLatitude()));
MapStatusProxy ms = BNMapControllerProxy.getInstance().getMapStatus();
//Log.e(TAG,"level="+level);
ms._Level = level;
double cLatitude = Math.min(start.getLatitude(), end.getLatitude()) + Math.abs((start.getLatitude() - end.getLatitude()) / 2);
double cLogitude = Math.min(start.getLongitude(), end.getLongitude()) + Math.abs((start.getLongitude() - end.getLongitude()) / 2);
//Log.e(TAG,"lat="+cLatitude+",lng="+cLogitude);
Bundle b1 = ZeroZeroProxy.bala2((int) (cLogitude * 1e5), (int) (cLatitude * 1e5));
if (b1 != null) {
ms._CenterPtX = b1.getInt("MCx");
ms._CenterPtY = b1.getInt("MCy");
}
/*if (!BNavigatorProxy.getInstance().isNaviBegin()) {
_Yoffest = 205;
_Xoffest = 45;
} else {
_Yoffest = 60;
_Xoffest = 30;
}
ms._Yoffset = ScreenUtil.getInstance().dip2px(_Yoffest);
ms._Xoffset = 0 - ScreenUtil.getInstance().dip2px(_Xoffest);*/
if (!BNavigatorProxy.getInstance().isNaviBegin())
ms._Yoffset = ScreenUtil.getInstance().dip2px(100);
BNMapControllerProxy.getInstance().setMapStatus(ms, BNMapControllerProxy.AnimationType.eAnimationLevel);
}
示例11: addPassPoint
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
public void addPassPoint(BNRoutePlanNode node) {
if (routeInputs.size() > 1) {
for (int i = 0; i < routeInputs.size(); i++) {
if (routeInputs.get(i).getName().indexOf(node.getName()) != -1) {
return;
}
}
routeInputs.add(routeInputs.size() - 1, node);
}
}
示例12: getPassPointsHasCoordinate
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
public List<BNRoutePlanNode> getPassPointsHasCoordinate() {
if (routeInputs.size() > 2) {
List<BNRoutePlanNode> list = new ArrayList<BNRoutePlanNode>();
for (int i = 1; i < routeInputs.size() - 1; ++i) {
if (routeInputs.get(i).getLatitude() > 0) {
list.add(routeInputs.get(i));
}
}
return list;
}
return null;
}
示例13: getRouteInputsHasCoordinate
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
public List<BNRoutePlanNode> getRouteInputsHasCoordinate() {
if (routeInputs.size() > 2) {
List<BNRoutePlanNode> list = new ArrayList<BNRoutePlanNode>();
for (int i = 0; i < routeInputs.size(); ++i) {
if (routeInputs.get(i).getLatitude() > 0) {
list.add(routeInputs.get(i));
}
}
return list;
}
return null;
}
示例14: routeInputsContains
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
public boolean routeInputsContains(String passPoint) {
for (BNRoutePlanNode n : routeInputs) {
if (n.getName().indexOf(passPoint) != -1) {
return true;
}
}
return false;
}
示例15: getAddress
import com.baidu.navisdk.adapter.BNRoutePlanNode; //导入依赖的package包/类
/**
* 填充地址对象
**/
private com.lingju.context.entity.Address getAddress(BNRoutePlanNode routePlanNode) {
com.lingju.context.entity.Address address = new com.lingju.context.entity.Address();
address.setName(routePlanNode.getName());
address.setDetailedaddress(routePlanNode.getDescription());
address.setLongitude(routePlanNode.getLongitude());
address.setLatitude(routePlanNode.getLatitude());
return address;
}