Merge branch 'dev_MogoAP_eagle-1030_211020_8.0.14_for_newtts' into dev_MogoAP_eagle-220_211207_8.0.15

# Conflicts:
#	foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java
#	gradle.properties
#	tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java
This commit is contained in:
donghongyu
2021-12-15 15:59:41 +08:00

View File

@@ -53,19 +53,19 @@ import java.util.List;
*/
public class ObjectUtils {
public static MarkerOptions fromMogo( MogoMarkerOptions opt ) {
public static MarkerOptions fromMogo(MogoMarkerOptions opt) {
if ( opt == null ) {
if (opt == null) {
return null;
}
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
final ArrayList< Bitmap > icons = opt.getIcons();
if ( icons != null && !icons.isEmpty() ) {
for ( Bitmap icon : icons ) {
if ( icon == null || icon.isRecycled() ) {
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
final ArrayList<Bitmap> icons = opt.getIcons();
if (icons != null && !icons.isEmpty()) {
for (Bitmap icon : icons) {
if (icon == null || icon.isRecycled()) {
continue;
}
descriptors.add( new BitmapDescriptor( icon ) );
descriptors.add(new BitmapDescriptor(icon));
}
}
@@ -86,83 +86,84 @@ public class ObjectUtils {
// }
MarkerOptions markerOptions = new MarkerOptions()
.setGps( opt.isGps() )
.position( new LonLatPoint( opt.getLongitude(), opt.getLatitude() ) )
.anchor( opt.getU(), opt.getV() )
.icons( descriptors )
.period( opt.getPeriod() )
.controlAngle( opt.isControlAngle() )
.rotateAngle( opt.getRotate() )
.setFlat( opt.isFlat() )
.visible( opt.isVisible() )
.infoWindowEnable( opt.isInifoWindowEnable() )
.setGps(opt.isGps())
.position(new LonLatPoint(opt.getLongitude(), opt.getLatitude()))
.anchor(opt.getU(), opt.getV())
.icons(descriptors)
.period(opt.getPeriod())
.controlAngle(opt.isControlAngle())
.rotateAngle(opt.getRotate())
.setFlat(opt.isFlat())
.visible(opt.isVisible())
.infoWindowEnable(opt.isInifoWindowEnable())
.scale(opt.getScale())
.alpha( opt.getAlpha() )
.alpha(opt.getAlpha())
// .draggable( opt.isDraggable() )
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
.zIndex( opt.getzIndex() );
.setInfoWindowOffset(opt.getOffsetX(), opt.getOffsetY())
.zIndex(opt.getzIndex());
try {
Color.parseColor( opt.getAnchorColor() );
markerOptions.anchorColor( opt.getAnchorColor() );
} catch ( Exception e ) {
Color.parseColor(opt.getAnchorColor());
markerOptions.anchorColor(opt.getAnchorColor());
} catch (Exception e) {
}
markerOptions.vrEnable( opt.is3DMode() );
if ( !TextUtils.isEmpty( opt.getResName() ) ) {
markerOptions.setMarkerIconName( opt.getResName() );
markerOptions.vrEnable(opt.is3DMode());
if (!TextUtils.isEmpty(opt.getResName())) {
markerOptions.setMarkerIconName(opt.getResName());
} else {
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo( opt );
if ( descriptor != null ) {
markerOptions.markerIcon( descriptor );
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo(opt);
if (descriptor != null) {
markerOptions.markerIcon(descriptor);
}
if ( opt.getIcon3DRes() != 0 ) {
markerOptions.marker3DIcon( opt.getIcon3DRes() );
if (opt.getIcon3DRes() != 0) {
markerOptions.marker3DIcon(opt.getIcon3DRes());
}
}
if ( !TextUtils.isEmpty( opt.getTitle() ) ) {
markerOptions.title( opt.getTitle() );
if (!TextUtils.isEmpty(opt.getTitle())) {
markerOptions.title(opt.getTitle());
}
if ( !TextUtils.isEmpty( opt.getSnippet() ) ) {
markerOptions.snippet( opt.getSnippet() );
if (!TextUtils.isEmpty(opt.getSnippet())) {
markerOptions.snippet(opt.getSnippet());
}
return markerOptions;
}
private static BitmapDescriptor getBitmapDescriptorFromMogo( MogoMarkerOptions options ) {
if ( options == null ) {
private static BitmapDescriptor getBitmapDescriptorFromMogo(MogoMarkerOptions options) {
if (options == null) {
return null;
}
Bitmap icon = options.getIcon();
if ( icon != null ) {
return BitmapDescriptorFactory.INSTANCE.fromBitmap( icon );
if (icon != null) {
return BitmapDescriptorFactory.INSTANCE.fromBitmap(icon);
}
View view = options.getIconView();
if ( view != null ) {
return BitmapDescriptorFactory.INSTANCE.fromView( view );
if (view != null) {
return BitmapDescriptorFactory.INSTANCE.fromView(view);
}
return null;
}
public static MogoLocation fromLocation( com.zhidaoauto.map.sdk.open.location.MogoLocation aLocation ) {
if ( aLocation == null ) {
public static MogoLocation fromLocation(com.zhidaoauto.map.sdk.open.location.MogoLocation aLocation) {
if (aLocation == null) {
return null;
}
MogoLocation location = new MogoLocation();
// location.setLocType( aLocation.getLocationType() );
location.setSpeed( aLocation.getSpeed() );
location.setLatitude( aLocation.getLat() );
location.setLongitude( aLocation.getLon() );
location.setAltitude( aLocation.getAltitude() );
// location.setTime( aLocation.getTime() );
location.setBearing( aLocation.getHeading() );
// location.setAccuracy( aLocation.getAccuracy() );
location.setCityCode( aLocation.getCityCode() );
location.setCityName( aLocation.getCity() );
location.setProvider( aLocation.getProvider() );
location.setAddress( aLocation.getAddress() );
location.setDistrict( aLocation.getDistrict() );
location.setProvince( aLocation.getProvince() );
location.setAdCode( aLocation.getAdCode() );
location.setLocType(1); // 定位类型
location.setSatellite(4);
location.setSpeed(aLocation.getSpeed());
location.setLatitude(aLocation.getLat());
location.setLongitude(aLocation.getLon());
location.setAltitude(aLocation.getAltitude());
location.setBearing(aLocation.getHeading());
location.setCityCode(aLocation.getCityCode());
location.setCityName(aLocation.getCity());
location.setProvider(aLocation.getProvider());
location.setAddress(aLocation.getAddress());
location.setDistrict(aLocation.getDistrict());
location.setProvince(aLocation.getProvince());
location.setAdCode(aLocation.getAdCode());
// location.setAccuracy( aLocation.getAccuracy() );
// location.setTime( aLocation.getTime() );
// location.setLocationDetail( aLocation.getLocationDetail() );
// location.setPoiName( aLocation.getPoiName() );
// location.setAoiName( aLocation.getAoiName() );
@@ -173,15 +174,14 @@ public class ObjectUtils {
// location.setBuildingId( aLocation.getBuildingId() );
// location.setFloor( aLocation.getFloor() );
// location.setGpsAccuracyStatus( aLocation.getGpsAccuracyStatus() );
// location.setSatellite( aLocation.getSatellites() );
return location;
}
public static LonLatPoint fromMogo( MogoLatLng latLng ) {
if ( latLng == null ) {
public static LonLatPoint fromMogo(MogoLatLng latLng) {
if (latLng == null) {
return null;
}
return new LonLatPoint( latLng.lon, latLng.lat );
return new LonLatPoint(latLng.lon, latLng.lat);
}
// public static NaviLatLng fromMogoAsNavi( MogoLatLng latLng ) {
@@ -198,11 +198,11 @@ public class ObjectUtils {
// return new LatLng( latLng.lat, latLng.lng );
// }
public static MogoLatLng fromAMap( LonLatPoint point ) {
if ( point == null ) {
public static MogoLatLng fromAMap(LonLatPoint point) {
if (point == null) {
return null;
}
return new MogoLatLng( point.getLatitude(), point.getLongitude() );
return new MogoLatLng(point.getLatitude(), point.getLongitude());
}
// public static MogoLatLng CameraPositionfromAMap( LatLng point ) {
@@ -212,19 +212,19 @@ public class ObjectUtils {
// return new MogoLatLng( point.latitude, point.longitude );
// }
public static GeocodeQuery fromMogo( MogoGeocodeQuery query ) {
if ( query == null ) {
public static GeocodeQuery fromMogo(MogoGeocodeQuery query) {
if (query == null) {
return null;
}
GeocodeQuery q = new GeocodeQuery( query.getLocationName(), query.getCity() );
GeocodeQuery q = new GeocodeQuery(query.getLocationName(), query.getCity());
return q;
}
public static RegeocodeQuery fromMogo( MogoRegeocodeQuery query ) {
if ( query == null ) {
public static RegeocodeQuery fromMogo(MogoRegeocodeQuery query) {
if (query == null) {
return null;
}
RegeocodeQuery q = new RegeocodeQuery( fromMogo( query.getPoint() ), 1000 );
RegeocodeQuery q = new RegeocodeQuery(fromMogo(query.getPoint()), 1000);
return q;
}
@@ -266,39 +266,39 @@ public class ObjectUtils {
// return mogoCrossroad;
// }
public static MogoGeocodeAddress fromAMap( GeocodeAddress address ) {
if ( address == null ) {
public static MogoGeocodeAddress fromAMap(GeocodeAddress address) {
if (address == null) {
return null;
}
MogoGeocodeAddress mogoGeocodeAddress = new MogoGeocodeAddress();
mogoGeocodeAddress.setAdcode( address.getAdcode() );
mogoGeocodeAddress.setBuilding( address.getBuilding() );
mogoGeocodeAddress.setCity( address.getCity() );
mogoGeocodeAddress.setDistrict( address.getDistrict() );
mogoGeocodeAddress.setFormatAddress( address.getFormatAddress() );
mogoGeocodeAddress.setLatlng( fromAMap( address.getLonlat() ) );
mogoGeocodeAddress.setLevel( address.getLevel() );
mogoGeocodeAddress.setNeighborhood( address.getNeighborhood() );
mogoGeocodeAddress.setProvince( address.getProvince() );
mogoGeocodeAddress.setTownship( address.getTownship() );
mogoGeocodeAddress.setAdcode(address.getAdcode());
mogoGeocodeAddress.setBuilding(address.getBuilding());
mogoGeocodeAddress.setCity(address.getCity());
mogoGeocodeAddress.setDistrict(address.getDistrict());
mogoGeocodeAddress.setFormatAddress(address.getFormatAddress());
mogoGeocodeAddress.setLatlng(fromAMap(address.getLonlat()));
mogoGeocodeAddress.setLevel(address.getLevel());
mogoGeocodeAddress.setNeighborhood(address.getNeighborhood());
mogoGeocodeAddress.setProvince(address.getProvince());
mogoGeocodeAddress.setTownship(address.getTownship());
return mogoGeocodeAddress;
}
public static MogoGeocodeResult fromAMap( GeocodeResult result ) {
if ( result == null || result.getGeocodeAddressList() == null ) {
public static MogoGeocodeResult fromAMap(GeocodeResult result) {
if (result == null || result.getGeocodeAddressList() == null) {
return null;
}
MogoGeocodeResult mogoGeocodeResult = new MogoGeocodeResult();
final List< MogoGeocodeAddress > addresses = new ArrayList<>();
List< GeocodeAddress > list = result.getGeocodeAddressList();
for ( GeocodeAddress geocodeAddress : list ) {
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap( geocodeAddress );
if ( mogoGeocodeAddress != null ) {
addresses.add( mogoGeocodeAddress );
final List<MogoGeocodeAddress> addresses = new ArrayList<>();
List<GeocodeAddress> list = result.getGeocodeAddressList();
for (GeocodeAddress geocodeAddress : list) {
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap(geocodeAddress);
if (mogoGeocodeAddress != null) {
addresses.add(mogoGeocodeAddress);
}
}
mogoGeocodeResult.setAddresses( addresses );
mogoGeocodeResult.setAddresses(addresses);
return mogoGeocodeResult;
}
@@ -374,23 +374,23 @@ public class ObjectUtils {
// return mogoSubPoiItem;
// }
public static MogoPoiItem fromAMap( PoiItem poiItem ) {
if ( poiItem == null ) {
public static MogoPoiItem fromAMap(PoiItem poiItem) {
if (poiItem == null) {
return null;
}
MogoPoiItem mogoPoiItem = new MogoPoiItem();
mogoPoiItem.setAdCode( poiItem.getAdCode() );
mogoPoiItem.setAdName( poiItem.getAdName() );
mogoPoiItem.setBusinessArea( poiItem.getBusinessArea() );
mogoPoiItem.setCityCode( poiItem.getCityCode() );
mogoPoiItem.setCityName( poiItem.getCityName() );
mogoPoiItem.setDirection( poiItem.getDirection() );
mogoPoiItem.setDistance( poiItem.getDistance() );
mogoPoiItem.setEmail( poiItem.getEmail() );
mogoPoiItem.setEnter( fromAMap( poiItem.getEnter() ) );
mogoPoiItem.setExit( fromAMap( poiItem.getExit() ) );
mogoPoiItem.setAdCode(poiItem.getAdCode());
mogoPoiItem.setAdName(poiItem.getAdName());
mogoPoiItem.setBusinessArea(poiItem.getBusinessArea());
mogoPoiItem.setCityCode(poiItem.getCityCode());
mogoPoiItem.setCityName(poiItem.getCityName());
mogoPoiItem.setDirection(poiItem.getDirection());
mogoPoiItem.setDistance(poiItem.getDistance());
mogoPoiItem.setEmail(poiItem.getEmail());
mogoPoiItem.setEnter(fromAMap(poiItem.getEnter()));
mogoPoiItem.setExit(fromAMap(poiItem.getExit()));
// mogoPoiItem.setIndoorData( fromAMap( poiItem.getIndoorData() ) );
mogoPoiItem.setParkingType( poiItem.getParkingType() );
mogoPoiItem.setParkingType(poiItem.getParkingType());
// mogoPoiItem.setIndoorMap( poiItem.isIndoorMap() );
// if ( poiItem.getPhotos() != null ) {
// List< MogoPhoto > mogoPhotos = new ArrayList<>();
@@ -403,13 +403,13 @@ public class ObjectUtils {
// mogoPoiItem.setPhotos( mogoPhotos );
// }
// mogoPoiItem.setPoiExtension( fromAMap( poiItem.getPoiExtension() ) );
mogoPoiItem.setPoiId( poiItem.getPoiId() );
mogoPoiItem.setPoint( fromAMap( poiItem.getLonLatPoint() ) );
mogoPoiItem.setPostcode( poiItem.getPostcode() );
mogoPoiItem.setProvinceCode( poiItem.getProvinceCode() );
mogoPoiItem.setProvinceName( poiItem.getProvinceName() );
mogoPoiItem.setShopID( poiItem.getShopID() );
mogoPoiItem.setSnippet( poiItem.getSnippet() );
mogoPoiItem.setPoiId(poiItem.getPoiId());
mogoPoiItem.setPoint(fromAMap(poiItem.getLonLatPoint()));
mogoPoiItem.setPostcode(poiItem.getPostcode());
mogoPoiItem.setProvinceCode(poiItem.getProvinceCode());
mogoPoiItem.setProvinceName(poiItem.getProvinceName());
mogoPoiItem.setShopID(poiItem.getShopID());
mogoPoiItem.setSnippet(poiItem.getSnippet());
// if ( poiItem.getSubPois() != null ) {
// List< MogoSubPoiItem > mogoSubPoiItems = new ArrayList<>();
// for ( SubPoiItem subPois : poiItem.getSubPois() ) {
@@ -420,20 +420,20 @@ public class ObjectUtils {
// }
// mogoPoiItem.setSubPois( mogoSubPoiItems );
// }
mogoPoiItem.setTel( poiItem.getTel() );
mogoPoiItem.setTypeCode( poiItem.getTypeCode() );
mogoPoiItem.setTitle( poiItem.getTitle() );
mogoPoiItem.setTypeDes( poiItem.getTypeDes() );
mogoPoiItem.setWebsite( poiItem.getWebsite() );
mogoPoiItem.setTel(poiItem.getTel());
mogoPoiItem.setTypeCode(poiItem.getTypeCode());
mogoPoiItem.setTitle(poiItem.getTitle());
mogoPoiItem.setTypeDes(poiItem.getTypeDes());
mogoPoiItem.setWebsite(poiItem.getWebsite());
return mogoPoiItem;
}
public static MogoRegeocodeAddress fromAMap( RegeocodeAddress regeocodeAddress ) {
if ( regeocodeAddress == null ) {
public static MogoRegeocodeAddress fromAMap(RegeocodeAddress regeocodeAddress) {
if (regeocodeAddress == null) {
return null;
}
MogoRegeocodeAddress mogoRegeocodeAddress = new MogoRegeocodeAddress();
mogoRegeocodeAddress.setAdCode( regeocodeAddress.getAdCode() );
mogoRegeocodeAddress.setAdCode(regeocodeAddress.getAdCode());
// if ( regeocodeAddress.getAois() != null ) {
// List< MogoAoiItem > items = new ArrayList<>();
// for ( AoiItem aois : regeocodeAddress.getAois() ) {
@@ -445,7 +445,7 @@ public class ObjectUtils {
// mogoRegeocodeAddress.setAois( items );
// }
mogoRegeocodeAddress.setBuilding( regeocodeAddress.getBuilding() );
mogoRegeocodeAddress.setBuilding(regeocodeAddress.getBuilding());
// if ( regeocodeAddress.getBusinessAreas() != null ) {
// List< MogoBusinessArea > mogoBusinessAreas = new ArrayList<>();
// for ( BusinessArea businessArea : regeocodeAddress.getBusinessAreas() ) {
@@ -457,9 +457,9 @@ public class ObjectUtils {
// mogoRegeocodeAddress.setBusinessAreas( mogoBusinessAreas );
// }
mogoRegeocodeAddress.setCity( regeocodeAddress.getCity() );
mogoRegeocodeAddress.setCityCode( regeocodeAddress.getCityCode() );
mogoRegeocodeAddress.setCountry( regeocodeAddress.getCountry() );
mogoRegeocodeAddress.setCity(regeocodeAddress.getCity());
mogoRegeocodeAddress.setCityCode(regeocodeAddress.getCityCode());
mogoRegeocodeAddress.setCountry(regeocodeAddress.getCountry());
// if ( regeocodeAddress.getCrossroads() != null ) {
// List< MogoCrossroad > mogoCrossroads = new ArrayList<>();
// for ( Crossroad crossroad : regeocodeAddress.getCrossroads() ) {
@@ -471,19 +471,19 @@ public class ObjectUtils {
// }
// mogoRegeocodeAddress.setCrossroads( mogoCrossroads );
// }
mogoRegeocodeAddress.setDistrict( regeocodeAddress.getDistrict() );
mogoRegeocodeAddress.setFormatAddress( regeocodeAddress.getFormatAddress() );
mogoRegeocodeAddress.setNeighborhood( regeocodeAddress.getNeighborhood() );
if ( regeocodeAddress.getPoiList() != null ) {
List< MogoPoiItem > mogoPoiItems = new ArrayList<>();
List< PoiItem > list = regeocodeAddress.getPoiList();
for ( PoiItem pois : list ) {
MogoPoiItem mogoPoiItem = fromAMap( pois );
mogoPoiItems.add( mogoPoiItem );
mogoRegeocodeAddress.setDistrict(regeocodeAddress.getDistrict());
mogoRegeocodeAddress.setFormatAddress(regeocodeAddress.getFormatAddress());
mogoRegeocodeAddress.setNeighborhood(regeocodeAddress.getNeighborhood());
if (regeocodeAddress.getPoiList() != null) {
List<MogoPoiItem> mogoPoiItems = new ArrayList<>();
List<PoiItem> list = regeocodeAddress.getPoiList();
for (PoiItem pois : list) {
MogoPoiItem mogoPoiItem = fromAMap(pois);
mogoPoiItems.add(mogoPoiItem);
}
mogoRegeocodeAddress.setPois( mogoPoiItems );
mogoRegeocodeAddress.setPois(mogoPoiItems);
}
mogoRegeocodeAddress.setProvince( regeocodeAddress.getProvince() );
mogoRegeocodeAddress.setProvince(regeocodeAddress.getProvince());
// if ( regeocodeAddress.getRoads() != null ) {
// List< MogoRegeocodeRoad > mogoRegeocodeRoads = new ArrayList<>();
// for ( RegeocodeRoad road : regeocodeAddress.getRoads() ) {
@@ -495,43 +495,43 @@ public class ObjectUtils {
// mogoRegeocodeAddress.setRoads( mogoRegeocodeRoads );
// }
// mogoRegeocodeAddress.setStreetNumber( fromAMap( regeocodeAddress.getStreetNumber() ) );
mogoRegeocodeAddress.setTowncode( regeocodeAddress.getTowncode() );
mogoRegeocodeAddress.setTownship( regeocodeAddress.getTownship() );
mogoRegeocodeAddress.setTowncode(regeocodeAddress.getTowncode());
mogoRegeocodeAddress.setTownship(regeocodeAddress.getTownship());
return mogoRegeocodeAddress;
}
public static MogoRegeocodeResult fromAMap( RegeocodeResult regeocodeResult ) {
if ( regeocodeResult == null ) {
public static MogoRegeocodeResult fromAMap(RegeocodeResult regeocodeResult) {
if (regeocodeResult == null) {
return null;
}
MogoRegeocodeResult mogoRegeocodeResult = new MogoRegeocodeResult();
mogoRegeocodeResult.setRegeocodeAddress( fromAMap( regeocodeResult.getRegeocodeAddress() ) );
mogoRegeocodeResult.setRegeocodeAddress(fromAMap(regeocodeResult.getRegeocodeAddress()));
return mogoRegeocodeResult;
}
public static InputtipsQuery fromMogo( MogoInputtipsQuery query ) {
if ( query == null ) {
public static InputtipsQuery fromMogo(MogoInputtipsQuery query) {
if (query == null) {
return null;
}
InputtipsQuery inputtipsQuery = new InputtipsQuery( query.getKeyword(), query.getCity() );
inputtipsQuery.setCityLimit( query.isCityLimit() );
inputtipsQuery.setLocation( fromMogo( query.getLocation() ) );
inputtipsQuery.setType( query.getType() );
InputtipsQuery inputtipsQuery = new InputtipsQuery(query.getKeyword(), query.getCity());
inputtipsQuery.setCityLimit(query.isCityLimit());
inputtipsQuery.setLocation(fromMogo(query.getLocation()));
inputtipsQuery.setType(query.getType());
return inputtipsQuery;
}
public static MogoTip fromAMap( Tip tip ) {
if ( tip == null ) {
public static MogoTip fromAMap(Tip tip) {
if (tip == null) {
return null;
}
MogoTip mogoTip = new MogoTip();
mogoTip.setAdCode( tip.getAdcode() );
mogoTip.setAddress( tip.getAddress() );
mogoTip.setDistrict( tip.getDistrict() );
mogoTip.setName( tip.getName() );
mogoTip.setPoiID( tip.getPoiID() );
mogoTip.setPoint( fromAMap( tip.getLatPoint() ) );
mogoTip.setTypeCode( tip.getTypeCode() );
mogoTip.setAdCode(tip.getAdcode());
mogoTip.setAddress(tip.getAddress());
mogoTip.setDistrict(tip.getDistrict());
mogoTip.setName(tip.getName());
mogoTip.setPoiID(tip.getPoiID());
mogoTip.setPoint(fromAMap(tip.getLatPoint()));
mogoTip.setTypeCode(tip.getTypeCode());
return mogoTip;
}
@@ -546,197 +546,123 @@ public class ObjectUtils {
// return mogoPoi;
// }
public static MogoPoiSearchQuery fromAMap( Query query ) {
if ( query == null ) {
public static MogoPoiSearchQuery fromAMap(Query query) {
if (query == null) {
return null;
}
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery( query.getKeyword(), query.getCategory(), query.getCity() );
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery(query.getKeyword(), query.getCategory(), query.getCity());
// mogoPoiSearchQuery.setBuilding( query.getBuilding() );
mogoPoiSearchQuery.setCityLimit( query.getCityLimit() );
mogoPoiSearchQuery.setDistanceSort( query.getDistanceSort() );
mogoPoiSearchQuery.setLocation( fromAMap( query.getLocation() ) );
mogoPoiSearchQuery.setPageNum( query.getPageNum() );
mogoPoiSearchQuery.setPageSize( query.getPageSize() );
mogoPoiSearchQuery.setCityLimit(query.getCityLimit());
mogoPoiSearchQuery.setDistanceSort(query.getDistanceSort());
mogoPoiSearchQuery.setLocation(fromAMap(query.getLocation()));
mogoPoiSearchQuery.setPageNum(query.getPageNum());
mogoPoiSearchQuery.setPageSize(query.getPageSize());
return mogoPoiSearchQuery;
}
public static Query fromMogo( MogoPoiSearchQuery query ) {
if ( query == null || query.getQuery() == null ) {
public static Query fromMogo(MogoPoiSearchQuery query) {
if (query == null || query.getQuery() == null) {
return null;
}
Query psq = new Query( query.getQuery(), "", "" );
String category = getCategory( query.getQuery() );
if ( !category.equals( "" ) )
psq = new Query( "", "", getCategory( query.getQuery() ) );
Query psq = new Query(query.getQuery(), "", "");
String category = getCategory(query.getQuery());
if (!category.equals(""))
psq = new Query("", "", getCategory(query.getQuery()));
// psq.setBuilding( query.getBuilding() );
psq.setCityLimit( query.isCityLimit() );
psq.setDistanceSort( query.isDistanceSort() );
psq.setLocation( fromMogo( query.getLocation() ) );
psq.setPageNum( query.getPageNum() );
psq.setPageSize( query.getPageSize() );
psq.setCityLimit(query.isCityLimit());
psq.setDistanceSort(query.isDistanceSort());
psq.setLocation(fromMogo(query.getLocation()));
psq.setPageNum(query.getPageNum());
psq.setPageSize(query.getPageSize());
return psq;
}
public static MogoSearchBound fromAMap( SearchBound bound ) {
if ( bound == null ) {
public static MogoSearchBound fromAMap(SearchBound bound) {
if (bound == null) {
return null;
}
if ( bound.getShape() == SearchBound.BOUND_SHAPE ) {
return new MogoSearchBound( fromAMap( bound.getCenter() ), bound.getRange(), bound.isDistanceSort() );
} else if ( bound.getShape() == SearchBound.POLYGON_SHAPE ) {
return new MogoSearchBound( fromAMap( bound.getPolyGonList() ) );
} else if ( bound.getShape() == SearchBound.RECTANGLE_SHAPE ) {
return new MogoSearchBound( fromAMap( bound.getLowerLeft() ), fromAMap( bound.getUpperRight() ) );
if (bound.getShape() == SearchBound.BOUND_SHAPE) {
return new MogoSearchBound(fromAMap(bound.getCenter()), bound.getRange(), bound.isDistanceSort());
} else if (bound.getShape() == SearchBound.POLYGON_SHAPE) {
return new MogoSearchBound(fromAMap(bound.getPolyGonList()));
} else if (bound.getShape() == SearchBound.RECTANGLE_SHAPE) {
return new MogoSearchBound(fromAMap(bound.getLowerLeft()), fromAMap(bound.getUpperRight()));
}
return null;
}
public static List< MogoLatLng > fromAMap( List< LonLatPoint > latLngs ) {
if ( latLngs == null ) {
public static List<MogoLatLng> fromAMap(List<LonLatPoint> latLngs) {
if (latLngs == null) {
return null;
}
List< MogoLatLng > result = new ArrayList<>( latLngs.size() );
for ( LonLatPoint latLng : latLngs ) {
result.add( fromAMap( latLng ) );
List<MogoLatLng> result = new ArrayList<>(latLngs.size());
for (LonLatPoint latLng : latLngs) {
result.add(fromAMap(latLng));
}
return result;
}
public static List< LonLatPoint > fromMogo( List< MogoLatLng > latLngs ) {
if ( latLngs == null ) {
public static List<LonLatPoint> fromMogo(List<MogoLatLng> latLngs) {
if (latLngs == null) {
return null;
}
List< LonLatPoint > result = new ArrayList<>( latLngs.size() );
for ( MogoLatLng latLng : latLngs ) {
result.add( fromMogo( latLng ) );
List<LonLatPoint> result = new ArrayList<>(latLngs.size());
for (MogoLatLng latLng : latLngs) {
result.add(fromMogo(latLng));
}
return result;
}
public static SearchBound fromMogo( MogoSearchBound bound ) {
if ( bound == null ) {
public static SearchBound fromMogo(MogoSearchBound bound) {
if (bound == null) {
return null;
}
if ( bound.getShape() == MogoSearchBound.SHAPE_BOUND ) {
return new SearchBound( fromMogo( bound.getCenterPoint() ), bound.getRadiusInMeters(), bound.isDistanceSort() );
} else if ( bound.getShape() == MogoSearchBound.SHAPE_POLYGON ) {
return new SearchBound( fromMogo( bound.getPolyGonList() ) );
} else if ( bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE ) {
return new SearchBound( fromMogo( bound.getLowerLeft() ), fromMogo( bound.getUpperRight() ) );
if (bound.getShape() == MogoSearchBound.SHAPE_BOUND) {
return new SearchBound(fromMogo(bound.getCenterPoint()), bound.getRadiusInMeters(), bound.isDistanceSort());
} else if (bound.getShape() == MogoSearchBound.SHAPE_POLYGON) {
return new SearchBound(fromMogo(bound.getPolyGonList()));
} else if (bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE) {
return new SearchBound(fromMogo(bound.getLowerLeft()), fromMogo(bound.getUpperRight()));
}
return null;
}
public static MogoPoiResult fromAMap( PoiSearchResult result ) {
if ( result == null ) {
public static MogoPoiResult fromAMap(PoiSearchResult result) {
if (result == null) {
return null;
}
MogoPoiResult mogoPoiResult = new MogoPoiResult();
if ( result.getItems() != null ) {
final List< PoiSearchItem > poiItems = result.getItems();
final ArrayList< MogoPoiItem > mogoPoiItems = new ArrayList<>( poiItems.size() );
for ( PoiSearchItem poiItem : poiItems ) {
mogoPoiItems.add( fromAMap( poiItem.getPoi() ) );
if (result.getItems() != null) {
final List<PoiSearchItem> poiItems = result.getItems();
final ArrayList<MogoPoiItem> mogoPoiItems = new ArrayList<>(poiItems.size());
for (PoiSearchItem poiItem : poiItems) {
mogoPoiItems.add(fromAMap(poiItem.getPoi()));
}
mogoPoiResult.setPois( mogoPoiItems );
mogoPoiResult.setPois(mogoPoiItems);
}
return mogoPoiResult;
}
// public static MogoNaviInfo fromAMap(Context context, NaviInfo naviInfo ) {
// if ( naviInfo == null ) {
// return null;
// }
// MogoNaviInfo mogoNaviInfo = new MogoNaviInfo();
// mogoNaviInfo.setCurrentRoadName( naviInfo.getCurrentRoadName() );
// mogoNaviInfo.setCurrentSpeed( naviInfo.getCurrentSpeed() );
// mogoNaviInfo.setCurStepRetainDistance( naviInfo.getCurStepRetainDistance() );
// mogoNaviInfo.setCurStepRetainTime( naviInfo.getCurStepRetainTime() );
// mogoNaviInfo.setIconResId( IconTypeUtils.getResIdByIconType( context, naviInfo.getIconType() ) );
// mogoNaviInfo.setNextRoadName( naviInfo.getNextRoadName() );
// mogoNaviInfo.setPathRetainDistance( naviInfo.getPathRetainDistance() );
// mogoNaviInfo.setPathRetainTime( naviInfo.getPathRetainTime() );
// mogoNaviInfo.setCurrentSpeed( naviInfo.getLimitSpeed() );
// return mogoNaviInfo;
// }
//
// public static MogoCongestionInfo fromAMap( AimLessModeCongestionInfo aimLessModeCongestionInfo ) {
// if ( aimLessModeCongestionInfo == null ) {
// return null;
// }
// MogoCongestionInfo congestionInfo = new MogoCongestionInfo();
// congestionInfo.setCongestionStatus( aimLessModeCongestionInfo.getCongestionStatus() );
// congestionInfo.setEventLat( aimLessModeCongestionInfo.getEventLat() );
// congestionInfo.setEventLon( aimLessModeCongestionInfo.getEventLon() );
// congestionInfo.setEventType( aimLessModeCongestionInfo.getEventType() );
// congestionInfo.setCongestionLinks( new ArrayList<MogoCongestionLink>() );
// congestionInfo.setLength( aimLessModeCongestionInfo.getLength() );
// congestionInfo.setRoadName( aimLessModeCongestionInfo.getRoadName() );
// congestionInfo.setTime( aimLessModeCongestionInfo.getTime() );
// if ( aimLessModeCongestionInfo.getAmapCongestionLinks() != null
// && aimLessModeCongestionInfo.getAmapCongestionLinks().length != 0 ) {
// for ( AMapCongestionLink amapCongestionLink : aimLessModeCongestionInfo.getAmapCongestionLinks() ) {
// if ( amapCongestionLink == null ) {
// continue;
// }
// MogoCongestionLink link = new MogoCongestionLink();
// link.setCongestionStatus( amapCongestionLink.getCongestionStatus() );
// if ( amapCongestionLink.getCoords() != null ) {
// link.setCoords( new ArrayList< MogoLatLng >() );
// Iterator<NaviLatLng> iterator = amapCongestionLink.getCoords().iterator();
// while ( iterator.hasNext() ) {
// NaviLatLng naviLatLng = iterator.next();
// if ( naviLatLng == null ) {
// continue;
// }
// link.getCoords().add( new MogoLatLng( naviLatLng.getLatitude(), naviLatLng.getLongitude() ) );
// }
// }
// congestionInfo.getCongestionLinks().add( link );
// }
// }
// return congestionInfo;
// }
//
// public static MogoTraffic fromAMap(AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) {
// if ( aMapNaviTrafficFacilityInfos == null || aMapNaviTrafficFacilityInfos.length == 0 ) {
// return null;
// }
// for ( AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo : aMapNaviTrafficFacilityInfos ) {
// if ( aMapNaviTrafficFacilityInfo == null ) {
// continue;
// }
// MogoTraffic traffic = new MogoTraffic( MogoTraffic.TYPE_AIM );
// traffic.setDistance( aMapNaviTrafficFacilityInfo.getDistance() );
// traffic.setSpeedLimit( aMapNaviTrafficFacilityInfo.getLimitSpeed() );
// traffic.setTrafficType( aMapNaviTrafficFacilityInfo.getBroadcastType() );
// traffic.setLat( aMapNaviTrafficFacilityInfo.latitude );
// traffic.setLon( aMapNaviTrafficFacilityInfo.longitude );
// return traffic;
// }
// return null;
// }
public static PolylineOptions fromMogo( MogoPolylineOptions options ) {
if ( options == null ) {
public static PolylineOptions fromMogo(MogoPolylineOptions options) {
if (options == null) {
return null;
}
PolylineOptions target = new PolylineOptions();
target.setGps(options.gps());
if ( options.getPoints() != null ) {
List< LonLatPoint > points = new ArrayList<>();
for ( MogoLatLng point : options.getPoints() ) {
points.add( fromMogo( point ) );
if (options.getPoints() != null) {
List<LonLatPoint> points = new ArrayList<>();
for (MogoLatLng point : options.getPoints()) {
points.add(fromMogo(point));
}
target.lonLatPoints( points );
target.lonLatPoints(points);
}
target.setLineWidth( options.getWidth() );
target.setLineWidth(options.getWidth());
target.zIndex(options.getZIndex());
target.setColor( options.getColor() );
target.useGradient( options.isGradient() );
if ( options.getColorValues() != null ) {
target.colorValues( options.getColorValues() );
target.setColor(options.getColor());
target.useGradient(options.isGradient());
if (options.getColorValues() != null) {
target.colorValues(options.getColorValues());
}
// target.transparency( options.getTransparency() );
// target.aboveMaskLayer( options.isAboveMaskLayer() );
@@ -746,31 +672,25 @@ public class ObjectUtils {
return target;
}
// public static MogoLatLng fromAMap( LatLng latLng ) {
// if ( latLng == null ) {
// return null;
// }
// return new MogoLatLng( latLng.latitude, latLng.longitude );
// }
public static MapCameraPosition fromAMap( CameraPosition position ) {
if ( position == null ) {
public static MapCameraPosition fromAMap(CameraPosition position) {
if (position == null) {
return null;
}
return new MapCameraPosition( fromAMap( position.getTarget() ), position.getBearing(), position.getTilt(), position.getZoom() );
return new MapCameraPosition(fromAMap(position.getTarget()), position.getBearing(), position.getTilt(), position.getZoom());
}
private static String getCategory( String key ) {
private static String getCategory(String key) {
String category = "";
if ( key.equals( "加油站" ) ) {
if (key.equals("加油站")) {
category = "6";
} else if ( key.equals( "停车场" ) ) {
} else if (key.equals("停车场")) {
category = "12";
} else if ( key.equals( "餐馆" ) ) {
} else if (key.equals("餐馆")) {
category = "22";
} else if ( key.equals( "洗车" ) ) {
} else if (key.equals("洗车")) {
category = "8";
} else if ( key.equals( "厕所" ) ) {
} else if (key.equals("厕所")) {
}
return category;