use of com.google.android.libraries.maps.model.LatLng in project android-maps-utils by googlemaps.
the class TileProviderAndProjectionDemo method startDemo.
@Override
protected void startDemo(boolean isRestore) {
PointTileOverlay pto = new PointTileOverlay();
pto.addPoint(new LatLng(0, 0));
pto.addPoint(new LatLng(21, -10));
getMap().addTileOverlay(new TileOverlayOptions().tileProvider(pto));
}
use of com.google.android.libraries.maps.model.LatLng in project android-maps-utils by googlemaps.
the class VisibleClusteringDemoActivity method readItems.
private void readItems() throws JSONException {
InputStream inputStream = getResources().openRawResource(R.raw.radar_search);
List<MyItem> items = new MyItemReader().read(inputStream);
for (int i = 0; i < 100; i++) {
double offset = i / 60d;
for (MyItem item : items) {
LatLng position = item.getPosition();
double lat = position.latitude + offset;
double lng = position.longitude + offset;
MyItem offsetItem = new MyItem(lat, lng);
mClusterManager.addItem(offsetItem);
}
}
}
use of com.google.android.libraries.maps.model.LatLng 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();
}
});
}
use of com.google.android.libraries.maps.model.LatLng in project google-maps by capacitor-community.
the class CapacitorGoogleMaps method addPolygon.
@PluginMethod()
public void addPolygon(final PluginCall call) {
final JSArray points = call.getArray("points", new JSArray());
getBridge().executeOnMainThread(new Runnable() {
@Override
public void run() {
PolygonOptions polygonOptions = new PolygonOptions();
for (int i = 0; i < points.length(); i++) {
try {
JSONObject point = points.getJSONObject(i);
LatLng latLng = new LatLng(point.getDouble("latitude"), point.getDouble("longitude"));
polygonOptions.add(latLng);
} catch (JSONException e) {
e.printStackTrace();
}
}
googleMap.addPolygon(polygonOptions);
call.resolve();
}
});
}
use of com.google.android.libraries.maps.model.LatLng in project android-places-demos by googlemaps.
the class ProgrammaticAutocompleteToolbarActivity method getPlacePredictions.
/**
* This method demonstrates the programmatic approach to getting place predictions. The
* parameters in this request are currently biased to Kolkata, India.
*
* @param query the plus code query string (e.g. "GCG2+3M K")
*/
private void getPlacePredictions(String query) {
// The value of 'bias' biases prediction results to the rectangular region provided
// (currently Kolkata). Modify these values to get results for another area. Make sure to
// pass in the appropriate value/s for .setCountries() in the
// FindAutocompletePredictionsRequest.Builder object as well.
final LocationBias bias = RectangularBounds.newInstance(// SW lat, lng
new LatLng(22.458744, 88.208162), // NE lat, lng
new LatLng(22.730671, 88.524896));
// Create a new programmatic Place Autocomplete request in Places SDK for Android
final FindAutocompletePredictionsRequest newRequest = FindAutocompletePredictionsRequest.builder().setSessionToken(sessionToken).setLocationBias(bias).setTypeFilter(TypeFilter.ESTABLISHMENT).setQuery(query).setCountries("IN").build();
// Perform autocomplete predictions request
placesClient.findAutocompletePredictions(newRequest).addOnSuccessListener((response) -> {
List<AutocompletePrediction> predictions = response.getAutocompletePredictions();
adapter.setPredictions(predictions);
progressBar.setIndeterminate(false);
viewAnimator.setDisplayedChild(predictions.isEmpty() ? 0 : 1);
}).addOnFailureListener((exception) -> {
progressBar.setIndeterminate(false);
if (exception instanceof ApiException) {
ApiException apiException = (ApiException) exception;
Log.e(TAG, "Place not found: " + apiException.getStatusCode());
}
});
}
Aggregations