本文整理汇总了Java中com.baidu.mapapi.search.MKPoiInfo类的典型用法代码示例。如果您正苦于以下问题:Java MKPoiInfo类的具体用法?Java MKPoiInfo怎么用?Java MKPoiInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MKPoiInfo类属于com.baidu.mapapi.search包,在下文中一共展示了MKPoiInfo类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: routeWalk
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
public void routeWalk(MKPoiInfo info)
{
mMKInfo = info;
mEndGeoPoint = mMKInfo.pt;
String city = mPreferences.getString(PREF_LOACTION_CITY, DEFAULT_CITY);
String address = mPreferences.getString(PREF_LOACTION_ADDRESS, DEFAULT_ADDRESS);
if (null != mRouteOverlay)
{
// 移除上次规划的线路
mMapView.getOverlays().remove(mRouteOverlay);
}
// 对起点终点的name进行赋值,也可以直接对坐标赋值,赋值坐标则将根据坐标进行搜索
MKPlanNode startNode = new MKPlanNode();
startNode.pt = mStartGeoPoint;
startNode.name = address;
MKPlanNode endNode = new MKPlanNode();
endNode.name = mMKInfo.address;
endNode.pt = mMKInfo.pt;
mMKSearch.walkingSearch(city, startNode, city, endNode);
}
示例2: routeDrive
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
/** TODO 规划线路 */
public void routeDrive(MKPoiInfo info, boolean selfRoute)
{
mMKInfo = info;
mSelfRoute = selfRoute;
mEndGeoPoint = mMKInfo.pt;
String city = mPreferences.getString(PREF_LOACTION_CITY, DEFAULT_CITY);
String address = mPreferences.getString(PREF_LOACTION_ADDRESS, DEFAULT_ADDRESS);
if (null != mRouteOverlay)
{
// 移除上次规划的线路
mMapView.getOverlays().remove(mRouteOverlay);
}
// 对起点终点的name进行赋值,也可以直接对坐标赋值,赋值坐标则将根据坐标进行搜索
MKPlanNode startNode = new MKPlanNode();
startNode.pt = mStartGeoPoint;
startNode.name = address;
MKPlanNode endNode = new MKPlanNode();
endNode.name = mMKInfo.address;
endNode.pt = mMKInfo.pt;
mMKSearch.drivingSearch(city, startNode, city, endNode);
}
示例3: onTap
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
@Override
protected boolean onTap(int i)
{
super.onTap(i);
MKPoiInfo info = getPoi(i);
StringBuffer message = new StringBuffer();
message.append("城市:" + info.city);
message.append("\n名称:" + info.name);
message.append("\n地址:" + info.address);
message.append("\n电话号码:" + info.phoneNum);
final AlertDialog alertDialog = new AlertDialog.Builder(mActivity).setMessage(message).setTitle("位置详情").setPositiveButton("驾车线路", getOnClickListener(info)).setNegativeButton("取消", null).setNeutralButton("步行路线", getOnClickListener(info)).create();
alertDialog.show();
return true;
}
示例4: getOnClickListener
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
private OnClickListener getOnClickListener(final MKPoiInfo info)
{
return new OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
switch (which)
{
case DialogInterface.BUTTON_POSITIVE:
routeDrive(info);
break;
case DialogInterface.BUTTON_NEUTRAL:
routeWalk(info);
break;
case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss();
break;
}
}
};
}
示例5: onClickMapPoi
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
public void onClickMapPoi(MapPoi poi)
{
if (null != poi)
{
mEndGeoPoint = new GeoPoint(poi.geoPt.getLatitudeE6(), poi.geoPt.getLongitudeE6());
LocationData clickLocationData = new LocationData();
clickLocationData.latitude = poi.geoPt.getLatitudeE6() / 1000000.0;
clickLocationData.longitude = poi.geoPt.getLongitudeE6() / 1000000.0;
mClickLocationOverlay.setData(clickLocationData);
mClickLocationOverlay.setMarker(getResources().getDrawable(R.drawable.ic_nav_turn_start_s));
mMapView.getOverlays().remove(mClickLocationOverlay);
// mMapView.getOverlays().add(mClickLocationOverlay);
MKPoiInfo info = new MKPoiInfo();
info.pt = poi.geoPt;
info.address = poi.strText;
routeDrive(info, true);
mMapView.refresh();
Toast.makeText(LocationActivity.this, poi.strText, Toast.LENGTH_SHORT).show();
}
}
示例6: getRouteInfo
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
/** TODO 查看驾车路线信息 */
private void getRouteInfo(MKDrivingRouteResult res)
{
System.out.println("======================驾车路线信息==========================");
MKRouteAddrResult addressResult = res.getAddrResult();
int steps = mDividerRoute.getNumSteps();
for (int i = 0; i < steps; i++)
{
System.out.println(mDividerRoute.getStep(i).getContent());
}
System.out.println("taxi价格 = " + res.getTaxiPrice());
System.out.println("目的地 = " + res.getEnd().name);
System.out.println("起始地 = " + res.getStart().name);
if (null != addressResult)
{
ArrayList<ArrayList<MKPoiInfo>> poiList = addressResult.mWpPoiList;
for (ArrayList<MKPoiInfo> poi1 : poiList)
{
for (MKPoiInfo poi2 : poi1)
{
System.out.println("poi2.name = " + poi2.name);
}
}
}
System.out.println("======================驾车路线信息==========================");
}
示例7: getWalkInfo
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
/** TODO 查看步行路线信息 */
private void getWalkInfo(MKWalkingRouteResult res)
{
System.out.println("======================步行路线信息==========================");
MKRouteAddrResult addressResult = res.getAddrResult();
int steps = mWalkRoute.getNumSteps();
for (int i = 0; i < steps; i++)
{
System.out.println("|| " + mWalkRoute.getStep(i).getContent());
}
System.out.println("|| taxi价格 = " + res.getTaxiPrice());
System.out.println("|| 目的地 = " + res.getEnd().name);
System.out.println("|| 起始地 = " + res.getStart().name);
if (null != addressResult)
{
ArrayList<ArrayList<MKPoiInfo>> poiList = addressResult.mWpPoiList;
for (ArrayList<MKPoiInfo> poi1 : poiList)
{
for (MKPoiInfo poi2 : poi1)
{
System.out.println("poi2.name = " + poi2.name);
}
}
}
System.out.println("======================步行路线信息==========================");
}
示例8: onTap
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
@Override
protected boolean onTap(int i) {
super.onTap(i);
MKPoiInfo info = getPoi(i);
if (info.hasCaterDetails) {
mSearch.poiDetailSearch(info.uid);
}
return true;
}
示例9: onGetPoiResult
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
@Override
public void onGetPoiResult(MKPoiResult res, int type, int error)
{
// 错误号可参考MKEvent中的定义
if (error != 0 || res == null)
{
Toast.makeText(LocationActivity.this, "抱歉,未找到结果", Toast.LENGTH_LONG).show();
return;
}
// 将地图移动到第一个POI中心点
if (res.getCurrentNumPois() > 0)
{
// 将poi结果显示到地图上
MyPoiOverlay poiOverlay = new MyPoiOverlay(LocationActivity.this, mMapView, mMKSearch);
poiOverlay.setData(res.getAllPoi());
mMapView.getOverlays().clear();
mMapView.getOverlays().add(mLocationOverlay);
mMapView.getOverlays().add(poiOverlay);
mMapView.refresh();
// 当ePoiType为2(公交线路)或4(地铁线路)时, poi坐标为空
for (MKPoiInfo info : res.getAllPoi())
{
if (info.pt != null)
{
mMapView.getController().animateTo(info.pt);
break;
}
}
}
else if (res.getCityListNum() > 0)
{
// 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表
String strInfo = "在";
for (int i = 0; i < res.getCityListNum(); i++)
{
strInfo += res.getCityListInfo(i).city;
strInfo += ",";
}
strInfo += "找到结果";
Toast.makeText(LocationActivity.this, strInfo, Toast.LENGTH_LONG).show();
}
}
示例10: BaseAdapter_search
import com.baidu.mapapi.search.MKPoiInfo; //导入依赖的package包/类
public BaseAdapter_search(Activity context, List<MKPoiInfo> list)
{
context_Activity = context;
msgIds = list;
}