Java Code Examples for com.google.android.gms.maps.model.PolylineOptions
The following examples show how to use
com.google.android.gms.maps.model.PolylineOptions.
These examples are extracted from open source projects.
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 Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options in transit mode. * * @param context A context. * @param stepList A list of latitude and longitude for the steps. * @param transitWidth Width of the polyline in screen pixels for transit polyline. * @param transitColor Color of the polyline as a 32-bit ARGB color for transit polyline. * @param walkingWidth Width of the polyline in screen pixels for walking polyline. * @param walkingColor Color of the polyline as a 32-bit ARGB color for walking polyline. * @param clickable Is polyline clickable. * @return Options for a polyline. * @since 1.2.0 */ public static ArrayList<PolylineOptions> createTransitPolyline( @NonNull Context context, @Nullable List<Step> stepList, @Dimension(unit = Dimension.DP) int transitWidth, @ColorInt int transitColor, @Dimension(unit = Dimension.DP) int walkingWidth, @ColorInt int walkingColor, boolean clickable) { return createTransitPolyline( context, stepList, transitWidth, transitColor, null, walkingWidth, walkingColor, null, clickable, JointType.DEFAULT, null, null ); }
Example #2
Source Project: FimiX8-RE Author: wladimir-computin File: GglMapAiPoint2PointManager.java License: MIT License | 6 votes |
public void drawPointLine(LatLng latLngDevice) { if (this.pointMarker != null) { LatLng latLng = this.pointMarker.getPosition(); this.latLngs.clear(); this.latLngs.add(latLng); this.latLngs.add(latLngDevice); if (this.polyline == null) { PolylineOptions polylineOptions = new PolylineOptions(); polylineOptions.addAll(this.latLngs); polylineOptions.color(this.context.getResources().getColor(R.color.x8_drone_inface_line)).zIndex(50.0f); polylineOptions.width(4.0f); if (this.polyline != null) { this.polyline.remove(); } this.polyline = this.googleMap.addPolyline(polylineOptions); this.polyline.setPattern(PATTERN_DASHED); } this.polyline.setPoints(this.latLngs); } }
Example #3
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options in transit mode. * * @param context A context. * @param stepList A list of latitude and longitude for the steps. * @param transitWidth Width of the polyline in screen pixels for transit polyline. * @param transitColor Color of the polyline as a 32-bit ARGB color for transit polyline. * @param walkingWidth Width of the polyline in screen pixels for walking polyline. * @param walkingColor Color of the polyline as a 32-bit ARGB color for walking polyline. * @param clickable Is polyline clickable. * @param jointType Joint type for all vertices of the polyline except the start and end vertices. * @return Options for a polyline. * @since 1.2.0 */ public static ArrayList<PolylineOptions> createTransitPolyline( @NonNull Context context, @Nullable List<Step> stepList, @Dimension(unit = Dimension.DP) int transitWidth, @ColorInt int transitColor, @Dimension(unit = Dimension.DP) int walkingWidth, @ColorInt int walkingColor, boolean clickable, int jointType) { return createTransitPolyline( context, stepList, transitWidth, transitColor, null, walkingWidth, walkingColor, null, clickable, jointType, null, null ); }
Example #4
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options in transit mode. * * @param context A context. * @param stepList A list of latitude and longitude for the steps. * @param transitWidth Width of the polyline in screen pixels for transit polyline. * @param transitColor Color of the polyline as a 32-bit ARGB color for transit polyline. * @param walkingWidth Width of the polyline in screen pixels for walking polyline. * @param walkingColor Color of the polyline as a 32-bit ARGB color for walking polyline. * @param clickable Is polyline clickable. * @param startCap Cap at the start vertex of the polyline. * @param endCap Cap at the end vertex of the polyline. * @return Options for a polyline. * @since 1.2.0 */ public static ArrayList<PolylineOptions> createTransitPolyline( @NonNull Context context, @Nullable List<Step> stepList, @Dimension(unit = Dimension.DP) int transitWidth, @ColorInt int transitColor, @Dimension(unit = Dimension.DP) int walkingWidth, @ColorInt int walkingColor, boolean clickable, @Nullable Cap startCap, @Nullable Cap endCap) { return createTransitPolyline( context, stepList, transitWidth, transitColor, null, walkingWidth, walkingColor, null, clickable, JointType.DEFAULT, startCap, endCap ); }
Example #5
Source Project: ridesharing-android Author: hypertrack File: MapUtils.java License: MIT License | 6 votes |
public static GoogleMapConfig.Builder getBuilder(Context context) { int width = context.getResources().getDisplayMetrics().widthPixels; int height = context.getResources().getDisplayMetrics().heightPixels; int mapRouteWidth = context.getResources().getDimensionPixelSize(R.dimen.map_route_width); GoogleMapConfig.TripOptions tripOptions = GoogleMapConfig.newTripOptions() .tripDestinationMarker(new MarkerOptions() .anchor(0.5f, 0.5f) .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_destination_marker))) .tripPassedRoutePolyline(null) .tripComingRoutePolyline(new PolylineOptions() .width(mapRouteWidth) .color(Color.BLACK) .pattern(Collections.<PatternItem>singletonList(new Dash(mapRouteWidth)))); return GoogleMapConfig.newBuilder(context) .tripOptions(tripOptions) .boundingBoxDimensions(width, height / 3); }
Example #6
Source Project: Companion-For-PUBG-Android Author: ZafraniTechLLC File: DistanceAction.java License: 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 #7
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options in transit mode. * * @param context A context. * @param stepList A list of latitude and longitude for the steps. * @param transitWidth Width of the polyline in screen pixels for transit polyline. * @param transitColor Color of the polyline as a 32-bit ARGB color for transit polyline. * @param transitPatternItemList Stroke pattern for the polyline for transit polyline. * @param walkingWidth Width of the polyline in screen pixels for walking polyline. * @param walkingColor Color of the polyline as a 32-bit ARGB color for walking polyline. * @param walkingPatternItemList Stroke pattern for the polyline for walking polyline. * @return Options for a polyline. * @since 1.2.0 */ public static ArrayList<PolylineOptions> createTransitPolyline( @NonNull Context context, @Nullable List<Step> stepList, @Dimension(unit = Dimension.DP) int transitWidth, @Nullable List<PatternItem> transitPatternItemList, @ColorInt int transitColor, @Dimension(unit = Dimension.DP) int walkingWidth, @ColorInt int walkingColor, @Nullable List<PatternItem> walkingPatternItemList) { return createTransitPolyline( context, stepList, transitWidth, transitColor, transitPatternItemList, walkingWidth, walkingColor, walkingPatternItemList, true, JointType.DEFAULT, null, null ); }
Example #8
Source Project: roads-api-samples Author: googlemaps File: MainActivity.java License: Apache License 2.0 | 6 votes |
/** * Handles the GPX button-click event, running the demo snippet {@link #loadGpxData}. */ public void onGpxButtonClick(View view) { try { mCapturedLocations = loadGpxData(Xml.newPullParser(), getResources().openRawResource(R.raw.gpx_data)); findViewById(R.id.snap_to_roads).setEnabled(true); LatLngBounds.Builder builder = new LatLngBounds.Builder(); PolylineOptions polyline = new PolylineOptions(); for (LatLng ll : mCapturedLocations) { com.google.android.gms.maps.model.LatLng mapPoint = new com.google.android.gms.maps.model.LatLng(ll.lat, ll.lng); builder.include(mapPoint); polyline.add(mapPoint); } mMap.addPolyline(polyline.color(Color.RED)); mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0)); } catch (XmlPullParserException | IOException e) { e.printStackTrace(); toastException(e); } }
Example #9
Source Project: roads-api-samples Author: googlemaps File: MainActivity.java License: Apache License 2.0 | 6 votes |
@Override protected void onPostExecute(List<SnappedPoint> snappedPoints) { mSnappedPoints = snappedPoints; mProgressBar.setVisibility(View.INVISIBLE); findViewById(R.id.speed_limits).setEnabled(true); com.google.android.gms.maps.model.LatLng[] mapPoints = new com.google.android.gms.maps.model.LatLng[mSnappedPoints.size()]; int i = 0; LatLngBounds.Builder bounds = new LatLngBounds.Builder(); for (SnappedPoint point : mSnappedPoints) { mapPoints[i] = new com.google.android.gms.maps.model.LatLng(point.location.lat, point.location.lng); bounds.include(mapPoints[i]); i += 1; } mMap.addPolyline(new PolylineOptions().add(mapPoints).color(Color.BLUE)); mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds.build(), 0)); }
Example #10
Source Project: geopackage-android-map Author: ngageoint File: GoogleMapShapeConverter.java License: 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 #11
Source Project: geopackage-android-map Author: ngageoint File: GoogleMapShapeConverter.java License: 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 #12
Source Project: geopackage-android-map Author: ngageoint File: GoogleMapShapeConverter.java License: 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 #13
Source Project: android-maps-utils Author: googlemaps File: DistanceDemoActivity.java License: Apache License 2.0 | 6 votes |
@Override protected void startDemo(boolean isRestore) { mTextView = findViewById(R.id.textView); if (!isRestore) { getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.8256, 151.2395), 10)); } getMap().setOnMarkerDragListener(this); mMarkerA = getMap().addMarker(new MarkerOptions().position(new LatLng(-33.9046, 151.155)).draggable(true)); mMarkerB = getMap().addMarker(new MarkerOptions().position(new LatLng(-33.8291, 151.248)).draggable(true)); mPolyline = getMap().addPolyline(new PolylineOptions().geodesic(true)); Toast.makeText(this, "Drag the markers!", Toast.LENGTH_LONG).show(); showDistance(); }
Example #14
Source Project: mytracks Author: Plonk42 File: TrackPathUtils.java License: Apache License 2.0 | 6 votes |
/** * Add a path. * * @param googleMap the google map * @param paths the existing paths * @param points the path points * @param color the path color * @param append true to append to the last path */ public static void addPath(GoogleMap googleMap, ArrayList<Polyline> paths, ArrayList<LatLng> points, int color, boolean append) { if (points.size() == 0) { return; } if (append && paths.size() != 0) { Polyline lastPolyline = paths.get(paths.size() - 1); ArrayList<LatLng> pathPoints = new ArrayList<LatLng>(); pathPoints.addAll(lastPolyline.getPoints()); pathPoints.addAll(points); lastPolyline.setPoints(pathPoints); } else { PolylineOptions polylineOptions = new PolylineOptions().addAll(points).width(5).color(color); Polyline polyline = googleMap.addPolyline(polylineOptions); paths.add(polyline); } points.clear(); }
Example #15
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options in transit mode. * * @param context A context. * @param stepList A list of latitude and longitude for the steps. * @param transitWidth Width of the polyline in screen pixels for transit polyline. * @param transitColor Color of the polyline as a 32-bit ARGB color for transit polyline. * @param walkingWidth Width of the polyline in screen pixels for walking polyline. * @param walkingColor Color of the polyline as a 32-bit ARGB color for walking polyline. * @return Options for a polyline. * @since 1.0.0 */ public static ArrayList<PolylineOptions> createTransitPolyline( @NonNull Context context, @Nullable List<Step> stepList, @Dimension(unit = Dimension.DP) int transitWidth, @ColorInt int transitColor, @Dimension(unit = Dimension.DP) int walkingWidth, @ColorInt int walkingColor) { return createTransitPolyline( context, stepList, transitWidth, transitColor, null, walkingWidth, walkingColor, null, true, JointType.DEFAULT, null, null ); }
Example #16
Source Project: ExamplesAndroid Author: David-Hackro File: MainActivity.java License: Apache License 2.0 | 6 votes |
@Override public void onMapReady(GoogleMap googleMap) { //Creamos una localizacion LatLng lugar = new LatLng(19.3910038, -99.2837004);//creamos el punto de partida(DF) //Movemos la camara,El metodo newLatLngZoom esta sobrecargado //Este es uno de los metodos,y recibe una localizacion y el respectivo zoom como segundo parametro googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(lugar, 20)); // Indicamos los puntos para crear la polilinea //Ente este caso la ruta es del df - Guerrero - Michoacan y llegando a Guadalajara googleMap.addPolyline(new PolylineOptions().geodesic(true) .add(new LatLng(17.547789, -99.532435)) // Guerrero .add(new LatLng(19.1539267, -103.0220045)) // Michoacan .add(new LatLng(20.6998812, -103.405454)) // Guadalajara ); //Utilidad para generar polilineas de google //https://developers.google.com/maps/documentation/utilities/polylineutility }
Example #17
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the path option to the polyline options. * * @param context A context. * @param pathOption Path options of the steps. * @return Options for a polyline. * @since 1.2.0 */ public static PolylineOptions createPolyline( @NonNull Context context, @NonNull PathOption pathOption ) { return createPolyline( context, pathOption.locationList, pathOption.width, pathOption.color, pathOption.clickable, pathOption.jointType, pathOption.startCap, pathOption.endCap, pathOption.patternItemList ); }
Example #18
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options. * * @param context A context. * @param locationList A list of latitude and longitude. * @param width Width of the polyline in screen pixels. * @param color Color of the polyline as a 32-bit ARGB color. * @return Options for a polyline. * @since 1.0.0 */ public static PolylineOptions createPolyline( @NonNull Context context, @Nullable ArrayList<LatLng> locationList, @Dimension(unit = Dimension.DP) int width, @ColorInt int color ) { return createPolyline( context, locationList, width, color, true, JointType.DEFAULT, null, null, null ); }
Example #19
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options. * * @param context A context. * @param locationList A list of latitude and longitude. * @param width Width of the polyline in screen pixels. * @param color Color of the polyline as a 32-bit ARGB color. * @param clickable Is polyline clickable. * @return Options for a polyline. * @since 1.2.0 */ public static PolylineOptions createPolyline( @NonNull Context context, @Nullable ArrayList<LatLng> locationList, @Dimension(unit = Dimension.DP) int width, @ColorInt int color, boolean clickable ) { return createPolyline( context, locationList, width, color, clickable, JointType.DEFAULT, null, null, null ); }
Example #20
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options. * * @param context A context. * @param locationList A list of latitude and longitude. * @param width Width of the polyline in screen pixels. * @param color Color of the polyline as a 32-bit ARGB color. * @param clickable Is polyline clickable. * @param jointType Joint type for all vertices of the polyline except the start and end vertices. * @return Options for a polyline. * @since 1.2.0 */ public static PolylineOptions createPolyline( @NonNull Context context, @Nullable ArrayList<LatLng> locationList, @Dimension(unit = Dimension.DP) int width, @ColorInt int color, boolean clickable, int jointType ) { return createPolyline( context, locationList, width, color, clickable, jointType, null, null, null ); }
Example #21
Source Project: GoogleDirectionLibrary Author: akexorcist File: DirectionConverter.java License: Apache License 2.0 | 6 votes |
/** * Convert the list of latitude and longitude to the polyline options. * * @param context A context. * @param locationList A list of latitude and longitude. * @param width Width of the polyline in screen pixels. * @param color Color of the polyline as a 32-bit ARGB color. * @param clickable Is polyline clickable. * @param patternItemList Stroke pattern for the polyline. * @return Options for a polyline. * @since 1.2.0 */ public static PolylineOptions createPolyline( @NonNull Context context, @Nullable ArrayList<LatLng> locationList, @Dimension(unit = Dimension.DP) int width, @ColorInt int color, boolean clickable, @Nullable List<PatternItem> patternItemList ) { return createPolyline( context, locationList, width, color, clickable, JointType.DEFAULT, null, null, patternItemList ); }
Example #22
Source Project: PrayTime-Android Author: alphamu File: KaabaLocatorFragment.java License: Apache License 2.0 | 5 votes |
private void initMap() { if (mMap == null && mLastLocation == null) { Log.w("KabaaLocatorFragment", "Ignoring since mMap or mLastLocation is null"); return; } registerRotationListener(); LatLng startPosition = new LatLng(mLastLocation.getLatitude(), mLastLocation.getLongitude()); //21.4224698,39.8262066 LatLng kaaba = new LatLng(21.4224698, 39.8262066); mMap.setMyLocationEnabled(true); mMap.getUiSettings().setMyLocationButtonEnabled(true); mMap.getUiSettings().setCompassEnabled(false); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(startPosition, 13)); //mMap.getUiSettings().setRotateGesturesEnabled(false); mMap.clear(); mMap.addMarker(new MarkerOptions() .title(getString(R.string.kaaba)) .position(kaaba)); mMap.addMarker(new MarkerOptions() .icon(BitmapDescriptorFactory.fromResource(R.drawable.compass)) .title(getString(R.string.current_location)) .position(startPosition)); // Polylines are useful for marking paths and routes on the map. mMap.addPolyline(new PolylineOptions().geodesic(true) .add(startPosition) // user position .add(kaaba) .color(Color.RED)); // Kaabah }
Example #23
Source Project: SEAL-Demo Author: microsoft File: RunActivity.java License: MIT License | 5 votes |
/** * This function allows to draw a route on a map */ private void drawRoute() { if (polylinePoints.size() > 1) { mMap.addPolyline(new PolylineOptions() .addAll(polylinePoints) .width(PATH_WIDTH) .color(Color.argb(255, 255, 140, 0)) ); } }
Example #24
Source Project: osmdroid Author: osmdroid File: MapWrapper.java License: Apache License 2.0 | 5 votes |
@Override public int addPolyline(final Polyline aPolyline) { if (mPolylines == null) { mPolylines = new HashMap<Integer, com.google.android.gms.maps.model.Polyline>(); } final PolylineOptions polylineOptions = new PolylineOptions().color(aPolyline.color).width(aPolyline.width); for(IGeoPoint point : aPolyline.points) { polylineOptions.add(new LatLng(point.getLatitude(), point.getLongitude())); } final com.google.android.gms.maps.model.Polyline polyline = mGoogleMap.addPolyline(polylineOptions); final int id = random.nextInt(); mPolylines.put(id, polyline); return id; }
Example #25
Source Project: Bus-Tracking-Parent Author: Rjtsahu File: MapActivity.java License: GNU General Public License v3.0 | 5 votes |
private void addLine(LatLng from, LatLng to) { if (mGoogleMap != null) { PolylineOptions lineOption = new PolylineOptions().add(from).add(to).color(Color.GRAY); // remove line if already drawn if (mLine != null) mLine.remove(); mLine = mGoogleMap.addPolyline(lineOption); } }
Example #26
Source Project: AirMapView Author: airbnb File: AirMapPolyline.java License: Apache License 2.0 | 5 votes |
/** * Add this polyline to the given {@link GoogleMap} instance * * @param googleMap the {@link GoogleMap} instance to which the polyline will be added */ public void addToGoogleMap(GoogleMap googleMap) { // add the polyline and keep a reference so it can be removed googlePolyline = googleMap.addPolyline(new PolylineOptions() .addAll(points) .width(strokeWidth) .color(strokeColor)); }
Example #27
Source Project: geopackage-android-map Author: ngageoint File: StyleUtils.java License: MIT License | 5 votes |
/** * Create new polyline options populated with the style * * @param style style row * @param density display density: {@link android.util.DisplayMetrics#density} * @return polyline options populated with the style */ public static PolylineOptions createPolylineOptions(StyleRow style, float density) { PolylineOptions polylineOptions = new PolylineOptions(); setStyle(polylineOptions, style, density); return polylineOptions; }
Example #28
Source Project: android-maps-utils Author: googlemaps File: Renderer.java License: Apache License 2.0 | 5 votes |
/** * Sets the inline linestring style by copying over the styles that have been set * * @param polylineOptions polygon options object to add inline styles to * @param inlineStyle inline styles to apply */ private void setInlineLineStringStyle(PolylineOptions polylineOptions, KmlStyle inlineStyle) { PolylineOptions inlinePolylineOptions = inlineStyle.getPolylineOptions(); if (inlineStyle.isStyleSet("outlineColor")) { polylineOptions.color(inlinePolylineOptions.getColor()); } if (inlineStyle.isStyleSet("width")) { polylineOptions.width(inlinePolylineOptions.getWidth()); } if (inlineStyle.isLineRandomColorMode()) { polylineOptions.color(KmlStyle.computeRandomColor(inlinePolylineOptions.getColor())); } }
Example #29
Source Project: geopackage-android-map Author: ngageoint File: GoogleMapShapeConverter.java License: MIT License | 5 votes |
/** * Convert a {@link MultiLineString} to a {@link MultiPolylineOptions} * * @param multiLineString multi line string * @return multi polyline options */ public MultiPolylineOptions toPolylines(MultiLineString multiLineString) { MultiPolylineOptions polylines = new MultiPolylineOptions(); for (LineString lineString : multiLineString.getLineStrings()) { PolylineOptions polyline = toPolyline(lineString); polylines.add(polyline); } return polylines; }
Example #30
Source Project: geopackage-android-map Author: ngageoint File: GoogleMapShapeConverter.java License: MIT License | 5 votes |
/** * Convert a {@link MultiPolylineOptions} to a {@link MultiLineString} * * @param multiPolylineOptions multi polyline options * @param hasZ has z flag * @param hasM has m flag * @return multi line string */ public MultiLineString toMultiLineStringFromOptions( MultiPolylineOptions multiPolylineOptions, boolean hasZ, boolean hasM) { MultiLineString multiLineString = new MultiLineString(hasZ, hasM); for (PolylineOptions polyline : multiPolylineOptions .getPolylineOptions()) { LineString lineString = toLineString(polyline); multiLineString.addLineString(lineString); } return multiLineString; }