コード例 #1
1
ファイル: Maps2Activity.java プロジェクト: gebuh/wsandroid
  @Override
  /**
   * - Capture the clicked cluster so we can use it in custom infoWindow - Check overall bounds of
   * items in cluster - If the bounds are empty (all hosts at same place) then let it pop the info
   * window - Otherwise, move the camera to show the bounds of the map
   */
  public boolean onClusterClick(Cluster<HostBriefInfo> cluster) {
    mLastClickedCluster = cluster; // remember for use later in the Adapter

    // Find out the bounds of the hosts currently in cluster
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (HostBriefInfo host : cluster.getItems()) {
      builder.include(host.getLatLng());
    }
    LatLngBounds bounds = builder.build();

    // If the hosts are not all at the same location, then change bounds of map.
    if (!bounds.southwest.equals(bounds.northeast)) {
      // Offset from edge of map in pixels when exploding cluster
      View mapView = findViewById(R.id.map_fragment);
      int padding_percent = getResources().getInteger(R.integer.cluster_explode_padding_percent);
      int padding = Math.min(mapView.getHeight(), mapView.getWidth()) * padding_percent / 100;
      CameraUpdate cu =
          CameraUpdateFactory.newLatLngBounds(
              bounds, mapView.getWidth(), mapView.getHeight(), padding);
      mMap.animateCamera(cu);
      return true;
    }
    showMultihostSelectDialog((ArrayList<HostBriefInfo>) cluster.getItems());
    return true;
  }
コード例 #2
0
  public void pause() {

    // Show the finish button
    finishButton.setVisibility(View.VISIBLE);

    // Changes the text and the colour of the button
    startButton.setText("Resume");
    startButton.getBackground().setColorFilter(Color.GREEN, PorterDuff.Mode.MULTIPLY);

    // Save the current time
    timeWhenPaused = myChrono.getBase() - SystemClock.elapsedRealtime();
    myChrono.stop();

    // Set a yellow marker on the current paused location
    LatLng pauseLocation = new LatLng(latitude, longitude);
    map.addMarker(
        new MarkerOptions()
            .position(pauseLocation)
            .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW)));

    // Zoom out to fit route points on the map.
    // This shows the user the total distance travelled on the map
    int last = routePoints.size();
    if (last >= 2) {

      LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
      for (int i = 0; i < last; i++) {
        boundsBuilder.include(routePoints.get(i));
      }

      LatLngBounds bounds = boundsBuilder.build();
      map.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 180));
    } else ;
  }
コード例 #3
0
  public void addHeatMap(List<GridPoint> gridPointList) {
    clearMap();
    List<LatLng> list = new ArrayList<LatLng>();
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    LatLng latLng = null;

    for (GridPoint gridPoint : gridPointList) {
      latLng =
          new LatLng(
              gridPoint.getLocation().getLatitude().doubleValue(),
              gridPoint.getLocation().getLongitude().doubleValue());
      list.add(latLng);
      builder.include(latLng);
    }

    if (list.size() < 1) {
      return;
    }

    mProvider = new HeatmapTileProvider.Builder().data(list).build();
    mOverlay = googleMap.addTileOverlay(new TileOverlayOptions().tileProvider(mProvider));

    if (gridPointList.size() > 1) {
      LatLngBounds bounds = builder.build();
      CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 0);
      googleMap.animateCamera(cu);
    } else if (gridPointList.size() > 0) {
      CameraPosition cameraPosition =
          new CameraPosition.Builder().target(latLng).zoom(zoomLevel).bearing(0).tilt(45).build();
      googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    }
    markersDisplayed = false;
    heatmapDisplayed = true;
    clusterDisplayed = false;
  }
