Exemplo n.º 1
0
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);
    // TODO draw Footprints

    projection = mapView.getProjection();

    if (activity.footprints != null && isTapable()) {
      iterator = activity.footprints.iterator();
      while (iterator.hasNext()) {

        Footprint footprint = iterator.next();

        GeoPoint geoPoint = footprint.getLocation();

        Point p = new Point();
        projection.toPixels(geoPoint, p);

        Rect bmpRec = new Rect(p.x, p.y, p.x + 45, p.y + 45);
        canvas.drawBitmap(footprint.getThumbnail(), null, bmpRec, null);
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public boolean onTap(GeoPoint p, MapView mapView) {
    if (isTapable()) {
      Footprint chosen = null;
      // TODO calculate tapped Footprint

      System.out.println("--------------> TAB TAB TAB TAB");
      if (activity.footprints != null) {
        iterator = activity.footprints.iterator();
      }

      while (iterator != null && iterator.hasNext()) {
        Footprint footprint = iterator.next();
        GeoPoint geoPoint = footprint.getLocation();

        Point p_foot = new Point();
        Point p_tab = new Point();

        projection.toPixels(geoPoint, p_foot);
        projection.toPixels(p, p_tab);

        if (p_tab.x >= p_foot.x
            & p_tab.y >= p_foot.y
            & p_tab.x <= (p_foot.x + 45)
            & p_tab.y <= (p_foot.y + 45)) {
          chosen = footprint;
          break;
        }
      }

      if (chosen != null) {
        activity.activateFotoView(chosen);
      }
    }
    return super.onTap(p, mapView);
  }