public void poiSearch(SearchBean bean) {
   isShowOverlay = false;
   if (aMap != null) {
     isShowOverlay = bean.isShowMarker();
     Query query = new Query(bean.getSearchKey(), bean.getPoiTypeSet(), bean.getCity());
     query.setPageNum(bean.getPageNumber());
     query.setPageSize(bean.getPageSize());
     query.setLimitDiscount(bean.isShowDiscount());
     query.setLimitGroupbuy(bean.isShowGroupbuy());
     PoiSearch search = new PoiSearch(this, query);
     if (bean.getSearchBound() != null) {
       PoiSearch.SearchBound bound = null;
       BoundBaseBean boundBaseBean = bean.getSearchBound();
       if (boundBaseBean.getType().equals(BoundBaseBean.TYPE_CIRCLE)) {
         CircleBoundBean circle = (CircleBoundBean) boundBaseBean;
         bound =
             new PoiSearch.SearchBound(
                 circle.getCenter(), circle.getRadiusInMeters(), circle.isDistanceSort());
       } else if (boundBaseBean.getType().equals(BoundBaseBean.TYPE_RECTANGLE)) {
         RectangleBoundBean rectangle = (RectangleBoundBean) boundBaseBean;
         bound = new PoiSearch.SearchBound(rectangle.getLowerLeft(), rectangle.getUpperRight());
       } else if (boundBaseBean.getType().equals(BoundBaseBean.TYPE_POLYGON)) {
         PolygonBoundBean polygon = (PolygonBoundBean) boundBaseBean;
         bound = new PoiSearch.SearchBound(polygon.getList());
       }
       search.setBound(bound);
     }
     search.setLanguage(bean.getLanguage());
     search.setOnPoiSearchListener(onPoiSearchListener);
     search.searchPOIAsyn();
   }
 }
Example #2
0
  /** 开始进行poi搜索 */
  protected void doSearchQuery(LatLonPoint lp) {
    mQuery =
        new PoiSearch.Query(
            "",
            mSpinner.getSelectedItem().toString(),
            ""); // 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国)
    mQuery.setPageSize(30); // 设置每页最多返回多少条poi。item

    if (lp != null) {
      poiSearch = new PoiSearch(this, mQuery);
      poiSearch.setOnPoiSearchListener(this);
      poiSearch.setBound(new SearchBound(lp, 2000, true)); //
      poiSearch.searchPOIAsyn(); // 异步搜索
    }
  }
  /** 开始进行poi搜索 */
  protected void doSearchQuery() {
    showProgressDialog(); // 显示进度框
    currentPage = 0;
    query =
        new PoiSearch.Query(
            keyWord,
            "",
            editCity.getText().toString()); // 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国)
    query.setPageSize(10); // 设置每页最多返回多少条poiitem
    query.setPageNum(currentPage); // 设置查第一页

    poiSearch = new PoiSearch(this, query);
    poiSearch.setOnPoiSearchListener(this);
    poiSearch.searchPOIAsyn();
  }
 /** 点击下一页按钮 */
 public void nextButton() {
   if (query != null && poiSearch != null && poiResult != null) {
     if (poiResult.getPageCount() - 1 > currentPage) {
       currentPage++;
       query.setPageNum(currentPage); // 设置查后一页
       poiSearch.searchPOIAsyn();
     } else {
       ToastUtil.show(PoiKeywordSearchActivity.this, "no result");
     }
   }
 }
 public void poiSearchDetail(String poiId) {
   PoiSearch search = new PoiSearch(this, null);
   search.setOnPoiSearchListener(onPoiSearchListener);
   search.searchPOIDetailAsyn(poiId);
 }