コード例 #4
0
    public void bind(final Context context, @NonNull final Accident accident) {
      mMapView.onResume();

      final int flags =
          DateUtils.FORMAT_SHOW_TIME
              | DateUtils.FORMAT_ABBREV_WEEKDAY
              | DateUtils.FORMAT_ABBREV_MONTH
              | DateUtils.FORMAT_SHOW_DATE;
      mTimeView.setText(
          DateUtils.getRelativeDateTimeString(
              context,
              accident.getTimestamp(),
              DateUtils.MINUTE_IN_MILLIS,
              DateUtils.DAY_IN_MILLIS,
              flags));

      mMaxSpeedView.setText(
          context.getString(
              R.string.max_speed_format, SpeedConverter.mpsToKph(accident.getMaxSpeed())));

      mTrackPolyline = new PolylineOptions();
      final LatLngBounds.Builder builder = new LatLngBounds.Builder();
      final List<AccidentPoint> points = accident.getPoints();
      for (final AccidentPoint point : points) {
        final LatLng latLng = point.asLatLng();
        mTrackPolyline.add(latLng);
        builder.include(latLng);
      }
      mMapBounds = builder.build();
      if (mMapLoaded) {
        showBoundsOnGoogleMap(mMapBounds);
        drawPolygonOnMap(mTrackPolyline);
      }
    }
コード例 #5
0
 private LatLngBounds getBounds(List<LatLng> pointsList) {
   LatLngBounds.Builder builder = new LatLngBounds.Builder();
   for (LatLng point : pointsList) {
     builder.include(point);
   }
   return builder.build();
 }
コード例 #6
0
 private LatLng calculateClusterPosition() {
   LatLngBounds.Builder builder = LatLngBounds.builder();
   for (DelegatingMarker m : markers) {
     builder.include(m.getPosition());
   }
   return builder.build().getCenter();
 }
コード例 #7
0
  /**
   * 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.
   */
  @Override
  public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mClusterManager = new ClusterManager<>(this, mMap);
    mClusterManager.setRenderer(new CaseRenderer());
    mClusterManager.setOnClusterClickListener(this);
    mClusterManager.setOnClusterItemInfoWindowClickListener(this);

    //        mClusterManager.getClusterMarkerCollection().setOnInfoWindowAdapter(new
    // MyCustomAdapterForClusters());
    //        mMap.setInfoWindowAdapter(mClusterManager.getMarkerManager());

    mMap.setOnCameraChangeListener(mClusterManager);
    mMap.setOnMarkerClickListener(mClusterManager);
    mMap.setOnInfoWindowClickListener(mClusterManager);
    mMap.setOnCameraChangeListener(mClusterManager);

    try {
      cases = readMapData();
      Log.d("Heath", "cases size:" + cases.size());
      float average_unit_price = getAverageUnitPrice(cases);
      average_unit_price_90p = average_unit_price * 0.9f;
      average_unit_price_110p = average_unit_price * 1.1f;
    } catch (JSONException e) {
      e.printStackTrace();
    }
    Log.d("CAC", "cases count:" + cases.size());
    mClusterManager.addItems(cases);
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (Case _case : cases) {
      builder.include(_case.getPosition());
    }
    LatLngBounds bounds = builder.build();
    mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 480, 800, 50));
  }
コード例 #8
0
ファイル: MapUtils.java プロジェクト: pablanco/taskManager
  @Override
  protected MapLocationBounds newMapBounds(List<MapLocation> locations) {
    // Override to use LatLngBounds implementation directly.
    LatLngBounds.Builder builder = LatLngBounds.builder();
    for (MapLocation location : locations) builder.include(location.getLatLng());

    return new MapLocationBounds(builder.build());
  }
コード例 #9
0
 private LatLngBounds getBounds() {
   LatLngBounds.Builder builder = LatLngBounds.builder();
   for (RoutePoint point : route.getRoutePointList()) {
     LatLng latLng = new LatLng(point.getLatitude(), point.getLongitude());
     builder.include(latLng);
   }
   return builder.build();
 }
コード例 #10
0
  public static void fixZoomForMarkers(GoogleMap googleMap, List<Marker> markers) {
    if (markers != null && markers.size() > 0) {
      LatLngBounds.Builder bc = new LatLngBounds.Builder();

      for (Marker marker : markers) {
        bc.include(marker.getPosition());
      }

      googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bc.build(), 50), 4000, null);
    }
  }
コード例 #11
0
  public static void fixZoomForLatLngs(GoogleMap googleMap, List<LatLng> latLngs) {
    if (latLngs != null && latLngs.size() > 0) {
      LatLngBounds.Builder bc = new LatLngBounds.Builder();

      for (LatLng latLng : latLngs) {
        bc.include(latLng);
      }

      googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bc.build(), 50), 4000, null);
    }
  }
コード例 #12
0
ファイル: MainActivity.java プロジェクト: b73597/IPV
 @Override
 protected void onPostExecute(ArrayList<Item> arrayList) {
   if (isCancelled()) return;
   googleMap.clear();
   LatLngBounds.Builder boundBuilder = new LatLngBounds.Builder();
   for (Item item : arrayList) {
     googleMap.addMarker(new MarkerOptions().position(item.location()).title(item.name));
     boundBuilder.include(item.location());
   }
   CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(boundBuilder.build(), 200);
   googleMap.moveCamera(cameraUpdate);
   googleMap.animateCamera(cameraUpdate, 1000, null);
 }
コード例 #13
0
  /**
   * Create polyline
   *
   * @param args
   * @param callbackContext
   * @throws JSONException
   */
  @SuppressWarnings("unused")
  private void createPolyline(final JSONArray args, final CallbackContext callbackContext)
      throws JSONException {
    final PolylineOptions polylineOptions = new PolylineOptions();
    int color;
    LatLngBounds.Builder builder = new LatLngBounds.Builder();

    JSONObject opts = args.getJSONObject(1);
    if (opts.has("points")) {
      JSONArray points = opts.getJSONArray("points");
      List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
      int i = 0;
      for (i = 0; i < path.size(); i++) {
        polylineOptions.add(path.get(i));
        builder.include(path.get(i));
      }
    }
    if (opts.has("color")) {
      color = PluginUtil.parsePluginColor(opts.getJSONArray("color"));
      polylineOptions.color(color);
    }
    if (opts.has("width")) {
      polylineOptions.width(opts.getInt("width") * this.density);
    }
    if (opts.has("visible")) {
      polylineOptions.visible(opts.getBoolean("visible"));
    }
    if (opts.has("geodesic")) {
      polylineOptions.geodesic(opts.getBoolean("geodesic"));
    }
    if (opts.has("zIndex")) {
      polylineOptions.zIndex(opts.getInt("zIndex"));
    }

    Polyline polyline = map.addPolyline(polylineOptions);
    String id = "polyline_" + polyline.getId();
    this.objects.put(id, polyline);

    String boundsId = "polyline_bounds_" + polyline.getId();
    this.objects.put(boundsId, builder.build());

    JSONObject result = new JSONObject();
    result.put("hashCode", polyline.hashCode());
    result.put("id", id);
    callbackContext.success(result);
  }
コード例 #14
0
ファイル: GoActivity.java プロジェクト: Coccoonx/relieferd
  private void showGroup(LatLng... listTmpMarker) {
    LatLngBounds.Builder builder = new LatLngBounds.Builder();

    // Zoom the camera to see all the marquers
    for (LatLng position : listTmpMarker) {
      builder.include(position);
    }

    LatLngBounds bounds = builder.build();
    int padding = 200; // offset from edges of the map in pixels

    // Animate camera
    mGoogleMap.setPadding(0, 0, 0, 0);
    CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
    mGoogleMap.animateCamera(cu);
    mGoogleMap.setPadding(0, topPadding, 0, 0);
  }
