tcx

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CvtToFitLaps

func CvtToFitLaps(db *TCXDB) (runLaps []fit.Lap)

Convert the TCXDB structure created from the XML to fit.Laps structure

func CvtToFitRecs

func CvtToFitRecs(db *TCXDB) (runRecs []fit.Record)

Convert the TCXDB structure created from the XML to fit.Record structure

func DeviceInfo

func DeviceInfo(db *TCXDB) (DevName string, DevUnitId string, DevProdID string)

Convert the TCXDB structure to device information.

func Distance

func Distance(lat1, lon1, lat2, lon2 float64) float64

Distance function returns the distance (in meters) between two points of a given longitude and latitude relatively accurately (using a spherical approximation of the Earth) through the Haversin Distance Formula for great arc distance on a sphere with accuracy for small distances

point coordinates are supplied in degrees and converted into rad. in the func

distance returned is METERS!!!!!! http://en.wikipedia.org/wiki/Haversine_formula

Types

type Activities

type Activities struct {
	Act []Activity `xml:"Activity"`
}

func ReadActivities

func ReadActivities(path string) (acts *Activities, err error)

Read the the activities.

type Activity

type Activity struct {
	Sport   string `xml:"Sport,attr,omitempty"`
	Id      time.Time
	Laps    []Lap  `xml:"Lap,omitempty"`
	Creator Device `xml:"Creator,omitempty"`
}

func ReadActivity

func ReadActivity(path string) (act *Activity, err error)

Read the activity.

type Author

type Author struct {
	Name       string `xml:",omitempty"`
	Build      Build  `xml:",omitempty"`
	LangID     string `xml:",omitempty"`
	PartNumber string `xml:",omitempty"`
}

func (Author) String

func (a Author) String() string

type Build

type Build struct {
	Version BuildVersion `xml:"Version,omitempty"`
	Type    string       `xml:",omitempty"`
	Time    string       `xml:",omitempty"`
	Builder string       `xml:",omitempty"`
}

type BuildVersion

type BuildVersion struct {
	VersionMajor int `xml:",omitempty"`
	VersionMinor int `xml:",omitempty"`
	BuildMajor   int `xml:",omitempty"`
	BuildMinor   int `xml:",omitempty"`
}

type Device

type Device struct {
	Name      string       `xml:",omitempty"`
	UnitId    uint         `xml:",omitempty"`
	ProductID string       `xml:",omitempty"`
	Version   BuildVersion `xml:",omitempty"`
}

type Lap

type Lap struct {
	Start         string  `xml:"StartTime,attr"`
	TotalTime     float64 `xml:"TotalTimeSeconds,omitempty"`
	Dist          float64 `xml:"DistanceMeters,omitempty"`
	Calories      float64 `xml:",omitempty"`
	MaxSpeed      float64 `xml:"MaximumSpeed,omitempty"`
	AvgHr         float64 `xml:"AverageHeartRateBpm>Value,omitempty"`
	MaxHr         float64 `xml:"MaximumHeartRateBpm>Value,omitempty"`
	Intensity     string  `xml:",omitempty"`
	TriggerMethod string  `xml:",omitempty"`
	Trk           *Track  `xml:"Track"`
}

func ReadLap

func ReadLap(path string) (lap *Lap, err error)

Read the lap.

type TCXDB

type TCXDB struct {
	XMLName xml.Name    `xml:"TrainingCenterDatabase"`
	Acts    *Activities `xml:"Activities"`
	Auth    Author      `xml:"Author"`
}

func ReadTCXFile

func ReadTCXFile(path string) (db *TCXDB, err error)

Read the TCX file.

type Track

type Track struct {
	Pt []Trackpoint `xml:"Trackpoint"`
}

func ReadTpts

func ReadTpts(path string) (track *Track, err error)

Read the track points.

type Trackpoint

type Trackpoint struct {
	Time  time.Time
	Lat   float64 `xml:"Position>LatitudeDegrees"`
	Long  float64 `xml:"Position>LongitudeDegrees"`
	Alt   float64 `xml:"AltitudeMeters,omitempty"`
	Dist  float64 `xml:"DistanceMeters,omitempty"`
	HR    float64 `xml:"HeartRateBpm>Value,omitempty"`
	Cad   float64 `xml:"Cadence,omitempty"`
	Speed float64 `xml:"Extensions>TPX>Speed,omitempty"`
	Power float64 `xml:"Extensions>TPX>Watts,omitempty"`
}

Jump to

Keyboard shortcuts

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