xctrack

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: BSD-2-Clause Imports: 14 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-xctrack

PkgGoDev

Package xctrack implements XCTrack's task format.

Features:

  • Reading and writing of .xctsk files.
  • Generation and parsing of XCTSK: URLs.
  • Encoding and decoding XCTSK: URLs as QR codes.

Additionally, a command line utility in cmd/xctrack converts between these formats.

License

MIT

Documentation

Overview

Package xctrack implements XCTrack's task format. See http://xctrack.org/ and http://xctrack.org/Competition_Interfaces.html.

Index

Constants

View Source
const (
	QRCodeScheme      = "XCTSK:"
	QRCodeTaskVersion = 2
)

Constants.

View Source
const (
	Extension = ".xctsk"
	MIMEType  = "application/xctsk"
	Version   = 1
)

Constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction string

An Direction is a direction.

const (
	DirectionEnter Direction = "ENTER"
	DirectionExit  Direction = "EXIT"
)

Directions.

type EarthModel

type EarthModel string

An EarthModel is an Earth model.

const (
	EarthModelWGS84     EarthModel = "WGS84"
	EarthModelFAISphere EarthModel = "FAI_SPHERE"
)

Earth models.

type Goal

type Goal struct {
	Type     GoalType   `json:"type,omitempty"`
	Deadline *TimeOfDay `json:"deadline,omitempty"`
}

A Goal is a goal.

type GoalType

type GoalType string

A GoalType is a goal type.

const (
	GoalTypeCylinder GoalType = "CYLINDER"
	GoalTypeLine     GoalType = "LINE"
)

Goal types.

type QRCodeDirection

type QRCodeDirection int

A QRCodeDirection is a QR code direction.

const (
	QRCodeDirectionEnter QRCodeDirection = 1
	QRCodeDirectionExit  QRCodeDirection = 2
)

QR code directions.

type QRCodeEarthModel

type QRCodeEarthModel int

A QRCodeEarthModel is a QR code Earth model.

const (
	QRCodeEarthModelWGS84     QRCodeEarthModel = 0
	QRCodeEarthModelFAISphere QRCodeEarthModel = 1
)

QR code Earth models.

type QRCodeGoal

type QRCodeGoal struct {
	Deadline *TimeOfDay     `json:"d,omitempty"`
	Type     QRCodeGoalType `json:"t,omitempty"`
}

A QRCodeGoal is a QR code goal.

type QRCodeGoalType

type QRCodeGoalType int

A QRCodeGoalType is a QR code goal type.

const (
	QRCodeGoalTypeLine     QRCodeGoalType = 1
	QRCodeGoalTypeCylinder QRCodeGoalType = 2
)

QR code goal types.

type QRCodeSSS

type QRCodeSSS struct {
	TimeGates []*TimeOfDay    `json:"g"`
	Direction QRCodeDirection `json:"d"`
	Type      QRCodeSSSType   `json:"t"`
}

A QRCodeSSS is a QR code start.

type QRCodeSSSType

type QRCodeSSSType int

A QRCodeSSSType is a QR code start of speed section type.

const (
	QRCodeSSSTypeRace        QRCodeSSSType = 1
	QRCodeSSSTypeElapsedTime QRCodeSSSType = 2
)

QR code start of speed section types.

type QRCodeTask

type QRCodeTask struct {
	TaskType     TaskType           `json:"taskType"`
	Version      int                `json:"version"`
	Turnpoints   []*QRCodeTurnpoint `json:"t"`
	TakeoffOpen  *TimeOfDay         `json:"to,omitempty"`
	TakeoffClose *TimeOfDay         `json:"tc,omitempty"`
	SSS          *QRCodeSSS         `json:"s,omitempty"`
	Goal         *QRCodeGoal        `json:"g,omitempty"`
	EarthModel   QRCodeEarthModel   `json:"e"`
}

A QRCodeTask is a QR code task.

func (*QRCodeTask) String

func (q *QRCodeTask) String() (string, error)

func (*QRCodeTask) Task

func (q *QRCodeTask) Task() *Task

Task returns t as a Task.

type QRCodeTaskType

type QRCodeTaskType int

A QRCodeTaskType is a QR code task type.

const (
	QRCodeTaskTypeRace        QRCodeTaskType = 1
	QRCodeTaskTypeElapsedTime QRCodeTaskType = 2
)

QR code task types.

type QRCodeTurnpoint

