com.google.android.gms.maps.model.Dash Java Examples
The following examples show how to use
com.google.android.gms.maps.model.Dash.
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: MapUtils.java From ridesharing-android with 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 #2
Source File: SecondExampleActivity.java From Curve-Fit with Apache License 2.0 | 5 votes |
@Override public void onMapReady(GoogleMap googleMap) { this.map = googleMap; curveManager = new CurveManager(map); ArrayList<LatLng> latLngArrayList = new ArrayList<>(); latLngArrayList.add(new LatLng(12.30548451, 76.65521267)); latLngArrayList.add(new LatLng(19.81516491, 85.83133625)); latLngArrayList.add(new LatLng(26.9124336, 75.7872709)); latLngArrayList.add(new LatLng(28.596111, 83.820278)); CurveOptions curveOptions = new CurveOptions(); curveOptions.addAll(latLngArrayList); curveOptions.color(Color.DKGRAY); curveOptions.setComputePointsBasedOnScreenPixels(false); curveOptions.setAlpha(0.5f); curveOptions.width(10); List<PatternItem> pattern = Arrays.asList(new Dash(30), new Gap(20)); curveOptions.pattern(pattern); curveOptions.geodesic(false); for (LatLng position : latLngArrayList) { new MarkerOptions().position(position); map.addMarker(new MarkerOptions().position(position)); } map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(21.146633, 79.088860), 5)); curveManager.drawCurveAsync(curveOptions); }
Example #3
Source File: ThirdExampleActivity.java From Curve-Fit with Apache License 2.0 | 5 votes |
@Override public void onMapReady(GoogleMap googleMap) { this.map = googleMap; curveManager = new CurveManager(map); CurveOptions curveOptions = new CurveOptions(); curveOptions.add(sourceLatLng); curveOptions.add(destinationLatLng); curveOptions.color(Color.DKGRAY); curveOptions.setComputePointsBasedOnScreenPixels(true); curveOptions.setAlpha(0.5f); curveOptions.width(12); List<PatternItem> pattern = Arrays.asList(new Dash(30), new Gap(30)); curveOptions.pattern(pattern); curveOptions.geodesic(false); map.addMarker(new MarkerOptions() .position(sourceLatLng) .anchor(0.5f, 1f)); map.addMarker(new MarkerOptions() .position(destinationLatLng) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)) .anchor(0.5f, 1f)); map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(56.14683221, 10.2079815), 14)); curveManager.drawCurveAsync(curveOptions); }
Example #4
Source File: FirstExampleActivity.java From Curve-Fit with Apache License 2.0 | 4 votes |
private void drawCurveLine() { String sourceLatitude = latitudeInputOneEditText.getText().toString().trim(); String sourceLongitude = longitudeInputOneEditText.getText().toString().trim(); String destLatitude = latitudeInputTwoEditText.getText().toString().trim(); String destLongitude = longitudeInputTwoEditText.getText().toString().trim(); String alpha = alphaEditText.getText().toString().trim(); if (sourceLatitude.equals("") || sourceLongitude.equals("") || destLatitude.equals("") || destLongitude.equals("") || alpha.equals("")) { return; } LatLng initLatLng = new LatLng(Double.valueOf(sourceLatitude), Double.valueOf(sourceLongitude)); LatLng finalLatLng = new LatLng(Double.valueOf(destLatitude), Double.valueOf(destLongitude)); CurveOptions curveOptions = new CurveOptions(); curveOptions.add(initLatLng); curveOptions.add(finalLatLng); curveOptions.clickable(true); curveOptions.setComputePointsBasedOnScreenPixels(checkBox.isChecked()); curveOptions.setZoomToPosition(true); curveOptions.setAlpha(Float.valueOf(alpha)); curveOptions.width(12); List<PatternItem> pattern = Arrays.asList(new Dash(30), new Gap(25)); curveOptions.pattern(pattern); curveOptions.geodesic(false); if (checkBox.isChecked()) { curveOptions.color(getResources().getColor(R.color.red_500)); } else { curveOptions.color(getResources().getColor(R.color.indigo_a700)); } LatLngBounds.Builder builder = new LatLngBounds.Builder(); builder.include(initLatLng); builder.include(finalLatLng); LatLngBounds bounds = builder.build(); map.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20)); if (curveManager != null) { curveManager.drawCurveAsync(curveOptions); } map.addMarker(new MarkerOptions().position(initLatLng).anchor(0.5f, 1f)); map.addMarker(new MarkerOptions().position(finalLatLng) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)) .anchor(0.5f, 1f)); }