public void onDetermined(ArrayList<GeoPoint> alPoint, ArrayList<Integer> alRadius) {
    GeoPoint oPoint = null;
    int oRadius = 0;

    // remove old radiusoverlays
    for (int i = 0; i < mapView.getOverlays().size(); i++) {
      RadiusOverlay mROtemp = new RadiusOverlay(oPoint, oRadius);
      Overlay Otemp = mapView.getOverlays().get(i);

      if (Otemp.getClass() == mROtemp.getClass()) {
        mapView.getOverlays().remove(Otemp);
        i--;
      }
    }

    // add new route overlays
    for (int i = 0; i < alPoint.size(); i++) {
      oPoint = alPoint.get(i);
      oRadius = alRadius.get(i);

      mapView.getOverlays().add(new RadiusOverlay(oPoint, oRadius));
    }

    mapView.invalidate();
  }
示例#2
0
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {

    super.draw(canvas, mapView, shadow);

    if (shadow) {
      return;
    }

    Projection projection = mapView.getProjection();
    Path path = new Path();
    boolean isFirst = true;

    for (int i = 0; i < pointsSize; i++) {
      GeoPoint gPoint = points.get(i);
      Point pixelPoint = pixelPoints[i];

      projection.toPixels(gPoint, pixelPoint);

      if (isFirst) {
        path.moveTo(pixelPoint.x, pixelPoint.y);
        isFirst = false;
      } else {
        path.lineTo(pixelPoint.x, pixelPoint.y);
      }
    }

    canvas.drawPath(path, mPaint);
  }
示例#3
0
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    if (!shadow) {

      // Make sure to give mMarker bounds so it will draw in the overlay
      final int intrinsicWidth = mMarker.getIntrinsicWidth();
      final int intrinsicHeight = mMarker.getIntrinsicHeight();
      mMarker.setBounds(0, 0, intrinsicWidth, intrinsicHeight);

      mMarkerXOffset = -(intrinsicWidth / 2);
      mMarkerYOffset = -(intrinsicHeight / 2);

      Paint paint = new Paint();
      paint.setARGB(250, 0, 0, 0);
      paint.setAntiAlias(true);
      paint.setFakeBoldText(true);

      Point point2 = new Point();
      Projection p = mapView.getProjection();
      p.toPixels(mGeoPoint, point2);

      canvas.drawText(text, point2.x - intrinsicWidth, point2.y + intrinsicHeight, paint);
      super.draw(canvas, mapView, shadow);
      drawAt(canvas, mMarker, point2.x + mMarkerXOffset, point2.y + mMarkerYOffset, shadow);
    }
  }
示例#4
0
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {

    super.draw(canvas, mapView, shadow);

    Projection projection = mapView.getProjection();

    int latSpan = mapView.getLatitudeSpan();
    int lngSpan = mapView.getLongitudeSpan();
    GeoPoint mapCenter = mapView.getMapCenter();
    int mapLeftGeo = mapCenter.getLongitudeE6() - (lngSpan / 2);
    int mapRightGeo = mapCenter.getLongitudeE6() + (lngSpan / 2);

    int mapTopGeo = mapCenter.getLatitudeE6() - (latSpan / 2);
    int mapBottomGeo = mapCenter.getLatitudeE6() + (latSpan / 2);

    GeoPoint geoPoint = this.getSampleLocation();

    if ((geoPoint.getLatitudeE6() > mapTopGeo && geoPoint.getLatitudeE6() < mapBottomGeo)
        && (geoPoint.getLongitudeE6() > mapLeftGeo && geoPoint.getLongitudeE6() < mapRightGeo)) {
      Point myPoint = new Point();
      projection.toPixels(geoPoint, myPoint);
      Bitmap marker =
          BitmapFactory.decodeResource(mapView.getContext().getResources(), R.drawable.markerblue);
      canvas.drawBitmap(marker, myPoint.x - 15, myPoint.y - 30, null);
    }
  }
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    Projection projection = mapView.getProjection();

    if (shadow == false) {
      // Get the current location
      Double latitude = 0.0, longitude = 0.0;
      if (location != null) {
        latitude = location.getLatitude() * 1E6;
        longitude = location.getLongitude() * 1E6;
      }
      GeoPoint geoPoint = new GeoPoint(latitude.intValue(), longitude.intValue());
      // Convert the location to screen pixles
      Point point = new Point();
      projection.toPixels(geoPoint, point);
      // Start Drawing
      Paint paint = new Paint();
      paint.setAntiAlias(true);
      paint.setARGB(150, 238, 17, 100);
      canvas.drawCircle(point.x, point.y, mRadius + 4, paint);
      paint.setARGB(255, 255, 255, 0);
      canvas.drawCircle(point.x, point.y, mRadius + 2, paint);
      paint.setARGB(250, 255, 0, 0);
      canvas.drawCircle(point.x, point.y, mRadius, paint);
    }
    super.draw(canvas, mapView, shadow);
  }
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    // Get the map projection to convert lat/long to screen coordinates
    Projection projection = mapView.getProjection();

    Point lPoint = new Point();
    projection.toPixels(locationPoint, lPoint);

    // Draw the overlay
    if (shadow == false) {
      if (friendLocations.size() > 0) {
        Iterator<String> e = friendLocations.keySet().iterator();
        do {
          // Get the name and location of each contact
          String name = e.next();
          Location location = friendLocations.get(name);

          // Convert the lat / long to a Geopoint
          Double latitude = location.getLatitude() * 1E6;
          Double longitude = location.getLongitude() * 1E6;
          GeoPoint geopoint = new GeoPoint(latitude.intValue(), longitude.intValue());

          // Ensure each contact is within 10km
          float dist = location.distanceTo(getLocation());
          if (dist < 10000) {
            Point point = new Point();
            projection.toPixels(geopoint, point);

            // Draw a line connecting the contact to your current location.
            canvas.drawLine(lPoint.x, lPoint.y, point.x, point.y, paint);

            // Draw a marker at the contact's location.
            RectF oval =
                new RectF(
                    point.x - markerRadius,
                    point.y - markerRadius,
                    point.x + markerRadius,
                    point.y + markerRadius);

            canvas.drawOval(oval, backPaint);
            oval.inset(2, 2);
            canvas.drawOval(oval, paint);

            // Draw the contact's name next to their position.
            float textWidth = paint.measureText(name);
            float textHeight = paint.getTextSize();
            RectF textRect =
                new RectF(
                    point.x + markerRadius,
                    point.y - textHeight,
                    point.x + markerRadius + 8 + textWidth,
                    point.y + 4);
            canvas.drawRoundRect(textRect, 3, 3, backPaint);
            canvas.drawText(name, point.x + markerRadius + 4, point.y, paint);
          }
        } while (e.hasNext());
      }
    }
    super.draw(canvas, mapView, shadow);
  }
 @Override
 public void draw(Canvas canvas, MapView mapView, boolean shadow) {
   super.draw(canvas, mapView, shadow);
   if (!shadow) {
     mProjection.setProjection(mapView.getProjection());
     draw(canvas);
   }
 }
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    // TODO Auto-generated method stub
    super.draw(canvas, mapView, shadow);

    GeoPoint centerGp = mapView.getMapCenter();
    Projection projection = mapView.getProjection();
    Point centerPoint = projection.toPixels(centerGp, null);

    drawCircle(canvas, centerPoint, mapView);
  }
 public void draw(Canvas canvas, MapView mapview, boolean flag) {
   Projection projection = mapview.getProjection();
   Paint paint = new Paint();
   Point point = new Point();
   projection.toPixels(gp1, point);
   paint.setColor(color);
   Point point1 = new Point();
   projection.toPixels(gp2, point1);
   paint.setStrokeWidth(5F);
   paint.setAlpha(120);
   canvas.drawLine(point.x, point.y, point1.x, point1.y, paint);
   super.draw(canvas, mapview, flag);
 }
示例#10
0
  /**
   * @param canvas
   * @param mapView
   * @param shadow
   * @see TrackingOverlay#draw(Canvas, MapView, boolean)
   */
  private void drawDots(Canvas canvas, MapView mapView, boolean shadow) {
    this.mCanvas = canvas;
    this.mScreenPoint = new Point();
    this.mPrevScreenPoint = new Point();
    mProjection = mapView.getProjection();
    mTopLeft = mProjection.fromPixels(0, 0);
    mBottumRight = mProjection.fromPixels(this.mCanvas.getWidth(), this.mCanvas.getHeight());

    transformSegmentToCanvasDots();

    drawStartStopCircles();

    super.draw(this.mCanvas, mapView, shadow);
    this.mCanvas = null;
  }
