use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.
the class BusRouteOverlay method checkRailwayToNextTaxi.
private void checkRailwayToNextTaxi(BusStep busStep, BusStep busStep1) {
LatLonPoint railwayLastPoint = busStep.getRailway().getArrivalstop().getLocation();
LatLonPoint taxiFirstPoint = busStep1.getTaxi().getOrigin();
if (!railwayLastPoint.equals(taxiFirstPoint)) {
addWalkPolyLineByLatLonPoints(railwayLastPoint, taxiFirstPoint);
}
}
use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.
the class DrivingRouteOverlay method addToMap.
/**
* 添加驾车路线添加到地图上显示。
*/
public void addToMap() {
initPolylineOptions();
try {
if (mAMap == null) {
return;
}
if (mWidth == 0 || drivePath == null) {
return;
}
mLatLngOfPath = new ArrayList<>();
tmcs = new ArrayList<>();
List<DriveStep> drivePaths = drivePath.getSteps();
mPolylineOptions.add(startPoint);
for (DriveStep step : drivePaths) {
List<LatLonPoint> latLonPoints = step.getPolyline();
List<TMC> tmcList = step.getTMCs();
tmcs.addAll(tmcList);
addDrivingStationMarkers(step, convertToLatLng(latLonPoints.get(0)));
for (LatLonPoint latlonpoint : latLonPoints) {
mPolylineOptions.add(convertToLatLng(latlonpoint));
mLatLngOfPath.add(convertToLatLng(latlonpoint));
}
}
mPolylineOptions.add(endPoint);
if (startMarker != null) {
startMarker.remove();
startMarker = null;
}
if (endMarker != null) {
endMarker.remove();
endMarker = null;
}
addStartAndEndMarker();
addThroughPointMarker();
if (isColorFulLine && tmcs.size() > 0) {
colorWayUpdate(tmcs);
showColorPolyline();
} else {
showPolyline();
}
} catch (Throwable e) {
e.printStackTrace();
}
}
use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.
the class DrivingRouteOverlay method colorWayUpdate.
/**
* 根据不同的路段拥堵情况展示不同的颜色
*
* @param tmcSection
*/
private void colorWayUpdate(List<TMC> tmcSection) {
if (mAMap == null) {
return;
}
if (tmcSection == null || tmcSection.size() <= 0) {
return;
}
TMC segmentTrafficStatus;
mPolylineOptionsColor = null;
mPolylineOptionsColor = new PolylineOptions();
mPolylineOptionsColor.width(getRouteWidth());
List<Integer> colorList = new ArrayList<Integer>();
mPolylineOptionsColor.add(startPoint);
mPolylineOptionsColor.add(AMapUtil.convertToLatLng(tmcSection.get(0).getPolyline().get(0)));
colorList.add(getDriveColor());
for (int i = 0; i < tmcSection.size(); i++) {
segmentTrafficStatus = tmcSection.get(i);
int color = getColor(segmentTrafficStatus.getStatus());
List<LatLonPoint> mPolyline = segmentTrafficStatus.getPolyline();
for (int j = 1; j < mPolyline.size(); j++) {
mPolylineOptionsColor.add(AMapUtil.convertToLatLng(mPolyline.get(j)));
colorList.add(color);
}
}
mPolylineOptionsColor.add(endPoint);
colorList.add(getDriveColor());
mPolylineOptionsColor.colorValues(colorList);
}
use of com.amap.api.services.core.LatLonPoint in project ride-read-android by Ride-Read.
the class MapFragment method onPoiSearched.
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
if (null == poiResult)
return;
List<PoiItem> poiList = poiResult.getPois();
if (!ListUtils.isEmpty(poiList)) {
PoiItem firstResult = poiList.get(0);
LatLonPoint resultPoint = firstResult.getLatLonPoint();
LatLng resultLatLng = new LatLng(resultPoint.getLatitude(), resultPoint.getLongitude());
mAMap.moveCamera(CameraUpdateFactory.changeLatLng(resultLatLng));
ToastUtils.show("搜索结果为:" + firstResult.getAdName());
} else {
List<SuggestionCity> suggestionCitys = poiResult.getSearchSuggestionCitys();
if (!ListUtils.isEmpty(suggestionCitys)) {
ToastUtils.show("搜索失败,建议搜索填写:" + suggestionCitys.get(0).getCityName());
}
}
}
Aggregations