Java Code Examples for com.google.android.gms.maps.model.PolylineOptions#zIndex()
The following examples show how to use
com.google.android.gms.maps.model.PolylineOptions#zIndex() .
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: DistanceAction.java From Companion-For-PUBG-Android with MIT License | 6 votes |
/** * If an origin and destination exist this will draw a line between them and * render the time it takes to reach the {@link DistanceAction#destination} */ private void addPolyline() { if (this.origin == null || this.destination == null) { return; } releasePolyline(); this.destination.marker.setTitle(getTitleForDistance(getDistance())); this.destination.marker.setSnippet(this.snippet); this.destination.marker.showInfoWindow(); final PolylineOptions polylineOptions = new PolylineOptions(); polylineOptions.add(this.origin.latLng); polylineOptions.add(this.destination.latLng); polylineOptions.width(5); polylineOptions.color(this.colorAccent); polylineOptions.zIndex(1000); this.polyline = this.mapController.addPolyline(polylineOptions); }
Example 2
Source File: GoogleMapShapeConverter.java From geopackage-android-map with MIT License | 6 votes |
/** * Convert a {@link LineString} to a {@link PolylineOptions} * * @param lineString line string * @return polyline options */ public PolylineOptions toPolyline(LineString lineString) { PolylineOptions polylineOptions = new PolylineOptions(); Double z = null; // Try to simplify the number of points in the line string List<Point> points = simplifyPoints(lineString.getPoints()); for (Point point : points) { LatLng latLng = toLatLng(point); polylineOptions.add(latLng); if (point.hasZ()) { z = (z == null) ? point.getZ() : Math.max(z, point.getZ()); } } if (lineString.hasZ() && z != null) { polylineOptions.zIndex(z.floatValue()); } return polylineOptions; }
Example 3
Source File: GoogleMapShapeConverter.java From geopackage-android-map with MIT License | 6 votes |
/** * Add a list of Polylines to the map * * @param map google map * @param polylines multi polyline options * @return multi polyline */ public static MultiPolyline addPolylinesToMap(GoogleMap map, MultiPolylineOptions polylines) { MultiPolyline multiPolyline = new MultiPolyline(); for (PolylineOptions polylineOption : polylines.getPolylineOptions()) { if (polylines.getOptions() != null) { polylineOption.color(polylines.getOptions().getColor()); polylineOption.geodesic(polylines.getOptions().isGeodesic()); polylineOption.visible(polylines.getOptions().isVisible()); polylineOption.zIndex(polylines.getOptions().getZIndex()); polylineOption.width(polylines.getOptions().getWidth()); } Polyline polyline = addPolylineToMap(map, polylineOption); multiPolyline.add(polyline); } return multiPolyline; }
Example 4
Source File: GoogleMapShapeConverter.java From geopackage-android-map with MIT License | 6 votes |
/** * Add a Polyline to the map as markers * * @param map google map * @param polylineOptions polyline options * @param polylineMarkerOptions polyline marker options * @param globalPolylineOptions global polyline options * @return polyline markers */ public PolylineMarkers addPolylineToMapAsMarkers(GoogleMap map, PolylineOptions polylineOptions, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { PolylineMarkers polylineMarkers = new PolylineMarkers(this); if (globalPolylineOptions != null) { polylineOptions.color(globalPolylineOptions.getColor()); polylineOptions.geodesic(globalPolylineOptions.isGeodesic()); polylineOptions.visible(globalPolylineOptions.isVisible()); polylineOptions.zIndex(globalPolylineOptions.getZIndex()); polylineOptions.width(globalPolylineOptions.getWidth()); } Polyline polyline = addPolylineToMap(map, polylineOptions); polylineMarkers.setPolyline(polyline); List<Marker> markers = addPointsToMapAsMarkers(map, polylineOptions.getPoints(), polylineMarkerOptions, false); polylineMarkers.setMarkers(markers); return polylineMarkers; }
Example 5
Source File: PlaceMapFragment.java From RxGpsService with Apache License 2.0 | 6 votes |
private Polyline drawPath(List<LatLong> latLongs, int color, float zIndex, Polyline polyline) { if (googleMap != null && latLongs != null && !latLongs.isEmpty()) { PolylineOptions polyLineOptions = new PolylineOptions(); polyLineOptions.width(getResources().getDimension(R.dimen._2dp)); polyLineOptions.color(color); polyLineOptions.zIndex(zIndex); for (LatLong latLong : latLongs) { polyLineOptions.add(new LatLng(latLong.latitude(), latLong.longitude())); } if (polyline != null) polyline.remove(); return googleMap.addPolyline(polyLineOptions); } return null; }
Example 6
Source File: PlaceMapFragment.java From RxGpsService with Apache License 2.0 | 5 votes |
private void drawSegmentPathUser(LatLng latLng) { PolylineOptions polyLineOptions = new PolylineOptions(); polyLineOptions.width(getResources().getDimension(R.dimen._2dp)); polyLineOptions.color(ContextCompat.getColor(getContext(), R.color.blue)); polyLineOptions.zIndex(2f); if (polylineUserLastPath != null) { for (LatLng latLngOld : polylineUserLastPath.getPoints()) polyLineOptions.add(latLngOld); } polyLineOptions.add(latLng); polylineUserLastPath = removePath(polylineUserLastPath); polylineUserLastPath = googleMap.addPolyline(polyLineOptions); }
Example 7
Source File: GeoJsonLineStringStyle.java From android-maps-utils with Apache License 2.0 | 5 votes |
/** * Gets a new PolylineOptions object containing styles for the GeoJsonLineString * * @return new PolylineOptions object */ public PolylineOptions toPolylineOptions() { PolylineOptions polylineOptions = new PolylineOptions(); polylineOptions.color(mPolylineOptions.getColor()); polylineOptions.clickable(mPolylineOptions.isClickable()); polylineOptions.geodesic(mPolylineOptions.isGeodesic()); polylineOptions.visible(mPolylineOptions.isVisible()); polylineOptions.width(mPolylineOptions.getWidth()); polylineOptions.zIndex(mPolylineOptions.getZIndex()); polylineOptions.pattern(getPattern()); return polylineOptions; }