Merged
Conversation
There was a problem hiding this comment.
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.
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>
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.