Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc8de856 authored by mitulsheth's avatar mitulsheth
Browse files

Merge branch 'main' of https://gitlab.e.foundation/e/os/maps into...

Merge branch 'main' of https://gitlab.e.foundation/e/os/maps into Fix_removing_places_from_the_favorites-ai-review
parents 66fbd88c 5562383a
Loading
Loading
Loading
Loading
Loading
+33 −10
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ interface AutoOptions {
    val maneuverPenalty: Double?
    val gateCost: Double?
    val privateAccessPenalty: Double?
    val tollBoothCost: Double?
    val useHighways: Double?
    val useTolls: Double?
    val useLivingStreets: Double?
@@ -66,11 +67,12 @@ interface AutoOptions {
 * Routing options for automobile mode.
 */
data class AutoRoutingOptions(
    override val costingType: String = "auto",
    override val costingType: String = COSTING_TYPE_AUTO,

    // Maneuver and access penalties
    override val maneuverPenalty: Double? = null,
    override val gateCost: Double? = null,
    override val maneuverPenalty: Double? = DEFAULT_MANEUVER_PENALTY,
    override val gateCost: Double? = DEFAULT_GATE_COST,
    override val tollBoothCost: Double? = DEFAULT_TOLL_BOOTH_COST,
    override val privateAccessPenalty: Double? = null,

    // Road type preferences (0-1 range)
@@ -88,17 +90,26 @@ data class AutoRoutingOptions(
    // HOV options
    override val excludeUnpaved: Boolean? = null,
    override val excludeCashOnlyTolls: Boolean? = null
) : RoutingOptions(), AutoOptions
) : RoutingOptions(), AutoOptions {

    companion object {
        const val COSTING_TYPE_AUTO = "auto"
        const val DEFAULT_MANEUVER_PENALTY = 25.0
        const val DEFAULT_GATE_COST = 45.0
        const val DEFAULT_TOLL_BOOTH_COST = 30.0
    }
}

/**
 * Routing options for truck mode (extends auto with truck-specific parameters).
 */
data class TruckRoutingOptions(
    override val costingType: String = "truck",
    override val costingType: String = COSTING_TYPE_TRUCK,

    // Basic auto options
    override val maneuverPenalty: Double? = null,
    override val gateCost: Double? = null,
    override val gateCost: Double? = DEFAULT_GATE_COST,
    override val tollBoothCost: Double? = DEFAULT_TOLL_BOOTH_COST,
    override val privateAccessPenalty: Double? = null,
    override val useHighways: Double? = null,
    override val useTolls: Double? = null,
@@ -119,7 +130,14 @@ data class TruckRoutingOptions(
    val axleCount: Int? = null,
    val hazmat: Boolean? = null,
    val useTruckRoute: Double? = null // 0-1 range
) : RoutingOptions(), AutoOptions
) : RoutingOptions(), AutoOptions {

    companion object {
        const val COSTING_TYPE_TRUCK = "truck"
        const val DEFAULT_GATE_COST = 45.0
        const val DEFAULT_TOLL_BOOTH_COST = 30.0
    }
}

/**
 * Routing options for motor scooter mode.
@@ -130,6 +148,7 @@ data class MotorScooterRoutingOptions(
    // Basic auto options
    override val maneuverPenalty: Double? = null,
    override val gateCost: Double? = null,
    override val tollBoothCost: Double? = null,
    override val privateAccessPenalty: Double? = null,
    override val useHighways: Double? = null,
    override val useTolls: Double? = null,
@@ -156,6 +175,7 @@ data class MotorcycleRoutingOptions(
    // Basic auto options
    override val maneuverPenalty: Double? = null,
    override val gateCost: Double? = null,
    override val tollBoothCost: Double? = null,
    override val privateAccessPenalty: Double? = null,
    override val useHighways: Double? = null,
    override val useTolls: Double? = null,
@@ -199,8 +219,7 @@ data class CyclingRoutingOptions(
data class PedestrianRoutingOptions(
    override val costingType: String = "pedestrian",

    // Walking speed
    val walkingSpeed: Double? = null, // km/h
    val walkingSpeed: Double? = WALKING_SPEED_IN_KMH, // km/h

    // Path preferences (factors)
    val walkwayFactor: Double? = null,
@@ -211,4 +230,8 @@ data class PedestrianRoutingOptions(

    // Accessibility options
    val type: PedestrianType? = null
) : RoutingOptions()
) : RoutingOptions() {
    companion object {
        const val WALKING_SPEED_IN_KMH = 4.2
    }
}
+5 −10
Original line number Diff line number Diff line
@@ -36,11 +36,9 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.isImeVisible
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeContent
@@ -112,7 +110,6 @@ import earth.maps.cardinal.routing.RouteRepository
import earth.maps.cardinal.ui.directions.DirectionsScreen
import earth.maps.cardinal.ui.directions.DirectionsViewModel
import earth.maps.cardinal.ui.directions.RouteDisplayHandler
import earth.maps.cardinal.ui.navigation.TurnByTurnNavigationScreen
import earth.maps.cardinal.ui.home.HomeScreen
import earth.maps.cardinal.ui.home.HomeViewModel
import earth.maps.cardinal.ui.home.NearbyScreenContent
@@ -121,6 +118,7 @@ import earth.maps.cardinal.ui.home.OfflineAreasScreen
import earth.maps.cardinal.ui.home.OfflineAreasViewModel
import earth.maps.cardinal.ui.home.TransitScreenContent
import earth.maps.cardinal.ui.home.TransitScreenViewModel
import earth.maps.cardinal.ui.navigation.TurnByTurnNavigationScreen
import earth.maps.cardinal.ui.place.PlaceCardScreen
import earth.maps.cardinal.ui.place.PlaceCardViewModel
import earth.maps.cardinal.ui.saved.ManagePlacesScreen
@@ -1112,13 +1110,10 @@ private fun TurnByTurnRoute(
        }
    }

    val routingMode = routingModeJson?.let {
        try {
            Gson().fromJson(it, RoutingMode::class.java)
        } catch (_: Exception) {
            RoutingMode.AUTO
        }
    } ?: RoutingMode.AUTO
    val routingMode = runCatching {
        RoutingMode.entries.first { it.value.equals(routingModeJson, ignoreCase = true) } ?: RoutingMode.AUTO
    }.getOrElse { RoutingMode.AUTO }


    port?.let { port ->
        TurnByTurnNavigationScreen(