當前位置: 首頁>>代碼示例>>Java>>正文


Java Circle類代碼示例

本文整理匯總了Java中com.google.android.gms.maps.model.Circle的典型用法代碼示例。如果您正苦於以下問題:Java Circle類的具體用法?Java Circle怎麽用?Java Circle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Circle類屬於com.google.android.gms.maps.model包,在下文中一共展示了Circle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMapReady

import com.google.android.gms.maps.model.Circle; //導入依賴的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)));
    }
 
開發者ID:jamesgeorge007,項目名稱:TrackIn-Android-Application,代碼行數:17,代碼來源:cordmap.java

示例2: isCircleContains

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
/**
 * Check if a circle contains a point
 * @param circle
 * @param point
 */
private boolean isCircleContains(Circle circle, LatLng point) {
  double r = circle.getRadius();
  LatLng center = circle.getCenter();
  double cX = center.latitude;
  double cY = center.longitude;
  double pX = point.latitude;
  double pY = point.longitude;

  float[] results = new float[1];

  Location.distanceBetween(cX, cY, pX, pY, results);

  if(results[0] < r) {
    return true;
  } else {
    return false;
  }
}
 
開發者ID:AdrianBZG,項目名稱:PhoneChat,代碼行數:24,代碼來源:GoogleMaps.java

示例3: clearPokemonCircles

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
private void clearPokemonCircles() {

        //Check and eventually remove old marker
        if (userSelectedPositionMarkers != null && userSelectedPositionCircles != null) {

            for (Marker marker : userSelectedPositionMarkers) {
                marker.remove();
            }
            userSelectedPositionMarkers.clear();

            for (Circle circle : userSelectedPositionCircles) {
                circle.remove();
            }
            userSelectedPositionCircles.clear();
        }
    }
 
開發者ID:shivarajp,項目名稱:LivePokemonFinder,代碼行數:17,代碼來源:MapWrapperFragment.java

示例4: addMarker

import com.google.android.gms.maps.model.Circle; //導入依賴的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));
}
 
開發者ID:letolab,項目名稱:LETO-Toggl_Android,代碼行數:22,代碼來源:GeofenceSettingsActivity.java

示例5: initKnownLocations

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
private void initKnownLocations() {
    if(mMarkerMap != null) {
        for(Marker m : mMarkerMap.keySet())
            m.remove();
    }

    if(mCircleMap != null) {
        for(Circle c : mCircleMap.keySet())
            c.remove();
    }

    mMarkerMap = HashBiMap.create();
    mCircleMap = HashBiMap.create();

    if(!mLocations.isEmpty()) {
        for(KnownLocation kl : mLocations) {
            // Each KnownLocation gives us a MarkerOptions we can use.
            Log.d(DEBUG_TAG, "Making marker for KnownLocation " + kl.toString() + " at a range of " + kl.getRange() + "m");
            Marker newMark = mMap.addMarker(makeExistingMarker(kl));
            Circle newCircle = mMap.addCircle(kl.makeCircle(this));
            mMarkerMap.put(newMark, kl);
            mCircleMap.put(newCircle, kl);
        }
    }
}
 
開發者ID:CaptainSpam,項目名稱:geohashdroid,代碼行數:26,代碼來源:KnownLocationsPicker.java

示例6: onMapReady

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
@Override
public void onMapReady(GoogleMap googleMap) {
    LatLng myPosition = new LatLng(
            Double.valueOf(mGeofencesList.get(Utils.LATITUDE)),
            Double.valueOf(mGeofencesList.get(Utils.LONGITUDE)));
    MarkerOptions mo = new MarkerOptions()
            .position(myPosition)
            .visible(true)
            .title(mGeofencesList.get(Utils.NAME));
    Marker marker = googleMap.addMarker(mo);
    marker.showInfoWindow();

    Circle circle = googleMap.addCircle(new CircleOptions()
            .center(myPosition)
            .radius(Double.valueOf(mGeofencesList.get(Utils.RADIUS)))
            .strokeColor(Color.RED));

    googleMap.moveCamera(CameraUpdateFactory.newLatLng(myPosition));
    googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(myPosition, Utils.getZoomLevel(circle)));
}
 
