本文整理匯總了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;
}