From 5d5fb910f21de98b88a1753fed8e9575bd0625df Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Mon, 17 Feb 2020 22:18:45 +0800 Subject: [PATCH] opt --- .../map/impl/amap/navi/CalculatePathItem.java | 90 +++--- .../map/impl/amap/navi/NaviOverlayHelper.java | 264 ++++++++++-------- .../main/res/drawable-ldpi/ic_endpoint.png | Bin 0 -> 482 bytes .../main/res/drawable-xhdpi/ic_endpoint.png | Bin 0 -> 788 bytes 4 files changed, 203 insertions(+), 151 deletions(-) create mode 100755 libraries/map-amap/src/main/res/drawable-ldpi/ic_endpoint.png create mode 100755 libraries/map-amap/src/main/res/drawable-xhdpi/ic_endpoint.png diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/CalculatePathItem.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/CalculatePathItem.java index 262aab4e5b..ec40a2b4fb 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/CalculatePathItem.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/CalculatePathItem.java @@ -27,6 +27,7 @@ public class CalculatePathItem { private AMapNaviPath mPath; private RouteOverLayWrapper mOverLazWrapper; + private ArrayList< MogoLatLng > mPoints; public int getId() { return mId; @@ -36,14 +37,14 @@ public class CalculatePathItem { return mPath; } - public RouteOverLayWrapper getOverLazWrapper(boolean createIfNull) { - if (mOverLazWrapper == null && createIfNull) { - mOverLazWrapper = new RouteOverLayWrapper(mContext, mAMap, mPath); + public RouteOverLayWrapper getOverLazWrapper( boolean createIfNull ) { + if ( mOverLazWrapper == null && createIfNull ) { + mOverLazWrapper = new RouteOverLayWrapper( mContext, mAMap, mPath ); } return mOverLazWrapper; } - public CalculatePathItem(Context context, AMap amap, int id, AMapNaviPath path) { + public CalculatePathItem( Context context, AMap amap, int id, AMapNaviPath path ) { mContext = context; mAMap = amap; this.mId = id; @@ -55,41 +56,41 @@ public class CalculatePathItem { } public String getTime() { - if (mTimeBuilder == null) { + if ( mTimeBuilder == null ) { final int time = mPath.getAllTime(); mTimeBuilder = new StringBuilder(); - fillFormatTime(time, mTimeBuilder); + fillFormatTime( time, mTimeBuilder ); } return mTimeBuilder.toString(); } private StringBuilder mTimeBuilder; - private void fillFormatTime(int seconds, StringBuilder builder) { + private void fillFormatTime( int seconds, StringBuilder builder ) { // int days = seconds / ( 24 * 60 * 60 ); // if ( days > 0 ) { // builder.append( days ).append( "天" ); // } // seconds -= days * 24 * 60 * 60; - int hours = seconds / (60 * 60); - if (hours > 0) { - builder.append(hours).append("小时"); + int hours = seconds / ( 60 * 60 ); + if ( hours > 0 ) { + builder.append( hours ).append( "小时" ); } seconds -= hours * 60 * 60; int min = seconds / 60; - builder.append(min > 1 ? min : 1).append("分钟"); + builder.append( min > 1 ? min : 1 ).append( "分钟" ); } private String mDistanceCacheStr = ""; public String getDistance() { - if (TextUtils.isEmpty(mDistanceCacheStr)) { + if ( TextUtils.isEmpty( mDistanceCacheStr ) ) { int distance = mPath.getAllLength(); - if (distance == -1) { + if ( distance == -1 ) { mDistanceCacheStr = "路程总程未获取"; } - if (distance >= 1000) { - mDistanceCacheStr = String.format("%.1f公里", (float) distance / 1000); + if ( distance >= 1000 ) { + mDistanceCacheStr = String.format( "%.1f公里", ( float ) distance / 1000 ); } else { mDistanceCacheStr = distance + "米"; } @@ -100,14 +101,14 @@ public class CalculatePathItem { private StringBuilder mDescBuilder = null; public String getDesc() { - if (mDescBuilder == null) { + if ( mDescBuilder == null ) { mDescBuilder = new StringBuilder(); int lightsSize = getTrafficNumber(); - if (lightsSize > 0) { - mDescBuilder.append("红绿灯").append(lightsSize).append("个"); + if ( lightsSize > 0 ) { + mDescBuilder.append( "红绿灯" ).append( lightsSize ).append( "个" ); } - mDescBuilder.append(" "); - mDescBuilder.append("收费").append(mPath.getTollCost()).append("元"); + mDescBuilder.append( " " ); + mDescBuilder.append( "收费" ).append( mPath.getTollCost() ).append( "元" ); } return mDescBuilder.toString(); @@ -115,11 +116,11 @@ public class CalculatePathItem { public int getTrafficNumber() { int trafficLightNumber = 0; - if (mPath == null) { + if ( mPath == null ) { return trafficLightNumber; } - List steps = mPath.getSteps(); - for (AMapNaviStep step : steps) { + List< AMapNaviStep > steps = mPath.getSteps(); + for ( AMapNaviStep step : steps ) { trafficLightNumber += step.getTrafficLightNumber(); } return trafficLightNumber; @@ -129,21 +130,44 @@ public class CalculatePathItem { mContext = null; mAMap = null; mPath = null; - if (mOverLazWrapper != null) { + if ( mOverLazWrapper != null ) { mOverLazWrapper.destroy(); } mOverLazWrapper = null; + if ( mPoints != null ) { + mPoints.clear(); + } + mPoints = null; } - public List getCoordList() { - - ArrayList mogoLatLngs = new ArrayList<>(); - for (NaviLatLng latlng : mPath.getCoordList() - ) { - MogoLatLng mogoLatLng = - new MogoLatLng(latlng.getLatitude(), latlng.getLongitude()); - mogoLatLngs.add(mogoLatLng); + public List< MogoLatLng > getCoordList() { + if ( mPoints == null ) { + mPoints = new ArrayList<>(); + for ( NaviLatLng latlng : mPath.getCoordList() ) { + MogoLatLng mogoLatLng = new MogoLatLng( latlng.getLatitude(), latlng.getLongitude() ); + mPoints.add( mogoLatLng ); + } } - return mogoLatLngs; + return mPoints; + } + + public MogoLatLng getDriveStartPoint() { + if ( mPath != null && mPath.getCoordList() != null && mPath.getCoordList().size() > 0 ) { + NaviLatLng startPoint = mPath.getCoordList().get( 0 ); + if ( startPoint != null ) { + return new MogoLatLng( startPoint.getLatitude(), startPoint.getLongitude() ); + } + } + return null; + } + + public MogoLatLng getDriveEndPoint() { + if ( mPath != null && mPath.getCoordList() != null && mPath.getCoordList().size() > 0 ) { + NaviLatLng endPoint = mPath.getCoordList().get( mPath.getCoordList().size() - 1 ); + if ( endPoint != null ) { + return new MogoLatLng( endPoint.getLatitude(), endPoint.getLongitude() ); + } + } + return null; } } \ No newline at end of file diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/NaviOverlayHelper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/NaviOverlayHelper.java index 62b15c5f59..7184e1615b 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/NaviOverlayHelper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/NaviOverlayHelper.java @@ -1,6 +1,8 @@ package com.mogo.map.impl.amap.navi; import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Rect; import android.text.TextUtils; @@ -14,15 +16,17 @@ import com.amap.api.navi.model.AMapNaviPath; import com.amap.api.navi.model.NaviInfo; import com.amap.api.navi.model.NaviLatLng; import com.mogo.map.MogoLatLng; +import com.mogo.map.MogoMap; import com.mogo.map.impl.amap.AMapWrapper; import com.mogo.map.impl.amap.R; import com.mogo.map.impl.amap.overlay.RouteOverLayWrapper; +import com.mogo.map.marker.MogoMarkerOptions; +import com.mogo.map.marker.MogoMarkersHandler; import com.mogo.map.navi.MogoCalculatePath; import com.mogo.map.navi.OnCalculatePathItemClickInteraction; import com.mogo.utils.WindowUtils; import com.mogo.utils.logger.Logger; -import java.lang.ref.SoftReference; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -55,14 +59,14 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction { // 规划的路线显示边距 private Rect mBoundRect = null; - private List mCalculatePathItems; - private List mPaths = new ArrayList<>(); + private List< CalculatePathItem > mCalculatePathItems; + private List< MogoCalculatePath > mPaths = new ArrayList<>(); private int mSelectedPathId; private CalculatePathItem mSelectedCalculatePathItem; private OnCalculatePathItemClickInteraction mLineClickInteraction; - public NaviOverlayHelper(AMapNavi mAMapNavi, AMap mAMap, Context mContext) { + public NaviOverlayHelper( AMapNavi mAMapNavi, AMap mAMap, Context mContext ) { this.mAMapNavi = mAMapNavi; this.mAMap = mAMap; this.mContext = mContext; @@ -75,11 +79,12 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction { public void showCalculatedPaths() { clearCalculatedOverlay(); mCalculatePathItems = getSortedPaths(); - if (mCalculatePathItems == null || mCalculatePathItems.isEmpty()) { + if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) { return; } - showPathsBound(mCalculatePathItems.get(0).getPath().getBoundsForPath()); - renderPathOverlay(mCalculatePathItems); + showPathsBound( mCalculatePathItems.get( 0 ).getPath().getBoundsForPath() ); + renderPathOverlay( mCalculatePathItems ); + addEndPoints(); } /** @@ -87,41 +92,41 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction { * * @return 排序好的路径规划列表 */ - private List getSortedPaths() { + private List< CalculatePathItem > getSortedPaths() { checkAMapInstance(); - final Map pathMap = mAMapNavi.getNaviPaths(); - if (pathMap == null || pathMap.isEmpty()) { + final Map< Integer, AMapNaviPath > pathMap = mAMapNavi.getNaviPaths(); + if ( pathMap == null || pathMap.isEmpty() ) { return null; } - TreeMap sortedMap = - new TreeMap(new Comparator() { - @Override - public int compare(Integer obj1, Integer obj2) { - if (obj1 != null) { - return obj1.compareTo(obj2); + TreeMap< Integer, AMapNaviPath > sortedMap = + new TreeMap< Integer, AMapNaviPath >( new Comparator< Integer >() { + @Override + public int compare( Integer obj1, Integer obj2 ) { + if ( obj1 != null ) { + return obj1.compareTo( obj2 ); + } + if ( obj2 != null ) { + return obj2.compareTo( obj1 ); + } + return 0; } - if (obj2 != null) { - return obj2.compareTo(obj1); - } - return 0; - } - }); - sortedMap.putAll(pathMap); + } ); + sortedMap.putAll( pathMap ); - final List items = new ArrayList<>(); - for (Map.Entry entry : sortedMap.entrySet()) { - if (entry == null || entry.getKey() == null || entry.getValue() == null) { + final List< CalculatePathItem > items = new ArrayList<>(); + for ( Map.Entry< Integer, AMapNaviPath > entry : sortedMap.entrySet() ) { + if ( entry == null || entry.getKey() == null || entry.getValue() == null ) { continue; } - items.add(new CalculatePathItem(mContext, mAMap, entry.getKey(), entry.getValue())); + items.add( new CalculatePathItem( mContext, mAMap, entry.getKey(), entry.getValue() ) ); } return items; } private void calculateBoundArea() { - if (mBoundRect == null) { + if ( mBoundRect == null ) { mBoundRect = new Rect(); - final int padding = WindowUtils.dip2px(mContext, 80); + final int padding = WindowUtils.dip2px( mContext, 80 ); mBoundRect.left = padding; mBoundRect.right = padding; mBoundRect.top = padding; @@ -132,60 +137,83 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction { /** * 将规划好的路径显示在视野内 */ - private void showPathsBound(LatLngBounds bounds) { + private void showPathsBound( LatLngBounds bounds ) { checkAMapInstance(); mAMap.animateCamera( - CameraUpdateFactory.newLatLngBoundsRect(bounds, mBoundRect.left, mBoundRect.right, - mBoundRect.top, mBoundRect.bottom)); + CameraUpdateFactory.newLatLngBoundsRect( bounds, mBoundRect.left, mBoundRect.right, + mBoundRect.top, mBoundRect.bottom ) ); } private void checkAMapInstance() { - if (mAMap == null) { + if ( mAMap == null ) { mAMap = AMapWrapper.getAMap(); } } - public void renderPathOverlay(List paths) { - if (paths == null || paths.size() == 0) { + public void renderPathOverlay( List< CalculatePathItem > paths ) { + if ( paths == null || paths.size() == 0 ) { return; } - for (int i = 0; i < paths.size(); i++) { - final CalculatePathItem item = paths.get(i); - if (item == null || item.getPath() == null) { + for ( int i = 0; i < paths.size(); i++ ) { + final CalculatePathItem item = paths.get( i ); + if ( item == null || item.getPath() == null ) { continue; } - RouteOverLayWrapper wrapper = item.getOverLazWrapper(true); - wrapper.setTrafficLightsVisible(false); + RouteOverLayWrapper wrapper = item.getOverLazWrapper( true ); + wrapper.setTrafficLightsVisible( false ); // 默认选中第一个 - if (i == 0) { + if ( i == 0 ) { mSelectedPathId = item.getId(); mSelectedCalculatePathItem = item; - wrapper.setStartBitmap(R.drawable.ic_navi_start) - .setEndBitmap(R.drawable.ic_navi_target); - mAMapNavi.selectRouteId(item.getId()); + wrapper.setStartBitmap( R.drawable.ic_navi_start ) + .setEndBitmap( R.drawable.ic_navi_target ); + mAMapNavi.selectRouteId( item.getId() ); } wrapper.addToMap(); - wrapper.setTransparency(i == 0 ? AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED - : AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED); + wrapper.setTransparency( i == 0 ? AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED : AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED ); + } + } + + public void addEndPoints() { + if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) { + return; + } + + Bitmap bitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_endpoint ); + MogoMarkerOptions options = new MogoMarkerOptions().icon( bitmap ).zIndex( 0 ).anchor( 0.5f, 0.5f ); + for ( CalculatePathItem path : mCalculatePathItems ) { + List< MogoLatLng > points = path.getCoordList(); + if ( points == null || points.isEmpty() ) { + continue; + } + MogoLatLng startPoint = path.getDriveStartPoint(); + MogoLatLng endPoint = path.getDriveEndPoint(); + if ( startPoint == null || endPoint == null ) { + continue; + } + MogoMap.getInstance().getMogoMap().addMarker( TAG, options.latitude( startPoint.lat ).longitude( startPoint.lng ) ); + MogoMap.getInstance().getMogoMap().addMarker( TAG, options.latitude( endPoint.lat ).longitude( endPoint.lng ) ); } } public void clearCalculatedOverlay() { - if (mCalculatePathItems != null && !mCalculatePathItems.isEmpty()) { - for (CalculatePathItem calculatePathItem : mCalculatePathItems) { - if (calculatePathItem == null) { + if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) { + for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) { + if ( calculatePathItem == null ) { continue; } - RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper(false); - if (wrapper != null) { + RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( false ); + if ( wrapper != null ) { wrapper.destroy(); } + calculatePathItem.release(); } mCalculatePathItems.clear(); } - if (mPaths != null) { + if ( mPaths != null ) { mPaths.clear(); } + MogoMarkersHandler.getInstance().remove( TAG ); } /** @@ -193,66 +221,66 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction { * * @param polyline 选中的线 */ - public boolean handleClickedPolyline(Polyline polyline, boolean isNaviing) { - if (polyline == null) { + public boolean handleClickedPolyline( Polyline polyline, boolean isNaviing ) { + if ( polyline == null ) { return false; } - if (mPaths != null && !mPaths.isEmpty()) { - for (MogoCalculatePath path : mPaths) { - if (TextUtils.equals(path.getTagId(), polyline.getId())) { - if (mLineClickInteraction != null) { - mLineClickInteraction.onItemClicked(path.getTagId()); + if ( mPaths != null && !mPaths.isEmpty() ) { + for ( MogoCalculatePath path : mPaths ) { + if ( TextUtils.equals( path.getTagId(), polyline.getId() ) ) { + if ( mLineClickInteraction != null ) { + mLineClickInteraction.onItemClicked( path.getTagId() ); break; } } } } - return handleClickedPolyline(polyline.getId()); + return handleClickedPolyline( polyline.getId() ); } - private boolean handleClickedPolyline(String id) { - if (id == null) { + private boolean handleClickedPolyline( String id ) { + if ( id == null ) { return false; } - Logger.i(TAG, "polyline id = " + id); - mSelectedCalculatePathItem = isCalculatePolyline(id); - if (mSelectedCalculatePathItem == null) { + Logger.i( TAG, "polyline id = " + id ); + mSelectedCalculatePathItem = isCalculatePolyline( id ); + if ( mSelectedCalculatePathItem == null ) { return false; } mSelectedPathId = mSelectedCalculatePathItem.getId(); - if (mCalculatePathItems != null) { - for (CalculatePathItem item : mCalculatePathItems) { - final RouteOverLayWrapper wrapper = item.getOverLazWrapper(false); - if (wrapper == null) { + if ( mCalculatePathItems != null ) { + for ( CalculatePathItem item : mCalculatePathItems ) { + final RouteOverLayWrapper wrapper = item.getOverLazWrapper( false ); + if ( wrapper == null ) { continue; } wrapper.setTransparency( - item == mSelectedCalculatePathItem - ? AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED - : AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED + item == mSelectedCalculatePathItem + ? AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED + : AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED ); } } return true; } - private CalculatePathItem isCalculatePolyline(String id) { + private CalculatePathItem isCalculatePolyline( String id ) { CalculatePathItem result = null; - if (mCalculatePathItems == null || mCalculatePathItems.isEmpty()) { + if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) { return result; } - for (CalculatePathItem calculatePathItem : mCalculatePathItems) { - if (calculatePathItem == null) { + for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) { + if ( calculatePathItem == null ) { continue; } - final RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper(false); - if (wrapper == null) { + final RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( false ); + if ( wrapper == null ) { continue; } - if (wrapper.getTrafficColorfulPolyline() == null) { + if ( wrapper.getTrafficColorfulPolyline() == null ) { continue; } - if (TextUtils.equals(wrapper.getTrafficColorfulPolyline().getId(), id)) { + if ( TextUtils.equals( wrapper.getTrafficColorfulPolyline().getId(), id ) ) { result = calculatePathItem; } } @@ -266,61 +294,61 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction { /** * 车辆拐弯时绘制转向箭头 */ - public void handleNaviInfoUpdate(NaviInfo naviInfo) { - if (mSelectedCalculatePathItem != null) { - RouteOverLayWrapper wrapper = mSelectedCalculatePathItem.getOverLazWrapper(false); - if (wrapper != null) { - wrapper.drawArrow(naviInfo); + public void handleNaviInfoUpdate( NaviInfo naviInfo ) { + if ( mSelectedCalculatePathItem != null ) { + RouteOverLayWrapper wrapper = mSelectedCalculatePathItem.getOverLazWrapper( false ); + if ( wrapper != null ) { + wrapper.drawArrow( naviInfo ); } } } - public void handlePassedLocation(AMapNaviLocation location) { - if (mSelectedCalculatePathItem != null) { - RouteOverLayWrapper wrapper = mSelectedCalculatePathItem.getOverLazWrapper(false); - if (wrapper != null) { - wrapper.updatePolyline(location); + public void handlePassedLocation( AMapNaviLocation location ) { + if ( mSelectedCalculatePathItem != null ) { + RouteOverLayWrapper wrapper = mSelectedCalculatePathItem.getOverLazWrapper( false ); + if ( wrapper != null ) { + wrapper.updatePolyline( location ); } } } - public List getCalculateStrategies() { - if (mCalculatePathItems != null && !mCalculatePathItems.isEmpty()) { - for (CalculatePathItem calculatePathItem : mCalculatePathItems) { + public List< MogoCalculatePath > getCalculateStrategies() { + if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) { + for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) { MogoCalculatePath path = new MogoCalculatePath(); - path.setDistance(calculatePathItem.getDistance()); - path.setPathId(calculatePathItem.getId()); - path.setStrategyName(calculatePathItem.getStrategyName()); - path.setTime(calculatePathItem.getTime()); - List coordList = calculatePathItem.getPath().getCoordList(); - ArrayList mogoLatLngs = new ArrayList<>(); - for (NaviLatLng latlng : coordList + path.setDistance( calculatePathItem.getDistance() ); + path.setPathId( calculatePathItem.getId() ); + path.setStrategyName( calculatePathItem.getStrategyName() ); + path.setTime( calculatePathItem.getTime() ); + List< NaviLatLng > coordList = calculatePathItem.getPath().getCoordList(); + ArrayList< MogoLatLng > mogoLatLngs = new ArrayList<>(); + for ( NaviLatLng latlng : coordList ) { MogoLatLng mogoLatLng = - new MogoLatLng(latlng.getLatitude(), latlng.getLongitude()); - mogoLatLngs.add(mogoLatLng); + new MogoLatLng( latlng.getLatitude(), latlng.getLongitude() ); + mogoLatLngs.add( mogoLatLng ); } - path.setCoordList(mogoLatLngs); - path.setTrafficLights(calculatePathItem.getTrafficNumber()); - mPaths.add(path); - final RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper(true); - if (wrapper == null) { + path.setCoordList( mogoLatLngs ); + path.setTrafficLights( calculatePathItem.getTrafficNumber() ); + mPaths.add( path ); + final RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( true ); + if ( wrapper == null ) { continue; } - if (wrapper.getTrafficColorfulPolyline() == null) { + if ( wrapper.getTrafficColorfulPolyline() == null ) { continue; } - path.setTagId(wrapper.getTrafficColorfulPolyline().getId()); + path.setTagId( wrapper.getTrafficColorfulPolyline().getId() ); } } return mPaths; } - public List getCalculatedPathPos() { + public List< MogoLatLng > getCalculatedPathPos() { - if (mSelectedCalculatePathItem != null) { - return mSelectedCalculatePathItem.getCoordList(); + if ( mSelectedCalculatePathItem != null ) { + return mSelectedCalculatePathItem.getCoordList(); } //if (mPaths != null && !mPaths.isEmpty()) { // return mPaths.get(0).getCoordList(); @@ -329,21 +357,21 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction { } @Override - public void onItemClicked(String tagId) { - handleClickedPolyline(tagId); - mAMapNavi.selectRouteId(getSelectedPathId()); + public void onItemClicked( String tagId ) { + handleClickedPolyline( tagId ); + mAMapNavi.selectRouteId( getSelectedPathId() ); } public OnCalculatePathItemClickInteraction getItemClickInteraction() { return this; } - public void setLineClickInteraction(OnCalculatePathItemClickInteraction lineClickInteraction) { + public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) { mLineClickInteraction = lineClickInteraction; } - public void setCalculatePathDisplayBounds(Rect bounds) { - if (bounds != null) { + public void setCalculatePathDisplayBounds( Rect bounds ) { + if ( bounds != null ) { mBoundRect = bounds; } } diff --git a/libraries/map-amap/src/main/res/drawable-ldpi/ic_endpoint.png b/libraries/map-amap/src/main/res/drawable-ldpi/ic_endpoint.png new file mode 100755 index 0000000000000000000000000000000000000000..3dc2e6361ceab7f022fefb0946ab737e95a51c66 GIT binary patch literal 482 zcmV<80UiE{P)Px$oJmAMR5%f>RIy3}K@gqUBo;xCKvd95At)(rB0>_yRH9f~3#RrDEc^rO2-cRO zSSgYO#55^INnsU15e}Oa#@xE^yg8Or<01~+?J@h_+nJr2WBSI5*N3ZG)0QS(V$#!q zXyPstH<;nHM9K7ojO_Y(% zVXGl}i6n2<3)LoYflv_1px+V^Hb-tu%+vbh9L=OZbsu^joju*t>GK_F6LLuQR3cSC zWJx%JbizooBWc>ptWP)Px%&PhZ;R7efQmpy0{Q4q&x-Y!On*Ju`)f20=0QDb$!?#1vYH2y&6Yso}Ko0}Xfkod0@z_x9~u&3z;pcz5sS?aXiA z*UTK#0%TZgH8ypppLB45G;NcXCDPI$TqGv6X<{|Hx9`a0Fmv#CEd7(yhlutR?yjtS zs+4>y5g<(u08HK{Hvz7I;r4+=eG~)N^n(^-eB1*=qD4;vZv0B z?>PFvWsm@Ct$F9p1_c|JVg))~0O?T!oGZbkKaL^*-Md_>c+rO{dkF zI-$N&v}<)Y4M^Lvs*Ac-bcUv-`5*N5dx^%s&d^h7<-m2W^q}~DF9zo$UTwzM)1Xqh z9}Sq_yVvy4$?iVNc4SO-qF?;|jjqp3(UUKQ#26IH^A1IO9)fXt%f<3L`yeT1I4TxAEcRj{6ICFpLD_+Pv