private void transformSegmentToCanvasDots() {
    Cursor trackCursor = null;
    GeoPoint geoPoint;
    mCalculatedPoints = 0;
    setStepSize();
    step = 0;

    try {
      trackCursor =
          this.mResolver.query(
              this.mSegmentUri,
              new String[] {Waypoints.LATITUDE, Waypoints.LONGITUDE, Waypoints.ACCURACY},
              null,
              null,
              null);
      if (trackCursor.moveToFirst()) {
        // Start point of the segments, possible a dot
        this.mStartPoint = extractGeoPoint(trackCursor);
        moveToGeoPoint(this.mStartPoint);

        Paint radiusPaint = new Paint();
        radiusPaint.setColor(Color.YELLOW);
        radiusPaint.setAlpha(100);

        do {
          geoPoint = extractGeoPoint(trackCursor);
          Point out = new Point();
          mProjection.toPixels(geoPoint, out);
          mCalculatedPoints++;
          Bitmap bitmap =
              BitmapFactory.decodeResource(this.mContext.getResources(), R.drawable.stip2);
          this.mCanvas.drawBitmap(bitmap, out.x - 8, out.y - 8, new Paint());
          float radius = mProjection.metersToEquatorPixels(trackCursor.getFloat(2));
          if (radius > 8f) {
            this.mCanvas.drawCircle(out.x, out.y, radius, radiusPaint);
          }
          this.mPrevScreenPoint.x = this.mScreenPoint.x;
          this.mPrevScreenPoint.y = this.mScreenPoint.y;
        } while (moveToNextWayPoint(trackCursor));

        // End point of the segments, possible a dot
        this.mEndPoint = extractGeoPoint(trackCursor);
      }
    } finally {
      if (trackCursor != null) {
        trackCursor.close();
      }
    }

    //      Log.d( TAG, "transformSegmentToPath stop: points "+mCalculatedPoints );
  }
  private void calculateDots() {
    mPathCalculation.reset();
    mDotPathCalculation.clear();

    if (mWaypointsCursor == null) {
      mWaypointsCursor =
          this.mResolver.query(
              this.mWaypointsUri,
              new String[] {
                Waypoints.LATITUDE,
                Waypoints.LONGITUDE,
                Waypoints.SPEED,
                Waypoints.TIME,
                Waypoints.ACCURACY
              },
              null,
              null,
              null);
    }
    if (mRequeryFlag) {
      mWaypointsCursor.requery();
      mRequeryFlag = false;
    }
    if (mProjection != null && mWaypointsCursor.moveToFirst()) {
      GeoPoint geoPoint;

      mStartPoint = extractGeoPoint();
      mPrevGeoPoint = mStartPoint;

      do {
        geoPoint = extractGeoPoint();
        // Do no include log wrong 0.0 lat 0.0 long, skip to next value in while-loop
        if (geoPoint.getLatitudeE6() == 0 || geoPoint.getLongitudeE6() == 0) {
          continue;
        }
        setScreenPoint(geoPoint);

        float distance = (float) distanceInPoints(this.mPrevDrawnScreenPoint, this.mScreenPoint);
        if (distance > MINIMUM_PX_DISTANCE) {
          DotVO dotVO = new DotVO();
          dotVO.x = this.mScreenPoint.x;
          dotVO.y = this.mScreenPoint.y;
          dotVO.speed = mWaypointsCursor.getLong(2);
          dotVO.time = mWaypointsCursor.getLong(3);
          dotVO.radius = mProjection.metersToEquatorPixels(mWaypointsCursor.getFloat(4));
          mDotPathCalculation.add(dotVO);

          this.mPrevDrawnScreenPoint.x = this.mScreenPoint.x;
          this.mPrevDrawnScreenPoint.y = this.mScreenPoint.y;
        }
      } while (moveToNextWayPoint());

      this.mEndPoint = extractGeoPoint();
      DotVO pointVO = new DotVO();
      pointVO.x = this.mScreenPoint.x;
      pointVO.y = this.mScreenPoint.y;
      pointVO.speed = mWaypointsCursor.getLong(2);
      pointVO.time = mWaypointsCursor.getLong(3);
      pointVO.radius = mProjection.metersToEquatorPixels(mWaypointsCursor.getFloat(4));
      mDotPathCalculation.add(pointVO);
    }
  }