import { AppliedFareProduct, Company, Config, Currency, ElevationProfile, ElevationProfileComponent, FlexBookingInfo, ItineraryOnlyLegsRequired, LatLngArray, Leg, MassUnitOption, Money, Place, Step, Stop, TncFare } from "@opentripplanner/types"; export declare const transitModes: string[]; /** * @param {config} config OTP-RR configuration object * @return {Array} List of all transit modes defined in config; otherwise default mode list */ export declare function getTransitModes(config: Config): string[]; export declare function isTransitLeg(leg: Leg): boolean; export declare function isTransit(mode: string): boolean; /** * Returns true if the leg pickup rules enabled which require * calling ahead for the service to run. "mustPhone" is the only * property which encodes this info. */ export declare function isReservationRequired(leg: Leg): boolean; /** * Returns true if a user must ask the driver to let the user off * or if the user must flag the driver down for pickup. * "coordinateWithDriver" in board/alight rule encodes this info. */ export declare function isCoordinationRequired(leg: Leg): boolean; export declare function containsGeometry(place: Place): boolean; export declare function endsWithGeometry(leg: Leg): boolean; export declare function startsWithGeometry(leg: Leg): boolean; export declare function legContainsGeometry(leg: Leg): boolean; export declare function isAdvanceBookingRequired(info?: FlexBookingInfo): boolean; export declare function legDropoffRequiresAdvanceBooking(leg: Leg): boolean; /** * The two rules checked by the above two functions are the only values * returned by OTP when a leg is a flex leg. */ export declare function isFlex(leg: Leg): boolean; export declare function isRideshareLeg(leg: Leg): boolean; export declare function isWalk(mode: string): boolean; export declare function isBicycle(mode: string): boolean; export declare function isBicycleRent(mode: string): boolean; export declare function isCar(mode: string): boolean; export declare function isMicromobility(mode: string): boolean; export declare function isAccessMode(mode: string): boolean; /** * @param {string} modesStr a comma-separated list of OTP modes * @return {boolean} whether any of the modes are transit modes */ export declare function hasTransit(modesStr: string): boolean; /** * @param {string} modesStr a comma-separated list of OTP modes * @return {boolean} whether any of the modes are car-based modes */ export declare function hasCar(modesStr: string): boolean; /** * @param {string} modesStr a comma-separated list of OTP modes * @return {boolean} whether any of the modes are bicycle-based modes */ export declare function hasBike(modesStr: string): boolean; /** * @param {string} modesStr a comma-separated list of OTP modes * @return {boolean} whether any of the modes are micromobility-based modes */ export declare function hasMicromobility(modesStr: string): boolean; /** * @param {string} modesStr a comma-separated list of OTP modes * @return {boolean} whether any of the modes is a hailing mode */ export declare function hasHail(modesStr: string): boolean; /** * @param {string} modesStr a comma-separated list of OTP modes * @return {boolean} whether any of the modes is a rental mode */ export declare function hasRental(modesStr: string): boolean; export declare function getMapColor(mode: string): string; export declare function toSentenceCase(str: string): string; /** * Derive the company string based on mode and network associated with leg. */ export declare function getCompanyFromLeg(leg?: Leg): string | null; export declare function getItineraryBounds(itinerary: ItineraryOnlyLegsRequired): LatLngArray[]; /** * Return a coords object that encloses the given leg's geometry. */ export declare function getLegBounds(leg: Leg): number[][]; export declare function legLocationAtDistance(leg: Leg, distance: number): LatLngArray | undefined | null; /** * Returns an interpolated elevation at a specified distance along a leg * @param points - The points of the elevation profile. Each point is a tuple of [distance, elevation]. * @param distance - The distance along the leg to interpolate the elevation at * @returns The interpolated elevation at the specified distance */ export declare function legElevationAtDistance(points: [number, number][], distance: number): number | undefined; export declare function mapOldElevationComponentToNew(oldElev: { first: number; second: number; }): ElevationProfileComponent; export declare function getElevationProfile(steps: Step[], unitConversion?: number): ElevationProfile; /** * Uses canvas.measureText to compute and return the width of the given text of given font in pixels. * * @param {string} text The text to be rendered. * @param {string} font The css font descriptor that text is to be rendered with (e.g. "bold 14px verdana"). * * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393 */ export declare function getTextWidth(text: string, font?: string): number; /** * Get the configured company object for the given network string if the company * has been defined in the provided companies array config. */ export declare function getCompanyForNetwork(networkString: string, companies?: Company[]): Company | undefined; /** * Get a string label to display from a list of vehicle rental networks. Returns * empty string if no networks provided. * * @param {Array} networks A list of network ids. * @param {Array} [companies=[]] An optional list of the companies config. * @return {string} A label for use in presentation on a website. */ export declare function getCompaniesLabelFromNetworks(networks?: string[] | string, companies?: Company[]): string; export declare function getTNCLocation(leg: Pick, type: "from" | "to"): string; export declare function calculatePhysicalActivity(itinerary: ItineraryOnlyLegsRequired): { bikeDuration: number; caloriesBurned: number; walkDuration: number; }; /** * For an itinerary, calculates the TNC fares and returns an object with * these values and currency info. * It is assumed that the same currency is used for all TNC legs. */ export declare function calculateTncFares(itinerary: ItineraryOnlyLegsRequired): TncFare; /** * @param {itinerary} itinerary OTP trip itinierary, only legs is required. * @param {carbonIntensity} carbonIntensity carbon intensity by mode in grams/meter * @param {units} units units to be used in return value * @return Amount of carbon in chosen unit */ export declare function calculateEmissions(itinerary: ItineraryOnlyLegsRequired, carbonIntensity?: Record, units?: MassUnitOption): number; /** * Returns the user-facing stop code to display for a stop or place */ export declare function getDisplayedStopCode(placeOrStop: Place | Stop): string | undefined; /** * Removes the first part of the OTP standard scope (":"), if it is present. * @param item String that is potentially scoped with `:` character * @returns descoped string */ export declare const descope: (item?: string | null) => string | null | undefined; export type ExtendedMoney = Money & { originalAmount?: number; }; export declare const zeroDollars: (currency: Currency) => Money; /** * Extracts useful data from the fare products on a leg, such as the leg cost and transfer info. * @param leg Leg with Fares v2 information * @param mediumId Desired medium ID to calculate fare for * @param riderCategoryId Desire rider category to calculate fare for * @param seenFareIds Fare IDs used on previous legs. Used to detect transfer discounts. * @returns Object containing price as well as transfer/dependent * fare information. `AppliedFareProduct` should contain * all the information needed, but the other fields are kept to * make the transition to Fares V2 less jarring. */ export declare function getLegCost(leg: Leg, mediumId?: string | null, riderCategoryId?: string | null, seenFareIds?: string[] | null): { alternateFareProducts?: AppliedFareProduct[]; appliedFareProduct?: AppliedFareProduct; isDependent?: boolean; price?: Money; productUseId?: string; }; /** * Returns the total itinerary cost for a given set of legs. * @param legs Itinerary legs with fare products (must have used getLegsWithFares) * @param category Rider category (youth, regular, senior) * @param container Fare container (cash, electronic) * @param seenFareIds List of fare product IDs that have already been seen on prev legs. * @param nulledTotalFareOnAnyMissingFare If this is set to true, the total fare * will be null if *any* fare is missing. If false, the total will be the total * fare with the missing fares ignored. * @returns Money object for the total itinerary cost. */ export declare function getItineraryCost(legs: Leg[], mediumId?: string | (string | null)[] | null, riderCategoryId?: string | (string | null)[] | null, nulledTotalFareOnAnyMissingFare?: boolean): Money | undefined; export declare const convertGraphQLResponseToLegacy: (leg: any) => Leg; /** Extracts the route number for a leg returned from OTP1 or OTP2. */ export declare const getLegRouteShortName: (leg: Pick) => string | null; /** Extract the route long name for a leg returned from OTP1 or OTP2. */ export declare const getLegRouteLongName: (leg: Pick) => string | undefined; /** * Returns the route short name, or the route long name if no short name is provided. * This is happens with Seattle area streetcars and ferries. */ export declare const getLegRouteName: (leg: Pick) => string | undefined; //# sourceMappingURL=itinerary.d.ts.map