Skip to content

Commit

Permalink
Update TrackImporter.java
Browse files Browse the repository at this point in the history
Added the Feature which Identifies when a user is on a chairlift.
  • Loading branch information
Bharath290403 committed Apr 8, 2024
1 parent 4310e85 commit dc8d09c
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,28 @@ private void matchMarkers2TrackPoints(Track.Id trackId) {
markers.addAll(doneMarkers);
}

public List<TrackPoint> chairLiftSegment(List<TrackPoint> trackPoints, double elevationThreshold)
{
List<TrackPoint> currentSegment = new ArrayList<>();
for (int i=1;i<trackPoints.size();i++)
{
TrackPoint previousPoint = trackPoints.get(i - 1);
TrackPoint currentPoint = trackPoints.get(i);
double currentElevation = currentPoint.getAltitude().toM();
double previousElevation = previousPoint.getAltitude().toM();
double elevationDifference = Math.abs(currentElevation - previousElevation);
if (elevationDifference > elevationThreshold) // TrackPoints are added to the list
{
currentSegment.add(currentPoint);
}
else if (elevationDifference<=elevationThreshold) // The chairlift has stopped gaining altitude
{
break;
}
}
return currentSegment; // list is returned.
}

/**
* Gets the photo url for a file.
*
Expand Down

0 comments on commit dc8d09c

Please sign in to comment.