Java 类com.google.android.gms.maps.model.Circle 实例源码

项目:TrackIn-Android-Application    文件:cordmap.java   
@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)));
    }
项目:PhoneChat    文件:GoogleMaps.java   
/**
 * 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;
  }
}
项目:LivePokemonFinder    文件:MapWrapperFragment.java   
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();
        }
    }
项目:LETO-Toggl_Android    文件:GeofenceSettingsActivity.java   
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));
}
项目:geohashdroid    文件:KnownLocationsPicker.java   
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);
        }
    }
}
项目:accengage-android-sdk-samples    文件:GeofencesDetailsActivity.java   
@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)));
}
项目:PowerSwitch_Android    文件:MapViewHandler.java   
/**
 * 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;
}
项目:Bikeable    文件:GraphToMapConnector.java   
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();
            }
        }
    });
}
项目:downtown    文件:Nearby.java   
@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();
    }
}
项目:neo4art    文件:GoogleMaps.java   
/**
 * 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;
  }
}
项目:neo4art    文件:GoogleMaps.java   
/**
 * 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;
  }
}
项目:neo4art    文件:GoogleMaps.java   
/**
 * 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;
  }
}
项目:refuge    文件:Visualizer.java   
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);
}
项目:climbers    文件:MapsActivity.java   
@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);
}
项目:Rogo    文件:NearYouMapActivity.java   
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)
        );

    }
}
项目:maps-android-codelabs    文件:LocationActivity.java   
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);
}
项目:VennTracker    文件:Circles.java   
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();
}
项目:TrackIn-Android-Application    文件:GPSActivity.java   
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */

public int getZoomLevel(Circle circle) {
    int zoomlevel = 11;
    if (circle != null) {
        double radius = circle.getRadius() + circle.getRadius() / 2;
        double scale = radius / 500;
        zoomlevel = (int) (16 - Math.log(scale) / Math.log(2));
    }
    return zoomlevel;
}
项目:TrackIn-Android-Application    文件:GPSActivity.java   
@Override
public void onMapClick(LatLng point) {
    mMap.clear();
    System.out.println("125");
    CircleOptions circleoptions = new CircleOptions().strokeWidth(2).strokeColor(Color.BLUE).fillColor(Color.parseColor("#500084d3"));
    try {

        com.trackin.iodroid.trackin.GPSTracker gpsTracker = new com.trackin.iodroid.trackin.GPSTracker(getApplicationContext());
        mLocation = gpsTracker.getLocation();

        latitude = mLocation.getLatitude();
        longitude = mLocation.getLongitude();
      /*  Geocoder geocoder = new Geocoder(this);
        geocoder.get*/
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        SupportMapFragment
                mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
        lat = gpsTracker.getLocation().getLatitude();
        lng = gpsTracker.getLocation().getLongitude();
        LatLng currloc = new LatLng(lat, lng);
        mMap.addMarker(new MarkerOptions().position(currloc).title(getAddress(currloc)));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(currloc));
        Circle circle = mMap.addCircle(circleoptions.center(currloc).radius(5000.0));
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(circleoptions.getCenter(), getZoomLevel(circle)));
        final TextView textViewToChange = (TextView) findViewById(R.id.cord);
        textViewToChange.setText("Latittude:"+point.latitude+"\nLongitude"+point.longitude);
        System.out.println("149");
    } catch (Exception e) {
        //toast

    }
    System.out.println("153");
}
项目:TrackIn-Android-Application    文件:cordmap.java   
public int getZoomLevel(Circle circle)
{
    int zoomlevel=11;
    if(circle!=null)
    {
        double radius=circle.getRadius() + circle.getRadius()/2;
        double scale=radius/500;
        zoomlevel=(int) (16-Math.log(scale)/Math.log(2));
    }
    return zoomlevel;
}
项目:TrackIn-Android-Application    文件:addmap.java   
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
public int getZoomLevel(Circle circle)
{
    int zoomlevel=11;
    if(circle!=null)
    {
        double radius=circle.getRadius() + circle.getRadius()/2;
        double scale=radius/500;
        zoomlevel=(int) (16-Math.log(scale)/Math.log(2));
    }
    return zoomlevel;
}
项目:TrackIn-Android-Application    文件:MapsActivity.java   
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
public int getZoomLevel(Circle circle)
{
    int zoomlevel=11;
    if(circle!=null)
    {
        double radius=circle.getRadius() + circle.getRadius()/2;
        double scale=radius/500;
        zoomlevel=(int) (16-Math.log(scale)/Math.log(2));
    }
    return zoomlevel;
}
项目:pokiimap-human    文件:MapWrapperFragment.java   
private void removeAllCircles(){
    long delay = 0;
    for(final Circle circle : circles){
        delay+=200;
        mView.postDelayed(new Runnable() {
            @Override
            public void run() {
                circle.remove();
            }
        }, delay);
    }
    circles.clear();
}
项目:travelers-diary    文件:MapFragment.java   
public void setTodoItemsVisible(boolean visible) {
    for (Map.Entry<Marker, String> entry :
            mTodoRefsMap.entrySet()) {
        Marker marker = entry.getKey();
        if (marker != null) {
            Circle circle = mTodoCirclesMap.get(marker);
            if (circle != null) {
                circle.setVisible(visible);
            }
            marker.setVisible(visible);
        }
    }
}
项目:PhoneChat    文件:PluginCircle.java   
/**
 * Create circle
 * @param args
 * @param callbackContext
 * @throws JSONException 
 */
