Beispiel #1
0
    public void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow) {
      super.draw(canvas, mapView, false);

      // Disable unzooming map more than level 14, there will be to many
      // stations in map view
      if (mapView.getZoomLevel() < 14) mapView.getController().setZoom(14);
    }
Beispiel #2
0
    public void draw(Canvas canvas, MapView mapv, boolean shadow) {
      int cZoom = mapView.getZoomLevel();
      GeoPoint kpGP = parceToGP(r.getString(R.string.kpiPoint));
      // Log.i(TAG, "Zoom=" + cZoom);

      if (cZoom > mZoomMin) {

        GeoPoint[] kpiZone0 = parceToGPAr(r.getStringArray(R.array.kpiZone0));

        Paint mPaint = new Paint();
        mPaint.setDither(true);
        mPaint.setColor(0xff0962f5);
        mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        mPaint.setStrokeJoin(Paint.Join.ROUND);
        mPaint.setStrokeCap(Paint.Cap.ROUND);
        mPaint.setStrokeWidth(2);
        drawFigure(mPaint, canvas, shadow, kpiZone0);

        if (cZoom > mZoomMax) {
          super.draw(canvas, mapv, false);

          int i;
          Point p = new Point();
          Paint tPaint = new Paint();

          tPaint.setDither(true);
          tPaint.setColor(Color.BLACK);
          tPaint.setStyle(Paint.Style.FILL);
          tPaint.setFakeBoldText(true);
          tPaint.setTextAlign(Align.CENTER);
          tPaint.setTextSize(14);

          for (mapItem item : itemAr) {
            projection.toPixels(item.gp, p);
            canvas.drawText(item.index, p.x, p.y, tPaint);
          }
        } else { // Draw only KPI Area
          int i;
          Point p = new Point();
          Paint tPaint = new Paint();

          tPaint.setDither(true);
          tPaint.setColor(0xff0962f5);
          tPaint.setStyle(Paint.Style.FILL);
          tPaint.setFakeBoldText(true);
          tPaint.setTextAlign(Align.CENTER);
          tPaint.setTextSize(18);

          projection.toPixels(kpGP, p);
          canvas.drawText("KPI", p.x, p.y, tPaint);
          canvas.drawBitmap(
              kpiIcon, p.x - kpiIcon.getWidth() / 2, p.y - kpiIcon.getHeight() / 2, null);
        }
      } else {
        Point p = new Point();
        projection.toPixels(kpGP, p);
        canvas.drawBitmap(
            kpiIcon, p.x - kpiIcon.getWidth() / 2, p.y - kpiIcon.getHeight() / 2, null);
      }
    }
 @Override
 public void draw(Canvas canvas, MapView mapView, boolean shadow) {
   if (longPressFinished) {
     longPressFinished = false;
     this.gs.invokeLongPressFinished();
   }
   if (zoomFinished) {
     zoomFinished = false;
     this.gs.invokeZoomFinished();
   }
   super.draw(canvas, mapView, false);
   if (lastZoomlevel == -1) lastZoomlevel = mapView.getZoomLevel();
   if (mapView.getZoomLevel() != lastZoomlevel) {
     this.gs.invokeZoomEvent(lastZoomlevel, mapView.getZoomLevel());
     lastZoomlevel = mapView.getZoomLevel();
   }
 }
