Skip to content

GeoRouteRequest

Qt Base Class: QGeoRouteRequest

Signature: QGeoRouteRequest(self, origin: PySide6.QtPositioning.QGeoCoordinate, destination: PySide6.QtPositioning.QGeoCoordinate) -> None QGeoRouteRequest(self, other: PySide6.QtLocation.QGeoRouteRequest) -> None QGeoRouteRequest(self, waypoints: Sequence[PySide6.QtPositioning.QGeoCoordinate] = Default(QList<QGeoCoordinate>)) -> None

Base classes

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

⋔ Inheritance diagram

graph TD
  1473573431696["location.GeoRouteRequest"]
  1473573384848["QtLocation.QGeoRouteRequest"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473573384848 --> 1473573431696
  1473291690208 --> 1473573384848
  140713234304496 --> 1473291690208

🛈 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) -> RouteOptimizationStr:
        """Return current route optimization.

        Returns:
            Route optimization
        """
        return ROUTE_OPTIMIZATION.inverse[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() -> RouteOptimizationStr

Return current route optimization.

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

    Returns:
        Route optimization
    """
    return ROUTE_OPTIMIZATION.inverse[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))