예제 #1
0
파일: main.go 프로젝트: cdupuis/strava
func lookupTransitRoutingPreference(transitRoutingPreference string, r *maps.DistanceMatrixRequest) {
	switch transitRoutingPreference {
	case "fewer_transfers":
		r.TransitRoutingPreference = maps.TransitRoutingPreferenceFewerTransfers
	case "less_walking":
		r.TransitRoutingPreference = maps.TransitRoutingPreferenceLessWalking
	case "":
		// ignore
	default:
		log.Fatalf("Unknown transit routing preference %s", transitRoutingPreference)
	}
}
예제 #2
0
파일: main.go 프로젝트: cdupuis/strava
func lookupUnits(units string, r *maps.DistanceMatrixRequest) {
	switch units {
	case "metric":
		r.Units = maps.UnitsMetric
	case "imperial":
		r.Units = maps.UnitsImperial
	case "":
		// ignore
	default:
		log.Fatalf("Unknown units %s", units)
	}
}
예제 #3
0
파일: main.go 프로젝트: cdupuis/strava
func lookupAvoid(avoid string, r *maps.DistanceMatrixRequest) {
	switch avoid {
	case "tolls":
		r.Avoid = maps.AvoidTolls
	case "highways":
		r.Avoid = maps.AvoidHighways
	case "ferries":
		r.Avoid = maps.AvoidFerries
	case "":
		// ignore
	default:
		log.Fatalf("Unknown avoid restriction %s", avoid)
	}
}
예제 #4
0
파일: main.go 프로젝트: cdupuis/strava
func lookupMode(mode string, r *maps.DistanceMatrixRequest) {
	switch mode {
	case "driving":
		r.Mode = maps.TravelModeDriving
	case "walking":
		r.Mode = maps.TravelModeWalking
	case "bicycling":
		r.Mode = maps.TravelModeBicycling
	case "transit":
		r.Mode = maps.TravelModeTransit
	case "":
		// ignore
	default:
		log.Fatalf("Unknown mode %s", mode)
	}
}
예제 #5
0
파일: main.go 프로젝트: cdupuis/strava
func lookupTransitMode(transitMode string, r *maps.DistanceMatrixRequest) {
	if transitMode != "" {
		for _, m := range strings.Split(transitMode, "|") {
			switch m {
			case "bus":
				r.TransitMode = append(r.TransitMode, maps.TransitModeBus)
			case "subway":
				r.TransitMode = append(r.TransitMode, maps.TransitModeSubway)
			case "train":
				r.TransitMode = append(r.TransitMode, maps.TransitModeTrain)
			case "tram":
				r.TransitMode = append(r.TransitMode, maps.TransitModeTram)
			case "rail":
				r.TransitMode = append(r.TransitMode, maps.TransitModeRail)
			default:
				log.Fatalf("Unknown transit_mode %s", m)
			}
		}
	}
}