Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a bearing pointer to the HSI widget for projects using pyG5 as GUI Element #16

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pyG5/pyG5View.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def __init__(self, parent=None):
("slip", 0),
("headingBug", 0),
("vs", 30),
("bearing1", 0),
("bearing1avail", 0),
("vs0", 23),
("vfe", 88),
("vno", 118),
Expand Down Expand Up @@ -1072,6 +1074,40 @@ def paintEvent(self, event):
vertAvailable = self._nav1gsavailable
gsDev = self._nav1gs

# bearing 1
if self._bearing1avail:
self.qp.rotate(90 - self._headingBug + self._bearing1)

self.setPen(2, Qt.GlobalColor.cyan)

# arrow
self.qp.drawPolyline(
QPolygonF(
[
QPointF(rotatinghsiCircleRadius - 20, 0),
QPointF(rotatinghsiCircleRadius - 25, 0),
QPointF(rotatinghsiCircleRadius - 35, -17),
QPointF(rotatinghsiCircleRadius - 25, 0),
QPointF(rotatinghsiCircleRadius - 35, 17),
QPointF(rotatinghsiCircleRadius - 25, 0),
QPointF(hsiCircleRadius, 0),
]
)
)

# backside
self.qp.drawPolyline(
QPolygonF(
[
QPointF(-rotatinghsiCircleRadius + 25, 0),
QPointF(-hsiCircleRadius, 0),
]
)
)

self.qp.rotate(-90 + self._headingBug - self._bearing1)

self.setPen(1, Qt.GlobalColor.black)
self.qp.setBrush(QBrush(navColor))
# Draw the CDI
self.qp.rotate(90 - self._headingBug + navcrs)
Expand Down
Loading