igc

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: BSD-2-Clause Imports: 9 Imported by: 8

Documentation

Overview

Package igc implements an IGC parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

An Encoder is an IGC encoder.

func NewEncoder

func NewEncoder(w io.Writer, options ...EncoderOption) *Encoder

NewEncoder returns a new Encoder that writes to w.

func (*Encoder) Encode

func (enc *Encoder) Encode(ls *geom.LineString) error

Encode encodes a LineString.

type EncoderOption

type EncoderOption func(*Encoder)

An EncoderOption sets an option on an Encoder.

func A

func A(a string) EncoderOption

A sets the A-record text.

type Errors

type Errors []error

An Errors is a slice of errors encountered.

func (Errors) Error

func (es Errors) Error() string
type Header struct {
	Source   string
	Key      string
	KeyExtra string
	Value    string
}

A Header is an IGC header.

type T

type T struct {
	Headers    []Header
	LineString *geom.LineString
}

A T represents a parsed IGC file.

func Read

func Read(r io.Reader) (*T, error)

Read reads a igc.T from r, which should contain IGC records.

IGC files in the wild are often corrupt, the IGC specification has been incomplete, and has evolved over time. The parser is consequently very tolerant of what it accepts and ignores several common errors. Consequently, the returned T might still contain headers and coordinates, even if the returned error is non-nil.

func (*T) HasCoords added in v1.0.3

func (t *T) HasCoords() bool

HasCoords returns true if t has at least one coordinate.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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