示例#11
0
  // Called periodically by the Android system when it wants us to redraw the path
  public void draw(Canvas canvas, MapView mv, boolean shadow) {
    super.draw(canvas, mv, shadow);

    if (m_loaded) {

      // This is the normal case: all of our data is already loaded
      // So, we need to draw the path to screen

      // Draws are called twice, once for the "shadow" and once for the foreground
      // Since we draw only one thing, we only need to draw during one of these
      // Pick shadow, in case we ever add anything later that we want to appear
      // on top of the path.
      if (shadow) {
        calculateNewPathIfNeeded(mv);

        // Now, we've got a fully-calculated path.  Put it on the screen (if it's not empty)
        if (m_path != null && !m_path.isEmpty()) {
          Paint paint = new Paint();
          paint.setDither(true);
          paint.setARGB(126, 0, 126, 255);
          paint.setStyle(Paint.Style.STROKE);
          paint.setStrokeJoin(Paint.Join.ROUND);
          paint.setStrokeCap(Paint.Cap.ROUND);
          paint.setStrokeWidth(5);
          canvas.drawPath(m_path, paint);
        }
      }

    } else {
      // We get here if the data hasn't been loaded.  Just show a message.

      Paint paint = new Paint();
      if (shadow) {
        // Draw a black rectangular background...
        paint.setARGB(255, 0, 0, 0);
        paint.setStyle(Paint.Style.FILL);
        canvas.drawRect(0, 0, 300, 40, paint);
      } else {
        // With white text in front.
        paint.setARGB(255, 255, 255, 255);
        paint.setStyle(Paint.Style.STROKE);
        canvas.drawText("Loading Route Data...", 10, 20, paint);
      }

      // And cache the map so we can force a redraw when we get the data loaded.
      m_mapView = mv;
    }
  }
    public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
      super.draw(canvas, mapView, shadow);

      // Vertaal de Geopoint naar pixels en plaats daar een marker
      Point screenPts = new Point();
      if (p != null) {
        mapView.getProjection().toPixels(p, screenPts);
        Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.marker);
        canvas.drawBitmap(
            bmp,
            screenPts.x - 24,
            screenPts.y - 48,
            null); // puntje van het vlaggetje precies op de juiste plek
      }
      return true;
    }
 @Override
 public void draw(Canvas canvas, MapView mapView, boolean shadow) {
   super.draw(canvas, mapView, shadow);
   Point locationPoint = new Point();
   Projection projection = mapView.getProjection();
   projection.toPixels(getGeopoint(), locationPoint);
   Paint containerPaint = new Paint();
   containerPaint.setAntiAlias(true);
   int containerX = locationPoint.x;
   int containerY = locationPoint.y;
   if (shadow) {
     containerX += CONTAINER_SHADOW_OFFSET;
     containerY += CONTAINER_SHADOW_OFFSET;
     containerPaint.setARGB(90, 0, 0, 0);
     canvas.drawCircle(containerX, containerY, CONTAINER_RADIUS, containerPaint);
   } else {
     containerPaint.setColor(Color.RED);
     canvas.drawCircle(containerX, containerY, CONTAINER_RADIUS, containerPaint);
   }
 }
