dev
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.search.query.MogoGeocodeQuery;
|
||||
import com.mogo.map.search.query.MogoRegeocodeQuery;
|
||||
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.amap.search.GeocodeSearchClient;
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.search.query.MogoGeocodeQuery;
|
||||
import com.mogo.map.search.query.MogoRegeocodeQuery;
|
||||
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.geo;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search.query;
|
||||
package com.mogo.map.search.geo.query;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search.query;
|
||||
package com.mogo.map.search.geo.query;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.inputtips;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.inputtips;
|
||||
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.search.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.inputtips;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.amap.search.InputtipsSearch;
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.search.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search;
|
||||
package com.mogo.map.search.inputtips;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.map.search.query;
|
||||
package com.mogo.map.search.inputtips.query;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.map.search.poisearch;
|
||||
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* poi 搜索
|
||||
*/
|
||||
public interface IMogoPoiSearch {
|
||||
|
||||
void setPoiSearchListener( IMogoPoiSearchListener listener );
|
||||
|
||||
/**
|
||||
* 异步搜索poi信息
|
||||
*/
|
||||
void searchPOIAsyn();
|
||||
|
||||
/**
|
||||
* 同步搜索poi信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoPoiResult searchPOI() throws MogoMapException;
|
||||
|
||||
/**
|
||||
* 设置查询条件
|
||||
*
|
||||
* @param query
|
||||
*/
|
||||
void setQuery( MogoPoiSearchQuery query );
|
||||
|
||||
/**
|
||||
* 根据poiId搜索详情,同步
|
||||
*
|
||||
* @param poiId
|
||||
* @return
|
||||
*/
|
||||
MogoPoiItem searchPOIId( String poiId ) throws MogoMapException;
|
||||
|
||||
/**
|
||||
* 根据poiId搜索详情,异步
|
||||
*
|
||||
* @param poiId
|
||||
*/
|
||||
void searchPOIIdAsyn( String poiId );
|
||||
|
||||
/**
|
||||
* 周边检索POI
|
||||
*
|
||||
* @param bound
|
||||
*/
|
||||
void setBound( MogoSearchBound bound );
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.map.search.poisearch;
|
||||
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* poi 检索结果回调
|
||||
*/
|
||||
public interface IMogoPoiSearchListener {
|
||||
|
||||
/**
|
||||
* 返回POI搜索异步处理的结果。
|
||||
*/
|
||||
void onPoiSearched( MogoPoiResult result, int errorCode );
|
||||
|
||||
/**
|
||||
* poi ID 检索结果回调方法
|
||||
*/
|
||||
void onPoiItemSearched( MogoPoiItem item, int errorCode );
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.map.search.poisearch;
|
||||
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* poi搜索结果集
|
||||
*/
|
||||
public class MogoPoiResult {
|
||||
|
||||
private ArrayList< MogoPoiItem > pois;
|
||||
|
||||
public ArrayList< MogoPoiItem > getPois() {
|
||||
return pois;
|
||||
}
|
||||
|
||||
public void setPois( ArrayList< MogoPoiItem > pois ) {
|
||||
this.pois = pois;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.mogo.map.search.poisearch;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.amap.search.PoiSearchClient;
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoPoiSearch implements IMogoPoiSearch {
|
||||
|
||||
private IMogoPoiSearch mDelegate;
|
||||
|
||||
public MogoPoiSearch( Context context, MogoPoiSearchQuery query ) {
|
||||
mDelegate = new PoiSearchClient( context, query );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoiSearchListener( IMogoPoiSearchListener listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setPoiSearchListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPOIAsyn() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.searchPOIAsyn();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiResult searchPOI() throws MogoMapException {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.searchPOI();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuery( MogoPoiSearchQuery query ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setQuery( query );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiItem searchPOIId( String poiId ) throws MogoMapException {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.searchPOIId( poiId );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPOIIdAsyn( String poiId ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.searchPOIIdAsyn( poiId );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBound( MogoSearchBound bound ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setBound( bound );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.mogo.map.search.poisearch;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 周边搜索范围
|
||||
*/
|
||||
public class MogoSearchBound implements Parcelable {
|
||||
|
||||
public static final String SHAPE_BOUND = "Bound";
|
||||
public static final String SHAPE_RECTANGLE = "Rectangle";
|
||||
public static final String SHAPE_POLYGON = "Polygon";
|
||||
|
||||
/**
|
||||
* 中心点
|
||||
*/
|
||||
private MogoLatLng centerPoint;
|
||||
/**
|
||||
* 半径:米
|
||||
*/
|
||||
private int radiusInMeters;
|
||||
|
||||
/**
|
||||
* 搜索范围的形状
|
||||
*/
|
||||
private String shape;
|
||||
|
||||
/**
|
||||
* 按距离排序
|
||||
*/
|
||||
private boolean isDistanceSort;
|
||||
|
||||
/**
|
||||
* 左下角
|
||||
*/
|
||||
private MogoLatLng lowerLeft;
|
||||
/**
|
||||
* 右上角
|
||||
*/
|
||||
private MogoLatLng upperRight;
|
||||
|
||||
/**
|
||||
* 范围搜索地点列表
|
||||
*/
|
||||
private List< MogoLatLng > polyGonList;
|
||||
|
||||
public MogoSearchBound( MogoLatLng centerPoint, int radiusInMeters ) {
|
||||
this( centerPoint, radiusInMeters, true );
|
||||
}
|
||||
|
||||
public MogoSearchBound( MogoLatLng centerPoint, int radiusInMeters, boolean isDistanceSort ) {
|
||||
this.centerPoint = centerPoint;
|
||||
this.radiusInMeters = radiusInMeters;
|
||||
this.isDistanceSort = isDistanceSort;
|
||||
this.shape = SHAPE_BOUND;
|
||||
}
|
||||
|
||||
public MogoSearchBound( MogoLatLng lowerLeft, MogoLatLng upperRight ) {
|
||||
this.lowerLeft = lowerLeft;
|
||||
this.upperRight = upperRight;
|
||||
this.shape = SHAPE_RECTANGLE;
|
||||
}
|
||||
|
||||
public MogoSearchBound( List< MogoLatLng > polyGonList ) {
|
||||
this.polyGonList = polyGonList;
|
||||
this.shape = SHAPE_POLYGON;
|
||||
}
|
||||
|
||||
public MogoLatLng getCenterPoint() {
|
||||
return centerPoint;
|
||||
}
|
||||
|
||||
public int getRadiusInMeters() {
|
||||
return radiusInMeters;
|
||||
}
|
||||
|
||||
public String getShape() {
|
||||
return shape;
|
||||
}
|
||||
|
||||
public boolean isDistanceSort() {
|
||||
return isDistanceSort;
|
||||
}
|
||||
|
||||
public MogoLatLng getLowerLeft() {
|
||||
return lowerLeft;
|
||||
}
|
||||
|
||||
public MogoLatLng getUpperRight() {
|
||||
return upperRight;
|
||||
}
|
||||
|
||||
public List< MogoLatLng > getPolyGonList() {
|
||||
return polyGonList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeParcelable( this.centerPoint, flags );
|
||||
dest.writeInt( this.radiusInMeters );
|
||||
dest.writeString( this.shape );
|
||||
dest.writeByte( this.isDistanceSort ? ( byte ) 1 : ( byte ) 0 );
|
||||
dest.writeParcelable( this.lowerLeft, flags );
|
||||
dest.writeParcelable( this.upperRight, flags );
|
||||
dest.writeTypedList( this.polyGonList );
|
||||
}
|
||||
|
||||
protected MogoSearchBound( Parcel in ) {
|
||||
this.centerPoint = in.readParcelable( MogoLatLng.class.getClassLoader() );
|
||||
this.radiusInMeters = in.readInt();
|
||||
this.shape = in.readString();
|
||||
this.isDistanceSort = in.readByte() != 0;
|
||||
this.lowerLeft = in.readParcelable( MogoLatLng.class.getClassLoader() );
|
||||
this.upperRight = in.readParcelable( MogoLatLng.class.getClassLoader() );
|
||||
this.polyGonList = in.createTypedArrayList( MogoLatLng.CREATOR );
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator< MogoSearchBound > CREATOR = new Parcelable.Creator< MogoSearchBound >() {
|
||||
@Override
|
||||
public MogoSearchBound createFromParcel( Parcel source ) {
|
||||
return new MogoSearchBound( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoSearchBound[] newArray( int size ) {
|
||||
return new MogoSearchBound[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.mogo.map.search.poisearch.query;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* poi 搜索查询条件
|
||||
*/
|
||||
public class MogoPoiSearchQuery implements Parcelable {
|
||||
|
||||
private String query;
|
||||
private String category;
|
||||
private String city;
|
||||
private String building;
|
||||
private int pageNum;
|
||||
private int pageSize;
|
||||
private boolean isCityLimit;
|
||||
private boolean isSubPois;
|
||||
private boolean isDistanceSort;
|
||||
private MogoLatLng location;
|
||||
|
||||
/**
|
||||
* @param query 查询字符串,多个关键字用“|”分割
|
||||
* @param category 类型的组合,比如定义如下组合:餐馆|电影院|景点
|
||||
*/
|
||||
public MogoPoiSearchQuery( String query, String category ) {
|
||||
this.query = query;
|
||||
this.category = category;
|
||||
this.city = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param query 查询字符串,多个关键字用“|”分割
|
||||
* @param category 类型的组合,比如定义如下组合:餐馆|电影院|景点
|
||||
*/
|
||||
public MogoPoiSearchQuery( String query, String category, String city ) {
|
||||
this.query = query;
|
||||
this.category = category;
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getBuilding() {
|
||||
return building;
|
||||
}
|
||||
|
||||
public void setBuilding( String building ) {
|
||||
this.building = building;
|
||||
}
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum( int pageNum ) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize( int pageSize ) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public boolean isCityLimit() {
|
||||
return isCityLimit;
|
||||
}
|
||||
|
||||
public void setCityLimit( boolean cityLimit ) {
|
||||
isCityLimit = cityLimit;
|
||||
}
|
||||
|
||||
public boolean isSubPois() {
|
||||
return isSubPois;
|
||||
}
|
||||
|
||||
public void setSubPois( boolean subPois ) {
|
||||
isSubPois = subPois;
|
||||
}
|
||||
|
||||
public boolean isDistanceSort() {
|
||||
return isDistanceSort;
|
||||
}
|
||||
|
||||
public void setDistanceSort( boolean distanceSort ) {
|
||||
isDistanceSort = distanceSort;
|
||||
}
|
||||
|
||||
public MogoLatLng getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation( MogoLatLng location ) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeString( this.building );
|
||||
dest.writeString( this.category );
|
||||
dest.writeString( this.city );
|
||||
dest.writeInt( this.pageNum );
|
||||
dest.writeInt( this.pageSize );
|
||||
dest.writeByte( this.isCityLimit ? ( byte ) 1 : ( byte ) 0 );
|
||||
dest.writeByte( this.isSubPois ? ( byte ) 1 : ( byte ) 0 );
|
||||
dest.writeByte( this.isDistanceSort ? ( byte ) 1 : ( byte ) 0 );
|
||||
dest.writeParcelable( this.location, flags );
|
||||
}
|
||||
|
||||
public MogoPoiSearchQuery() {
|
||||
}
|
||||
|
||||
protected MogoPoiSearchQuery( Parcel in ) {
|
||||
this.building = in.readString();
|
||||
this.category = in.readString();
|
||||
this.city = in.readString();
|
||||
this.pageNum = in.readInt();
|
||||
this.pageSize = in.readInt();
|
||||
this.isCityLimit = in.readByte() != 0;
|
||||
this.isSubPois = in.readByte() != 0;
|
||||
this.isDistanceSort = in.readByte() != 0;
|
||||
this.location = in.readParcelable( MogoLatLng.class.getClassLoader() );
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator< MogoPoiSearchQuery > CREATOR = new Parcelable.Creator< MogoPoiSearchQuery >() {
|
||||
@Override
|
||||
public MogoPoiSearchQuery createFromParcel( Parcel source ) {
|
||||
return new MogoPoiSearchQuery( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiSearchQuery[] newArray( int size ) {
|
||||
return new MogoPoiSearchQuery[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user