コード例 #15
0
  private Boolean zoomOnMarkers() {
    try {
      int padding = 150;

      LatLngBounds.Builder builder = new LatLngBounds.Builder();
      for (Marker marker : mapMarkers) {
        builder.include(marker.getPosition());
      }
      LatLngBounds bounds = builder.build();

      CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
      map.animateCamera(cu);
      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }
コード例 #16
0
  /**
   * Set points
   *
   * @param args
   * @param callbackContext
   * @throws JSONException
   */
  @SuppressWarnings("unused")
  private void setPoints(final JSONArray args, final CallbackContext callbackContext)
      throws JSONException {
    String id = args.getString(1);
    Polyline polyline = this.getPolyline(id);

    JSONArray points = args.getJSONArray(2);
    List<LatLng> path = PluginUtil.JSONArray2LatLngList(points);
    polyline.setPoints(path);

    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (int i = 0; i < path.size(); i++) {
      builder.include(path.get(i));
    }
    this.objects.put("polyline_bounds_" + polyline.getId(), builder.build());

    this.sendNoResult(callbackContext);
  }
コード例 #17
0
    // Executes in UI thread, after the parsing process
    @Override
    protected void onPostExecute(List<List<HashMap<String, String>>> result) {
      ArrayList points = null;
      PolylineOptions lineOptions = null;
      MarkerOptions markerOptions = new MarkerOptions();

      // Traversing through all the routes
      for (int i = 0; i < result.size(); i++) {
        points = new ArrayList();
        lineOptions = new PolylineOptions();

        // Fetching i-th route
        List<HashMap<String, String>> path = result.get(i);

        // Fetching all the points in i-th route
        for (int j = 0; j < path.size(); j++) {
          HashMap<String, String> point = path.get(j);

          double lat = Double.parseDouble(point.get("lat"));
          double lng = Double.parseDouble(point.get("lng"));
          LatLng position = new LatLng(lat, lng);

          points.add(position);
        }

        // Adding all the points in the route to LineOptions
        lineOptions.addAll(points);
        lineOptions.width(2);
        lineOptions.color(Color.RED);
      }

      // Drawing polyline in the Google Map for the i-th route
      mMap.addPolyline(lineOptions);

      List<LatLng> pointis = lineOptions.getPoints(); // route is instance of PolylineOptions

      LatLngBounds.Builder bc = new LatLngBounds.Builder();

      for (LatLng item : pointis) {
        bc.include(item);
      }

      mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bc.build(), 50));
    }
コード例 #18
0
  private void addMarker(GoogleMap map, double lat, double lon, int title, int snippet) {
    Marker marker =
        map.addMarker(
            new MarkerOptions()
                .position(new LatLng(lat, lon))
                .title(getString(title))
                .snippet(getString(snippet)));

    builder.include(marker.getPosition());
  }
コード例 #19
0
  private void zoomMapToLatLngBounds(
      final LinearLayout layout, final GoogleMap mMap, final ArrayList<LatLng> bounds) {

    LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();

    for (int i = 0; i < bounds.size(); i++) {
      boundsBuilder.include(bounds.get(i));
    }

    final LatLngBounds boundsfinal = boundsBuilder.build();

    mMap.setOnMapLoadedCallback(
        new GoogleMap.OnMapLoadedCallback() {
          @Override
          public void onMapLoaded() {
            mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(boundsfinal, 25));
          }
        });
  }
コード例 #20
0
  public void addCluster(List<GridPoint> complaintDtos) {
    clearMap();
    GoogleMapCluster googleMapCluster;
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    ClusterManager<GoogleMapCluster> mClusterManager;
    mClusterManager = new ClusterManager<GoogleMapCluster>(getActivity(), googleMap);
    googleMap.setOnCameraChangeListener(mClusterManager);
    googleMap.setOnMarkerClickListener(mClusterManager);
    for (GridPoint complaintDto : complaintDtos) {
      googleMapCluster =
          new GoogleMapCluster(
              complaintDto.getLocation().getLatitude().doubleValue(),
              complaintDto.getLocation().getLongitude().doubleValue());
      mClusterManager.addItem(googleMapCluster);
      builder.include(googleMapCluster.getPosition());
    }

    if (complaintDtos.size() > 1) {
      LatLngBounds bounds = builder.build();
      CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 0);
      googleMap.animateCamera(cu);
    } else if (complaintDtos.size() > 0) {
      CameraPosition cameraPosition =
          new CameraPosition.Builder()
              .target(
                  new LatLng(
                      complaintDtos.get(0).getLocation().getLatitude().doubleValue(),
                      complaintDtos.get(0).getLocation().getLongitude().doubleValue()))
              .zoom(zoomLevel)
              .bearing(0)
              .tilt(45)
              .build();
      googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    }
    markersDisplayed = false;
    heatmapDisplayed = false;
    clusterDisplayed = true;
  }