示例#14
0
  /**
   * @param canvas
   * @param mapView
   * @param shadow
   * @see TrackingOverlay#draw(Canvas, MapView, boolean)
   */
  public void drawPath(Canvas canvas, MapView mapView, boolean shadow) {
    this.mCanvas = canvas;
    this.mScreenPoint = new Point();
    this.mPrevScreenPoint = new Point();
    mProjection = mapView.getProjection();
    mTopLeft = mProjection.fromPixels(0, 0);
    mBottumRight = mProjection.fromPixels(this.mCanvas.getWidth(), this.mCanvas.getHeight());

    this.mPath.rewind();
    this.mShader = null;
    transformSegmentToPath();

    // Just the rendering bits left to do
    Paint routePaint = new Paint();
    routePaint.setPathEffect(new CornerPathEffect(10));
    //      Log.d( TAG, "Drawing color is "+trackColoringMethod );
    switch (trackColoringMethod) {
      case (DRAW_CALCULATED):
      case (DRAW_MEASURED):
        routePaint.setShader(this.mShader);
        break;
      case (DRAW_RED):
        routePaint.setColor(Color.RED);
        break;
      case (DRAW_GREEN):
      default:
        routePaint.setColor(Color.GREEN);
        break;
    }
    routePaint.setStyle(Paint.Style.STROKE);
    routePaint.setStrokeWidth(8);
    routePaint.setAntiAlias(true);

    this.mCanvas.drawPath(this.mPath, routePaint);

    drawStartStopCircles();

    super.draw(this.mCanvas, mapView, shadow);
    this.mCanvas = null;
  }
    @Override
    public boolean draw(Canvas canvas, MapView mv, boolean shadow, long when) {
      super.draw(canvas, mv, shadow);
      Point screenPxs = new Point();
      Paint textPaint = new Paint();
      textPaint.setColor(Color.BLACK);
      textPaint.setTextSize(20);

      mv.getProjection().toPixels(locationPoint, screenPxs);

      Drawable icon;

      if (isBrewery) {
        icon = res.getDrawable(R.drawable.brewery);
      } else {
        icon = res.getDrawable(R.drawable.user);
      }

      canvas.drawText(label, screenPxs.x + 12, screenPxs.y, textPaint);
      canvas.drawBitmap(((BitmapDrawable) icon).getBitmap(), screenPxs.x, screenPxs.y, null);
      return true;
    }
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);
    System.out.println("[PRODUCTS OVERLAY DRAW]");

    if (paint == null) {
      paint = new Paint(Paint.ANTI_ALIAS_FLAG);
      paint.setStrokeWidth(4.0f);
    }

    // center of map
    Point centerScreen = new Point();
    if (center != null) {
      mapView.getProjection().toPixels(center, centerScreen);
      Bitmap bmp = BitmapFactory.decodeResource(Global.application.getResources(), R.drawable.home);
      canvas.drawBitmap(bmp, centerScreen.x, centerScreen.y, null);

      // draw circle
      if (radius != NO_RADIUS) {
        float realRadius = mapView.getProjection().metersToEquatorPixels(radius);
        paint.setColor(CIRCLE_COLOR);
        canvas.drawCircle(centerScreen.x, centerScreen.y, realRadius, paint);
      }
    }

    // found products
    paint.setColor(Color.BLUE);
    for (ProductInfo productInfo : products) {
      Point screenPoint = new Point();
      mapView
          .getProjection()
          .toPixels(
              new GeoPoint((int) (productInfo.lat * 1E6), (int) (productInfo.lng * 1E6)),
              screenPoint);

      //			canvas.drawPoint(screenPoint.x, screenPoint.y, paint);
      canvas.drawBitmap(STAR_ICON, screenPoint.x, screenPoint.y, null);
    }
  }
示例#17
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);
      }
    }
  }
示例#18
0
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);

    if (this.currentLocation != null && destLocation != null) {
      ApplicationUtils.drawLine(currentLocation, destLocation, mapView, canvas);

      Point pointIni = new Point();
      Projection projectionIni = mapView.getProjection();
      projectionIni.toPixels(currentLocation, pointIni);

      Point pointEnd = new Point();
      Projection projectionEnd = mapView.getProjection();
      projectionEnd.toPixels(destLocation, pointEnd);

      // Bitmap bmp = BitmapFactory.decodeResource(context.getResources(),
      // R.drawable.pin);
      // canvas.drawBitmap(bmp, pointIni.x - 6, pointIni.y - 30, null);
      // canvas.drawBitmap(bmp, pointEnd.x - 6, pointEnd.y - 30, null);

      drawPoint(canvas, pointIni);
      drawPoint(canvas, pointEnd);
    }
  }
示例#19
0
  /** ***** Overlay Overrides ****** */
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);

    final Projection projection = mapView.getProjection();

    int numPoints = points.size();

    if (numPoints > 1) {
      for (int i = 0; i < points.size() - 1; i++) {
        GeoPoint gp1 = points.get(i);
        GeoPoint gp2 = points.get(i + 1);
        Paint paint = new Paint();
        paint.setDither(true);
        paint.setColor(Color.RED);
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
        paint.setStrokeJoin(Paint.Join.ROUND);
        paint.setStrokeCap(Paint.Cap.ROUND);
        paint.setStrokeWidth(4);
        paint.setAlpha(80);

        Point p1 = new Point();
        Point p2 = new Point();

        Path path = new Path();

        projection.toPixels(gp1, p1);
        projection.toPixels(gp2, p2);

        path.moveTo(p2.x, p2.y);
        path.lineTo(p1.x, p1.y);

        canvas.drawPath(path, paint);
      }
    }
  }
 @Override
 public void draw(Canvas canvas, MapView mapView, boolean shadow) {
   super.draw(canvas, mapView, shadow);
 }
