Documentation ¶
Overview ¶
Provides routines to render flights as PDFs in various ways
Index ¶
- Variables
- func DrawApproachFrame(pdf *gofpdf.Fpdf)
- func DrawDeltaGradientKey(pdf *gofpdf.Fpdf)
- func DrawSFOClassB(pdf *gofpdf.Fpdf)
- func DrawSpeedGradientKey(pdf *gofpdf.Fpdf)
- func DrawTitle(pdf *gofpdf.Fpdf, title string)
- func DrawTrack(pdf *gofpdf.Fpdf, tInput fdb.Track, colorscheme ColorScheme)
- func DrawWaypoints(pdf *gofpdf.Fpdf)
- func NewApproachPdf(colorscheme ColorScheme) *gofpdf.Fpdf
- func WriteFlight(output io.Writer, f fdb.Flight) error
- func WriteTrack(output io.Writer, t fdb.Track) error
- type AnchorPoint
- type BaseGrid
- func (bg BaseGrid) DrawColorSchemeKey()
- func (bg BaseGrid) DrawGridlines()
- func (bg BaseGrid) Line(x1, y1, x2, y2 float64)
- func (bg BaseGrid) LineBy(x, y float64)
- func (bg BaseGrid) LineTo(x, y float64) bool
- func (bg BaseGrid) MaybeSetDrawColor()
- func (bg BaseGrid) MaybeSetTextColor()
- func (bg BaseGrid) MoveBy(x, y float64)
- func (bg BaseGrid) MoveTo(x, y float64) bool
- func (bg BaseGrid) U(x float64) (float64, bool)
- func (bg BaseGrid) UV(x, y float64) (float64, float64, bool)
- func (bg BaseGrid) V(y float64) (float64, bool)
- type ColorScheme
- type DescentPdf
- func (g DescentPdf) DrawCaption()
- func (g DescentPdf) DrawColorSchemeKeys()
- func (g DescentPdf) DrawFrames()
- func (g DescentPdf) DrawReferencePoint(p geo.Latlong, label string)
- func (g *DescentPdf) DrawTrackAsDistanceFromOrigin(t fdb.Track)
- func (g *DescentPdf) DrawTrackAsDistanceRemainingAlongPath(t fdb.Track)
- func (g *DescentPdf) DrawTrackAsDistanceTravelledAlongPath(t fdb.Track)
- func (g *DescentPdf) DrawTrackWithDistFunc(t fdb.Track, f DistanceFunc, colorscheme ColorScheme)
- func (g *DescentPdf) Init()
- func (g DescentPdf) MaybeDrawSFOClassB()
- func (g *DescentPdf) ReconfigureForDepartures()
- type DistanceFunc
- type ProjectAlongPath
- type ProjectAsCrowFlies
- type SideviewPdf
- func (g SideviewPdf) DrawCaption()
- func (g SideviewPdf) DrawColorSchemeKeys()
- func (g SideviewPdf) DrawFrames()
- func (g *SideviewPdf) DrawPointProjectedIntoTrack(t fdb.Track, p geo.Latlong, label string)
- func (g *SideviewPdf) DrawProjectedTrack(t fdb.Track, colorscheme ColorScheme) error
- func (g *SideviewPdf) Init()
- func (g SideviewPdf) MaybeDrawSFOClassB()
- type TrackProjector
- type WaypointFurniture
Constants ¶
This section is empty.
Variables ¶
var ( ApproachBoxWidth = 245.0 ApproachBoxHeight = 100.0 ApproachBoxOffsetX = 10.0 ApproachBoxOffsetY = 10.0 ApproachWidthNM = 80.0 // How many NM out the box starts ApproachHeightFeet = 20000.0 // How many feet up the box starts SpeedGradientMin = 200.0 SpeedGradientMax = 400.0 DeltaGradientMax = 20.0 // http://www.perbang.dk/rgbgradient/ SpeedGradientColors = [][]int{ {0x00, 0xBF, 0xA9}, {0x00, 0xC2, 0x66}, {0x00, 0xC5, 0x21}, {0x25, 0xC9, 0x00}, {0x6F, 0xCC, 0x00}, {0xBB, 0xD0, 0x00}, {0xD3, 0x9D, 0x00}, {0xD7, 0x53, 0x00}, {0xDA, 0x06, 0x00}, {0xDE, 0x00, 0x48}, {0xE1, 0x00, 0x99}, {0xDB, 0x00, 0xE5}, } DeltaGradientColors = [][]int{ {0xF5, 0x00, 0x2B}, {0xA8, 0x00, 0x1C}, {0x7C, 0x00, 0x0E}, {0x70, 0x70, 0x70}, {0x00, 0x6C, 0x03}, {0x00, 0x98, 0x07}, {0x00, 0xE5, 0x0B}, } )
The ApproachBox is from NW(10,10) to SE(270,110)
var ( BlackRGB = []int{0, 0, 0} RedRGB = []int{0xff, 0, 0} GreenRGB = []int{0, 0xff, 0} BlueRGB = []int{0, 0, 0xff} )
Functions ¶
func DrawApproachFrame ¶
func DrawDeltaGradientKey ¶
func DrawSFOClassB ¶
func DrawSpeedGradientKey ¶
func DrawWaypoints ¶
func NewApproachPdf ¶
func NewApproachPdf(colorscheme ColorScheme) *gofpdf.Fpdf
Types ¶
type AnchorPoint ¶
type AnchorPoint struct { geo.NamedLatlong AltitudeMin float64 AltitudeMax float64 // if max uninitialized, no checks performed DistMaxKM float64 // if non-zero, must be at least this close, or we skip flight }
func (AnchorPoint) PointOfClosestApproach ¶
func (AnchorPoint) String ¶
func (ap AnchorPoint) String() string
type BaseGrid ¶
type BaseGrid struct { *gofpdf.Fpdf // Embed the thing we're writing to // Describe the portion of PDF page space the grid will be drawn over (labels go outside of this) OffsetU float64 // where the origin (top-right) should be, in PDF coords (top-right) OffsetV float64 // where the origin (top-right) should be, in PDF coords (top-right) W, H float64 // width and height of the grid, in PDF units (should be mm) // Control how (x,y) vals are mapped into (u,v) vals InvertX, InvertY bool // A grid's origin defaults to bottom-left; these bools flip that MinX, MinY, MaxX, MaxY float64 // the range of values that should be scaled onto the grid. Clip bool // whether to clip lines to fit inside grid // How to draw gridlines NoGridlines bool // No lines at all for this graph XGridlineEvery, YGridlineEvery float64 // From Min[XY] to Max[XY] XMinorGridlineEvery, YMinorGridlineEvery float64 // From Min[XY] to Max[XY] XTickFmt, YTickFmt string // Will be passed a float64 via fmt.Sprintf; blank==none XTickOtherSide, YTickOtherSide bool // Note that InvertX,Y also affect where ticks go XOriginTickFmt, YOriginTickFmt string // Tick formats for the zero origin label // Other formatting LineColor []int // rgb, each [0,255] - axis labels }
Describes a grid we're going to plot ov`er, and the location of its top-left corner in PDF space
func (BaseGrid) DrawColorSchemeKey ¶
func (bg BaseGrid) DrawColorSchemeKey()
func (BaseGrid) DrawGridlines ¶
func (bg BaseGrid) DrawGridlines()
func (BaseGrid) MaybeSetDrawColor ¶
func (bg BaseGrid) MaybeSetDrawColor()
func (BaseGrid) MaybeSetTextColor ¶
func (bg BaseGrid) MaybeSetTextColor()
func (BaseGrid) MoveTo ¶
We submit coords in gridspace (e.g. x,y), and the grid transforms them into PDFspace.
type ColorScheme ¶
type ColorScheme int
const ( ByGroundspeed ColorScheme = iota ByDeltaGroundspeed ByPlotKind )
type DescentPdf ¶
type DescentPdf struct { ToShow map[string]bool // Which grids to render AltitudeMin float64 AltitudeMax float64 Anchor geo.NamedLatlong AnchorAltitudeMin float64 AnchorAltitudeMax float64 LengthNM float64 AveragingWindow time.Duration ColorScheme // embedded LineThickness float64 LineOpacity float64 // 0.0==transparent, 1.0==opaque Grids map[string]*BaseGrid *gofpdf.Fpdf // Embedded pointer Permalink string Caption string Debug string ShowDebug bool }
func (DescentPdf) DrawCaption ¶
func (g DescentPdf) DrawCaption()
func (DescentPdf) DrawColorSchemeKeys ¶
func (g DescentPdf) DrawColorSchemeKeys()
func (DescentPdf) DrawFrames ¶
func (g DescentPdf) DrawFrames()
func (DescentPdf) DrawReferencePoint ¶
func (g DescentPdf) DrawReferencePoint(p geo.Latlong, label string)
func (*DescentPdf) DrawTrackAsDistanceFromOrigin ¶
func (g *DescentPdf) DrawTrackAsDistanceFromOrigin(t fdb.Track)
func (*DescentPdf) DrawTrackAsDistanceRemainingAlongPath ¶
func (g *DescentPdf) DrawTrackAsDistanceRemainingAlongPath(t fdb.Track)
Consider distance to be distance travelled along the path. (E.g. if the aircraft descends in a steady spiral, we'll plot the 'unrolled' version as a long steady line.) Also, plot as 'distance remaining until destination'
func (*DescentPdf) DrawTrackAsDistanceTravelledAlongPath ¶
func (g *DescentPdf) DrawTrackAsDistanceTravelledAlongPath(t fdb.Track)
As above, but plat as 'distance travelled from Origin' (i.e. suitable for departures)
func (*DescentPdf) DrawTrackWithDistFunc ¶
func (g *DescentPdf) DrawTrackWithDistFunc(t fdb.Track, f DistanceFunc, colorscheme ColorScheme)
func (*DescentPdf) Init ¶
func (g *DescentPdf) Init()
func (DescentPdf) MaybeDrawSFOClassB ¶
func (g DescentPdf) MaybeDrawSFOClassB()
func (*DescentPdf) ReconfigureForDepartures ¶
func (g *DescentPdf) ReconfigureForDepartures()
If we are rendering departures, flip everything so the origin is on the Left Hand Side.
type DistanceFunc ¶
type DistanceFunc func(tp fdb.Trackpoint) (float64, float64, []int)
type ProjectAlongPath ¶
type ProjectAlongPath struct {
// contains filtered or unexported fields
}
func (*ProjectAlongPath) Description ¶
func (p *ProjectAlongPath) Description() string
func (*ProjectAlongPath) Project ¶
func (p *ProjectAlongPath) Project(tp fdb.Trackpoint) (float64, float64)
func (*ProjectAlongPath) Setup ¶
func (p *ProjectAlongPath) Setup(t fdb.Track, ap AnchorPoint) error
type ProjectAsCrowFlies ¶
type ProjectAsCrowFlies struct {
// contains filtered or unexported fields
}
func (*ProjectAsCrowFlies) Description ¶
func (p *ProjectAsCrowFlies) Description() string
func (*ProjectAsCrowFlies) Project ¶
func (p *ProjectAsCrowFlies) Project(tp fdb.Trackpoint) (float64, float64)
func (*ProjectAsCrowFlies) Setup ¶
func (p *ProjectAsCrowFlies) Setup(t fdb.Track, ap AnchorPoint) error
type SideviewPdf ¶
type SideviewPdf struct { ToShow map[string]bool // Which grids to render Grids map[string]*BaseGrid AltitudeMin float64 // Min/max for the altitude and distance axes AltitudeMax float64 AnchorDistMinNM float64 AnchorDistMaxNM float64 AnchorPoint // embedded TrackProjector // embedded AveragingWindow time.Duration ColorScheme // embedded LineThickness float64 LineOpacity float64 // 0.0==transparent, 1.0==opaque (>1 is a thickness) *gofpdf.Fpdf // embedded Permalink string MapPermalink string Caption string Debug string ShowDebug bool }
func (SideviewPdf) DrawCaption ¶
func (g SideviewPdf) DrawCaption()
func (SideviewPdf) DrawColorSchemeKeys ¶
func (g SideviewPdf) DrawColorSchemeKeys()
func (SideviewPdf) DrawFrames ¶
func (g SideviewPdf) DrawFrames()
func (*SideviewPdf) DrawPointProjectedIntoTrack ¶
This is trickier than it looks. We find the trackpoint closest to the refpt, then project it via whatever projector we're using in this sideview.
func (*SideviewPdf) DrawProjectedTrack ¶
func (g *SideviewPdf) DrawProjectedTrack(t fdb.Track, colorscheme ColorScheme) error
func (*SideviewPdf) Init ¶
func (g *SideviewPdf) Init()
func (SideviewPdf) MaybeDrawSFOClassB ¶
func (g SideviewPdf) MaybeDrawSFOClassB()
Only valid if the grid is anchored to SFO.
type TrackProjector ¶
type TrackProjector interface { Setup(fdb.Track, AnchorPoint) error Project(fdb.Trackpoint) (distNM float64, alt float64) Description() string }
A TrackProjector projects trackpoints into a 2D coordinate space (distNM by altitude)