@SuppressWarnings("unused")
private void createCircle(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  final CircleOptions circleOptions = new CircleOptions();
  int color;

  JSONObject opts = args.getJSONObject(1);
  if (opts.has("center")) {
    JSONObject center = opts.getJSONObject("center");
    circleOptions.center(new LatLng(center.getDouble("lat"), center.getDouble("lng")));
  }
  if (opts.has("radius")) {
    circleOptions.radius(opts.getDouble("radius"));
  }
  if (opts.has("strokeColor")) {
    color = PluginUtil.parsePluginColor(opts.getJSONArray("strokeColor"));
    circleOptions.strokeColor(color);
  }
  if (opts.has("fillColor")) {
    color = PluginUtil.parsePluginColor(opts.getJSONArray("fillColor"));
    circleOptions.fillColor(color);
  }
  if (opts.has("strokeWidth")) {
    circleOptions.strokeWidth(opts.getInt("strokeWidth") * this.density);
  }
  if (opts.has("visible")) {
    circleOptions.visible(opts.getBoolean("visible"));
  }
  if (opts.has("zIndex")) {
    circleOptions.zIndex(opts.getInt("zIndex"));
  }
  Circle circle = map.addCircle(circleOptions);
  String id = "circle_" + circle.getId();
  this.objects.put(id, circle);

  JSONObject result = new JSONObject();
  result.put("hashCode", circle.hashCode());
  result.put("id", id);
  callbackContext.success(result);
}
项目:PhoneChat    文件:PluginCircle.java   
/**
 * set center
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void setCenter(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  LatLng center = new LatLng(args.getDouble(2), args.getDouble(3));
  Circle circle = this.getCircle(id);
  circle.setCenter(center);
  callbackContext.success();
}
项目:PhoneChat    文件:PluginCircle.java   
/**
 * Remove the circle
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void remove(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  Circle circle = this.getCircle(id);
  if (circle == null) {
    this.sendNoResult(callbackContext);
    return;
  }
  circle.remove();
  this.objects.remove(id);
  this.sendNoResult(callbackContext);
}
项目:LivePokemonFinder    文件:MapWrapperFragment.java   
private void drawCatchedPokemonCircle(double latitude, double longitude) {

        if (mGoogleMap != null && mPref.getShowScannedPlaces()) {
            double radiusInMeters = MapHelper.SCAN_RADIUS;
            int shadeColor = 0x44DCD90D; // fill
            CircleOptions circleOptions = new CircleOptions()
                    .center(new LatLng(latitude, longitude))
                    .radius(radiusInMeters).fillColor(shadeColor)
                    .strokeColor(Color.TRANSPARENT)
                    .zIndex(MapHelper.LAYER_SCANNED_LOCATIONS);
            final Circle circle = mGoogleMap.addCircle(circleOptions);
            userSelectedPositionCircles.add(circle);
        }
    }
项目:Nearby-Shops-Distributor-Android-app    文件:PickLocationActivity.java   
public int getZoomLevel(Circle circle)
{
    int zoomLevel = 11;
    if (circle != null)
    {
        double radius = circle.getRadius();
        double scale = radius / 500;
        zoomLevel = (int) Math.floor((16 - Math.log(scale) / Math.log(2)));
    }
    return zoomLevel ;
}
项目:Nearby-Shops-End-User-Android-app    文件:ShopDetail.java   
public int getZoomLevel(Circle circle)
{
    int zoomLevel = 11;
    if (circle != null)
    {
        double radius = circle.getRadius();
        double scale = radius / 500;
        zoomLevel = (int) Math.floor((16 - Math.log(scale) / Math.log(2)));
    }
    return zoomLevel ;
}
项目:Nearby-Shops-End-User-Android-app    文件:FilterShops.java   
void drawShops()
    {

        for(Shop shop: dataset)
        {
            LatLng latLng = new LatLng(
                    shop.getLatCenter(),
                    shop.getLonCenter()
            );

            Marker marker = mMap.addMarker(new MarkerOptions()
                    .position(latLng)
                    .snippet(shop.getShopAddress() + "\n" + shop.getCity())
                    .title(shop.getShopName())
            );

//            marker.showInfoWindow();

            Circle circle = mMap.addCircle(
                    new CircleOptions()
                            .center(latLng)
                            .fillColor(0x11000000)
                            .radius(shop.getDeliveryRange()*1000)
                            .strokeWidth(1)
            );

            circleMap.put(shop.getShopID(),circle);
            markerMap.put(shop.getShopID(),marker);

        }

    }
项目:Nearby-Shops-End-User-Android-app    文件:FilterShops.java   
public int getZoomLevel(Circle circle)
{
    int zoomLevel = 11;
    if (circle != null)
    {
        double radius = circle.getRadius();
        double scale = radius / 500;
        zoomLevel = (int) Math.floor((16 - Math.log(scale) / Math.log(2)));
    }
    return zoomLevel ;
}
项目:geohashdroid    文件:KnownLocationsPicker.java   
private void confirmKnownLocationFromDialog(@NonNull String name,
                                            @NonNull LatLng location,
                                            double range,
                                            boolean restrictGraticule,
                                            @NonNull Address address) {
    // An address!  We know what to do with this, right?
    KnownLocation newLoc = new KnownLocation(name, location, range, restrictGraticule);

    // Of course we do!  It's guaranteed to be a new marker!
    mLocations.add(newLoc);

    // And what's more, it's guaranteed to have an old version on the map!
    mActiveAddressMap.inverse().remove(address).remove();

    // Then, replace it with the new one.
    Marker newMark = mMap.addMarker(makeExistingMarker(newLoc));
    Circle newCircle = mMap.addCircle(newLoc.makeCircle(this));
    mMarkerMap.forcePut(newMark, newLoc);
    mCircleMap.forcePut(newCircle, newLoc);
    KnownLocation.storeKnownLocations(this, mLocations);

    mActiveAddresses.remove(address);
    if(mActiveMarker != null) mActiveMarker.remove();

    // Done!
    removeActiveKnownLocation();
}
项目:geohashdroid    文件:KnownLocationsPicker.java   
private void confirmKnownLocationFromDialog(@NonNull String name,
                                            @NonNull LatLng location,
                                            double range,
                                            boolean restrictGraticule,
                                            @Nullable KnownLocation existing) {
    // Okay, we got location data in.  Make one!
    KnownLocation newLoc = new KnownLocation(name, location, range, restrictGraticule);

    // Is this new or a replacement?
    if(existing != null) {
        // Replacement!  Or rather, remove the old one and re-add the new
        // one in place.
        int oldIndex = mLocations.indexOf(existing);
        mLocations.remove(oldIndex);
        mLocations.add(oldIndex, newLoc);

        // Since this is an existing KnownLocation, the marker should be in
        // that map, ripe for removal.
        mMarkerMap.inverse().remove(existing).remove();
        mCircleMap.inverse().remove(existing).remove();
    } else {
        // Brand new!
        mLocations.add(newLoc);
    }

    // In both cases, store the data and add a new marker.
    Marker newMark = mMap.addMarker(makeExistingMarker(newLoc));
    Circle newCircle = mMap.addCircle(newLoc.makeCircle(this));
    mMarkerMap.forcePut(newMark, newLoc);
    mCircleMap.forcePut(newCircle, newLoc);
    KnownLocation.storeKnownLocations(this, mLocations);

    // And remove the marker from the map.  The visual one this time.
    // TODO: Null-checking shouldn't be necessary here.
    if(mActiveMarker != null) mActiveMarker.remove();

    // And end the active parts.
    removeActiveKnownLocation();
}
项目:RxGoogleMaps    文件:CircleClickFunc.java   
@Override
public Observable<Circle> call(final GoogleMap googleMap) {
    return Observable.create(new Observable.OnSubscribe<Circle>() {
        @Override
        public void call(final Subscriber<? super Circle> subscriber) {
            googleMap.setOnCircleClickListener(new GoogleMap.OnCircleClickListener() {
                @Override
                public void onCircleClick(Circle circle) {
                    subscriber.onNext(circle);
                }
            });
        }
    });
}
项目:RxGoogleMaps    文件:CircleClickFuncTest.java   
@Test
public void shouldEmmitMarker() throws Exception {
    TestSubscriber<Circle> testSubscriber = new TestSubscriber<>();
    new CircleClickFunc().call(googleMap)
                         .subscribe(testSubscriber);
    verify(googleMap).setOnCircleClickListener(argumentCaptor.capture());
    argumentCaptor.getValue().onCircleClick(null);
    testSubscriber.assertNoErrors();
    testSubscriber.assertValueCount(1);
    argumentCaptor.getValue().onCircleClick(null);
    testSubscriber.assertValueCount(2);
}
项目:accengage-android-sdk-samples    文件:Utils.java   
/**
 * Calculates the optimal zoom to apply to the maps' camera when drawing a geofence using circle
 * @param circle you want to zoom to
 * @return the best zoom level
 */
