Java Code Examples for com.google.android.gms.maps.model.Polyline#setPattern()
The following examples show how to use
com.google.android.gms.maps.model.Polyline#setPattern() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GglMapAiLineManager.java From FimiX8-RE with MIT License | 5 votes |
public Polyline getPolyline(int index, Polyline pl, int color) { PolylineOptions polylineOptions = new PolylineOptions(); polylineOptions.addAll(pl.getPoints()); polylineOptions.color(this.context.getResources().getColor(color)).zIndex(3.0f); polylineOptions.width(4.0f); Polyline line = this.googleMap.addPolyline(polylineOptions); line.setPattern(PATTERN_DASHED); return line; }
Example 2
Source File: GglMapAiLineManager.java From FimiX8-RE with MIT License | 5 votes |
public void drawPointLine(LatLng latLngDevice) { if (this.gglMapLocationManager != null && this.gglMapLocationManager.getDevLocation() != null) { Polyline polyline; if (this.polylineList != null) { for (Polyline polyline2 : this.polylineList) { polyline2.remove(); } this.polylineList.clear(); } for (int i = 0; i < this.mMarkerList.size(); i++) { PolylineOptions polylineOptions = new PolylineOptions(); if (i == 0) { polylineOptions.add(latLngDevice); polylineOptions.add(((Marker) this.mMarkerList.get(i)).getPosition()); } else { polylineOptions.add(((Marker) this.mMarkerList.get(i - 1)).getPosition()); polylineOptions.add(((Marker) this.mMarkerList.get(i)).getPosition()); } polylineOptions.color(this.context.getResources().getColor(this.lineDefaultColor)).zIndex(3.0f); polylineOptions.width(4.0f); polyline2 = this.googleMap.addPolyline(polylineOptions); polyline2.setPattern(PATTERN_DASHED); try { this.polylineList.add(polyline2); } catch (Exception e) { } } } }
Example 3
Source File: PolyActivity.java From android-samples with Apache License 2.0 | 5 votes |
/** * Listens for clicks on a polyline. * @param polyline The polyline object that the user has clicked. */ @Override public void onPolylineClick(Polyline polyline) { // Flip from solid stroke to dotted stroke pattern. if ((polyline.getPattern() == null) || (!polyline.getPattern().contains(DOT))) { polyline.setPattern(PATTERN_POLYLINE_DOTTED); } else { // The default pattern is a solid stroke. polyline.setPattern(null); } Toast.makeText(this, "Route type " + polyline.getTag().toString(), Toast.LENGTH_SHORT).show(); }