Java Code Examples for com.amap.api.maps.model.LatLng#equals()
The following examples show how to use
com.amap.api.maps.model.LatLng#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PointsUtil.java From SmoothMove with MIT License | 6 votes |
/** * 如果在垂足在端点,直接返回端点的下标 * * @param points * @param point * @return */ public static Pair<Integer, LatLng> calShortestDistancePoint(List<LatLng> points, LatLng point) { List<DPoint> dPoints = new ArrayList<DPoint>(); int index = 0; for (LatLng latLng : points) { dPoints.add(new DPoint(latLng.latitude, latLng.longitude)); if (latLng.equals(point)) { return new Pair(index, point); } index++; } DPoint dPoint = new DPoint(point.latitude, point.longitude); Pair<Integer, DPoint> pair = calShortestDistancePoint(dPoints, dPoint); if (pair != null) { return new Pair(pair.first, new LatLng(pair.second.x, pair.second.y)); } return null; }
Example 2
Source File: GaodeMapLocationManager.java From FimiX8-RE with MIT License | 5 votes |
private void startChangeLocation(LatLng latLng) { if (this.locationMarker != null) { LatLng curLatlng = this.locationMarker.getPosition(); if (curLatlng == null || !curLatlng.equals(latLng)) { this.locationMarker.setPosition(latLng); } } }
Example 3
Source File: CustomLocationModeActivity.java From TraceByAmap with MIT License | 5 votes |
/** * 修改自定义定位小蓝点的位置 * @param latLng */ private void startChangeLocation(LatLng latLng) { if(locationMarker != null) { LatLng curLatlng = locationMarker.getPosition(); if(curLatlng == null || !curLatlng.equals(latLng)) { locationMarker.setPosition(latLng); } } }
Example 4
Source File: BusRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
/** * @param busStep */ private void addWalkSteps(BusStep busStep) { RouteBusWalkItem routeBusWalkItem = busStep.getWalk(); List<WalkStep> walkSteps = routeBusWalkItem.getSteps(); for (int j = 0; j < walkSteps.size(); j++) { WalkStep walkStep = walkSteps.get(j); if (j == 0) { LatLng latLng = AMapUtil.convertToLatLng(walkStep .getPolyline().get(0)); String road = walkStep.getRoad();// 道路名字 String instruction = getWalkSnippet(walkSteps);// 步行导航信息 addWalkStationMarkers(latLng, road, instruction); } List<LatLng> listWalkPolyline = AMapUtil .convertArrList(walkStep.getPolyline()); this.latLng = listWalkPolyline.get(listWalkPolyline.size() - 1); addWalkPolyline(listWalkPolyline); // 假如步行前一段的终点和下的起点有断开,断画直线连接起来,避免断线问题 if (j < walkSteps.size() - 1) { LatLng lastLatLng = listWalkPolyline.get(listWalkPolyline .size() - 1); LatLng firstlatLatLng = AMapUtil .convertToLatLng(walkSteps.get(j + 1).getPolyline() .get(0)); if (!(lastLatLng.equals(firstlatLatLng))) { addWalkPolyline(lastLatLng, firstlatLatLng); } } } }
Example 5
Source File: BusRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
/** * * checkBusToNextBusNoWalk 和这个类似 * * @param busStep * @param busStep1 */ private void checkBusEndToNextBusStart(BusStep busStep, BusStep busStep1) { LatLonPoint busLastPoint = getLastBuslinePoint(busStep); LatLng endbusLatLng = AMapUtil.convertToLatLng(busLastPoint); LatLonPoint busFirstPoint = getFirstBuslinePoint(busStep1); LatLng startbusLatLng = AMapUtil.convertToLatLng(busFirstPoint); if (!endbusLatLng.equals(startbusLatLng)) { drawLineArrow(endbusLatLng, startbusLatLng);// } }
Example 6
Source File: BusRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
/** * @param busStep */ private void addWalkSteps(BusStep busStep) { RouteBusWalkItem routeBusWalkItem = busStep.getWalk(); List<WalkStep> walkSteps = routeBusWalkItem.getSteps(); for (int j = 0; j < walkSteps.size(); j++) { WalkStep walkStep = walkSteps.get(j); if (j == 0) { LatLng latLng = AMapUtil.convertToLatLng(walkStep .getPolyline().get(0)); String road = walkStep.getRoad();// 道路名字 String instruction = getWalkSnippet(walkSteps);// 步行导航信息 addWalkStationMarkers(latLng, road, instruction); } List<LatLng> listWalkPolyline = AMapUtil .convertArrList(walkStep.getPolyline()); this.latLng = listWalkPolyline.get(listWalkPolyline.size() - 1); addWalkPolyline(listWalkPolyline); // 假如步行前一段的终点和下的起点有断开,断画直线连接起来,避免断线问题 if (j < walkSteps.size() - 1) { LatLng lastLatLng = listWalkPolyline.get(listWalkPolyline .size() - 1); LatLng firstlatLatLng = AMapUtil.convertToLatLng(walkSteps.get(j + 1).getPolyline().get(0)); if (!(lastLatLng.equals(firstlatLatLng))) { addWalkPolyline(lastLatLng, firstlatLatLng); } } } }
Example 7
Source File: BusRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
/** * * checkBusToNextBusNoWalk 和这个类似 * * @param busStep * @param busStep1 */ private void checkBusEndToNextBusStart(BusStep busStep, BusStep busStep1) { LatLonPoint busLastPoint = getLastBuslinePoint(busStep); LatLng endbusLatLng = AMapUtil.convertToLatLng(busLastPoint); LatLonPoint busFirstPoint = getFirstBuslinePoint(busStep1); LatLng startbusLatLng = AMapUtil.convertToLatLng(busFirstPoint); if (!endbusLatLng.equals(startbusLatLng)) { drawLineArrow(endbusLatLng, startbusLatLng);// } }
Example 8
Source File: BusRouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
/** * @param busStep */ private void addWalkSteps(BusStep busStep) { RouteBusWalkItem routeBusWalkItem = busStep.getWalk(); List<WalkStep> walkSteps = routeBusWalkItem.getSteps(); for (int j = 0; j < walkSteps.size(); j++) { WalkStep walkStep = walkSteps.get(j); if (j == 0) { LatLng latLng = AMapUtil.convertToLatLng(walkStep .getPolyline().get(0)); String road = walkStep.getRoad();// 道路名字 String instruction = getWalkSnippet(walkSteps);// 步行导航信息 addWalkStationMarkers(latLng, road, instruction); } List<LatLng> listWalkPolyline = AMapUtil .convertArrList(walkStep.getPolyline()); this.latLng = listWalkPolyline.get(listWalkPolyline.size() - 1); addWalkPolyline(listWalkPolyline); // 假如步行前一段的终点和下的起点有断开,断画直线连接起来,避免断线问题 if (j < walkSteps.size() - 1) { LatLng lastLatLng = listWalkPolyline.get(listWalkPolyline .size() - 1); LatLng firstlatLatLng = AMapUtil.convertToLatLng(walkSteps.get(j + 1).getPolyline().get(0)); if (!(lastLatLng.equals(firstlatLatLng))) { addWalkPolyline(lastLatLng, firstlatLatLng); } } } }
Example 9
Source File: BusRouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
/** * * checkBusToNextBusNoWalk 和这个类似 * * @param busStep * @param busStep1 */ private void checkBusEndToNextBusStart(BusStep busStep, BusStep busStep1) { LatLonPoint busLastPoint = getLastBuslinePoint(busStep); LatLng endbusLatLng = AMapUtil.convertToLatLng(busLastPoint); LatLonPoint busFirstPoint = getFirstBuslinePoint(busStep1); LatLng startbusLatLng = AMapUtil.convertToLatLng(busFirstPoint); if (!endbusLatLng.equals(startbusLatLng)) { drawLineArrow(endbusLatLng, startbusLatLng);// } }