src/main/java/de/blau/android/layer/gpx/MapOverlay.java
/**
     * Draw the trackpoints
     * 
     * @param canvas the Canvas to draw on
     */
Draw the trackpoints

@param canvas the Canvas to draw on
Draw the trackpoints @param canvas the Canvas to draw on
private void drawTrackPoints(@NonNull Canvas canvas) {
        List<TrackPoint> trackPoints = track.getTrackPoints();
        int size = trackPoints.size();
        if (size > 0) {
            final float maxLen = getStrokeWidth() * 2;
            if (size < TRACKPOINT_PARALLELIZATION_THRESHOLD || linePointsList.size() == 1) {
                final FloatPrimitiveList linePoints = linePointsList.get(0);
                map.pointListToLinePointsArray(linePoints, trackPoints);
                GeoMath.squashPointsArray(linePoints, getStrokeWidth() * 2);
                canvas.drawLines(linePoints.getArray(), 0, linePoints.size(), paint);
            } else {
                int offset = 0;
                int length = size / linePointsList.size();
                List<Callable<Void>> callableTasks = new ArrayList<>();
                for (int i = linePointsList.size() - 1; i >= 0; i--) {
                    final FloatPrimitiveList finalLinePoints = linePointsList.get(i);
                    final int finalOffset = offset;
                    final int finalLength = i != 0 ? length + 1 : size - offset;
                    callableTasks.add(() -> {
                        map.pointListToLinePointsArray(finalLinePoints, trackPoints, finalOffset, finalLength);
                        GeoMath.squashPointsArray(finalLinePoints, maxLen);
                        canvas.drawLines(finalLinePoints.getArray(), 0, finalLinePoints.size(), paint);
                        return null;
                    });
                    offset += length;
                }
                try {
                    executorService.invokeAll(callableTasks);
                } catch (InterruptedException | RejectedExecutionException ex) { 
                    Log.e(DEBUG_TAG, ex.getMessage());
                }
            }
        }
    }
private void drawTrackPoints ( @ NonNull Canvas canvas ) { List < TrackPoint > trackPoints = track . getTrackPoints ( ) ; int size = trackPoints . size ( ) ; if ( size > 0 ) { final float maxLen = getStrokeWidth ( ) * 2 ; if ( size < TRACKPOINT_PARALLELIZATION_THRESHOLD || linePointsList . size ( ) == 1 ) { final FloatPrimitiveList linePoints = linePointsList . get ( 0 ) ; map . pointListToLinePointsArray ( linePoints , trackPoints ) ; GeoMath . squashPointsArray ( linePoints , getStrokeWidth ( ) * 2 ) ; canvas . drawLines ( linePoints . getArray ( ) , 0 , linePoints . size ( ) , paint ) ; } else { int offset = 0 ; int length = size / linePointsList . size ( ) ; List < Callable < Void > > callableTasks = new ArrayList < > ( ) ; for ( int i = linePointsList . size ( ) - 1 ; i >= 0 ; i -- ) { final FloatPrimitiveList finalLinePoints = linePointsList . get ( i ) ; final int finalOffset = offset ; final int finalLength = i != 0 ? length + 1 : size - offset ; callableTasks . add ( ( ) -> { map . pointListToLinePointsArray ( finalLinePoints , trackPoints , finalOffset , finalLength ) ; GeoMath . squashPointsArray ( finalLinePoints , maxLen ) ; canvas . drawLines ( finalLinePoints . getArray ( ) , 0 , finalLinePoints . size ( ) , paint ) ; return null ; } ) ; offset += length ; } try { executorService . invokeAll ( callableTasks ) ; } catch ( InterruptedException | RejectedExecutionException ex ) { Log . e ( DEBUG_TAG , ex . getMessage ( ) ) ; } } } }
Draw the trackpoints
Draw the trackpoints
// + 1 to join with next chunk, last chunk slightly different due to division remainder // NOSONAR not much we can do here