domain

package
v0.0.0-...-95221f7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRecordsWithLocaiton = errors.New("no records with location")
)

Functions

This section is empty.

Types

type ActivityBounds

type ActivityBounds struct {
	LatMin  float64 `json:"latMin"`  // between -90 (south pole) and +90 (north pole)
	LatMax  float64 `json:"latMax"`  // between -90 (south pole) and +90 (north pole)
	LongMin float64 `json:"longMin"` // between -180 and +180
	LongMax float64 `json:"longMax"` // between -180 and +180
}

func ActivityBoundsFromFitActivity

func ActivityBoundsFromFitActivity(activity *fit.ActivityFile) (*ActivityBounds, error)

type FitFile

type FitFile struct {
	*FitFileSummary `json:"summary"`
	Records         []*Record `json:"records"`
	*ActivityBounds `json:"activityBounds"`
}

func NewFitFile

func NewFitFile(name string, hash Hash, reader io.Reader, nearbyObjectsFetcher NearbyObjectsFetcher) (*FitFile, error)

func (*FitFile) GetLaps

func (f *FitFile) GetLaps(incrementMetres int) []*Lap

type FitFileSummary

type FitFileSummary struct {
	Name               string                  `json:"name"`
	Hash               Hash                    `json:"hash"`
	StartTime          time.Time               `json:"startTime"`
	EndTime            time.Time               `json:"endTime"`
	DeviceManufacturer string                  `json:"deviceManufacturer"`
	DeviceProduct      string                  `json:"deviceProduct"`
	TotalDistance      float64                 `json:"totalDistance"`
	ActivityBounds     *ActivityBounds         `json:"activityBounds"`
	NearbyObjects      []*GeographicMapElement `json:"nearbyObjects"`
}

FitFileSummary is a summary of a fit file

func NewFitFileSummary

func NewFitFileSummary(name string, hash Hash, startTime, endTime time.Time, deviceManufacturer, deviceProduct string, totalDistance float64, activityBounds *ActivityBounds, nearbyObjects []*GeographicMapElement) *FitFileSummary

NewFitFileSummary creates a new FitFileSummary

func NewFitFileSummaryFromReader

func NewFitFileSummaryFromReader(name string, hash Hash, reader io.Reader, nearbyObjectsFetcher NearbyObjectsFetcher) (*FitFileSummary, error)

type GeographicMapElement

type GeographicMapElement struct {
	Tags struct {
		Name  string `json:"name"`
		Place string `json:"place"`
		IsIn  string `json:"isIn"`
	} `json:"tags"`
}

type Hash

type Hash string

func NewHash

func NewHash(reader io.Reader) (Hash, error)

type Lap

type Lap struct {
	StartTimestamp           time.Time `json:"startTimestamp"`
	EndTimestamp             time.Time `json:"endTimestamp"`
	DistanceInLapMetres      int       `json:"distanceInLapMetres"`
	CumulativeDistanceMetres int       `json:"cumulativeDistanceMetres"`
	StartAltitude            int       `json:"startAltitude"`
	EndAltitude              int       `json:"endAltitude"`
}

type NearbyObjectsFetcher

type NearbyObjectsFetcher interface {
	Fetch(activity *ActivityBounds) ([]*GeographicMapElement, error)
}

type Record

type Record struct {
	Timestamp    time.Time `json:"timestamp"`
	PositionLat  float64   `json:"posLat"`
	PositionLong float64   `json:"posLong"`
	Distance     int       `json:"distance"`
	Altitude     int       `json:"altitude"`
}

func NewRecord

func NewRecord(timestamp time.Time, posLat, posLong float64, distance, altitude int) *Record

Jump to

Keyboard shortcuts

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