コード例 #21
0
ファイル: Map.java プロジェクト: SujaySKumar/GPSTracker
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);

    if (savedInstanceState == null) {
      getSupportFragmentManager()
          .beginTransaction()
          .add(R.id.container, new PlaceholderFragment())
          .commit();
    }

    map = ((MapFragment) getFragmentManager().findFragmentById(R.id.container)).getMap();
    LatLng p = new LatLng(SMSReceiver.lat, SMSReceiver.lon);
    MarkerOptions a =
        new MarkerOptions().position(p).title("Your Location").snippet("You got the message here");
    map.addMarker(a);
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    builder.include(a.getPosition());
    LatLngBounds bounds = builder.build();
    CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 2);
    map.moveCamera(cu);
  }
コード例 #22
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.show_map);

    Bundle cmds = getIntent().getExtras();

    if (cmds == null) {
      // We have no trip to show, do nothing
      return;
    }

    trip = TripData.fetchTrip(this, cmds.getLong("showtrip"));

    gpspoints = trip.getPoints();

    // Upload the trip if it hasn't yet been sent
    if (trip.status < TripData.STATUS_SENT || cmds.getBoolean("uploadTrip", false)) {
      // And upload to the cloud database, too!  W00t W00t!
      TripUploader uploader = new TripUploader(ShowMap.this);
      uploader.execute(trip.tripid);
    }

    // Show trip details
    setTitle(trip.purp);
    // ((TextView) findViewById(R.id.text2)).setText(trip.info);
    // ((TextView) findViewById(R.id.text3)).setText(trip.fancystart);

    // Set up the map
    GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

    CyclePoint startPoint = null;
    CyclePoint endPoint = null;
    LatLngBounds.Builder tripBoundsBuilder = new LatLngBounds.Builder();

    PolylineOptions tripLine =
        new PolylineOptions().color(getResources().getColor(R.color.accent_color));

    for (CyclePoint cyclepoint : gpspoints) {
      Log.i(getClass().getName(), cyclepoint.latLng.latitude + ", " + cyclepoint.latLng.longitude);
      // Add point to boundary calculator
      tripBoundsBuilder.include(cyclepoint.latLng);

      // Add to the trip line
      tripLine.add(cyclepoint.latLng);

      if (startPoint == null) startPoint = cyclepoint;
      endPoint = cyclepoint;
    }

    LatLngBounds tripBounds = tripBoundsBuilder.build();
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);

    int minSize = Math.min(size.x, size.y);
    Log.i(getClass().getName(), String.valueOf(minSize));

    // Zoome the camera so it shows the entire trip on the map
    map.moveCamera(CameraUpdateFactory.newLatLngBounds(tripBounds, minSize, minSize, 0));

    // Draw the trip on the map
    map.addPolyline(tripLine);

    // Show the first and last markers
    map.addMarker(
        new MarkerOptions()
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.trip_start))
            .anchor(0.5f, 0.5f)
            .position(startPoint.latLng));
    map.addMarker(
        new MarkerOptions()
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.trip_end))
            .anchor(0.5f, 0.5f)
            .position(endPoint.latLng));

    int total_seconds = (int) Math.round((trip.endTime - trip.startTime) / 1000);
    int seconds = total_seconds;
    int minutes = (int) Math.floor(seconds / 60);
    seconds -= (minutes * 60);
    int hours = (int) Math.floor(minutes / 60);
    minutes -= (hours * 60);

    double total_miles = 0.0006212f * trip.distance;

    double speed = total_miles / total_seconds * (60 * 60);

    double calories = Common.distanceToCals(trip.distance);
    calories = Math.max(calories, 0);

    View infoView = getLayoutInflater().inflate(R.layout.show_info, null);

    TextView text1 = (TextView) infoView.findViewById(R.id.text1);
    infoView.findViewById(R.id.image_view).setVisibility(View.GONE);

    text1.setText(
        Html.fromHtml(
            TextUtils.join(
                "<br>",
                new String[] {
                  String.format(
                      "<b>" + getString(R.string.start_time) + "</b> %s", trip.fancystart),
                  String.format(
                      "<b>" + getString(R.string.time_elapsed) + "</b> %1$02d:%2$02d:%3$02d",
                      hours,
                      minutes,
                      seconds),
                  String.format(
                      "<b>" + getString(R.string.distance) + "</b> %1.1f miles", total_miles),
                  String.format("<b>" + getString(R.string.avg_speed) + "</b> %1.1f mph", speed),
                  String.format("<b>" + getString(R.string.est_cal) + "</b> %.1f kcal", calories),
                  String.format(
                      "<b>" + getString(R.string.c02_reduced) + "</b> %.1f lbs",
                      Common.distanceToCO2(trip.distance)),
                  String.format("<b>" + getString(R.string.notes) + "</b> %s", trip.note)
                })));

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setView(infoView);
    infoDialog = builder.create();
  }
