Search in sources :

Example 1 with Circle

use of com.google.android.libraries.maps.model.Circle in project android-samples by googlemaps.

the class CircleDemoActivity method onMapReady.

@Override
public void onMapReady(GoogleMap googleMap) {
    // Override the default content description on the view, for accessibility mode.
    googleMap.setContentDescription(getString(R.string.map_circle_description));
    map = googleMap;
    map.setOnMarkerDragListener(this);
    map.setOnMapLongClickListener(this);
    fillColorArgb = Color.HSVToColor(fillAlphaBar.getProgress(), new float[] { fillHueBar.getProgress(), 1, 1 });
    strokeColorArgb = Color.HSVToColor(strokeAlphaBar.getProgress(), new float[] { strokeHueBar.getProgress(), 1, 1 });
    fillHueBar.setOnSeekBarChangeListener(this);
    fillAlphaBar.setOnSeekBarChangeListener(this);
    strokeWidthBar.setOnSeekBarChangeListener(this);
    strokeHueBar.setOnSeekBarChangeListener(this);
    strokeAlphaBar.setOnSeekBarChangeListener(this);
    strokePatternSpinner.setOnItemSelectedListener(this);
    DraggableCircle circle = new DraggableCircle(SYDNEY, DEFAULT_RADIUS_METERS);
    circles.add(circle);
    // Move the map so that it is centered on the initial circle
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(SYDNEY, 4.0f));
    // Set up the click listener for the circle.
    googleMap.setOnCircleClickListener(new OnCircleClickListener() {

        @Override
        public void onCircleClick(Circle circle) {
            // Flip the red, green and blue components of the circle's stroke color.
            circle.setStrokeColor(circle.getStrokeColor() ^ 0x00ffffff);
        }
    });
    List<PatternItem> pattern = getSelectedPattern(strokePatternSpinner.getSelectedItemPosition());
    for (DraggableCircle draggableCircle : circles) {
        draggableCircle.setStrokePattern(pattern);
    }
}
Also used : OnCircleClickListener(com.google.android.libraries.maps.GoogleMap.OnCircleClickListener) Circle(com.google.android.libraries.maps.model.Circle) PatternItem(com.google.android.libraries.maps.model.PatternItem)

Aggregations

OnCircleClickListener (com.google.android.libraries.maps.GoogleMap.OnCircleClickListener)1 Circle (com.google.android.libraries.maps.model.Circle)1 PatternItem (com.google.android.libraries.maps.model.PatternItem)1