/** * Sets ending point. * * <ul> * <li>If {@code point} is the same as starting point — swap points if ending point is * set, skip otherwise. * <li>Set starting point to MyPosition if it was not set before. * </ul> * * Route starts to build if both points were set. * * @return {@code true} if the point was set. */ @SuppressWarnings("Duplicates") public boolean setEndPoint(MapObject point) { mLogger.d("setEndPoint"); if (MapObject.same(mEndPoint, point)) { if (mStartPoint == null) return setStartFromMyPosition(); mLogger.d("setEndPoint: skip the same end point"); return false; } if (point != null && point.sameAs(mStartPoint)) { if (mEndPoint == null) { mLogger.d("setEndPoint: skip because end point is empty"); return false; } mLogger.d("setEndPoint: swap with starting point"); mStartPoint = mEndPoint; } mEndPoint = point; if (mStartPoint == null) return setStartFromMyPosition(); setPointsInternal(); checkAndBuildRoute(); return true; }