Documentation
¶
Index ¶
- Constants
- Variables
- func DrawCompass(p math.Point2LL, ctx *panes.Context, rotationAngle float32, ...)
- func DrawHighlighted(ctx *panes.Context, transforms ScopeTransformations, ...)
- func DrawRangeRings(ctx *panes.Context, center math.Point2LL, radius float32, color renderer.RGB, ...)
- type ATPAStatus
- type AircraftState
- func (s *AircraftState) HaveHeading() bool
- func (s *AircraftState) HeadingVector(nmPerLongitude, magneticVariation float32) math.Point2LL
- func (s *AircraftState) Ident(now time.Time) bool
- func (s *AircraftState) LostTrack(now time.Time) bool
- func (s *AircraftState) TrackAltitude() int
- func (s *AircraftState) TrackDeltaAltitude() int
- func (s *AircraftState) TrackGroundspeed() int
- func (s *AircraftState) TrackHeading(nmPerLongitude float32) float32
- func (s *AircraftState) TrackPosition() math.Point2LL
- type AudioType
- type CAAircraft
- type CRDAMode
- type CRDARunwayPairState
- type CRDARunwayState
- type CommandMode
- type CommandStatus
- type DatablockType
- type DwellMode
- type GhostState
- type ModeledAircraft
- type PreferenceSet
- type QuickLookPosition
- type STARSBrightness
- type STARSConvergingRunways
- type STARSError
- type STARSFont
- type STARSGlyph
- type STARSPane
- func (sp *STARSPane) Activate(ss *sim.State, r renderer.Renderer, p platform.Platform, ...)
- func (sp *STARSPane) CanTakeKeyboardFocus() bool
- func (sp *STARSPane) DisplayName() string
- func (sp *STARSPane) Draw(ctx *panes.Context, cb *renderer.CommandBuffer)
- func (sp *STARSPane) DrawUI(p platform.Platform, config *platform.Config)
- func (sp *STARSPane) Hide() bool
- func (sp *STARSPane) MakePreferenceSet(name string, ss *sim.State) PreferenceSet
- func (sp *STARSPane) Reset(ss sim.State, lg *log.Logger)
- func (sp *STARSPane) Upgrade(from, to int)
- func (sp *STARSPane) WarnOutsideAirspace(ctx *panes.Context, ac *av.Aircraft) (alts [][2]int, outside bool)
- type STARSRangeBearingLine
- type ScopeTransformations
- func (st *ScopeTransformations) LatLongFromWindowP(p [2]float32) math.Point2LL
- func (st *ScopeTransformations) LatLongFromWindowV(v [2]float32) math.Point2LL
- func (st *ScopeTransformations) LoadLatLongViewingMatrices(cb *renderer.CommandBuffer)
- func (st *ScopeTransformations) LoadWindowViewingMatrices(cb *renderer.CommandBuffer)
- func (st *ScopeTransformations) NormalizedFromWindowP(p [2]float32) [2]float32
- func (st *ScopeTransformations) PixelDistanceNM(nmPerLongitude float32) float32
- func (st *ScopeTransformations) WindowFromLatLongP(p math.Point2LL) [2]float32
- type VideoMapsGroup
- type WeatherRadar
Constants ¶
const ( CommandModeNone = iota CommandModeInitiateControl CommandModeTerminateControl CommandModeHandOff CommandModeVFRPlan CommandModeMultiFunc CommandModeFlightData CommandModeCollisionAlert CommandModeMin CommandModeSavePrefAs CommandModeMaps CommandModeLDR CommandModeRangeRings CommandModeRange CommandModeSiteMenu )
const ( PartialDatablock = iota LimitedDatablock FullDatablock )
const ( AudioConflictAlert = iota AudioSquawkSPC AudioMinimumSafeAltitudeWarning AudioModeCIntruder AudioTest AudioInboundHandoff AudioCommandError AudioHandoffAccepted AudioNumTypes )
The types of events we may play audio for.
const ( CRDAModeStagger = iota CRDAModeTie )
const ( VideoMapsGroupGeo = iota VideoMapsGroupSysProc VideoMapsGroupCurrent )
const ( // Make 0 be "on" so zero-initialization gives "on" DwellModeOn = iota DwellModeLock DwellModeOff )
const ( RadarModeSingle = iota RadarModeMulti RadarModeFused )
const ( ATPAStatusUnset = iota ATPAStatusMonitor ATPAStatusWarning ATPAStatusAlert )
const ( GhostStateRegular = iota GhostStateSuppressed GhostStateForced )
const AlertAudioDuration = 5 * time.Second
const LateralMinimum = 3
IFR TRACON separation requirements
const NumPreferenceSets = 32
const NumWxLevels = 6
const STARSFilledUpTriangle = string(rune(0x1e))
Filled upward-pointing triangle
const STARSTriangleCharacter = string(rune(0x80))
STARS ∆ is character 0x80 in the font
const VerticalMinimum = 1000
const WxBlockRes = 2
Block size in pixels of the quads in the converted radar image used for display.
const WxLatLongExtent = 2.5
Latitude-longitude extent of the fetched image; the requests are +/- this much from the current center.
Variables ¶
var ( ErrSTARSBeaconMismatch = NewSTARSError("BCN MISMATCH") ErrSTARSCommandFormat = NewSTARSError("FORMAT") ErrSTARSDuplicateBeacon = NewSTARSError("DUP BCN") ErrSTARSIllegalACID = NewSTARSError("ILL ACID") ErrSTARSIllegalACType = NewSTARSError("ACTYPE NOT\nADAPTED") ErrSTARSIllegalATIS = NewSTARSError("ILL ATIS") ErrSTARSIllegalAirport = NewSTARSError("ILL AIRPORT") ErrSTARSIllegalCode = NewSTARSError("ILL CODE") ErrSTARSIllegalFix = NewSTARSError("ILL FIX") ErrSTARSIllegalFlight = NewSTARSError("ILL FLIGHT") ErrSTARSIllegalFunc = NewSTARSError("ILL FUNC") ErrSTARSIllegalFunction = NewSTARSError("ILL FNCT") ErrSTARSIllegalLine = NewSTARSError("ILL LINE") ErrSTARSIllegalMap = NewSTARSError("ILL MAP") ErrSTARSIllegalParam = NewSTARSError("ILL PARAM") ErrSTARSIllegalPosition = NewSTARSError("ILL POS") ErrSTARSIllegalRPC = NewSTARSError("ILL RPC") // CRDA runway pair config ErrSTARSIllegalRunway = NewSTARSError("ILL RWY") ErrSTARSIllegalScratchpad = NewSTARSError("ILL SCR") ErrSTARSIllegalSector = NewSTARSError("ILL SECTOR") ErrSTARSIllegalText = NewSTARSError("ILL TEXT") ErrSTARSIllegalTrack = NewSTARSError("ILL TRK") ErrSTARSIllegalValue = NewSTARSError("ILL VALUE") ErrSTARSNoFlight = NewSTARSError("NO FLIGHT") ErrSTARSRangeLimit = NewSTARSError("RANGE LIMIT") )
var ( STARSBackgroundColor = renderer.RGB{.2, .2, .2} // at 100 contrast STARSListColor = renderer.RGB{.1, .9, .1} STARSTextAlertColor = renderer.RGB{1, 0, 0} STARSMapColor = renderer.RGB{.55, .55, .55} STARSCompassColor = renderer.RGB{.55, .55, .55} STARSRangeRingColor = renderer.RGB{.55, .55, .55} STARSTrackBlockColor = renderer.RGB{0.12, 0.48, 1} STARSTrackHistoryColors = [5]renderer.RGB{ renderer.RGB{.12, .31, .78}, renderer.RGB{.28, .28, .67}, renderer.RGB{.2, .2, .51}, renderer.RGB{.16, .16, .43}, renderer.RGB{.12, .12, .35}, } STARSJRingConeColor = renderer.RGB{.5, .5, 1} STARSTrackedAircraftColor = renderer.RGB{1, 1, 1} STARSUntrackedAircraftColor = renderer.RGB{0, 1, 0} STARSInboundPointOutColor = renderer.RGB{1, 1, 0} STARSGhostColor = renderer.RGB{1, 1, 0} STARSSelectedAircraftColor = renderer.RGB{0, 1, 1} STARSATPAWarningColor = renderer.RGB{1, 1, 0} STARSATPAAlertColor = renderer.RGB{1, .215, 0} )
Functions ¶
func DrawCompass ¶
func DrawCompass(p math.Point2LL, ctx *panes.Context, rotationAngle float32, font *renderer.Font, color renderer.RGB, paneBounds math.Extent2D, transforms ScopeTransformations, cb *renderer.CommandBuffer)
DrawCompass emits drawing commands to draw compass heading directions at the edges of the current window. It takes a center point p in lat-long coordinates, transformation functions and the radar scope's current rotation angle, if any. Drawing commands are added to the provided command buffer, which is assumed to have projection matrices set up for drawing using window coordinates.
func DrawHighlighted ¶
func DrawHighlighted(ctx *panes.Context, transforms ScopeTransformations, cb *renderer.CommandBuffer)
If the user has run the "find" command to highlight a point in the world, draw a red circle around that point for a few seconds.
func DrawRangeRings ¶
func DrawRangeRings(ctx *panes.Context, center math.Point2LL, radius float32, color renderer.RGB, transforms ScopeTransformations, cb *renderer.CommandBuffer)
DrawRangeRings draws ten circles around the specified lat-long point in steps of the specified radius (in nm).
Types ¶
type ATPAStatus ¶
type ATPAStatus int
type AircraftState ¶
type AircraftState struct { DatablockType DatablockType FullLDBEndTime time.Time // If the LDB displays the groundspeed. When to stop DisplayRequestedAltitude *bool // nil if unspecified IsSelected bool // middle click // Only drawn if non-zero JRingRadius float32 ConeLength float32 DisplayTPASize *bool // unspecified->system default if nil DisplayATPAMonitor *bool // unspecified->system default if nil DisplayATPAWarnAlert *bool // unspecified->system default if nil IntrailDistance float32 ATPAStatus ATPAStatus MinimumMIT float32 ATPALeadAircraftCallsign string POFlashingEndTime time.Time UNFlashingEndTime time.Time IFFlashing bool // Will continue to flash unless slewed or a successful handoff NextController string // These are only set if a leader line direction was specified for this // aircraft individually: LeaderLineDirection *math.CardinalOrdinalDirection GlobalLeaderLineDirection *math.CardinalOrdinalDirection UseGlobalLeaderLine bool Ghost struct { PartialDatablock bool State GhostState } DisplayLDBBeaconCode bool DisplayPTL bool DisableCAWarnings bool MSAW bool // minimum safe altitude warning DisableMSAW bool InhibitMSAW bool // only applies if in an alert. clear when alert is over? MSAWAcknowledged bool MSAWSoundEnd time.Time SPCAlert bool SPCAcknowledged bool SPCSoundEnd time.Time FirstSeen time.Time FirstRadarTrack time.Time HaveEnteredAirspace bool CWTCategory string // cache this for performance IdentStart, IdentEnd time.Time OutboundHandoffAccepted bool OutboundHandoffFlashEnd time.Time RDIndicatorEnd time.Time // This is a little messy: we maintain maps from callsign->sector id // for pointouts that track the global state of them. Here we track // just inbound pointouts to the current controller so that the first // click acks a point out but leaves it yellow and a second clears it // entirely. PointedOut bool ForceQL bool // contains filtered or unexported fields }
func (*AircraftState) HaveHeading ¶
func (s *AircraftState) HaveHeading() bool
func (*AircraftState) HeadingVector ¶
func (s *AircraftState) HeadingVector(nmPerLongitude, magneticVariation float32) math.Point2LL
Note that the vector returned by HeadingVector() is along the aircraft's extrapolated path. Thus, it includes the effect of wind. The returned vector is scaled so that it represents where it is expected to be one minute in the future.
func (*AircraftState) TrackAltitude ¶
func (s *AircraftState) TrackAltitude() int
func (*AircraftState) TrackDeltaAltitude ¶
func (s *AircraftState) TrackDeltaAltitude() int
func (*AircraftState) TrackGroundspeed ¶
func (s *AircraftState) TrackGroundspeed() int
func (*AircraftState) TrackHeading ¶
func (s *AircraftState) TrackHeading(nmPerLongitude float32) float32
func (*AircraftState) TrackPosition ¶
func (s *AircraftState) TrackPosition() math.Point2LL
type CAAircraft ¶
type CRDARunwayPairState ¶
type CRDARunwayPairState struct { Enabled bool Mode CRDAMode RunwayState [2]CRDARunwayState }
stores the per-preference set state for each STARSConvergingRunways
type CRDARunwayState ¶
type CRDARunwayState struct { Enabled bool LeaderLineDirection *math.CardinalOrdinalDirection // nil -> unset DrawCourseLines bool DrawQualificationRegion bool }
type CommandMode ¶
type CommandMode int
type CommandStatus ¶
type CommandStatus struct {
// contains filtered or unexported fields
}
type DatablockType ¶
type DatablockType int
type GhostState ¶
type GhostState int
type ModeledAircraft ¶
type ModeledAircraft struct {
// contains filtered or unexported fields
}
func MakeModeledAircraft ¶
func MakeModeledAircraft(ac *av.Aircraft, state *AircraftState, threshold math.Point2LL) ModeledAircraft
func (*ModeledAircraft) EstimatedAltitude ¶
func (ma *ModeledAircraft) EstimatedAltitude(s float32) float32
estimated altitude s seconds in the future
func (*ModeledAircraft) NextPosition ¶
func (ma *ModeledAircraft) NextPosition(p [2]float32) [2]float32
Return estimated position 1s in the future
type PreferenceSet ¶
type PreferenceSet struct { Name string DisplayDCB bool DCBPosition int Center math.Point2LL Range float32 CurrentCenter math.Point2LL OffCenter bool RangeRingsCenter math.Point2LL RangeRingRadius int CurrentATIS string GIText [9]string AudioVolume int // 1-10 RadarTrackHistory int // 4-94: 0.5s increments via trackball but 0.1s increments allowed if // keyboard input. RadarTrackHistoryRate float32 DisplayWeatherLevel [6]bool // If empty, then then MULTI or FUSED mode, depending on // FusedRadarMode. The custom JSON name is so we don't get errors // parsing old configs, which stored this as an array... RadarSiteSelected string `json:"RadarSiteSelectedName"` FusedRadarMode bool AudioEffectEnabled []bool // For tracked by the user LeaderLineDirection math.CardinalOrdinalDirection LeaderLineLength int // 0-7 // For tracked by other controllers ControllerLeaderLineDirections map[string]math.CardinalOrdinalDirection // If not specified in ControllerLeaderLineDirections... OtherControllerLeaderLineDirection *math.CardinalOrdinalDirection // Only set if specified by the user (and not used currently...) UnassociatedLeaderLineDirection *math.CardinalOrdinalDirection AltitudeFilters struct { Unassociated [2]int // low, high Associated [2]int } QuickLookAll bool QuickLookAllIsPlus bool QuickLookPositions []QuickLookPosition CRDA struct { Disabled bool // Has the same size and indexing as corresponding STARSPane // STARSConvergingRunways RunwayPairState []CRDARunwayPairState ForceAllGhosts bool } DisplayLDBBeaconCodes bool // TODO: default? SelectedBeaconCodes []string DisableCAWarnings bool DisableMSAW bool OverflightFullDatablocks bool AutomaticFDBOffset bool DisplayTPASize bool DisplayATPAInTrailDist bool `json:"DisplayATPAIntrailDist"` DisplayATPAWarningAlertCones bool DisplayATPAMonitorCones bool VideoMapVisible map[int]interface{} PTLLength float32 PTLOwn, PTLAll bool DisplayRequestedAltitude bool DwellMode DwellMode Bookmarks [10]struct { Center math.Point2LL Range float32 } Brightness struct { DCB STARSBrightness BackgroundContrast STARSBrightness VideoGroupA STARSBrightness VideoGroupB STARSBrightness FullDatablocks STARSBrightness Lists STARSBrightness Positions STARSBrightness LimitedDatablocks STARSBrightness OtherTracks STARSBrightness Lines STARSBrightness RangeRings STARSBrightness Compass STARSBrightness BeaconSymbols STARSBrightness PrimarySymbols STARSBrightness History STARSBrightness Weather STARSBrightness WxContrast STARSBrightness } CharSize struct { DCB int Datablocks int Lists int Tools int PositionSymbols int } PreviewAreaPosition [2]float32 SSAList struct { Position [2]float32 Visible bool Filter struct { All bool Time bool Altimeter bool Status bool Radar bool Codes bool SpecialPurposeCodes bool Range bool PredictedTrackLines bool AltitudeFilters bool AirportWeather bool QuickLookPositions bool DisabledTerminal bool ActiveCRDAPairs bool Text struct { Main bool GI [9]bool } } } VFRList struct { Position [2]float32 Visible bool Lines int } TABList struct { Position [2]float32 Visible bool Lines int } AlertList struct { Position [2]float32 Visible bool Lines int } CoastList struct { Position [2]float32 Visible bool Lines int } SignOnList struct { Position [2]float32 Visible bool } VideoMapsList struct { Position [2]float32 Visible bool Selection VideoMapsGroup } CRDAStatusList struct { Position [2]float32 Visible bool } TowerLists [3]struct { Position [2]float32 Visible bool Lines int } }
func (*PreferenceSet) Activate ¶
func (ps *PreferenceSet) Activate(p platform.Platform, sp *STARSPane)
func (*PreferenceSet) Duplicate ¶
func (ps *PreferenceSet) Duplicate() PreferenceSet
func (*PreferenceSet) ResetCRDAState ¶
func (ps *PreferenceSet) ResetCRDAState(rwys []STARSConvergingRunways)
func (*PreferenceSet) Upgrade ¶
func (ps *PreferenceSet) Upgrade(from, to int)
type QuickLookPosition ¶
func (QuickLookPosition) String ¶ added in v0.11.4
func (q QuickLookPosition) String() string
type STARSBrightness ¶
type STARSBrightness int
func (STARSBrightness) RGB ¶
func (b STARSBrightness) RGB() renderer.RGB
type STARSConvergingRunways ¶
type STARSConvergingRunways struct { av.ConvergingRunways ApproachRegions [2]*av.ApproachRegion Airport string Index int }
this is read-only, stored in STARSPane for convenience
type STARSError ¶
type STARSError struct {
// contains filtered or unexported fields
}
func GetSTARSError ¶
func GetSTARSError(e error, lg *log.Logger) *STARSError
func NewSTARSError ¶
func NewSTARSError(msg string) *STARSError
type STARSFont ¶
type STARSFont struct { PointSize int Width, Height int Glyphs []STARSGlyph }
type STARSGlyph ¶
type STARSPane ¶
type STARSPane struct { CurrentPreferenceSet PreferenceSet SelectedPreferenceSet int PreferenceSets []PreferenceSet // Preference set that was selected when we entered the PREF menu. RestoreSelectedPreferenceSet int // All of the aircraft in the world, each with additional information // carried along in an STARSAircraftState. Aircraft map[string]*AircraftState AircraftToIndex map[string]int // for use in lists IndexToAircraft map[int]string // map is sort of wasteful since it's dense, but... UnsupportedTracks map[av.Squawk]bool // visible or not // explicit JSON name to avoid errors during config deserialization for // backwards compatibility, since this used to be a // map[string]interface{}. AutoTrackDepartures bool `json:"autotrack_departures"` LockDisplay bool AirspaceAwareness struct { Interfacility bool Intrafacility bool } // callsign -> controller id InboundPointOuts map[string]string OutboundPointOuts map[string]string RejectedPointOuts map[string]interface{} ForceQLCallsigns map[string]interface{} RangeBearingLines []STARSRangeBearingLine MinSepAircraft [2]string CAAircraft []CAAircraft // For CRDA ConvergingRunways []STARSConvergingRunways // Various UI state FlipNumericKeypad bool // contains filtered or unexported fields }
func NewSTARSPane ¶
func (*STARSPane) CanTakeKeyboardFocus ¶
func (*STARSPane) DisplayName ¶
func (*STARSPane) MakePreferenceSet ¶
func (sp *STARSPane) MakePreferenceSet(name string, ss *sim.State) PreferenceSet
type STARSRangeBearingLine ¶
type ScopeTransformations ¶
type ScopeTransformations struct {
// contains filtered or unexported fields
}
ScopeTransformations manages various transformation matrices that are useful when drawing radar scopes and provides a number of useful methods to transform among related coordinate spaces.
func GetScopeTransformations ¶
func GetScopeTransformations(paneExtent math.Extent2D, magneticVariation float32, nmPerLongitude float32, center math.Point2LL, rangenm float32, rotationAngle float32) ScopeTransformations
GetScopeTransformations returns a ScopeTransformations object corresponding to the specified radar scope center, range, and rotation angle.
func (*ScopeTransformations) LatLongFromWindowP ¶
func (st *ScopeTransformations) LatLongFromWindowP(p [2]float32) math.Point2LL
LatLongFromWindowP transforms a point p in window coordinates to latitude-longitude.
func (*ScopeTransformations) LatLongFromWindowV ¶
func (st *ScopeTransformations) LatLongFromWindowV(v [2]float32) math.Point2LL
LatLongFromWindowV transforms a vector in window coordinates to a vector in latitude-longitude coordinates.
func (*ScopeTransformations) LoadLatLongViewingMatrices ¶
func (st *ScopeTransformations) LoadLatLongViewingMatrices(cb *renderer.CommandBuffer)
LoadLatLongViewingMatrices adds commands to the provided command buffer to load viewing matrices so that latitude-longiture positions can be provided for subsequent vertices.
func (*ScopeTransformations) LoadWindowViewingMatrices ¶
func (st *ScopeTransformations) LoadWindowViewingMatrices(cb *renderer.CommandBuffer)
LoadWindowViewingMatrices adds commands to the provided command buffer to load viewing matrices so that window-coordinate positions can be provided for subsequent vertices.
func (*ScopeTransformations) NormalizedFromWindowP ¶
func (st *ScopeTransformations) NormalizedFromWindowP(p [2]float32) [2]float32
NormalizedFromWindowP transforms a point p in window coordinates to normalized [0,1]^2 coordinates.
func (*ScopeTransformations) PixelDistanceNM ¶
func (st *ScopeTransformations) PixelDistanceNM(nmPerLongitude float32) float32
PixelDistanceNM returns the space between adjacent pixels expressed in nautical miles.
func (*ScopeTransformations) WindowFromLatLongP ¶
func (st *ScopeTransformations) WindowFromLatLongP(p math.Point2LL) [2]float32
WindowFromLatLongP transforms a point given in latitude-longitude coordinates to window coordinates, snapped to a pixel center.
type VideoMapsGroup ¶
type VideoMapsGroup int
type WeatherRadar ¶
type WeatherRadar struct {
// contains filtered or unexported fields
}
WeatherRadar provides functionality for fetching radar images to display in radar scopes. Only locations in the USA are currently supported, as the only current data source is the US NOAA...
func (*WeatherRadar) Activate ¶
Activate must be called for the WeatherRadar to start fetching weather radar images; it is called with an initial center position in latitude-longitude coordinates.
func (*WeatherRadar) Draw ¶
func (w *WeatherRadar) Draw(ctx *panes.Context, intensity float32, contrast float32, active [NumWxLevels]bool, transforms ScopeTransformations, cb *renderer.CommandBuffer)
Draw draws the current weather radar image, if available. (If none is yet available, it returns rather than stalling waiting for it).
func (*WeatherRadar) HaveWeather ¶ added in v0.11.2
func (w *WeatherRadar) HaveWeather() [NumWxLevels]bool
func (*WeatherRadar) UpdateCenter ¶
func (w *WeatherRadar) UpdateCenter(center math.Point2LL)
UpdateCenter provides a new center point for the radar image, causing a new image to be fetched.