use of com.amap.api.services.core.LatLonPoint in project KL2 by jweihao.
the class DataConversionUtils method changeToPoiItem.
public static PoiItem changeToPoiItem(AMapLocation data) {
if (null != data) {
try {
String title = data.getDescription();
if (TextUtils.isEmpty(title)) {
title = data.getPoiName();
}
if (TextUtils.isEmpty(title)) {
title = data.getStreet();
}
if (TextUtils.isEmpty(title)) {
title = "[位置]";
}
PoiItem poiItem = new PoiItem(data.getBuildingId(), new LatLonPoint(data.getLatitude(), data.getLongitude()), title, data.getAddress());
poiItem.setAdCode(data.getAdCode());
poiItem.setAdName(data.getDistrict());
poiItem.setBusinessArea(data.getStreet());
poiItem.setCityCode(data.getCityCode());
poiItem.setCityName(data.getCity());
poiItem.setProvinceName(data.getProvince());
return poiItem;
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
return null;
}
use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.
the class BusLineOverlay method addToMap.
/**
* 添加公交线路到地图中。
*
* @since V2.1.0
*/
public void addToMap() {
try {
List<LatLonPoint> pointList = mBusLineItem.getDirectionsCoordinates();
List<LatLng> listPolyline = AMapServicesUtil.convertArrList(pointList);
mBusLinePolyline = mAMap.addPolyline(new PolylineOptions().addAll(listPolyline).color(getBusColor()).width(getBuslineWidth()));
if (mBusStations.size() < 1) {
return;
}
for (int i = 1; i < mBusStations.size() - 1; i++) {
Marker marker = mAMap.addMarker(getMarkerOptions(i));
mBusStationMarks.add(marker);
}
Marker markerStart = mAMap.addMarker(getMarkerOptions(0));
mBusStationMarks.add(markerStart);
Marker markerEnd = mAMap.addMarker(getMarkerOptions(mBusStations.size() - 1));
mBusStationMarks.add(markerEnd);
} catch (Throwable e) {
e.printStackTrace();
}
}
use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.
the class BusLineOverlay method zoomToSpan.
/**
* 移动镜头到当前的视角。
*
* @since V2.1.0
*/
public void zoomToSpan() {
if (mAMap == null)
return;
try {
List<LatLonPoint> coordin = mBusLineItem.getDirectionsCoordinates();
if (coordin != null && coordin.size() > 0) {
LatLngBounds bounds = getLatLngBounds(coordin);
mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 5));
}
} catch (Throwable e) {
e.printStackTrace();
}
}
use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.
the class BusRouteOverlay method checkBusLineToNextWalk.
/**
* 检查bus最后一步和下一各step的步行起点是否一致
*
* @param busStep
* @param busStep1
*/
private void checkBusLineToNextWalk(BusStep busStep, BusStep busStep1) {
LatLonPoint busLastPoint = getLastBuslinePoint(busStep);
LatLonPoint walkFirstPoint = getFirstWalkPoint(busStep1);
if (!busLastPoint.equals(walkFirstPoint)) {
addWalkPolyLineByLatLonPoints(busLastPoint, walkFirstPoint);
}
}
use of com.amap.api.services.core.LatLonPoint in project LivingInCampus by DulCoder.
the class BusRouteOverlay method checkBusLineToNextRailway.
private void checkBusLineToNextRailway(BusStep busStep, BusStep busStep1) {
LatLonPoint busLastPoint = getLastBuslinePoint(busStep);
LatLonPoint railwayFirstPoint = busStep1.getRailway().getDeparturestop().getLocation();
if (!busLastPoint.equals(railwayFirstPoint)) {
addWalkPolyLineByLatLonPoints(busLastPoint, railwayFirstPoint);
}
}
Aggregations