開發者ID:Accengage,項目名稱:accengage-android-sdk-samples,代碼行數:21,代碼來源:GeofencesDetailsActivity.java

示例7: addGeofence

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
/**
 * Add Geofence to Map
 *
 * @param latLng position
 * @param radius radius
 * @return Geofence
 */
public Geofence addGeofence(LatLng latLng, double radius) {
    MarkerOptions markerOptions = new MarkerOptions()
            .position(latLng)
            .draggable(true);
    Marker marker = googleMap.addMarker(markerOptions);

    CircleOptions circleOptions = new CircleOptions().center(latLng)
            .radius(radius)
            .fillColor(ContextCompat.getColor(context, R.color.geofenceFillColor))
            .strokeColor(Color.BLUE)
            .strokeWidth(2);
    Circle circle = googleMap.addCircle(circleOptions);

    circles.put(circle.getId(), circle);
    Geofence geofence = new Geofence(marker, circle);
    geofences.put(marker.getId(), geofence);

    return geofence;
}
 
開發者ID:Power-Switch,項目名稱:PowerSwitch_Android,代碼行數:27,代碼來源:MapViewHandler.java

示例8: removeCircleAfterSomeTime

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
public void removeCircleAfterSomeTime(final Circle circle) {
    final Handler handler = new Handler();
    final long start = SystemClock.uptimeMillis();

    final long duration = 500;

    final Interpolator interpolator = new LinearInterpolator();

    handler.post(new Runnable() {
        @Override
        public void run() {
            long elapsed = SystemClock.uptimeMillis() - start;
            float t = interpolator.getInterpolation((float) elapsed
                    / duration);

            if (t < 1.0) {
                // Post again 16ms later.
                handler.postDelayed(this, 16);
            } else {
                circle.remove();
            }
        }
    });
}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:25,代碼來源:GraphToMapConnector.java

示例9: drawCircle

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
@SuppressLint("NewApi")
private void drawCircle(){
    final Circle circle = map.addCircle(new CircleOptions()
            .center(new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()))
            .strokeColor(Color.BLUE).radius(100));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ValueAnimator vAnimator = new ValueAnimator();
        vAnimator.setRepeatCount(0);
        vAnimator.setRepeatMode(ValueAnimator.RESTART);  /* PULSE */
        vAnimator.setIntValues(0, 100);
        vAnimator.setDuration(1000);
        vAnimator.setEvaluator(new IntEvaluator());
        vAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
        vAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                float animatedFraction = valueAnimator.getAnimatedFraction();
                // Log.e("", "" + animatedFraction);
                circle.setRadius(animatedFraction * 100);
            }
        });
        vAnimator.start();
    }
}
 
開發者ID:dklisiaris,項目名稱:downtown,代碼行數:26,代碼來源:Nearby.java

示例10: isCircleContains

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
/**
 * Check if a circle contains a point
 * @param circle
 * @param point
 */
private boolean isCircleContains(Circle circle, LatLng point) {
  double r = circle.getRadius();
  LatLng center = circle.getCenter();
  double cX = center.latitude;
  double cY = center.longitude;
  double pX = point.latitude;
  double pY = point.longitude;
  
  float[] results = new float[1];
  
  Location.distanceBetween(cX, cY, pX, pY, results);
  
  if(results[0] < r) {
    return true;
  } else {
    return false;
  }
}
 
開發者ID:neo4art,項目名稱:neo4art,代碼行數:24,代碼來源:GoogleMaps.java

示例11: drawScaledCircle

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
private static Circle drawScaledCircle(GoogleMap map,
                                      LatLng coordinates,
                                      double percent,
                                      int strokeColor,
                                      int fillColor) {
    Log.d(TAG, "drawScaledCircle() - percent: " + percent);
    double circleArea = percent * MAX_AREA;
    double radius = Math.sqrt(circleArea / Math.PI);
    Log.d(TAG, "drawScaledCircle() - radius (m): " + radius + " circleArea: " + circleArea + " percent: " + percent + " max Area: " + MAX_AREA);
    CircleOptions circleOptions = new CircleOptions()
            .center(coordinates)
            .radius(radius)
            .fillColor(fillColor)
            .strokeColor(strokeColor)
            .strokeWidth(5);
    return map.addCircle(circleOptions);
}
 
