Compass Control

Download GPSCompass.ocx Visual Studio Control

The Compass Control behaves like a "regular" compass: the center line stays pointing forward and the compass card spins under it. You may specify many different options to modify how the compass looks and behaves by setting the control's Properties.

Unlike most "regular" compasses, this compass control allows you (and through your programming, allows your end users) to set a secondary pointer, using any color you wish, drawn as a line or a dot, with or without a label. If the label is specified, you may set its label to display its absolute heading or its relative angle to the primary pointer (via the SecondaryClosing Property).
The SecondaryClosing Property in this example is shown to be set to True. This means that it will show the closing angle between the primary heading and the secondary: the value will therefore never be greater than 180 degrees.
The SecondaryStyle Property toggles between a line (Value=0) and a dot (Value=1), and you may specify the color using the SecondaryColor Property.
The primary heading lable may also be removed, font size for the cardinal values changed, tick marks removed, and the center line color changed. In fact, you could remove everything from the compass except the outer circle.
The Twilight and Night properties are also implemented, as in all of the other NMEA Sage controls. In this example the PrimaryFontSize Property is set to "25," the CardinalFontSize Property is set to "12," and the Night Property is set to True.
There are two ways to set the primary heading: by using the cHeading Property and/or the HDT Method. Degrees may be added that are greater than 359, and the control will modulus the sum (for example, a heading of 370 will reduce to a heading of 10).

Several NMEA devices provide True Heading ($..HDT) sentences. (For example many GPS receivers will send $GPHDT sentences.) You may pass these sentences to the Compass Control via the HDT Method.

The DangerTripped Event works with the secondary indicator to show a danger bearing: a direction to be avoided. If the boat swings towards that bearing, the DangerTripped Event will be raised. To function, one must tell the control the margin of danger using the DangerMargin Property, in degrees, that must be closed before the Event is tripped; you must also set the SecondaryClosing Property to True to tell the control that the secondary indicator is relative to the primary. Also, the TripDanger Property must be set to True.

When the event is triggered, your program will probably want to sound an alarm for the end user to hear, and give the end user a way to end the alarm and turn off the event until the boat is turned away from the danger bearing.

Events:

Resize
CompassError
Click
DangerTripped
DblClick

Methods:

HDT
ResetDefaults

Properties:

cHeading
Night
Twilight
Appearance
BackColor
FontColor
BorderStyle
ErrorNumber
ErrorDescription
ScaleTicks
ShowFiveTick
ShowTenTick
ShowCardinals
ShowCenterLine
ShowSecondary
FiveTickColor
TenTickColor
CenterLineColor
CardinalFontSize
ShowMajorCards
ShowMinorCards
PrimaryFontSize
SecondaryFontSize
SecondaryClosing
SecondaryHeading
SecondaryStyle
SecondaryColor
ShowSecondaryLabel
ShowPrimaryLabel
DangerMargin
TripDanger

Error Codes

0 - No Current Error
1 - Tick scaling must be from 1% to 1,000%
2 - NMEA sentence appears malformed. $..HDT sentences are valid.
3 - SecondaryStyle must be 0 (line) or 1 (dot).
4 -
5 - BorderStyle must be 0 or 1
6 - Appearance must be 0 or 1
NMEA Sage Home Page

The Banded Compass Control
The Compass Control
The North Biased Compass Control
The Goto Control
Course and Speed (Ground)
The Position Control
Engine RPM Control
The Rudder Control
The GPS Satellite Health Control
The GPS Satellite Elevation Control
Set and Drift control
The NMEA Talker Control
Depth and Water Temperature Control
The Wind Control
The Cross Track Alarm Control
The Pilot Control
Waypoint Plotter Control
Radar Control
Goto Simple Control