コード例 #23
0
  public void addMarkers(List<GridPoint> gridPointList, List<PointEntity> pointEntityList) {
    clearMap();
    Marker m;
    LatLngBounds.Builder builder = new LatLngBounds.Builder();

    for (GridPoint gridPoint : gridPointList) {
      Bitmap icon =
          gridPoint.getScore() > 10
              ? gridPoint.getScore() > 20
                  ? BitmapFactory.decodeResource(getResources(), R.drawable.red_dot)
                  : BitmapFactory.decodeResource(getResources(), R.drawable.yellow_dot)
              : BitmapFactory.decodeResource(getResources(), R.drawable.green_dot);
      float hue =
          gridPoint.getScore() > 10
              ? gridPoint.getScore() > 20
                  ? BitmapDescriptorFactory.HUE_RED
                  : BitmapDescriptorFactory.HUE_YELLOW
              : BitmapDescriptorFactory.HUE_GREEN;

      markerOptions = new MarkerOptions();
      markerOptions.visible(true);
      markerOptions.position(
          new LatLng(
              gridPoint.getLocation().getLatitude().doubleValue(),
              gridPoint.getLocation().getLongitude().doubleValue()));
      markerOptions.draggable(false);
      markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
      // markerOptions.icon(BitmapDescriptorFactory.defaultMarker(hue));

      m = googleMap.addMarker(markerOptions);
      gridMap.put(m.getId(), gridPoint);
      builder.include(m.getPosition());
    }

    for (PointEntity pointEntity : pointEntityList) {
      Bitmap icon =
          pointEntity.getPointType().equals(PointType.PERSON)
              ? BitmapFactory.decodeResource(getResources(), R.drawable.man)
              : pointEntity.getPointType().equals(PointType.POLICE_STATION)
                  ? BitmapFactory.decodeResource(getResources(), R.drawable.police)
                  : BitmapFactory.decodeResource(getResources(), R.drawable.hospital);
      markerOptions = new MarkerOptions();
      markerOptions.visible(true);
      markerOptions.position(
          new LatLng(
              pointEntity.getLocation().getLatitude().doubleValue(),
              pointEntity.getLocation().getLongitude().doubleValue()));
      markerOptions.draggable(false);
      markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));

      m = googleMap.addMarker(markerOptions);
      pointMap.put(m.getId(), pointEntity);
      builder.include(m.getPosition());
    }

    if (gridPointList.size() > 1) {
      LatLngBounds bounds = builder.build();
      CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 0);
      googleMap.animateCamera(cu);
    } else if (gridPointList.size() > 0) {
      CameraPosition cameraPosition =
          new CameraPosition.Builder()
              .target(
                  new LatLng(
                      gridPointList.get(0).getLocation().getLatitude().doubleValue(),
                      gridPointList.get(0).getLocation().getLongitude().doubleValue()))
              .zoom(zoomLevel)
              .bearing(0)
              .tilt(45)
              .build();
      googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    }

    markersDisplayed = true;
    heatmapDisplayed = false;
    clusterDisplayed = false;
  }