開發者ID:peter-tackage,項目名稱:refuge,代碼行數:18,代碼來源:Visualizer.java

示例12: onMapClick

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
@Override
public void onMapClick(LatLng arg0) {
	map.clear();
	CircleOptions circleOptions = new CircleOptions()
	.center(arg0)
	.radius(1000)
	.strokeWidth(2).strokeColor(Color.BLUE)
	.fillColor(Color.parseColor("#500084d3"));

	this.map_act.setPosition(arg0);
	Circle circle = map.addCircle(circleOptions);
	seekBarListener.setCircle(circle);
	map_act.resetSeekBar();
	map_act.setPosition(arg0);
	map_act.setRadius(1000);
}
 
開發者ID:leonardoalt,項目名稱:climbers,代碼行數:17,代碼來源:MapsActivity.java

示例13: goToCurrentLocation

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
protected void goToCurrentLocation() {
	loc = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
 	Location locate = loc.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    if (loc == null) {
        Toast.makeText(this, "Current location is not available", Toast.LENGTH_SHORT).show();
    }
    else {
        Toast.makeText(this, "Current location is available", Toast.LENGTH_SHORT).show();
        LatLng ll = new LatLng(locate.getLatitude(), locate.getLongitude());
        CameraUpdate update = CameraUpdateFactory.newLatLngZoom(ll, DEFAULTZOOM);
        mMap.animateCamera(update);
        Circle circle = mMap.addCircle(new CircleOptions()
        .center(new LatLng(locate.getLatitude(), locate.getLongitude()))
        .radius(7)
        .strokeColor(Color.BLUE)
        .fillColor(Color.GREEN)
        );
        
    }
}
 
開發者ID:Nirespire,項目名稱:Rogo,代碼行數:21,代碼來源:NearYouMapActivity.java

示例14: removeGeoFences

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
private void removeGeoFences() {
    List<String> requestIdsForRemoval = new ArrayList<String>();
    if (mGeoFences.isEmpty())
        return;
    for (Map.Entry<String, Circle> entry : mGeoFences.entrySet()) {
        String requestId = entry.getKey();
        Circle circle = entry.getValue();
        if (circle != null) {
            circle.remove();
            id--;
            Log.v(LocationActivity.TAG, "RemoveGeoFence requestId == " + requestId);
            Circle triggeringCircle = mTriggeringFences.get(requestId);
            if (triggeringCircle != null) {
                triggeringCircle.remove();
            }
            requestIdsForRemoval.add(requestId);
        }
    }
    mGeoFences.clear();
    mTriggeringFences.clear();
    mLocationClient.removeGeofences(requestIdsForRemoval, this);
}
 
開發者ID:saxman,項目名稱:maps-android-codelabs,代碼行數:23,代碼來源:LocationActivity.java

示例15: clearPolygons

import com.google.android.gms.maps.model.Circle; //導入依賴的package包/類
public static void clearPolygons(Context context) {
    // Remove all polygons from map
    for (Polygon polygon : mPolygonsToClear) {
        polygon.remove();
    }
    for (Circle circle : mPolygonsRedToClear) {
        circle.remove();
    }
    for (Marker marker : mIntersectingToClear) {
        marker.remove();
    }
    mIntersecting.clear();
    mIntersectingToClear.clear();
    mPolygonsRedToClear.clear();
    mPolygonsRed.clear();
    // Clear ArrayList holding polygons
    mPolygonsToClear.clear();
    // Clear ArrayList holding polygon point LatLng objects
    mPolygonPointsGreen.clear();

    DatabaseHelper myDb = DatabaseHelper.getInstance(context);
    // Clear ArrayList containing hole LatLng objects
    mHoles.clear();
    // Reset transparency on all markers
    SpawnLocation.markerResetTransparency();

    // Remove from database
    myDb.removeAllHoles();
    myDb.removePolygons();
    myDb.removeCircles();
    myDb.removeIntersections();
    myDb.close();
}
 
開發者ID:kav0rka,項目名稱:VennTracker,代碼行數:34,代碼來源:Circles.java


注:本文中的com.google.android.gms.maps.model.Circle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。