type QRCodeTurnpoint struct {
	Z           QRCodeTurnpointZ    `json:"z"`
	Name        string              `json:"n"`
	Description string              `json:"d,omitempty"`
	Type        QRCodeTurnpointType `json:"t,omitempty"`
}

A QRCodeTurnpoint is a QR code turnpoint.

type QRCodeTurnpointType

type QRCodeTurnpointType int

A QRCodeTurnpointType is a QR code turnpoint type.

const (
	QRCodeTurnpointTypeNone QRCodeTurnpointType = 0
	QRCodeTurnpointTypeSSS  QRCodeTurnpointType = 2
	QRCodeTurnpointTypeESS  QRCodeTurnpointType = 3
)

QR code turnpoint types.

type QRCodeTurnpointZ

type QRCodeTurnpointZ struct {
	Lon    float64
	Lat    float64
	Alt    int
	Radius int
}

A QRCodeTurnpointZ is a QR code turnpoint Z.

func (*QRCodeTurnpointZ) MarshalJSON

func (z *QRCodeTurnpointZ) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.Marshaler.

func (*QRCodeTurnpointZ) UnmarshalJSON

func (z *QRCodeTurnpointZ) UnmarshalJSON(value []byte) error

UnmarshalJSON implements encoding/json.Unmarshaler.

type SSS

type SSS struct {
	Type      SSSType      `json:"type"`
	Direction Direction    `json:"direction"`
	TimeGates []*TimeOfDay `json:"timeGates"`
}

An SSS is a start of speed section.

type SSSType

type SSSType string

An SSSType is a start of speed section type.

const (
	SSSTypeRace        SSSType = "RACE"
	SSSTypeElapsedTime SSSType = "ELAPSED-TIME"
)

Start of speed section types.

type Takeoff

type Takeoff struct {
	TimeOpen  *TimeOfDay `json:"timeOpen,omitempty"`
	TimeClose *TimeOfDay `json:"timeClose,omitempty"`
}

A Takeoff is a takeoff.

type Task

type Task struct {
	TaskType   TaskType     `json:"taskType"`
	Version    int          `json:"version"`
	EarthModel EarthModel   `json:"earthModel,omitempty"`
	Turnpoints []*Turnpoint `json:"turnpoints"`
	Takeoff    *Takeoff     `json:"takeoff,omitempty"`
	SSS        *SSS         `json:"sss,omitempty"`
	Goal       *Goal        `json:"goal,omitempty"`
}

A Task is an XC Track task, see http://xctrack.org/Competition_Interfaces.html.

func ParseTask

func ParseTask(data []byte) (*Task, error)

ParseTask parses a Task from data.

func (*Task) QRCodeTask

func (t *Task) QRCodeTask() *QRCodeTask

QRCodeTask returns t as a QRCodeTask.

type TaskType

type TaskType string

A TaskType is a task type.

const (
	TaskTypeClassic   TaskType = "CLASSIC"
	TaskTypeWaypoints TaskType = "W"
)

Task types.

type TimeOfDay added in v1.1.0

type TimeOfDay struct {
	Hour   int
	Minute int
	Second int
}

A TimeOfDay is a time of day.

func (*TimeOfDay) MarshalJSON added in v1.1.0

func (t *TimeOfDay) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.Marshaler.

func (*TimeOfDay) UnmarshalJSON added in v1.1.0

func (t *TimeOfDay) UnmarshalJSON(b []byte) error

UnmarshalJSON implements encoding/json.Unmarshaler.

type Turnpoint

type Turnpoint struct {
	Type     TurnpointType `json:"type,omitempty"`
	Radius   int           `json:"radius"`
	Waypoint Waypoint      `json:"waypoint"`
}

A Turnpoint is a turnpoint.

type TurnpointType

type TurnpointType string

A TurnpointType is a turnpoint type.

const (
	TurnpointTypeNone    TurnpointType = ""
	TurnpointTypeTakeoff TurnpointType = "TAKEOFF"
	TurnpointTypeSSS     TurnpointType = "SSS"
	TurnpointTypeESS     TurnpointType = "ESS"
)

Turnpoint types.

type Waypoint

type Waypoint struct {
	Name        string  `json:"name"`
	Description string  `json:"description,omitempty"`
	Lat         float64 `json:"lat"`
	Lon         float64 `json:"lon"`
	AltSmoothed int     `json:"altSmoothed"`
}

A Waypoint is a waypoint.

Directories

Path Synopsis
cmd
xctrack command
wptlist2xctsk module

Jump to

Keyboard shortcuts

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