Search in sources :

Example 1 with PatternItem

use of com.google.android.gms.maps.model.PatternItem 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 PatternItem

use of com.google.android.gms.maps.model.PatternItem in project android-samples by googlemaps.

the class CircleDemoActivity method onMapReady.

@Override
public void onMapReady(GoogleMap map) {
    // Override the default content description on the view, for accessibility mode.
    map.setContentDescription(getString(R.string.map_circle_description));
    mMap = map;
    mMap.setOnMarkerDragListener(this);
    mMap.setOnMapLongClickListener(this);
    mFillColorArgb = Color.HSVToColor(mFillAlphaBar.getProgress(), new float[] { mFillHueBar.getProgress(), 1, 1 });
    mStrokeColorArgb = Color.HSVToColor(mStrokeAlphaBar.getProgress(), new float[] { mStrokeHueBar.getProgress(), 1, 1 });
    mFillHueBar.setOnSeekBarChangeListener(this);
    mFillAlphaBar.setOnSeekBarChangeListener(this);
    mStrokeWidthBar.setOnSeekBarChangeListener(this);
    mStrokeHueBar.setOnSeekBarChangeListener(this);
    mStrokeAlphaBar.setOnSeekBarChangeListener(this);
    mStrokePatternSpinner.setOnItemSelectedListener(this);
    DraggableCircle circle = new DraggableCircle(SYDNEY, DEFAULT_RADIUS_METERS);
    mCircles.add(circle);
    // Move the map so that it is centered on the initial circle
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SYDNEY, 4.0f));
    // Set up the click listener for the circle.
    map.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(mStrokePatternSpinner.getSelectedItemPosition());
    for (DraggableCircle draggableCircle : mCircles) {
        draggableCircle.setStrokePattern(pattern);
    }
}
Also used : OnCircleClickListener(com.google.android.gms.maps.GoogleMap.OnCircleClickListener) Circle(com.google.android.gms.maps.model.Circle) PatternItem(com.google.android.gms.maps.model.PatternItem)

Aggregations

PatternItem (com.google.android.gms.maps.model.PatternItem)2 OnCircleClickListener (com.google.android.gms.maps.GoogleMap.OnCircleClickListener)1 Circle (com.google.android.gms.maps.model.Circle)1 Dot (com.google.android.gms.maps.model.Dot)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1