Search in sources :

Example 16 with LatLonPoint

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;
}
Also used : PoiItem(com.amap.api.services.core.PoiItem) LatLonPoint(com.amap.api.services.core.LatLonPoint)

Example 17 with LatLonPoint

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();
    }
}
Also used : LatLng(com.amap.api.maps.model.LatLng) Marker(com.amap.api.maps.model.Marker) LatLonPoint(com.amap.api.services.core.LatLonPoint) LatLonPoint(com.amap.api.services.core.LatLonPoint) PolylineOptions(com.amap.api.maps.model.PolylineOptions)

Example 18 with LatLonPoint

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();
    }
}
Also used : LatLngBounds(com.amap.api.maps.model.LatLngBounds) LatLonPoint(com.amap.api.services.core.LatLonPoint)

Example 19 with LatLonPoint

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);
    }
}
Also used : LatLonPoint(com.amap.api.services.core.LatLonPoint)

Example 20 with LatLonPoint

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);
    }
}
Also used : LatLonPoint(com.amap.api.services.core.LatLonPoint)

Aggregations

LatLonPoint (com.amap.api.services.core.LatLonPoint)24 LatLng (com.amap.api.maps.model.LatLng)5 PoiItem (com.amap.api.services.core.PoiItem)5 View (android.view.View)4 ArrayList (java.util.ArrayList)4 Intent (android.content.Intent)3 GeocodeSearch (com.amap.api.services.geocoder.GeocodeSearch)3 RecyclerView (android.support.v7.widget.RecyclerView)2 ImageView (android.widget.ImageView)2 PolylineOptions (com.amap.api.maps.model.PolylineOptions)2 LatLng (com.amap.api.maps2d.model.LatLng)2 GeocodeResult (com.amap.api.services.geocoder.GeocodeResult)2 RegeocodeResult (com.amap.api.services.geocoder.RegeocodeResult)2 PoiResult (com.amap.api.services.poisearch.PoiResult)2 PoiSearch (com.amap.api.services.poisearch.PoiSearch)2 TMC (com.amap.api.services.route.TMC)2 OnItemClickLisenter (com.jweihao.jdemo.utils.OnItemClickLisenter)2 Bundle (android.os.Bundle)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1