本文整理汇总了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;
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}