示例#1
0
  public void setMarkerLocation(LatLng latLng, Float zoom) {
    if (marker != null) {
      marker.remove();
      radiusCircle.remove();
    }
    marker = googleMap.addMarker(new MarkerOptions().position(latLng));

    googleMap.setOnMarkerClickListener(
        new GoogleMap.OnMarkerClickListener() {
          @Override
          public boolean onMarkerClick(Marker clickedMarker) {
            if (clickedMarker.equals(marker)) {
              Popup.showMarkerOptions(MapFragment.this.getActivity(), marker, radiusCircle);
            }
            return false;
          }
        });
    centerOnLatLng(latLng, zoom);

    String strokeColor = SettingHelper.getSettingValue("mapCircleStrokeColor");
    if (strokeColor == null) strokeColor = "FF425C97";
    String fillColor = SettingHelper.getSettingValue("mapCircleFillColor");
    if (fillColor == null) fillColor = "1E425C97";

    radiusCircle =
        googleMap.addCircle(
            new CircleOptions()
                .center(latLng)
                .radius(radius)
                .strokeColor(Color.parseColor("#" + strokeColor))
                .fillColor(Color.parseColor("#" + fillColor))
                .strokeWidth(2));
  }
  private void removePlaces() {

    Log.d(TAG, "removePlaces");
    for (Circle circle : placesOverlay) {
      circle.remove();
    }
    placesOverlay.clear();
  }
示例#3
0
 public void dibujarDistancia() {
   if (getMap() != null && getMap().isMyLocationEnabled() && getMap().getMyLocation() != null) {
     CircleOptions dOptions = new CircleOptions();
     dOptions.center(
         new LatLng(
             getMap().getMyLocation().getLatitude(), getMap().getMyLocation().getLongitude()));
     dOptions.radius(DataStorage.filtro.getDistancia());
     dOptions.strokeColor(0xFFFF0000);
     dOptions.fillColor(0x22FF0000);
     if (distanciaCirculo != null) {
       distanciaCirculo.remove();
     }
     distanciaCirculo = getMap().addCircle(dOptions);
   }
 }