Search in sources :

Example 1 with Dot

use of com.google.android.gms.maps.model.Dot in project android-maps-utils by googlemaps.

the class GeoJsonPolygonStyleTest method testStrokePattern.

@Test
public void testStrokePattern() {
    List<PatternItem> strokePatternItems = new ArrayList<>();
    strokePatternItems.add(new Dot());
    polygonStyle.setStrokePattern(strokePatternItems);
    assertEquals(strokePatternItems, polygonStyle.getStrokePattern());
    assertEquals(strokePatternItems, polygonStyle.toPolygonOptions().getStrokePattern());
}
Also used : PatternItem(com.google.android.gms.maps.model.PatternItem) ArrayList(java.util.ArrayList) Dot(com.google.android.gms.maps.model.Dot) Test(org.junit.Test)

Example 2 with Dot

use of com.google.android.gms.maps.model.Dot in project NavitiaSDKUX_android by CanalTP.

the class JourneyMapViewComponentSpec method onBind.

@OnBind
static void onBind(final ComponentContext context, final MapView mapView, @Prop Bundle savedInstanceState, @Prop final Journey journey) {
    mapView.onCreate(savedInstanceState);
    mapView.getMapAsync(new OnMapReadyCallback() {

        @SuppressWarnings("unchecked")
        @Override
        public void onMapReady(final GoogleMap googleMap) {
            mapView.onResume();
            googleMap.setOnCameraIdleListener(new GoogleMap.OnCameraIdleListener() {

                @Override
                public void onCameraIdle() {
                    redrawIntermediatePointCircles(googleMap);
                }
            });
            googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {

                @Override
                public boolean onMarkerClick(Marker marker) {
                    return true;
                }
            });
            JourneyPathElements journeyPathElements = new JourneyPathElements(journey);
            for (SectionPolyline sectionPolyline : journeyPathElements.getSectionPolylines()) {
                PolylineOptions polylineOptions = new PolylineOptions().zIndex(1);
                if (sectionPolyline.getType().equalsIgnoreCase(SectionPolyline.TYPE_STREET_NETWORK) && sectionPolyline.getMode().equalsIgnoreCase(SectionPolyline.MODE_WALKING)) {
                    polylineOptions.pattern(Arrays.asList(new Dot(), new Gap(10)));
                }
                polylineOptions.width(sectionPolyline.getWidth()).color(sectionPolyline.getColor());
                polylineOptions.addAll(sectionPolyline.getSectionPathCoordinates());
                googleMap.addPolyline(polylineOptions);
            }
            intermediatePointsCircles.clear();
            for (LatLng centerCoord : journeyPathElements.getIntermediatePointsCirclesCoords()) {
                CircleOptions circleOptions = new CircleOptions().center(centerCoord).strokeColor(Color.BLACK).strokeWidth(8).fillColor(Color.WHITE).radius(getCircleRadiusDependingOnCurrentCameraZoom(googleMap.getCameraPosition().zoom)).zIndex(2);
                intermediatePointsCircles.add(googleMap.addCircle(circleOptions));
            }
            LatLng[] ridesharingCoordinates = getRidesharingJourneyCoordinates(journey);
            LatLng departureCoordinates = getJourneyDepartureCoordinates(journey);
            LatLng arrivalCoordinates = getJourneyArrivalCoordinates(journey);
            String departureLabel = context.getString(R.string.departure);
            String arrivalLabel = context.getString(R.string.arrival);
            if (departureCoordinates.equals(ridesharingCoordinates[0])) {
                MarkerOptions departureMarkerOptions = new MarkerOptions().position(ridesharingCoordinates[0]).icon(BitmapDescriptorFactory.fromBitmap(getPlaceMarkerIcon(context, departureLabel, Configuration.colors.getOrigin(), true)));
                googleMap.addMarker(departureMarkerOptions);
            } else {
                if (ridesharingCoordinates[0] != null) {
                    MarkerOptions ridesharingDepartureMarkerOptions = new MarkerOptions().position(ridesharingCoordinates[0]).icon(BitmapDescriptorFactory.fromBitmap(getPlaceMarkerIcon(context, null, null, true)));
                    googleMap.addMarker(ridesharingDepartureMarkerOptions);
                }
                MarkerOptions departureMarkerOptions = new MarkerOptions().position(departureCoordinates).icon(BitmapDescriptorFactory.fromBitmap(getPlaceMarkerIcon(context, departureLabel, Configuration.colors.getOrigin(), false)));
                googleMap.addMarker(departureMarkerOptions);
            }
            if (arrivalCoordinates.equals(ridesharingCoordinates[1])) {
                MarkerOptions arrivalMarkerOptions = new MarkerOptions().position(ridesharingCoordinates[1]).icon(BitmapDescriptorFactory.fromBitmap(getPlaceMarkerIcon(context, arrivalLabel, Configuration.colors.getDestination(), true)));
                googleMap.addMarker(arrivalMarkerOptions);
            } else {
                if (ridesharingCoordinates[1] != null) {
                    MarkerOptions ridesharingArrivalMarkerOptions = new MarkerOptions().position(ridesharingCoordinates[1]).icon(BitmapDescriptorFactory.fromBitmap(getPlaceMarkerIcon(context, null, null, true)));
                    googleMap.addMarker(ridesharingArrivalMarkerOptions);
                }
                MarkerOptions arrivalMarkerOptions = new MarkerOptions().position(arrivalCoordinates).icon(BitmapDescriptorFactory.fromBitmap(getPlaceMarkerIcon(context, arrivalLabel, Configuration.colors.getDestination(), false)));
                googleMap.addMarker(arrivalMarkerOptions);
            }
            zoomToPolyline(googleMap, journeyPathElements.getJourneyPolylineCoords(), false);
        }
    });
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) Dot(com.google.android.gms.maps.model.Dot) OnMapReadyCallback(com.google.android.gms.maps.OnMapReadyCallback) Marker(com.google.android.gms.maps.model.Marker) PolylineOptions(com.google.android.gms.maps.model.PolylineOptions) SectionPolyline(org.kisio.NavitiaSDKUX.BusinessLogic.SectionPolyline) CircleOptions(com.google.android.gms.maps.model.CircleOptions) JourneyPathElements(org.kisio.NavitiaSDKUX.BusinessLogic.JourneyPathElements) GoogleMap(com.google.android.gms.maps.GoogleMap) Gap(com.google.android.gms.maps.model.Gap) LatLng(com.google.android.gms.maps.model.LatLng) OnBind(com.facebook.litho.annotations.OnBind)

Aggregations

Dot (com.google.android.gms.maps.model.Dot)2 OnBind (com.facebook.litho.annotations.OnBind)1 GoogleMap (com.google.android.gms.maps.GoogleMap)1 OnMapReadyCallback (com.google.android.gms.maps.OnMapReadyCallback)1 CircleOptions (com.google.android.gms.maps.model.CircleOptions)1 Gap (com.google.android.gms.maps.model.Gap)1 LatLng (com.google.android.gms.maps.model.LatLng)1 Marker (com.google.android.gms.maps.model.Marker)1 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)1 PatternItem (com.google.android.gms.maps.model.PatternItem)1 PolylineOptions (com.google.android.gms.maps.model.PolylineOptions)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 JourneyPathElements (org.kisio.NavitiaSDKUX.BusinessLogic.JourneyPathElements)1 SectionPolyline (org.kisio.NavitiaSDKUX.BusinessLogic.SectionPolyline)1