@Override
  public void updateMapLayer() {
    MapType mapType = Controller.getInstance().getPreferencesManager().getMapType();
    if (mapType == currentMapType) return;
    currentMapType = mapType;

    if (customTileOverlay != null) customTileOverlay.remove();
    customTileOverlay = null;

    switch (mapType) {
      case GoogleNormal:
        googleMap.setMapType(MAP_TYPE_NORMAL);
        return;
      case GoogleSatellite:
        googleMap.setMapType(MAP_TYPE_SATELLITE);
        return;
      case GoogleTerrain:
        googleMap.setMapType(MAP_TYPE_TERRAIN);
        return;
      case GoogleHybrid:
        googleMap.setMapType(MAP_TYPE_HYBRID);
        return;
    }

    googleMap.setMapType(MAP_TYPE_NONE); // Don't display any google layer

    UrlTileProvider provider = getTileProvider(mapType);
    if (provider != null) {
      customTileOverlay = googleMap.addTileOverlay(new TileOverlayOptions().tileProvider(provider));
      customTileOverlay.setZIndex(-100);
    }
  }
 private void updateMyOverlay() {
   if (!checkReady()) {
     return;
   }
   if (mMyOverlayCheckbox.isChecked()) {
     // wmsTileOverlay = mMap.addTileOverlay(new
     // TileOverlayOptions().tileProvider(wmsTileProvider));
     wmsTileOverlay.setVisible(true);
   } else {
     // wmsTileOverlay.remove();
     wmsTileOverlay.setVisible(false);
   }
 }
 public void changeOpacity(View view) {
   if (mDefaultOpacity) {
     mProvider.setOpacity(ALT_HEATMAP_OPACITY);
   } else {
     mProvider.setOpacity(HeatmapTileProvider.DEFAULT_OPACITY);
   }
   mOverlay.clearTileCache();
   mDefaultOpacity = !mDefaultOpacity;
 }
 public void changeGradient(View view) {
   if (mDefaultGradient) {
     mProvider.setGradient(ALT_HEATMAP_GRADIENT);
   } else {
     mProvider.setGradient(HeatmapTileProvider.DEFAULT_GRADIENT);
   }
   mOverlay.clearTileCache();
   mDefaultGradient = !mDefaultGradient;
 }
 public void changeRadius(View view) {
   if (mDefaultRadius) {
     mProvider.setRadius(ALT_HEATMAP_RADIUS);
   } else {
     mProvider.setRadius(HeatmapTileProvider.DEFAULT_RADIUS);
   }
   mOverlay.clearTileCache();
   mDefaultRadius = !mDefaultRadius;
 }
  private void setUpMap() {
    wmsTileProvider = TileProviderFactory.getOsgeoWmsTileProvider();
    wmsTileOverlay = mMap.addTileOverlay(new TileOverlayOptions().tileProvider(wmsTileProvider));
    wmsTileOverlay.setVisible(false);

    // Because the demo WMS layer we are using is just a white background map, switch the base layer
    // to satellite so we can see the WMS overlay.
    // mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
    mMap.setMapType(GoogleMap.MAP_TYPE_NONE);

    // LatLng latLng = new LatLng(28.0886, -16.2762);
    LatLng latLng = new LatLng(Double.parseDouble(y), Double.parseDouble(x));
    Marker mMarker = mMap.addMarker(new MarkerOptions().position(latLng).title(name));
    mMarker.showInfoWindow();

    CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 15);
    mMap.animateCamera(cameraUpdate, 2000, null);
  }
 public void removeHeatMap() {
   mOverlay.remove();
 }