Skip to content

GeoRouteRequest

Base classes

Name Children Inherits
QGeoRouteRequest
PySide6.QtLocation
QGeoRouteRequest(self, origin: PySide6.QtPositioning.QGeoCoordinate, destination: PySide6.QtPositioning.QGeoCoordinate, /) -> None

â‹” Inheritance diagram

graph TD
  866370724["location.GeoRouteRequest"]
  1082501113["QtLocation.QGeoRouteRequest"]
  37984305["Shiboken.Object"]
  2751680898["builtins.object"]
  1082501113 --> 866370724
  37984305 --> 1082501113
  2751680898 --> 37984305

🛈 DocStrings

Bases: QGeoRouteRequest

Represents the params and restrictions defining a routing information request.

Source code in prettyqt/location/georouterequest.py
class GeoRouteRequest(QtLocation.QGeoRouteRequest):
    """Represents the params and restrictions defining a routing information request."""

    def get_waypoints(self) -> list[positioning.GeoCoordinate]:
        return [positioning.GeoCoordinate(wp) for wp in self.waypoints()]

    def get_exclude_areas(self) -> list[positioning.GeoRectangle]:
        return [positioning.GeoRectangle(wp) for wp in self.excludeAreas()]

    def get_departure_time(self) -> core.DateTime:
        return core.DateTime(self.departureTime())

    def set_feature_weight(
        self,
        feature: FeatureTypeStr | QtLocation.QGeoRouteRequest.FeatureType,
        weight: FeatureWeightStr | QtLocation.QGeoRouteRequest.FeatureWeight,
    ):
        """Set the feature weight.

        Args:
            feature: Feature type
            weight: Feature weight
        """
        self.setFeatureWeight(
            FEATURE_TYPES.get_enum_value(feature), FEATURE_WEIGHTS.get_enum_value(weight)
        )

    def get_feature_weight(
        self, feature: FeatureTypeStr | QtLocation.QGeoRouteRequest.FeatureType
    ) -> FeatureWeightStr:
        """Return current feature weight.

        Returns:
            Feature weight
        """
        return FEATURE_WEIGHTS.inverse[
            self.featureWeight(FEATURE_TYPES.get_enum_value(feature))
        ]

    def set_route_optimization(
        self,
        optimization: RouteOptimizationStr
        | QtLocation.QGeoRouteRequest.RouteOptimization,
    ):
        """Set the route optimization.

        Args:
            optimization: Route optimization
        """
        self.setRouteOptimization(ROUTE_OPTIMIZATION.get_enum_value(optimization))

    def get_route_optimization(self) -> list[RouteOptimizationStr]:
        """Return current route optimization.

        Returns:
            Route optimization
        """
        return ROUTE_OPTIMIZATION.get_list(self.routeOptimization())

    def get_travel_modes(self) -> list[TravelModeStr]:
        return TRAVEL_MODE.get_list(self.travelModes())

    def set_travel_modes(self, *mode: TravelModeStr):
        flags = TRAVEL_MODE.merge_flags(mode)
        self.setTravelModes(flags)

    def get_feature_types(self) -> list[FeatureTypeStr]:
        return [k for k, v in FEATURE_TYPES.items() for t in self.featureTypes() if v & t]

get_feature_weight(feature: FeatureTypeStr | QtLocation.QGeoRouteRequest.FeatureType) -> FeatureWeightStr

Return current feature weight.

Source code in prettyqt/location/georouterequest.py
def get_feature_weight(
    self, feature: FeatureTypeStr | QtLocation.QGeoRouteRequest.FeatureType
) -> FeatureWeightStr:
    """Return current feature weight.

    Returns:
        Feature weight
    """
    return FEATURE_WEIGHTS.inverse[
        self.featureWeight(FEATURE_TYPES.get_enum_value(feature))
    ]

get_route_optimization() -> list[RouteOptimizationStr]

Return current route optimization.

Source code in prettyqt/location/georouterequest.py
def get_route_optimization(self) -> list[RouteOptimizationStr]:
    """Return current route optimization.

    Returns:
        Route optimization
    """
    return ROUTE_OPTIMIZATION.get_list(self.routeOptimization())

set_feature_weight(feature: FeatureTypeStr | QtLocation.QGeoRouteRequest.FeatureType, weight: FeatureWeightStr | QtLocation.QGeoRouteRequest.FeatureWeight)

Set the feature weight.

Parameters:

Name Type Description Default
feature FeatureTypeStr | FeatureType

Feature type

required
weight FeatureWeightStr | FeatureWeight

Feature weight

required
Source code in prettyqt/location/georouterequest.py
def set_feature_weight(
    self,
    feature: FeatureTypeStr | QtLocation.QGeoRouteRequest.FeatureType,
    weight: FeatureWeightStr | QtLocation.QGeoRouteRequest.FeatureWeight,
):
    """Set the feature weight.

    Args:
        feature: Feature type
        weight: Feature weight
    """
    self.setFeatureWeight(
        FEATURE_TYPES.get_enum_value(feature), FEATURE_WEIGHTS.get_enum_value(weight)
    )

set_route_optimization(optimization: RouteOptimizationStr | QtLocation.QGeoRouteRequest.RouteOptimization)

Set the route optimization.

Parameters:

Name Type Description Default
optimization RouteOptimizationStr | RouteOptimization

Route optimization

required
Source code in prettyqt/location/georouterequest.py
def set_route_optimization(
    self,
    optimization: RouteOptimizationStr
    | QtLocation.QGeoRouteRequest.RouteOptimization,
):
    """Set the route optimization.

    Args:
        optimization: Route optimization
    """
    self.setRouteOptimization(ROUTE_OPTIMIZATION.get_enum_value(optimization))

:fa-brands-github: Show source on GitHub