Exemplo n.º 1
0
  public void UpdateMarker() {
    marker.setTitle(
        (isInvoln() ? "Powered up " : "")
            + PlayerType.getTypeString(type)
            + " "
            + (local ? "You" : name));
    int drawableID = PlayerType.getDrawableID(type);

    Bitmap bmp = BitmapFactory.decodeResource(Game.getAppContext().getResources(), drawableID);

    if (bmp == null) {
      return;
    }

    double aspect = bmp.getWidth() / (double) bmp.getHeight();
    marker.setIcon(
        BitmapDescriptorFactory.fromBitmap(
            Bitmap.createScaledBitmap(bmp, (int) (100 * aspect), 100, false)));
    marker.setAlpha(isCooldown() ? 0.5f : 1f);
    marker.setVisible(true);
    marker.setPosition(new LatLng(latitude, longitude));
    marker.setSnippet("Score: " + score);
    accuracyCircle.setCenter(new LatLng(latitude, longitude));
    accuracyCircle.setRadius(accuracy);
  }
Exemplo n.º 2
0
  private void removePlaces() {

    Log.d(TAG, "removePlaces");
    for (Circle circle : placesOverlay) {
      circle.remove();
    }
    placesOverlay.clear();
  }
Exemplo n.º 3
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));
  }
Exemplo n.º 4
0
 public MapFragment changeRadius(double changechange) {
   if (radiusCircle != null) {
     if (radius + changechange < 0) radius = 0;
     else radius += changechange;
     radiusCircle.setRadius(radius);
   }
   return this;
 }
Exemplo n.º 5
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);
   }
 }
Exemplo n.º 6
0
 public double getRadius() {
   if (radiusCircle != null) return radiusCircle.getRadius();
   return 0;
 }