示例#21
0
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    Projection projection = mapView.getProjection();
    Paint pen = new Paint();
    pen.setColor(Color.RED);
    pen.setStrokeWidth(2);
    pen.setStyle(Paint.Style.STROKE);

    if ((location != null) && (shadow == false)) {
      // Get the current location
      Double latitude = location.getLatitude() * 1E6;
      Double longitude = location.getLongitude() * 1E6;
      GeoPoint geoPoint;
      geoPoint = new GeoPoint(latitude.intValue(), longitude.intValue());

      // Convert the location to screen pixels
      Point point = new Point();
      projection.toPixels(geoPoint, point);
      RectF oval =
          new RectF(point.x - mRadius, point.y - mRadius, point.x + mRadius, point.y + mRadius);

      // Setup the paint
      Paint paint = new Paint();
      paint.setARGB(250, 255, 255, 255);
      paint.setAntiAlias(true);
      paint.setFakeBoldText(true);

      Paint backPaint = new Paint();
      backPaint.setARGB(150, 255, 255, 0);
      backPaint.setAntiAlias(true);

      RectF backRect =
          new RectF(point.x + 6 + mRadius, point.y - 3 * mRadius, point.x + 65, point.y + mRadius);

      // Draw the marker
      canvas.drawOval(oval, paint);
      canvas.drawRoundRect(backRect, 5, 5, backPaint);
      canvas.drawText("NAHAJATE SE TUKAJ", point.x + 2 * mRadius + 2, point.y, paint);
    }

    // draw path history
    Path path = new Path();
    if (locations.size() > 1) {
      Location prej = locations.get(0);
      Double latitude1 = prej.getLatitude() * 1E6;
      Double longitude1 = prej.getLongitude() * 1E6;
      GeoPoint geoPoint1, geoPoint2;
      ;
      geoPoint1 = new GeoPoint(latitude1.intValue(), longitude1.intValue());
      // Convert the location to screen pixels
      Point point1 = new Point();
      projection.toPixels(geoPoint1, point1);
      path.moveTo(point1.x, point1.y);
      Point point2;
      for (int i = 1; i < locations.size(); i++) {
        // druga tocka
        Double latitude2 = locations.get(i).getLatitude() * 1E6;
        Double longitude2 = locations.get(i).getLongitude() * 1E6;
        geoPoint2 = new GeoPoint(latitude2.intValue(), longitude2.intValue());
        // Convert the location to screen pixels
        point2 = new Point();
        projection.toPixels(geoPoint2, point2);
        path.lineTo(point2.x, point2.y);
      }
      canvas.drawPath(path, pen);
    }
    super.draw(canvas, mapView, shadow);
  }
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);

    // buildings have no shadows; therefore return without drawing if shadow
    // == true
    if (shadow == true) {
      return;
    }

    try {

      // create a new painter
      Paint paint = new Paint();
      GeoPoint geoPoint = new GeoPoint((int) (1 * 1E6), (int) (1 * 1E6));
      Point screenCoordinates = new Point();
      Path path = new Path();

      //		//draw background
      //		// create a new painter
      //		paint.setColor(R.color.mapBackground);
      //		paint.setStyle(Paint.Style.FILL);
      //
      //		geoPoint = new GeoPoint((int) (1 * 1E6), (int) (1 * 1E6));
      //		screenCoordinates = new Point();
      //		mapView.getProjection().toPixels(geoPoint, screenCoordinates);
      //		path.moveTo(screenCoordinates.x, screenCoordinates.y);
      //
      //		geoPoint = new GeoPoint((int) (70 * 1E6), (int) (1 * 1E6));
      //		screenCoordinates = new Point();
      //		mapView.getProjection().toPixels(geoPoint, screenCoordinates);
      //		path.lineTo(screenCoordinates.x, screenCoordinates.y);
      //
      //		geoPoint = new GeoPoint((int) (70* 1E6), (int) (70 * 1E6));
      //		screenCoordinates = new Point();
      //		mapView.getProjection().toPixels(geoPoint, screenCoordinates);
      //		path.lineTo(screenCoordinates.x, screenCoordinates.y);
      //
      //		geoPoint = new GeoPoint((int) (1 * 1E6), (int) (70 * 1E6));
      //		screenCoordinates = new Point();
      //		mapView.getProjection().toPixels(geoPoint, screenCoordinates);
      //		path.lineTo(screenCoordinates.x, screenCoordinates.y);
      //
      //		// draw the path on bitmapCanvas
      //		canvas.drawPath(path, paint);
      //

      // draw line with antialiasing
      DrawFilter drawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG);
      canvas.setDrawFilter(drawFilter);

      // create a new painter
      paint.setColor(R.color.building);
      paint.setStyle(Paint.Style.FILL);

      // get the layer information of TUD_INF_E0
      WFSServer wfsServer = LocationModelAPI.getSelectedBuilding();

      // check whether WFS data is available
      if (wfsServer == null) {
        // no information available --> nothing has to be drawn
        return;
      }
      ArrayList<WFSLayer> toDrawLayer = wfsServer.getWfsPolygonLayers();
      ArrayList<BuildingPart> toDraw = new ArrayList<BuildingPart>();

      ArrayList<LocatableItem> items = toDrawLayer.get(floor).getItems();
      for (int j = 0; j < items.size(); j++) {
        toDraw.add((BuildingPart) items.get(j));
      }

      // convert polygon points to map points
      Iterator<BuildingPart> toDrawIt = toDraw.iterator();
      while (toDrawIt.hasNext()) {
        // current item
        BuildingPart part = toDrawIt.next();
        // current polygon
        Polygon polygon = (Polygon) part.getGeometry();
        // corner points of this polygon
        de.javagis.jgis.geometry.Point[] points = polygon.asPoints();

        // create new path for every ground
        path = new Path();
        for (int i = 0; i < points.length; i++) {
          // get on of the ground vertices
          double lat = points[i].getY();
          double lon = points[i].getX();
          geoPoint = new GeoPoint((int) (lat * 1E6), (int) (lon * 1E6));

          // transform current position to screen coordinates
          screenCoordinates = new Point();
          mapView.getProjection().toPixels(geoPoint, screenCoordinates);

          if (i == 0) {
            // path has to be started --> moveTo
            path.moveTo(screenCoordinates.x, screenCoordinates.y);
          } else {
            // path has to be resumed --> lineTo
            path.lineTo(screenCoordinates.x, screenCoordinates.y);
          }
        }

        // draw the path on bitmapCanvas
        canvas.drawPath(path, paint);
      }
    } catch (Exception e) {
      Log.e("BuildingOverlay", "needs more time to get buildings");
    }
  }
  @Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);

    final Projection prj = mapView.getProjection();

    GeoPoint gp1 = null;
    GeoPoint gp2 = null;
    GeoPoint gp3 = null;
    final Point p1 = new Point();
    final Point p2 = new Point();
    final Point p3 = new Point();
    final Path path = new Path();
    gp1 = new GeoPoint((int) (51.246451 * 1e6), (int) (4.418067 * 1e6));
    prj.toPixels(gp1, p1);
    path.moveTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246451 * 1e6), (int) (4.417768 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246504 * 1e6), (int) (4.417768 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246504 * 1e6), (int) (4.416918 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246459 * 1e6), (int) (4.416918 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246459 * 1e6), (int) (4.415888 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246377 * 1e6), (int) (4.415888 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246377 * 1e6), (int) (4.415526 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246165 * 1e6), (int) (4.415343 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246187 * 1e6), (int) (4.415263 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245916 * 1e6), (int) (4.415043 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245905 * 1e6), (int) (4.41508 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245744 * 1e6), (int) (4.414957 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245764 * 1e6), (int) (4.414879 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245377 * 1e6), (int) (4.41456 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245053 * 1e6), (int) (4.415579 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245097 * 1e6), (int) (4.415925 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245262 * 1e6), (int) (4.415955 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245419 * 1e6), (int) (4.41595 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245431 * 1e6), (int) (4.415848 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp2 = new GeoPoint((int) (51.245945 * 1e6), (int) (4.415954 * 1e6));
    gp3 = new GeoPoint((int) (51.245760 * 1e6), (int) (4.416719 * 1e6));
    prj.toPixels(gp2, p2);
    prj.toPixels(gp3, p3);
    path.cubicTo(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y);
    gp1 = new GeoPoint((int) (51.245693 * 1e6), (int) (4.416676 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245638 * 1e6), (int) (4.416974 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245628 * 1e6), (int) (4.417164 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245688 * 1e6), (int) (4.417164 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245691 * 1e6), (int) (4.417256 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245571 * 1e6), (int) (4.417248 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245606 * 1e6), (int) (4.417572 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245665 * 1e6), (int) (4.417846 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.2457 * 1e6), (int) (4.417816 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.2457 * 1e6), (int) (4.417768 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245752 * 1e6), (int) (4.417768 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.245752 * 1e6), (int) (4.418067 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);
    gp1 = new GeoPoint((int) (51.246451 * 1e6), (int) (4.418067 * 1e6));
    prj.toPixels(gp1, p1);
    path.lineTo(p1.x, p1.y);

    canvas.drawPath(path, paint);
  }