Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertFromM(n float64, toUnit string) float64
- func FormatAltitude(altitude_m float64, unit_type UnitType) string
- func FormatFloat(f float64, digits int) string
- func FormatLength(lengthM float64, ut UnitType) string
- func FormatSpeed(meters_per_seconds float64, unit_type UnitType, round bool) string
- func IsNanOrOnf(f float64) bool
- func RGBAToBytes(m *image.RGBA) ([]byte, error)
- func SVGToBytes(svg *draw2dsvg.Svg) ([]byte, error)
- type Axis
- type ChartParams
- type ChartService
- func (cs ChartService) ElevationChart(c context.Context, params ChartParams, g gpx.GPX, output OutputExtension) ([]byte, error)
- func (cs *ChartService) Errorf(c context.Context, msg string, params ...interface{})
- func (cs ChartService) SpeedChart(c context.Context, params ChartParams, g gpx.GPX, output OutputExtension) ([]byte, error)
- func (cs ChartService) SteepnessChart(c context.Context, params ChartParams, g gpx.GPX, output OutputExtension) ([]byte, error)
- type ErrorLogger
- type OutputExtension
- type Padding
- type Point
- type UnitType
Constants ¶
View Source
const ( OutputSVG = ".svg" OutputPNG = ".png" )
View Source
const ( DEFAULT_LEFT_PADDING_PIXELS = 40 DEFAULT_BOTTOM_PADDING_PIXELS = 20 )
View Source
const ( ONE_FEET = 0.3048 ONE_YARD = 0.9144 ONE_MILE = 1.609344 * 1000 ONE_NAUTICAL_MILE = 1852 )
Variables ¶
View Source
var ( SPEED_MPS = 1. SPEED_KMH = 1000. / math.Pow(60., 2) SPEED_MPH = 1.609344 * 1000. / math.Pow(60., 2) SPEED_KNOT = 1852. / math.Pow(60., 2) )
View Source
var ( Units = map[string]float64{} SPEED_UNITS = map[string]float64{ "mps": SPEED_MPS, "kmh": SPEED_KMH, "mph": SPEED_MPH, "knot": SPEED_KNOT, } )
Functions ¶
func ConvertFromM ¶
Convert from meters (or m/s if speed) into...
func FormatAltitude ¶
func FormatFloat ¶
func FormatLength ¶
func FormatSpeed ¶
func IsNanOrOnf ¶
Types ¶
type ChartParams ¶
type ChartParams struct {
Width, Height int
XAxis, YAxis Axis
Points []Point
FillColor color.RGBA
Unit UnitType
LineWidth float64
ChartMargin Padding
ChartPadding Padding
MinX, MaxX float64
MinY, MaxY float64
// contains filtered or unexported fields
}
func (ChartParams) UnitTypeOrMetric ¶
func (cp ChartParams) UnitTypeOrMetric() UnitType
type ChartService ¶
type ChartService struct { FontDirs []string Log ErrorLogger // contains filtered or unexported fields }
func NewChartService ¶
func NewChartService(fontDirs []string) (*ChartService, error)
func (ChartService) ElevationChart ¶
func (cs ChartService) ElevationChart(c context.Context, params ChartParams, g gpx.GPX, output OutputExtension) ([]byte, error)
func (*ChartService) Errorf ¶
func (cs *ChartService) Errorf(c context.Context, msg string, params ...interface{})
func (ChartService) SpeedChart ¶
func (cs ChartService) SpeedChart(c context.Context, params ChartParams, g gpx.GPX, output OutputExtension) ([]byte, error)
func (ChartService) SteepnessChart ¶
func (cs ChartService) SteepnessChart(c context.Context, params ChartParams, g gpx.GPX, output OutputExtension) ([]byte, error)
type ErrorLogger ¶
type OutputExtension ¶
type OutputExtension string
Click to show internal directories.
Click to hide internal directories.