Beispiel #4
0
    @Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow) {
      super.draw(canvas, mapView, shadow);

      int zoom = mapView.getZoomLevel();
      if (zoom <= 10) {
        LINE_WIDTH = 1;
      } else if (zoom < 15) {
        LINE_WIDTH = 2;
      } else {
        LINE_WIDTH = 3;
      }
      initPaint();

      try {
        boundCenterBottom(marker);
        if (listRoutePoint != null) {
          Projection projection = mapView.getProjection();
          canvas.drawPath(getPath(convertListGeoPointToPoint(listRoutePoint, projection)), paint);
        }
      } catch (Throwable e) {
      }
    }
  @Override
  public void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);

    // go through all OverlayItems and draw title for each of them
    for (OverlayItem item : mOverlays) {
      /* Converts latitude & longitude of this overlay item to coordinates on screen.
       * As we have called boundCenterBottom() in constructor, so these coordinates
       * will be of the bottom center position of the displayed marker.
       */
      GeoPoint point = item.getPoint();
      Point markerBottomCenterCoords = new Point();
      mapView.getProjection().toPixels(point, markerBottomCenterCoords);

      /* Find the width and height of the title*/
      TextPaint paintText = new TextPaint();
      Paint paintRect = new Paint();

      Rect rect = new Rect();
      paintText.setTextSize(FONT_SIZE);
      paintText.getTextBounds(item.getTitle(), 0, item.getTitle().length(), rect);

      rect.inset(-TITLE_MARGIN, -TITLE_MARGIN);
      rect.offsetTo(
          markerBottomCenterCoords.x - rect.width() / 2,
          markerBottomCenterCoords.y - markerHeight - rect.height());

      paintText.setTextAlign(Paint.Align.CENTER);
      paintText.setTextSize(FONT_SIZE);
      paintText.setARGB(255, 255, 255, 255);
      paintRect.setARGB(130, 0, 0, 0);

      canvas.drawRoundRect(new RectF(rect), 2, 2, paintRect);
      canvas.drawText(
          item.getTitle(), rect.left + rect.width() / 2, rect.bottom - TITLE_MARGIN, paintText);
    }
  }
Beispiel #6
0
  @Override
  public void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);

    Paint mPaint = new Paint();
    mPaint.setDither(true);
    mPaint.setColor(Color.RED);
    mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeWidth(2);

    List<Clue> clues = huntedService.getDataProvider().getTrackLog();

    Clue prevClue = null;
    for (Clue clue : clues) {
      if (prevClue != null) {
        GeoPoint prevCluePoint = Map.getPointForClue(prevClue);
        GeoPoint currentCluePoint = Map.getPointForClue(clue);
        Point fromPoint = new Point();
        mapView.getProjection().toPixels(prevCluePoint, fromPoint);
        Point toPoint = new Point();
        mapView.getProjection().toPixels(currentCluePoint, toPoint);
        canvas.drawLine(fromPoint.x, fromPoint.y, toPoint.x, toPoint.y, mPaint);
      }

      prevClue = clue;
    }

    // go through all OverlayItems and draw title for each of them
    List<OverlayItem> overlaysCopy = new ArrayList<OverlayItem>(overlays);
    for (OverlayItem item : overlaysCopy) {
      /* Converts latitude & longitude of this overlay item to coordinates on screen.
       * As we have called boundCenterBottom() in constructor, so these coordinates
       * will be of the bottom center position of the displayed marker.
       */
      GeoPoint point = item.getPoint();
      Point markerBottomCenterCoords = new Point();
      mapView.getProjection().toPixels(point, markerBottomCenterCoords);

      /* Find the width and height of the title*/
      TextPaint paintText = new TextPaint();
      Paint paintRect = new Paint();

      Rect rect = new Rect();
      paintText.setTextSize(FONT_SIZE);
      paintText.getTextBounds(item.getTitle(), 0, item.getTitle().length(), rect);

      rect.inset(-TITLE_MARGIN, -TITLE_MARGIN);
      rect.offsetTo(
          markerBottomCenterCoords.x - rect.width() / 2,
          markerBottomCenterCoords.y - 15 - rect.height());

      paintText.setTextAlign(Paint.Align.CENTER);
      paintText.setTextSize(FONT_SIZE);
      paintText.setARGB(255, 255, 255, 255);
      paintRect.setARGB(130, 0, 0, 0);

      canvas.drawRoundRect(new RectF(rect), 2, 2, paintRect);
      canvas.drawText(
          item.getTitle(), rect.left + rect.width() / 2, rect.bottom - TITLE_MARGIN, paintText);
    }
  }
 @Override
 public void draw(Canvas canvas, MapView mapView, boolean shadow) {
   super.draw(canvas, mapView, shadow);
   boundCenterBottom(marker);
 }
Beispiel #8
0
 @Override
 public void draw(Canvas canvas, MapView mapView, boolean shadow) {
   super.draw(canvas, mapView, false);
   boundCenter(mMarker);
 }
Beispiel #9
0
 @Override
 public void draw(Canvas canvas, MapView mapView, boolean shadow) {
   super.draw(canvas, mapView, false);
 }