Skip to content

Feature/3 (integrate with OsmAnd active tracks, process a selected distance range, and export the result back to OsmAnd)#1

Merged
adbuker merged 12 commits into
masterfrom
feature/3
Jun 8, 2026
Merged

Feature/3 (integrate with OsmAnd active tracks, process a selected distance range, and export the result back to OsmAnd)#1
adbuker merged 12 commits into
masterfrom
feature/3

Conversation

@adbuker

@adbuker adbuker commented May 8, 2026

Copy link
Copy Markdown
Owner

No description provided.

@adbuker adbuker requested a review from Copilot May 8, 2026 09:11
@adbuker adbuker changed the title Feature/3 Feature/3 (integrate with OsmAnd active tracks, process a selected distance range, and export the result back to OsmAnd) May 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new “Track Corridor” workflow to generate POIs along a selected segment of an OsmAnd GPX track, including OsmAnd AIDL integration, corridor geometry utilities, and supporting documentation/tests.

Changes:

  • Added Track Corridor UI flow (track selection, segment/corridor inputs, POI generation, send back to OsmAnd/share).
  • Introduced OsmAnd AIDL interface + parcelables, plus track parsing/corridor calculation helpers and cache.
  • Added docs and unit tests for the new parsing/corridor/cache components.

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
README.md Documents the new Track Corridor feature and links to new docs.
docs/track-corridor-workflow.md Adds a workflow diagram for the Track Corridor flow.
docs/architecture.md Adds a more complete architecture/project structure overview.
app/src/test/java/com/example/googleAttractionsGpx/TrackCacheRepositoryTest.kt Unit tests for track URI cache serialization/deserialization.
app/src/test/java/com/example/googleAttractionsGpx/GpxTrackParserTest.kt Unit tests for GPX track-point parsing behavior.
app/src/test/java/com/example/googleAttractionsGpx/CorridorCalculatorTest.kt Unit tests for corridor distance/segment extraction/bounds calculation.
app/src/main/java/net/osmand/aidlapi/gpx/ImportGpxParams.java Parcelable params for importing GPX into OsmAnd via AIDL.
app/src/main/java/net/osmand/aidlapi/gpx/ASelectedGpxFile.java Parcelable for selected/active GPX file references from OsmAnd.
app/src/main/java/net/osmand/aidlapi/gpx/AGpxFileDetails.java Parcelable details container for GPX metadata returned by OsmAnd.
app/src/main/java/net/osmand/aidlapi/gpx/AGpxFile.java Parcelable for imported GPX file entries returned by OsmAnd.
app/src/main/java/net/osmand/aidlapi/AidlParams.java Base Parcelable implementation used by added OsmAnd AIDL parcelables.
app/src/main/java/com/example/googleAttractionsGpx/presentation/TrackCorridorScreen.kt New Compose screen implementing the Track Corridor feature.
app/src/main/java/com/example/googleAttractionsGpx/presentation/MainActivity.kt Adds navigation route + toolbar entry point to Track Corridor screen.
app/src/main/java/com/example/googleAttractionsGpx/data/repository/TrackCacheRepository.kt SharedPreferences-backed cache mapping track names to persisted URIs.
app/src/main/java/com/example/googleAttractionsGpx/data/repository/OsmAndConnection.kt AIDL binding + APIs to fetch tracks and import GPX into OsmAnd.
app/src/main/java/com/example/googleAttractionsGpx/data/repository/GpxTrackParser.kt SAX-based track-point parsing from GPX files.
app/src/main/java/com/example/googleAttractionsGpx/data/repository/CorridorCalculator.kt Distance accumulation, sub-segment extraction, and corridor bounds computation.
app/src/main/AndroidManifest.xml Adds <queries> entries for OsmAnd package visibility.
app/src/main/aidl/net/osmand/aidlapi/IOsmAndAidlInterface.aidl Adds OsmAnd AIDL interface definition used for integration.
app/src/main/aidl/net/osmand/aidlapi/gpx/ImportGpxParams.aidl Declares ImportGpxParams as AIDL parcelable.
app/src/main/aidl/net/osmand/aidlapi/gpx/ASelectedGpxFile.aidl Declares ASelectedGpxFile as AIDL parcelable.
app/src/main/aidl/net/osmand/aidlapi/gpx/AGpxFileDetails.aidl Declares AGpxFileDetails as AIDL parcelable.
app/src/main/aidl/net/osmand/aidlapi/gpx/AGpxFile.aidl Declares AGpxFile as AIDL parcelable.
app/build.gradle.kts Enables AIDL build feature and bumps version.
.gitignore Ignores additional build output directories.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/aidl/net/osmand/aidlapi/IOsmAndAidlInterface.aidl
adbuker and others added 3 commits June 5, 2026 12:14
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 26 changed files in this pull request and generated 11 comments.

Comment on lines +114 to +116
fun selectTrack(trackName: String) {
selectedTrack = trackName
val cachedUri = trackCache.getUri(trackName)
Comment on lines +63 to +67
if (uri != null && selectedTrack != null) {
context.contentResolver.takePersistableUriPermission(
uri, Intent.FLAG_GRANT_READ_URI_PERMISSION
)
trackCache.putUri(selectedTrack!!, uri.toString())
Comment on lines +96 to +106
onConnected = {
val activeResult = osmAnd.getActiveTracks()
val importedResult = if (activeResult.tracks.isEmpty()) osmAnd.getImportedTracks() else null
val allTracks = importedResult?.tracks ?: activeResult.tracks
tracks = allTracks
isLoading = false
val diag = activeResult.diagnostics +
(if (importedResult != null) "\n${importedResult.diagnostics}" else "")
statusText = if (allTracks.isEmpty()) "No active tracks found.\n$diag"
else "Found ${allTracks.size} track(s)\n$diag"
},
Comment on lines +401 to +408
sb.append(" <trk>\n")
sb.append(" <name>Corridor segment</name>\n")
sb.append(" <trkseg>\n")
segment.forEach { coord ->
sb.append(""" <trkpt lat="${coord.latitude}" lon="${coord.longitude}"/>""").append("\n")
}
sb.append(" </trkseg>\n")
sb.append(" </trk>\n")
Comment on lines +42 to +45
if (result.isEmpty() && i > 0 && cumDist[i - 1] < startKm) {
val ratio = (startKm - cumDist[i - 1]) / (cumDist[i] - cumDist[i - 1])
result.add(interpolate(points[i - 1], points[i], ratio))
}
Comment on lines +58 to +61
if (cumDist[i] >= startKm) {
val ratio = (startKm - cumDist[i - 1]) / (cumDist[i] - cumDist[i - 1])
result.add(interpolate(points[i - 1], points[i], ratio))
break
Comment on lines +81 to +83
val latOffset = widthMeters / 111_320.0
val lngOffset = widthMeters / (111_320.0 * cos(Math.toRadians(centerLat)))

Comment on lines +140 to +143
points = bundle.getInt("points");
wptPoints = bundle.getInt("wptPoints");
wptCategoryNames = bundle.getStringArrayList("wptCategoryNames");
}
Comment on lines +78 to +80
val diag = "getActiveGpx: result=$result, count=${files.size}" +
files.joinToString { "\n - ${it.fileName}" }
TrackResult(files.mapNotNull { it.fileName }, diag)
Comment on lines +96 to +98
val diag = "getImportedGpx: result=$result, count=${files.size}" +
files.joinToString { "\n - ${it.fileName} (active=${it.isActive})" }
TrackResult(files.mapNotNull { it.fileName }, diag)
@adbuker adbuker merged commit d5989f4 into master Jun 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants