waypoint

package module
v0.0.0-...-908e3ce Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 11 Imported by: 0

README

go-waypoint

PkgGoDev

Package waypoint reads and writes waypoints in formats used by the free flying community.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func D

func D(d, m, s float64) float64

D converts degrees, minutes, and seconds into decimal degrees.

func Read

func Read(rs io.ReadSeeker) (Collection, Format, error)

Read tries to read waypoints from rs using all known formats. When successful, it returns the waypoints and the original format.

func Write

func Write(w io.Writer, wc Collection, format string) error

Write writes wc to w in format. Format must be a known format.

Types

type Collection

type Collection []*T

A Collection is a collection of Ts.

func (Collection) MarshalJSON

func (wc Collection) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.Marshaler.

type CompeGPSFormat

type CompeGPSFormat struct{}

A CompeGPSFormat represents a CompeGPS format.

func NewCompeGPSFormat

func NewCompeGPSFormat() *CompeGPSFormat

NewCompeGPSFormat returns a new CompeGPSFormat.

func (*CompeGPSFormat) Extension

func (*CompeGPSFormat) Extension() string

Extension returns the CompeGPS format extension.

func (*CompeGPSFormat) Name

func (*CompeGPSFormat) Name() string

Name returns the CompeGPS format name.

func (*CompeGPSFormat) Read

func (*CompeGPSFormat) Read(r io.Reader) (Collection, error)

Read reads waypoints from r.

func (*CompeGPSFormat) Write

func (*CompeGPSFormat) Write(w io.Writer, wc Collection) error

Write writes wc to w.

type Format

type Format interface {
	Extension() string
	Name() string
	Read(io.Reader) (Collection, error)
	Write(io.Writer, Collection) error
}

A Format is a waypoint format, with metadata and methods to read and write.

func New

func New(format string) (Format, error)

New returns a new Format. format must be a known format.

type FormatGeoFormat

type FormatGeoFormat struct{}

A FormatGeoFormat is a GeoFormat format.

func NewFormatGeoFormat

func NewFormatGeoFormat() *FormatGeoFormat

NewFormatGeoFormat returns a new FormatGeoFormat.

func (*FormatGeoFormat) Extension

func (f *FormatGeoFormat) Extension() string

Extension returns f's extension.

func (*FormatGeoFormat) Name

func (f *FormatGeoFormat) Name() string

Name returns f's name.

func (*FormatGeoFormat) Read

func (f *FormatGeoFormat) Read(r io.Reader) (Collection, error)

Read reads a Collection from r.

func (*FormatGeoFormat) Write

func (f *FormatGeoFormat) Write(w io.Writer, wc Collection) error

Write writes wc to w.

type GeoJSONFormat

type GeoJSONFormat struct{}

A GeoJSONFormat is a GeoJSON format.

func NewGeoJSONFormat

func NewGeoJSONFormat() *GeoJSONFormat

NewGeoJSONFormat returns a new GeoJSONFormat.

func (*GeoJSONFormat) Extension

func (f *GeoJSONFormat) Extension() string

Extension returns f's extension.

func (*GeoJSONFormat) Name

func (f *GeoJSONFormat) Name() string

Name returns f's name.

func (*GeoJSONFormat) Read

func (f *GeoJSONFormat) Read(r io.Reader) (Collection, error)

Read reads a Collection from r.

func (*GeoJSONFormat) Write

func (f *GeoJSONFormat) Write(w io.Writer, wc Collection) error

Write writes c to w.

type GeoJSONWaypoint

type GeoJSONWaypoint struct {
	ID       string `json:"id"`
	Type     string `json:"type"`
	Geometry struct {
		Type        string    `json:"type"`
		Coordinates []float64 `json:"coordinates"`
	}
	Properties struct {
		Color       string  `json:"color"`
		Description string  `json:"description"`
		Radius      float64 `json:"radius"`
	}
}

A GeoJSONWaypoint is a GeoJSON waypoint.

type GeoJSONWaypointFeatureCollection

type GeoJSONWaypointFeatureCollection struct {
	Type     string            `json:"type"`
	Features []GeoJSONWaypoint `json:"features"`
}

A GeoJSONWaypointFeatureCollection is a GeoJSON FeatureCollection of GeoJSON waypoints.

type OziExplorerFormat

type OziExplorerFormat struct{}

An OziExplorerFormat is an OziExplorer format.

func NewOziExplorerFormat

func NewOziExplorerFormat() *OziExplorerFormat

NewOziExplorerFormat returns a new OziExplorerFormat.

func (*OziExplorerFormat) Extension

func (f *OziExplorerFormat) Extension() string

Extension returns f's extension.

func (*OziExplorerFormat) Name

func (f *OziExplorerFormat) Name() string

Name returns f's name.

func (*OziExplorerFormat) Read

func (f *OziExplorerFormat) Read(r io.Reader) (Collection, error)

Read reads a Collection from r.

func (*OziExplorerFormat) Write

func (f *OziExplorerFormat) Write(w io.Writer, wc Collection) error

Write writes wc to w.

type SeeYouFormat

type SeeYouFormat struct{}

A SeeYouFormat is a SeeYou format.

func NewSeeYouFormat

func NewSeeYouFormat() *SeeYouFormat

NewSeeYouFormat returns a new SeeYouFormat.

func (*SeeYouFormat) Extension

func (f *SeeYouFormat) Extension() string

Extension returns f's extension.

func (*SeeYouFormat) Name

func (f *SeeYouFormat) Name() string

Name returns f's name.

func (*SeeYouFormat) Read

func (f *SeeYouFormat) Read(r io.Reader) (Collection, error)

Read reads a Collection from r.

func (*SeeYouFormat) Write

func (*SeeYouFormat) Write(w io.Writer, wc Collection) error

Write writes wc to w.

type T

type T struct {
	ID          string
	Description string
	Latitude    float64
	Longitude   float64
	Altitude    float64
	Radius      float64
	Color       color.Color
}

A T is a waypoint.

func (*T) MarshalJSON

func (w *T) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.Marshaler.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