Search in sources :

Example 1 with CircleOptions

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

the class TagsDemoActivity method addObjectsToMap.

private void addObjectsToMap() {
    // A circle centered on Adelaide.
    mAdelaideCircle = mMap.addCircle(new CircleOptions().center(ADELAIDE).radius(500000).fillColor(Color.argb(150, 66, 173, 244)).strokeColor(Color.rgb(66, 173, 244)).clickable(true));
    mAdelaideCircle.setTag(new CustomTag("Adelaide circle"));
    // A ground overlay at Sydney.
    mSydneyGroundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions().image(BitmapDescriptorFactory.fromResource(R.drawable.harbour_bridge)).position(SYDNEY, 700000).clickable(true));
    mSydneyGroundOverlay.setTag(new CustomTag("Sydney ground overlay"));
    // A marker at Hobart.
    mHobartMarker = mMap.addMarker(new MarkerOptions().position(HOBART));
    mHobartMarker.setTag(new CustomTag("Hobart marker"));
    // A polygon centered at Darwin.
    mDarwinPolygon = mMap.addPolygon(new PolygonOptions().add(new LatLng(DARWIN.latitude + 3, DARWIN.longitude - 3), new LatLng(DARWIN.latitude + 3, DARWIN.longitude + 3), new LatLng(DARWIN.latitude - 3, DARWIN.longitude + 3), new LatLng(DARWIN.latitude - 3, DARWIN.longitude - 3)).fillColor(Color.argb(150, 34, 173, 24)).strokeColor(Color.rgb(34, 173, 24)).clickable(true));
    mDarwinPolygon.setTag(new CustomTag("Darwin polygon"));
    // A polyline from Perth to Brisbane.
    mPolyline = mMap.addPolyline(new PolylineOptions().add(PERTH, BRISBANE).color(Color.rgb(103, 24, 173)).width(30).clickable(true));
    mPolyline.setTag(new CustomTag("Perth to Brisbane polyline"));
}
Also used : MarkerOptions(com.google.android.libraries.maps.model.MarkerOptions) CircleOptions(com.google.android.libraries.maps.model.CircleOptions) GroundOverlayOptions(com.google.android.libraries.maps.model.GroundOverlayOptions) PolygonOptions(com.google.android.libraries.maps.model.PolygonOptions) LatLng(com.google.android.libraries.maps.model.LatLng) PolylineOptions(com.google.android.libraries.maps.model.PolylineOptions)

Example 2 with CircleOptions

use of com.google.android.libraries.maps.model.CircleOptions in project android-maps-utils by googlemaps.

the class HeatmapsPlacesDemoActivity method startDemo.

@Override
protected void startDemo(boolean isRestore) {
    EditText editText = findViewById(R.id.input_text);
    editText.setOnEditorActionListener((textView, actionId, keyEvent) -> {
        boolean handled = false;
        if (actionId == EditorInfo.IME_ACTION_GO) {
            submit(null);
            handled = true;
        }
        return handled;
    });
    mCheckboxLayout = findViewById(R.id.checkboxes);
    GoogleMap map = getMap();
    if (!isRestore) {
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(SYDNEY, 11));
    }
    // Add a circle around Sydney to roughly encompass the results
    map.addCircle(new CircleOptions().center(SYDNEY).radius(SEARCH_RADIUS * 1.2).strokeColor(Color.RED).strokeWidth(4));
}
Also used : EditText(android.widget.EditText) CircleOptions(com.google.android.libraries.maps.model.CircleOptions) GoogleMap(com.google.android.libraries.maps.GoogleMap)

Example 3 with CircleOptions

use of com.google.android.libraries.maps.model.CircleOptions in project google-maps by capacitor-community.

the class CapacitorGoogleMaps method addCircle.

@PluginMethod()
public void addCircle(final PluginCall call) {
    final int radius = call.getInt("radius", 0);
    final JSONObject center = call.getObject("center", new JSObject());
    getBridge().executeOnMainThread(new Runnable() {

        @Override
        public void run() {
            CircleOptions circleOptions = new CircleOptions();
            circleOptions.radius(radius);
            try {
                circleOptions.center(new LatLng(center.getDouble("latitude"), center.getDouble("longitude")));
            } catch (JSONException e) {
                e.printStackTrace();
            }
            googleMap.addCircle(circleOptions);
            call.resolve();
        }
    });
}
Also used : JSONObject(org.json.JSONObject) CircleOptions(com.google.android.libraries.maps.model.CircleOptions) JSObject(com.getcapacitor.JSObject) JSONException(org.json.JSONException) LatLng(com.google.android.libraries.maps.model.LatLng) SuppressLint(android.annotation.SuppressLint) PluginMethod(com.getcapacitor.PluginMethod)

Aggregations

CircleOptions (com.google.android.libraries.maps.model.CircleOptions)3 LatLng (com.google.android.libraries.maps.model.LatLng)2 SuppressLint (android.annotation.SuppressLint)1 EditText (android.widget.EditText)1 JSObject (com.getcapacitor.JSObject)1 PluginMethod (com.getcapacitor.PluginMethod)1 GoogleMap (com.google.android.libraries.maps.GoogleMap)1 GroundOverlayOptions (com.google.android.libraries.maps.model.GroundOverlayOptions)1 MarkerOptions (com.google.android.libraries.maps.model.MarkerOptions)1 PolygonOptions (com.google.android.libraries.maps.model.PolygonOptions)1 PolylineOptions (com.google.android.libraries.maps.model.PolylineOptions)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1