Skip to content

Commit

Permalink
NAVAND-1166: add snapshot logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dzinad committed Feb 17, 2023
1 parent d811f31 commit 82399e4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle/artifact-settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ext {
mapboxArtifactLicenseUrl = 'https://www.mapbox.com/legal/tos/'
snapshot = project.hasProperty("snapshot") ? project.property("snapshot").toBoolean() : false
releaseTagPrefix = project.hasProperty('RELEASE_TAG_PREFIX') ? project.property('RELEASE_TAG_PREFIX') : 'v'
versionName = getVersionName()
versionName = '2.7.2-logged-SNAPSHOT'
}

def getVersionName() {
Expand Down
5 changes: 5 additions & 0 deletions libnavui-maps/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ dependencies {
implementation project(":libnavui-resources")

api dependenciesList.mapboxMapSdk
api("com.mapbox.maps:android-core") {
version {
strictly '10.7.0-a34a63fde5-SNAPSHOT'
}
}
api dependenciesList.mapboxSdkTurf

implementation dependenciesList.androidXAppCompat
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.mapbox.navigation.ui.maps.camera

internal object LogTag {

const val TAG = "[maps-core-sdk]"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mapbox.navigation.ui.maps.camera.data

import android.location.Location
import android.util.Log
import androidx.annotation.UiThread
import com.mapbox.api.directions.v5.models.DirectionsRoute
import com.mapbox.api.directions.v5.models.LegStep
Expand All @@ -16,6 +17,7 @@ import com.mapbox.navigation.base.route.NavigationRoute
import com.mapbox.navigation.base.route.toNavigationRoute
import com.mapbox.navigation.base.trip.model.RouteProgress
import com.mapbox.navigation.core.MapboxNavigation
import com.mapbox.navigation.ui.maps.camera.LogTag
import com.mapbox.navigation.ui.maps.camera.NavigationCamera
import com.mapbox.navigation.ui.maps.camera.data.ViewportDataSourceProcessor.getMapAnchoredPaddingFromUserPadding
import com.mapbox.navigation.ui.maps.camera.data.ViewportDataSourceProcessor.getPitchFallbackFromRouteProgress
Expand Down Expand Up @@ -558,6 +560,7 @@ class MapboxNavigationViewportDataSource(
* Provide additional points that should be fitted into the following frame update.
*/
fun additionalPointsToFrameForFollowing(points: List<Point>) {
Log.i(LogTag.TAG, "additionalPointsToFrameForFollowing: $points")
additionalPointsToFrameForFollowing = ArrayList(points)
}

Expand All @@ -577,6 +580,7 @@ class MapboxNavigationViewportDataSource(
* @see [evaluate]
*/
fun followingCenterPropertyOverride(value: Point?) {
Log.i(LogTag.TAG, "followingCenterPropertyOverride: $value")
followingCenterProperty.override = value
}

Expand All @@ -589,6 +593,7 @@ class MapboxNavigationViewportDataSource(
* @see [evaluate]
*/
fun followingZoomPropertyOverride(value: Double?) {
Log.i(LogTag.TAG, "followingZoomPropertyOverride: $value")
followingZoomProperty.override = value
}

Expand All @@ -601,6 +606,7 @@ class MapboxNavigationViewportDataSource(
* @see [evaluate]
*/
fun followingBearingPropertyOverride(value: Double?) {
Log.i(LogTag.TAG, "followingBearingPropertyOverride: $value")
followingBearingProperty.override = value
}

Expand All @@ -613,6 +619,7 @@ class MapboxNavigationViewportDataSource(
* @see [evaluate]
*/
fun followingPitchPropertyOverride(value: Double?) {
Log.i(LogTag.TAG, "followingPitchPropertyOverride: $value")
followingPitchProperty.override = value
}

Expand Down Expand Up @@ -699,6 +706,8 @@ class MapboxNavigationViewportDataSource(
// needs to be added here to be taken into account for bearing smoothing
pointsForFollowing.addAll(additionalPointsToFrameForFollowing)

Log.i(LogTag.TAG, "Target location: $localTargetLocation, pointsToFrame: $pointsForFollowing")

if (pointsForFollowing.isEmpty()) {
options.followingFrameOptions.run {
val cameraState = mapboxMap.cameraState
Expand Down Expand Up @@ -734,6 +743,7 @@ class MapboxNavigationViewportDataSource(
options.followingFrameOptions.maximizeViewableGeometryWhenPitchZero &&
followingPitchProperty.get() == ZERO_PITCH
) {
Log.i(LogTag.TAG, "maximizeViewableGeometryWhenPitchZero=true, \npoints to frame: $pointsForFollowing, \npadding: $followingPadding")
mapboxMap.cameraForCoordinates(
pointsForFollowing,
followingPadding,
Expand All @@ -758,6 +768,7 @@ class MapboxNavigationViewportDataSource(
.pitch(followingPitchProperty.get())
.zoom(cameraState.zoom)
.build()
Log.i(LogTag.TAG, "maximizeViewableGeometryWhenPitchZero=false, \npoints to frame: $pointsForFollowing, \ncamera center: ${fallbackCameraOptions.center}\nmap size: $mapSize, followingPadding=${followingPadding}, screenBox=$screenBox, resultingPadding=$padding, zoom=${fallbackCameraOptions.zoom}")
if (pointsForFollowing.size > 1) {
mapboxMap.cameraForCoordinates(
pointsForFollowing,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.navigation.ui.maps.camera.data

import android.util.Log
import com.mapbox.api.directions.v5.models.DirectionsRoute
import com.mapbox.geojson.LineString
import com.mapbox.geojson.Point
Expand All @@ -11,6 +12,7 @@ import com.mapbox.navigation.base.trip.model.RouteLegProgress
import com.mapbox.navigation.base.trip.model.RouteProgress
import com.mapbox.navigation.base.trip.model.RouteStepProgress
import com.mapbox.navigation.base.utils.DecodeUtils.stepsGeometryToPoints
import com.mapbox.navigation.ui.maps.camera.LogTag
import com.mapbox.navigation.utils.internal.logE
import com.mapbox.turf.TurfConstants
import com.mapbox.turf.TurfException
Expand Down Expand Up @@ -250,14 +252,16 @@ internal object ViewportDataSourceProcessor {
}

return followingFrameOptions.pitchNearManeuvers.run {
if (
(if (
enabled &&
upcomingManeuverType !in excludedManeuvers &&
currentStepProgress.distanceRemaining <= triggerDistanceFromManeuver
) {
MapboxNavigationViewportDataSource.ZERO_PITCH
} else {
followingFrameOptions.defaultPitch
}).also {
Log.i(LogTag.TAG, "getPitchFallbackFromRouteProgress, result=$it, default pitch=${followingFrameOptions.defaultPitch}, distanceRemaining=${currentStepProgress.distanceRemaining}, triggerDistanceFromManeuver=$triggerDistanceFromManeuver")
}
}
}
Expand Down

0 comments on commit 82399e4

Please sign in to comment.