当前位置: 首页>>代码示例>>Java>>正文


Java PolyUtil.isLocationOnPath方法代码示例

本文整理汇总了Java中com.google.maps.android.PolyUtil.isLocationOnPath方法的典型用法代码示例。如果您正苦于以下问题:Java PolyUtil.isLocationOnPath方法的具体用法?Java PolyUtil.isLocationOnPath怎么用?Java PolyUtil.isLocationOnPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.maps.android.PolyUtil的用法示例。


在下文中一共展示了PolyUtil.isLocationOnPath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCurrentPoint

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
public Step getCurrentPoint(Location location) {
    int size = itinerary.steps.size();
    Step first = itinerary.steps.get(0);
    Step last = itinerary.steps.get(size - 1);

    for (int i = size - 1; i >= current_id; i--) {
        Step point = itinerary.steps.get(i);
        if (PolyUtil.isLocationOnPath(new LatLng(location.getLatitude(), location.getLongitude()), point.polyline, false, 18)) {
            Log.i(TAG, "Proche prolyline : " + i);
            current_id = i;
            return point;
        }
    }

    boolean onTheLine = PolyUtil.isLocationOnPath(new LatLng(location.getLatitude(), location.getLongitude()), PolyUtil.decode(itinerary.polyline), false, 35);

    Calendar before = Calendar.getInstance();
    before.add(Calendar.SECOND,-20);
    if(!onTheLine && location.getAccuracy()<25 && (lastCalcul == null || lastCalcul.before(before))){
        lastCalcul = Calendar.getInstance();
        itineraryHelper.getItinerary(itinerary.name,new LatLng(location.getLatitude(),location.getLongitude()),itinerary.getDest());
    }
    Log.i(TAG, "Sortie de piste");
    return current;
}
 
开发者ID:snigle,项目名称:corsaire,代码行数:26,代码来源:NavigationService.java

示例2: drawMarker

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
/**
 * The function check if users tap a point close 200m to the freeway
 * then drag a markerOptions
 * @param point which is users tap on the map
 */
private void drawMarker(LatLng point) {
    List<LatLng> drawnPoints = globalPoly.getPoints();
    if (PolyUtil.isLocationOnPath(point, drawnPoints, true, 200.0)) {
        if(firstMarker == null){
            firstMarker = mMap.addMarker(new MarkerOptions().position(point).
                    icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)).
                    draggable(true).title("Start"));
            startPoint = firstMarker.getPosition();
        }
        else if(secondMarker == null ){
            secondMarker = mMap.addMarker(new MarkerOptions().position(point).
                    icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)).
                    draggable(true).title("End"));
            endPoint = secondMarker.getPosition();
        }
    }
}
 
开发者ID:Routelandia,项目名称:routelandia-android,代码行数:23,代码来源:MapsActivity.java

示例3: selectClickedRoute

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
public static boolean selectClickedRoute (AllRoutes allRoutes, com.google.android.gms.maps.model.LatLng clickLatLng){
    // return true iff a path was selected
    for (int i = 0; i < allRoutes.getNumRoutes(); i++){
        BikeableRoute route = allRoutes.getAllRoutes().get(i);
        if (PolyUtil.isLocationOnPath(clickLatLng, route.routePolylineOptions.getPoints(), true, 40)){
            allRoutes.selectAndColorRoute(i);
            return true;
        }
    }
    return false;
}
 
开发者ID:nogalavi,项目名称:Bikeable,代码行数:12,代码来源:MapUtils.java

示例4: findClosestTelOFunStations

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
private ArrayList<TelOFunStation> findClosestTelOFunStations (com.google.android.gms.maps.model.LatLng point){
    ArrayList <TelOFunStation> closestStations = new ArrayList<>();
    HashMap <Integer, TelOFunStation> allStations = IriaData.getTelOfanStationsDict();
    PolylineOptions onePointPolyLine = new PolylineOptions();
    onePointPolyLine.add(point);
    for (TelOFunStation station: allStations.values()){
        if (PolyUtil.isLocationOnPath(station.getCoordinates(), onePointPolyLine.getPoints(), true, 500)){
            closestStations.add(station);
        }
    }
    return closestStations;
}
 
开发者ID:nogalavi,项目名称:Bikeable,代码行数:13,代码来源:AllRoutes.java

示例5: isLocationOnPath

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
private static boolean isLocationOnPath(Coord p1, Coord p2, Coord t) {
    List<LatLng> latLngs = Arrays.asList(p1.toLatLng(), p2.toLatLng());

    return PolyUtil.isLocationOnPath(t.toLatLng(), latLngs, false, 15);
}
 
开发者ID:plusCubed,项目名称:velociraptor,代码行数:6,代码来源:LimitCache.java

示例6: checkPointWithPath

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
public boolean checkPointWithPath (LatLng point, PolylineOptions line){
    if (PolyUtil.isLocationOnPath(point, line.getPoints(), true, 30)){
        return true;
    }
    return false;
}
 
开发者ID:nogalavi,项目名称:Bikeable,代码行数:7,代码来源:BikePathCalculator.java

示例7: pointIsOnShape

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @Override
 */
public boolean pointIsOnShape(LatLng latLng, double tolerance) {

    boolean onShape = PolyUtil.isLocationOnPath(latLng, polyline.getPoints(), polyline.isGeodesic(), tolerance);

    return onShape;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:12,代码来源:MapPolylineObservation.java

示例8: isPointOnPolyline

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
/**
 * Is the point on the polyline
 *
 * @param point     point
 * @param polyline  polyline
 * @param geodesic  geodesic check flag
 * @param tolerance distance tolerance
 * @return true if on the line
 */
public static boolean isPointOnPolyline(LatLng point, PolylineOptions polyline, boolean geodesic, double tolerance) {
    return PolyUtil.isLocationOnPath(point, polyline.getPoints(), geodesic, tolerance);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:13,代码来源:MapUtils.java


注:本文中的com.google.maps.android.PolyUtil.isLocationOnPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。