public static int getZoomLevel(Circle circle) {
    int zoomLevel = 11;
    if (circle != null) {
        double radius = circle.getRadius() + circle.getRadius() / 2;
        double scale = radius / 500;
        zoomLevel = (int) (15 - Math.log(scale) / Math.log(2));
    }
    return zoomLevel;
}
项目:travelers-diary    文件:MapFragment.java   
public void setTodoItemsVisible(boolean visible) {
    for (Map.Entry<Marker, String> entry :
            mTodoRefsMap.entrySet()) {
        Marker marker = entry.getKey();
        if (marker != null) {
            Circle circle = mTodoCirclesMap.get(marker);
            if (circle != null) {
                circle.setVisible(visible);
            }
            marker.setVisible(visible);
        }
    }
}
项目:neo4art    文件:PluginCircle.java   
/**
 * Create circle
 * @param args
 * @param callbackContext
 * @throws JSONException 
 */
@SuppressWarnings("unused")
private void createCircle(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  final CircleOptions circleOptions = new CircleOptions();
  int color;

  JSONObject opts = args.getJSONObject(1);
  if (opts.has("center")) {
    JSONObject center = opts.getJSONObject("center");
    circleOptions.center(new LatLng(center.getDouble("lat"), center.getDouble("lng")));
  }
  if (opts.has("radius")) {
    circleOptions.radius(opts.getDouble("radius"));
  }
  if (opts.has("strokeColor")) {
    color = PluginUtil.parsePluginColor(opts.getJSONArray("strokeColor"));
    circleOptions.strokeColor(color);
  }
  if (opts.has("fillColor")) {
    color = PluginUtil.parsePluginColor(opts.getJSONArray("fillColor"));
    circleOptions.fillColor(color);
  }
  if (opts.has("strokeWidth")) {
    circleOptions.strokeWidth(opts.getInt("strokeWidth") * this.density);
  }
  if (opts.has("visible")) {
    circleOptions.visible(opts.getBoolean("visible"));
  }
  if (opts.has("zIndex")) {
    circleOptions.zIndex(opts.getInt("zIndex"));
  }
  Circle circle = map.addCircle(circleOptions);
  String id = "circle_" + circle.getId();
  this.objects.put(id, circle);

  JSONObject result = new JSONObject();
  result.put("hashCode", circle.hashCode());
  result.put("id", id);
  callbackContext.success(result);
}
项目:neo4art    文件:PluginCircle.java   
/**
 * set center
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void setCenter(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  LatLng center = new LatLng(args.getDouble(2), args.getDouble(3));
  Circle circle = this.getCircle(id);
  circle.setCenter(center);
  callbackContext.success();
}