google maps - Visualize progress on GoogleMaps Android -
i'm creating small test application visualise progress on google map using google maps android api. (api: here)
my backend serves me data polylines between 2 given coordinates. android application decodes data , draw polylines on googlemaps view.
i'd visualise route i've done. (so grey out parts/polylines i've driven on. i've tried coloring polylines i've passed calculating closest distance polyline given treshold. seem unable color polyline with:
- setcolor() - polyline
- color() - polylineoptions
there seems no way update existing polyline. if remove markers, polylines, .. , redraw polylines updated values on every location change, laggy.
i wondering if there better/alternative ways visualise progress on map.
private void drawpolyline() { if (polylines == null) polylines = new arraylist<polyline>(); if (mrouteinformation == null) return; log.i("navigationactivity", "drawing polyline"); (int = 0; < mrouteinformation.getrouteguidance().size(); i++) { routepart part = mrouteinformation.getrouteguidance().get(i); if (part != null && part.getroutevisualization() != null) { list<polylineoptions> options = mapsutils.decodepolylines(mrouteinformation.getrouteguidance().get(i).getroutevisualization()); if (options != null && options.size() > 0 && mgooglemap != null) { //add polylines maps. (polylineoptions polylineoptions : options) { if (!isfinishing()) { polylines.add(mgooglemap.addpolyline(polylineoptions)); } } } } } }
Comments
Post a Comment