Удалить полилинию за маркером текущего местоположения Как Uber android [дубликат]

Хорошая цель с самого начала - основанная на характере вашего сайта, я нашел много ресурсов по этому поводу в Googling - вы, конечно, не первый в этом разбираетесь.

Предполагается, что у мистического PHP6 все это выпрямилось, правда?

Вы можете в значительной степени установить utf-8 в качестве глобальной кодировки по умолчанию для mysql на уровне сервера, и она по умолчанию будет правильно соответствовать более гранулированных уровней.

6
задан dvrm 11 June 2013 в 08:01
поделиться

2 ответа

Единственный путь с версии 3.1.36:

List<LatLng> points = polyline.getPoints();
points.add(newPoint);
polyline.setPoints(points);

. Надеемся, что API будет расширен в более поздних версиях.

12
ответ дан MaciejGórski 25 August 2018 в 22:05
поделиться

* Я уже работал над обновлением пути полилинии без удаления полилинии. Мы можем это сделать, изменив точки этой полилинии. Проверить код ниже.

Это логика установки новых точек на полилинию.

/*Here the routes contain the points(latitude and longitude)*/
for (int i = 0; i < routes.size(); i++) {
            Route route = routes.get(i);
            if(polyline_path != null){
                polyline_path.setPoints(route.points);
            }
        }

Подробное объяснение:

private GoogleMap map_object;
private Marker marker_driver;
private Marker marker_drop_off;
private Polyline polyline_path;
private PolylineOptions polylineOptions_path;

...
...
...

/*HelperDirectionFinder is a class that I create to call google API and I used this 
  class to get directions routes*/

/*I have created Service, and I'm calling this lines below after 5 sec. to get the 
  updated routes from google API.*/

HelperDirectionFinder directionFinder = new HelperDirectionFinder(
            JobEndScreen.this, source, destinations);
    try {
        directionFinder.showDirection();
    } catch (UnsupportedEncodingException e) {
        HelperProgressDialog.closeDialog();
    }

...
...
...

@Override
public void onDirectionFinderStart() {
    if(polylineOptions_path == null){
        HelperProgressDialog.showDialog(getActivity(), "", getString(R.string.text_loading));
    }
}


/*This interface method is called after getting routes from google API.*/
/*Here the routes contains the list of path or routes returned by Google Api*/
@Override
public void onDirectionFinderSuccess(List<Route> routes) {
    HelperProgressDialog.closeDialog();


    /*When polylineOptions_path is null it means the polyline is not drawn.*/
    /*If the polylineOptions_path is not null it means the polyline is drawn on map*/
    if(polylineOptions_path == null){
        for (Route route : routes) {
            polylineOptions_path = new PolylineOptions().
                    geodesic(true).
                    color(ContextCompat.getColor(getActivity(), R.color.color_bg_gray_dark)).
                    width(10);

            for (int i = 0; i < route.points.size(); i++)
                polylineOptions_path.add(route.points.get(i));

            polyline_path = map_object.addPolyline(polylineOptions_path);
        }
    }
    else {
        for (int i = 0; i < routes.size(); i++) {
            Route route = routes.get(i);
            if(polyline_path != null){
                polyline_path.setPoints(route.points);
            }
        }
    }
}
0
ответ дан Hantash Nadeem 25 August 2018 в 22:05
поделиться
Другие вопросы по тегам:

Похожие вопросы: