Search in sources :

Example 1 with CircleOptions

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

the class HeatmapsPlacesDemoActivity method setUpMap.

private void setUpMap() {
    if (mMap == null) {
        mMap = getMap();
        if (mMap != null) {
            mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SYDNEY, 11));
            // Add a circle around Sydney to roughly encompass the results
            mMap.addCircle(new CircleOptions().center(SYDNEY).radius(SEARCH_RADIUS * 1.2).strokeColor(Color.RED).strokeWidth(4));
        }
    }
}
Also used : CircleOptions(com.google.android.gms.maps.model.CircleOptions)

Example 2 with CircleOptions

use of com.google.android.gms.maps.model.CircleOptions in project xDrip-plus by jamorham.

the class MapsActivity method redrawmap.

private static void redrawmap() {
    Log.d(TAG, "Attempting to redraw map: " + lastGeoLocation);
    if (mMap == null)
        return;
    mMap.clear();
    String[] splits = lastGeoLocation.split(",");
    // sanity check goes here
    LatLng mylocation;
    try {
        mylocation = new LatLng(Double.parseDouble(splits[0]), Double.parseDouble(splits[1]));
    } catch (NumberFormatException e) {
        Log.e(TAG, "Mylocation number exception: '" + lastGeoLocation + "'");
        return;
    } catch (ArrayIndexOutOfBoundsException e) {
        Log.e(TAG, "Mylocation array index exception: '" + lastGeoLocation + "'");
        return;
    }
    CircleOptions circleOptions = new CircleOptions().center(mylocation).strokeWidth(2).strokeColor(Color.GRAY).radius(1500);
    String title = "";
    if (lastGeoLocation.equals(defaultLocation)) {
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mylocation, 16));
        title = "No location data yet";
    } else {
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mylocation, 13));
    }
    if (lats.size() > 0) {
        PolylineOptions mylines = new PolylineOptions();
        for (int c = 0; c < lats.size(); c++) {
            mylines.add(new LatLng(lats.get(c), longs.get(c)));
        }
        mylines.width(1);
        mylines.color(Color.parseColor("#2ba367"));
        mMap.addPolyline(mylines);
    }
    mMap.addCircle(circleOptions);
    mMap.addMarker(new MarkerOptions().position(mylocation).title(title).alpha(0.9f).icon(BitmapDescriptorFactory.fromResource(R.drawable.jamorham_parakeet_marker)));
    mMap.getUiSettings().setMapToolbarEnabled(false);
    mMap.getUiSettings().setMyLocationButtonEnabled(true);
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) CircleOptions(com.google.android.gms.maps.model.CircleOptions) LatLng(com.google.android.gms.maps.model.LatLng) PolylineOptions(com.google.android.gms.maps.model.PolylineOptions)

Example 3 with CircleOptions

use of com.google.android.gms.maps.model.CircleOptions in project wigle-wifi-wardriving by wiglenet.

the class NetworkActivity method setupQuery.

@SuppressLint("HandlerLeak")
private void setupQuery() {
    // what runs on the gui thread
    final Handler handler = new Handler() {

        @Override
        public void handleMessage(final Message msg) {
            final TextView tv = (TextView) findViewById(R.id.na_observe);
            if (msg.what == MSG_OBS_UPDATE) {
                tv.setText(" " + Integer.toString(observations) + "...");
            } else if (msg.what == MSG_OBS_DONE) {
                tv.setText(" " + Integer.toString(observations));
                mapView.getMapAsync(new OnMapReadyCallback() {

                    @Override
                    public void onMapReady(final GoogleMap googleMap) {
                        int count = 0;
                        for (Map.Entry<LatLng, Integer> obs : obsMap.entrySet()) {
                            final LatLng latLon = obs.getKey();
                            final int level = obs.getValue();
                            if (count == 0 && network.getLatLng() == null) {
                                final CameraPosition cameraPosition = new CameraPosition.Builder().target(latLon).zoom(DEFAULT_ZOOM).build();
                                googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
                            }
                            googleMap.addCircle(new CircleOptions().center(latLon).radius(4).fillColor(NetworkListAdapter.getSignalColor(level, true)).strokeWidth(0).zIndex(level));
                            count++;
                        }
                        MainActivity.info("observation count: " + count);
                    }
                });
            }
        }
    };
    final String sql = "SELECT level,lat,lon FROM " + DatabaseHelper.LOCATION_TABLE + " WHERE bssid = '" + network.getBssid() + "' limit " + obsMap.maxSize();
    final QueryThread.Request request = new QueryThread.Request(sql, new QueryThread.ResultHandler() {

        @Override
        public boolean handleRow(final Cursor cursor) {
            observations++;
            obsMap.put(new LatLng(cursor.getFloat(1), cursor.getFloat(2)), cursor.getInt(0));
            if ((observations % 10) == 0) {
                // change things on the gui thread
                handler.sendEmptyMessage(MSG_OBS_UPDATE);
            }
            return true;
        }

        @Override
        public void complete() {
            handler.sendEmptyMessage(MSG_OBS_DONE);
        }
    });
    ListFragment.lameStatic.dbHelper.addToQueue(request);
}
Also used : Message(android.os.Message) Handler(android.os.Handler) OnMapReadyCallback(com.google.android.gms.maps.OnMapReadyCallback) Cursor(android.database.Cursor) SuppressLint(android.annotation.SuppressLint) CameraPosition(com.google.android.gms.maps.model.CameraPosition) CircleOptions(com.google.android.gms.maps.model.CircleOptions) GoogleMap(com.google.android.gms.maps.GoogleMap) QueryThread(net.wigle.wigleandroid.background.QueryThread) TextView(android.widget.TextView) LatLng(com.google.android.gms.maps.model.LatLng) ConcurrentLinkedHashMap(net.wigle.wigleandroid.model.ConcurrentLinkedHashMap) Map(java.util.Map) GoogleMap(com.google.android.gms.maps.GoogleMap) SuppressLint(android.annotation.SuppressLint)

