formatterlegs

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2024 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatLegs

func FormatLegs(
	connectionsVerbose *[]dbt.ConnectionVerbose,
	transfers *[]dbt.Transfer,
	beginTime *time.Time,
	walkspeedKmHr float64,
	from [2]float64,
	to [2]float64,
) *[]RouteLeg

Types

type RouteLeg

type RouteLeg struct {
	LegType       string     `json:"leg_type"` // transfer, walk, or trip
	LegBeginTime  time.Time  `json:"leg_begin_time,omitempty"`
	LegEndTime    time.Time  `json:"leg_end_time,omitempty"`
	LegDuration   string     `json:"leg_duration"`
	LegFromCoords [2]float64 `json:"leg_from_coords"`
	LegToCoords   [2]float64 `json:"leg_to_coords"`

	// When LegType == "trip" will be present
	TripRoute         *string              `json:"trip_route,omitempty"`
	TripRouteHeadsign *string              `json:"trip_route_headsign,omitempty"`
	TripFrom          *string              `json:"trip_from,omitempty"`
	TripFromSIDU      *string              `json:"-"`
	TripToSIDU        *string              `json:"-"`
	TripTo            *string              `json:"trip_to,omitempty"`
	TripStops         *[]*RouteStopDetails `json:"trip_stops,omitempty"`
	TripFeedID        *int                 `json:"trip_feed_id,omitempty"`
	TripAgencyID      *string              `json:"trip_agency_id,omitempty"`

	// When LegType == "walk" wil be present
	TransferFrom     *string `json:"transfer_from,omitempty"`
	TransferTo       *string `json:"transfer_to,omitempty"`
	TransferDdwell   *string `json:"transfer_ddwell,omitempty"`
	TransferDactive  *string `json:"transfer_dactive,omitempty"`
	TransferCategory *string `json:"transfer_category,omitempty"`
	TransferFeedIDs  *[]int  `json:"transfer_feed_ids,omitempty"`

	// When LegType == "transfer" will be present
	WalkTo     *string  `json:"walk_to,omitempty"`
	WalkFrom   *string  `json:"walk_from,omitempty"`
	WalkDistKm *float64 `json:"walk_dist_km,omitempty"`
}

RouteLeg represents a 'leg' in a route which may be either of transfer, walk, or trip type (see the LegType field).

The Leg* properties are always present, Trip*, Transfer*, and Walk* fields may be nonnil depending on the LegType field.

func FormatConnectionsToLegTransfer

func FormatConnectionsToLegTransfer(
	transfers *[]dbt.Transfer,
	legTransferFrom, legTransferTo *RouteLeg,
) *RouteLeg

func FormatConnectionsToLegTrip

func FormatConnectionsToLegTrip(
	yyyymmdd uint,
	timezoneUTCDeltasecs int,
	legConnections []*dbt.ConnectionVerbose,
) *RouteLeg

func FormatLegWalk

func FormatLegWalk(
	coordFrom, coordTo [2]float64,
	labelFrom, labelTo string,
	beginWalkAtTime time.Time,
	walkspeedKmHr float64,
) *RouteLeg

type RouteStopDetails

type RouteStopDetails struct {
	Time   time.Time  `json:"stop_time"`
	Name   string     `json:"stop_name"`
	Coords [2]float64 `json:"stop_coords"`
	ConnID string     `json:"stop_conn_id"`
}

RouteStopDetails represents a stop within a trip.

func FormatLegsStopDetails

func FormatLegsStopDetails(
	yyyymmdd uint,
	timezoneUTCDeltasecs int,
	legConnections []*dbt.ConnectionVerbose,
) []*RouteStopDetails

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL