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


Java CityInfo类代码示例

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


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

示例1: onGetPoiResult

import com.baidu.mapapi.search.core.CityInfo; //导入依赖的package包/类
@Override
public void onGetPoiResult(PoiResult result) {
    if (result == null
            || result.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
        Toast.makeText(MainActivity.this, "未找到结果", Toast.LENGTH_LONG)
                .show();
        return;
    }
    if (result.error == SearchResult.ERRORNO.NO_ERROR) {
        mBaiduMap.clear();
        PoiOverlay overlay = new MyPoiOverlay(mBaiduMap);
        mBaiduMap.setOnMarkerClickListener(overlay);
        overlay.setData(result);
        overlay.addToMap();
        overlay.zoomToSpan();
        return;
    }
    if (result.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) {
        // 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表
        String strInfo = "在";
        for (CityInfo cityInfo : result.getSuggestCityList()) {
            strInfo += cityInfo.city;
            strInfo += ",";
        }
        strInfo += "找到结果";
        Toast.makeText(MainActivity.this, strInfo, Toast.LENGTH_LONG)
                .show();
    }
}
 
开发者ID:PengZhiPeng,项目名称:Mooc-map,代码行数:30,代码来源:MainActivity.java

示例2: onGetPoiResult

import com.baidu.mapapi.search.core.CityInfo; //导入依赖的package包/类
public void onGetPoiResult(PoiResult result) {
	if (result == null
			|| result.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
		Toast.makeText(LocationDemo.this, "未找到结果", Toast.LENGTH_LONG)
				.show();
		return;
	}
	if (result.error == SearchResult.ERRORNO.NO_ERROR) {
		mBaiduMap.clear();
		PoiOverlay overlay = new MyPoiOverlay(mBaiduMap);
		mBaiduMap.setOnMarkerClickListener(overlay);
		overlay.setData(result);
		overlay.addToMap();
		overlay.zoomToSpan();
		return;
	}
	if (result.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) {

		// 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表
		String strInfo = "在";
		for (CityInfo cityInfo : result.getSuggestCityList()) {
			strInfo += cityInfo.city;
			strInfo += ",";
		}
		strInfo += "找到结果";
		Toast.makeText(LocationDemo.this, strInfo, Toast.LENGTH_LONG)
				.show();
	}


}
 
开发者ID:amazingokc,项目名称:BMap,代码行数:32,代码来源:LocationDemo.java

示例3: onGetPoiResult

import com.baidu.mapapi.search.core.CityInfo; //导入依赖的package包/类
public void onGetPoiResult(PoiResult result) {
    if (result == null
            || result.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
        Toast.makeText(MainActivity.this, "未找到结果", Toast.LENGTH_LONG)
                .show();
        bar.setVisibility(View.GONE);
        return;
    }
    if (result.error == SearchResult.ERRORNO.NO_ERROR) {
        mBaiduMap.clear();
        PoiOverlay overlay = new MyPoiOverlay(mBaiduMap);
        mBaiduMap.setOnMarkerClickListener(overlay);
        overlay.setData(result);
        overlay.addToMap();
        overlay.zoomToSpan();
        bar.setVisibility(View.GONE);
        return;
    }
    if (result.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) {

        // 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表
        String strInfo = "在";
        for (CityInfo cityInfo : result.getSuggestCityList()) {
            strInfo += cityInfo.city;
            strInfo += ",";
        }
        strInfo += "找到结果";
        bar.setVisibility(View.GONE);
        Toast.makeText(MainActivity.this, strInfo, Toast.LENGTH_LONG)
                .show();
    }


}
 
开发者ID:amazingokc,项目名称:BMap,代码行数:35,代码来源:MainActivity.java

示例4: onGetPoiResult

import com.baidu.mapapi.search.core.CityInfo; //导入依赖的package包/类
@Override
public void onGetPoiResult(PoiResult result) {
	if (result == null
			|| result.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
		// Toast.makeText(SearchActivity.this,
		// getResources().getString(R.string.notFoundResult),
		// Toast.LENGTH_LONG)
		// .show();
		if (mProgressDialog != null && mProgressDialog.isShowing())
			mProgressDialog.dismiss();
		return;
	}

	if (result.error == SearchResult.ERRORNO.NO_ERROR) {
		for (PoiInfo poi : result.getAllPoi()) {
			Log.i("SearchResult", "" + poi.name + ":" + poi.type.toString()
					+ " address:" + poi.address);
			if (poi.type == PoiInfo.POITYPE.BUS_LINE
					|| poi.type == PoiInfo.POITYPE.SUBWAY_LINE
					|| poi.type == PoiInfo.POITYPE.BUS_STATION) {
				if (isAlreadyAdd(poi.name)) {
					continue;
				}
				HashMap<String, Object> map = new HashMap<String, Object>();
				map.put("uid", poi.uid);
				if (poi.type == PoiInfo.POITYPE.BUS_STATION) {
					map.put("type", poi.type);
					map.put("title", poi.name);
					map.put("city", poi.city);
					map.put("district", "");
					map.put("address", poi.address);
					// 计算距离当前位置的距离
					double distance = DistanceUtil.getDistance(
							OneBusApplication.CURRENT_LOCATION,
							poi.location);
					map.put("distance", (int) distance + "米");
				} else {
					map.put("type", poi.type);
					map.put("buslineId", poi.uid);
					map.put("title", poi.name);
					map.put("city", poi.city);
					map.put("district", "");
				}
				mResultListData.add(map);
				continue;
			}
		}

		if (mResultListData.size() == 0) {
			// Toast.makeText(SearchActivity.this,
			// getResources().getString(R.string.notFoundResult),
			// Toast.LENGTH_SHORT).show();
		}

		mResultListViewAdapter.notifyDataSetChanged();
	}

	if (result.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) {

		// TODO
		String strInfo = "";
		for (CityInfo cityInfo : result.getSuggestCityList()) {
			strInfo += cityInfo.city;
			strInfo += ",";
		}
		// Toast.makeText(SearchActivity.this, strInfo, Toast.LENGTH_LONG)
		// .show();
	}
	if (mProgressDialog != null && mProgressDialog.isShowing()) {
		mProgressDialog.dismiss();
	}
}
 
开发者ID:Mrsunsunshine,项目名称:FrontOne,代码行数:73,代码来源:SearchActivity.java


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