Example 4 with CircleOptions

use of com.google.android.gms.maps.model.CircleOptions in project android-sdk-examples by IndoorAtlas.

the class MapsOverlayActivity method showLocationCircle.

private void showLocationCircle(LatLng center, double accuracyRadius) {
    if (mCircle == null) {
        // location can received before map is initialized, ignoring those updates
        if (mMap != null) {
            mCircle = mMap.addCircle(new CircleOptions().center(center).radius(accuracyRadius).fillColor(0x801681FB).strokeColor(0x800A78DD).zIndex(1.0f).visible(true).strokeWidth(5.0f));
        }
    } else {
        // move existing markers position to received location
        mCircle.setCenter(center);
        mCircle.setRadius(accuracyRadius);
    }
}
Also used : CircleOptions(com.google.android.gms.maps.model.CircleOptions)

Example 5 with CircleOptions

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

the class JourneyMapViewComponentSpec method redrawIntermediatePointCircles.

private static void redrawIntermediatePointCircles(GoogleMap googleMap) {
    List<CircleOptions> updatedIntermediatePointsCircles = new ArrayList<>();
    for (Circle circle : intermediatePointsCircles) {
        circle.remove();
        updatedIntermediatePointsCircles.add(new CircleOptions().center(circle.getCenter()).strokeColor(Color.BLACK).strokeWidth(8).fillColor(Color.WHITE).radius(getCircleRadiusDependingOnCurrentCameraZoom(googleMap.getCameraPosition().zoom)).zIndex(2));
    }
    intermediatePointsCircles.clear();
    for (CircleOptions circleOptions : updatedIntermediatePointsCircles) {
        intermediatePointsCircles.add(googleMap.addCircle(circleOptions));
    }
}
Also used : Circle(com.google.android.gms.maps.model.Circle) CircleOptions(com.google.android.gms.maps.model.CircleOptions) ArrayList(java.util.ArrayList)

Aggregations

CircleOptions (com.google.android.gms.maps.model.CircleOptions)16 LatLng (com.google.android.gms.maps.model.LatLng)8 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)8 PolylineOptions (com.google.android.gms.maps.model.PolylineOptions)4 GoogleMap (com.google.android.gms.maps.GoogleMap)3 OnMapReadyCallback (com.google.android.gms.maps.OnMapReadyCallback)3 CameraPosition (com.google.android.gms.maps.model.CameraPosition)3 SuppressLint (android.annotation.SuppressLint)2 Circle (com.google.android.gms.maps.model.Circle)2 Cursor (android.database.Cursor)1 Handler (android.os.Handler)1 Message (android.os.Message)1 RelativeLayout (android.widget.RelativeLayout)1 TextView (android.widget.TextView)1 OnBind (com.facebook.litho.annotations.OnBind)1 MapView (com.google.android.gms.maps.MapView)1 Dot (com.google.android.gms.maps.model.Dot)1 Gap (com.google.android.gms.maps.model.Gap)1 GroundOverlayOptions (com.google.android.gms.maps.model.GroundOverlayOptions)1 LatLngBounds (com.google.android.gms.maps.model.LatLngBounds)1