本文整理汇总了Java中com.google.android.gms.maps.model.CircleOptions类的典型用法代码示例。如果您正苦于以下问题:Java CircleOptions类的具体用法?Java CircleOptions怎么用?Java CircleOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CircleOptions类属于com.google.android.gms.maps.model包,在下文中一共展示了CircleOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initMap
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void initMap() {
PlaceAutocompleteFragment autocompleteFragment = new PlaceAutocompleteFragment();
CustomMapFragment mapFragment = new CustomMapFragment();
autocompleteFragment.setOnPlaceSelectedListener(this);
mapFragment.setParent(mBinding.scroll);
mapFragment.getMapAsync(this);
FragmentManager manager = getActivity().getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.add(R.id.place_autocomplete_fragment, autocompleteFragment);
transaction.add(R.id.google_map_fragment, mapFragment);
transaction.commit();
mMarkerOptions = new MarkerOptions().icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
mCircleOptions = new CircleOptions().fillColor(Color.argb(97, 93, 185, 139)).strokeColor(Color.argb(200, 93, 185, 139));
}
示例2: onMapReady
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// mMap.setOnMapClickListener(this);
Bundle bundle = getIntent().getExtras();
double r_long=bundle.getDouble("lattitude");
double r_lat=bundle.getDouble("longitude");
// Add a marker in Sydney and move the camera
LatLng mark = new LatLng(r_lat, r_long);
CircleOptions circleoptions=new CircleOptions().strokeWidth(2).strokeColor(Color.BLUE).fillColor(Color.parseColor("#500084d3"));
mMap.addMarker(new MarkerOptions().position(mark).title(getAddress(mark)));
mMap.moveCamera(CameraUpdateFactory.newLatLng(mark));
Circle circle=mMap.addCircle(circleoptions.center(mark).radius(5000.0));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(circleoptions.getCenter(),getZoomLevel(circle)));
}
示例3: drawFlagsCircle
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void drawFlagsCircle(LatLng position, String circleKey, int strokeColor, int fillColor){
// check if circle exist or not.
if(flagsCircleHashMap.containsKey(circleKey)){
flagsCircleHashMap.get(circleKey).setCenter(position);
flagsCircleHashMap.get(circleKey).setFillColor(fillColor);
flagsCircleHashMap.get(circleKey).setRadius(Constants.FLAG_RADIUS);
flagsCircleHashMap.get(circleKey).setStrokeColor(strokeColor);
}else {
CircleOptions circleOptions = new CircleOptions()
.center(position)
.strokeColor(strokeColor)
.fillColor(fillColor)
.radius(Constants.FLAG_RADIUS);
flagsCircleHashMap.put(circleKey, googleMap.addCircle(circleOptions));
}
}
示例4: setUpMap
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
@SuppressWarnings({"MissingPermission"})
private void setUpMap() {
mMap.setMyLocationEnabled(true);
//mMap.setPadding(0, ConversionUtil.dpToPx(68, getResources()), 0, 0);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
//Add circle and marker
int strokeColor = ContextCompat.getColor(getActivity(), R.color.map_circle_stroke);
int shadeColor = ContextCompat.getColor(getActivity(), R.color.map_circle_shade);
LatLng latLng = ConversionUtil.placeToLatLng(mReminder.getPlace());
mMap.addCircle(new CircleOptions()
.center(latLng)
.radius(mReminder.getPlace().getRadius())
.fillColor(shadeColor)
.strokeColor(strokeColor)
.strokeWidth(2));
mMap.addMarker(new MarkerOptions().position(latLng));
//Move camera
//mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latlng, 15), 1000, null); //Zoom level 15 = Streets, 1000ms animation
CameraPosition cameraPos = new CameraPosition.Builder().tilt(60).target(latLng).zoom(15).build();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPos), 1000, null);
}
示例5: refreshAccuraryIndicator
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void refreshAccuraryIndicator(Location location) {
if (mShowAccuracy) {
// Accuracy circle marker
if (mAccuracyCircle != null) {
mAccuracyCircle.setCenter(new LatLng(location.getLatitude(), location.getLongitude()));
mAccuracyCircle.setRadius(location.getAccuracy());
} else if (mMap != null) {
CircleOptions circleOptions = new CircleOptions().center(new LatLng(location.getLatitude(), location.getLongitude()));
circleOptions.fillColor(getResources().getColor(R.color.accuracy_circle_fill_color));
circleOptions.strokeColor(android.R.color.black);
circleOptions.strokeWidth(1);
circleOptions.radius(location.getAccuracy());
circleOptions.zIndex(2f);
mAccuracyCircle = mMap.addCircle(circleOptions);
}
} else {
if (mAccuracyCircle != null) {
mAccuracyCircle.remove();
mAccuracyCircle = null;
}
}
}
示例6: updateLocationOnMap
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void updateLocationOnMap(@NonNull Location location) {
if (locationMarker != null) {
locationMarker.remove();
}
LatLng userLocation = new LatLng(location.getLatitude(), location.getLongitude());
if (!followed) {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(userLocation, 15));
followed = true;
}
locationMarker = mMap.addMarker(new MarkerOptions().position(userLocation).title("Your location"));
if (radiusCircle != null) {
radiusCircle.remove();
}
radiusCircle = mMap.addCircle(new CircleOptions().center(locationMarker.getPosition()).radius(Double.parseDouble(PreferenceManager.getDefaultSharedPreferences(this).getString(getString(R.string.pref_radius_key), getString(R.string.pref_radius_default)))).fillColor(Color.argb(195, 102, 147, 173)));
}
示例7: redrawLocationOnMap
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void redrawLocationOnMap()
{
if(locationMarker!=null)
{
LatLng markerLocation = locationMarker.getPosition();
if (!followed) {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(markerLocation, 15));
followed = true;
}
locationMarker = mMap.addMarker(new MarkerOptions().position(markerLocation).title("Your location"));
if (radiusCircle != null) {
radiusCircle.remove();
}
radiusCircle = mMap.addCircle(new CircleOptions().center(locationMarker.getPosition()).radius(Double.parseDouble(PreferenceManager.getDefaultSharedPreferences(this).getString(getString(R.string.pref_radius_key), getString(R.string.pref_radius_default)))).fillColor(Color.argb(195, 102, 147, 173)));
}
else
{
Log.d("MapsActivity", "redrawLocationOnMap called with null==locationMarker");
}
}
示例8: setScanning
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
public void setScanning(boolean scanning) {
if (scanRange != null) scanRange.remove();
if (scanning) {
scanRange = mMap.addCircle(new CircleOptions().center(location).strokeColor(Color.argb(50, 29, 132, 181)).fillColor(Color.argb(30, 29, 132, 181)).radius(50));
scanButton.setVisibility(View.INVISIBLE);
scanProgressBar.setVisibility(View.VISIBLE);
cancelScanButton.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.VISIBLE);
progressBar.setProgress(0);
} else {
scanButton.setVisibility(View.VISIBLE);
scanProgressBar.setVisibility(View.INVISIBLE);
cancelScanButton.setVisibility(View.INVISIBLE);
progressBar.setVisibility(View.INVISIBLE);
scanRange = null;
if (rangeCenter != null) rangeCenter.remove();
rangeCenter = null;
}
}
示例9: nearbyRadius
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void nearbyRadius(LatLng latLng) {
int radius = Integer.parseInt(settingsSharedPreferences.getString("nearby_radius", "100"));
if (nearbyCircle != null) {
nearbyCircle.setCenter(latLng);
nearbyCircle.setRadius(radius);
} else {
CircleOptions nearbyCircleOptions = new CircleOptions()
.center(latLng)
.radius(radius)
.fillColor(Application.getContext().getResources().getColor(R.color.colorPrimaryTransparent))
.strokeWidth(0);
nearbyCircle = googleMap.addCircle(nearbyCircleOptions);
}
nearbyFriends();
}
示例10: DraggableCircle
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
public DraggableCircle(LatLng center, double radiusDouble) {
this.radius = radiusDouble;
centerMarker = mMap.addMarker(new MarkerOptions()
.position(center)
.draggable(true));
radiusMarker = mMap.addMarker(new MarkerOptions()
.position(toRadiusLatLng(center, this.radius))
.draggable(true)
.icon(BitmapDescriptorFactory.defaultMarker(
BitmapDescriptorFactory.HUE_AZURE)));
circle = mMap.addCircle(new CircleOptions()
.center(center)
.radius(this.radius)
.strokeWidth(DEFAULT_CIRCLE_WIDTH)
.strokeColor(DEFAULT_STROKE_COLOR)
.fillColor(DEFAULT_FILL_COLOR));
}
示例11: Result
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
/**
* Reconstructs the result.
*
* @param in The parcel where the result was written to
*/
protected Result(Parcel in) {
bundleId = in.readString();
markers = new ArrayList<>();
ArrayList<MarkerOptions> optionsList = in.createTypedArrayList(MarkerOptions.CREATOR);
ArrayList<Bitmap> bitmapList = in.createTypedArrayList(Bitmap.CREATOR);
ArrayList<Pair<MarkerOptions, Bitmap>> markers = new ArrayList<>();
polylines = in.createTypedArrayList(PolylineOptions.CREATOR);
polygons = in.createTypedArrayList(PolygonOptions.CREATOR);
circles = in.createTypedArrayList(CircleOptions.CREATOR);
if (bitmapList.size() != optionsList.size()){
throw new RuntimeException("optionlist and bitmapList are not equal in size");
}
for (int i = 0; i < optionsList.size(); i++){
markers.add(new Pair<MarkerOptions, Bitmap>(optionsList.get(i),bitmapList.get(i)));
}
this.markers = markers;
}
示例12: addMarker
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void addMarker(LatLng position){
mMap.clear();
mWorkspaceMarker = new MarkerOptions()
.position(position)
.title("Your Workplace")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.location));
mMap.addMarker(mWorkspaceMarker);
// Instantiates a new CircleOptions object and defines the center and radius
double radiusInMeters = 100.0;
int strokeColor = 0xffff0000; //red outline
int shadeColor = 0x44ff0000; //opaque red fill
CircleOptions circleOptions = new CircleOptions().center(position).radius(radiusInMeters).fillColor(shadeColor).strokeColor(strokeColor).strokeWidth(2);
Circle mCircle = mMap.addCircle(circleOptions);
if (myLocation!=null){
calculationByDistance(myLocation,position);
}
mAddressET.setText(getAddressFromCoordinates(position));
}
示例13: drawLocationAccuracyCircle
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void drawLocationAccuracyCircle(Location location){
if(location.getAccuracy() < 0){
return;
}
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
if (this.locationAccuracyCircle == null) {
this.locationAccuracyCircle = map.addCircle(new CircleOptions()
.center(latLng)
.fillColor(Color.argb(64, 0, 0, 0))
.strokeColor(Color.argb(64, 0, 0, 0))
.strokeWidth(0.0f)
.radius(location.getAccuracy())); //set readius to horizonal accuracy in meter.
} else {
this.locationAccuracyCircle.setCenter(latLng);
}
}
示例14: drawPredictionRange
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void drawPredictionRange(Location location){
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
if (this.predictionRange == null) {
this.predictionRange = map.addCircle(new CircleOptions()
.center(latLng)
.fillColor(Color.argb(50, 30, 207, 0))
.strokeColor(Color.argb(128, 30, 207, 0))
.strokeWidth(1.0f)
.radius(30)); //30 meters of the prediction range
} else {
this.predictionRange.setCenter(latLng);
}
this.predictionRange.setVisible(true);
handler.postDelayed(new Runnable() {
@Override
public void run() {
MainActivity.this.predictionRange.setVisible(false);
}
}, 2000);
}
示例15: displayLinesAndAreas
import com.google.android.gms.maps.model.CircleOptions; //导入依赖的package包/类
private void displayLinesAndAreas(List<ILatLonRecord> waypoints) {
try {
PolylineOptions polyline = new PolylineOptions().width(ResourcesHelper.getDimensionPixelSize(this, R.dimen.task_line_width)).color(getResources().getColor(R.color.task_line));
for (int i = 0; i < waypoints.size(); i++) {
CRecordWayPoint cRecordWayPoint = (CRecordWayPoint) waypoints.get(i);
if (cRecordWayPoint.getType() == CRecordType.START || cRecordWayPoint.getType() == CRecordType.TURN || cRecordWayPoint.getType() == CRecordType.FINISH) {
polyline.add(new LatLng(waypoints.get(i).getLatLon().getLat(), waypoints.get(i).getLatLon().getLon()));
}
if (cRecordWayPoint.getType() == CRecordType.TURN) {
googleMap.addCircle(new CircleOptions().center(new LatLng(waypoints.get(i).getLatLon().getLat(), waypoints.get(i).getLatLon().getLon()))
.radius(TaskConfig.getAreaWidth()).strokeColor(Color.TRANSPARENT)
.strokeWidth(getResources().getDimensionPixelSize(R.dimen.task_line_width))
.fillColor(getResources().getColor(R.color.task_fill_color)));
}
}
googleMap.addPolyline(polyline);
} catch (Throwable t) {
Logger.logError("Error trying to draw waypoints: " + t.getMessage());
}
}