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));
}
}
}
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);
}
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);
}
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);
}
}
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));
}
}
Aggregations