|
|
@ -934,7 +934,7 @@ void PrimaryFlightDisplay::drawAltimeter( |
|
|
|
effectiveHalfHeight -= secondaryAltitudeBoxHeight; |
|
|
|
effectiveHalfHeight -= secondaryAltitudeBoxHeight; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float markerHalfHeight = mediumTextSize*0.8; |
|
|
|
float markerHalfHeight = mediumTextSize; |
|
|
|
float leftEdge = instrumentEdgePen.widthF()*2; |
|
|
|
float leftEdge = instrumentEdgePen.widthF()*2; |
|
|
|
float rightEdge = w-leftEdge; |
|
|
|
float rightEdge = w-leftEdge; |
|
|
|
float tickmarkLeft = leftEdge; |
|
|
|
float tickmarkLeft = leftEdge; |
|
|
@ -942,6 +942,7 @@ void PrimaryFlightDisplay::drawAltimeter( |
|
|
|
float tickmarkRightMinor = tickmarkLeft+TAPE_GAUGES_TICKWIDTH_MINOR*w; |
|
|
|
float tickmarkRightMinor = tickmarkLeft+TAPE_GAUGES_TICKWIDTH_MINOR*w; |
|
|
|
float numbersLeft = 0.42*w; |
|
|
|
float numbersLeft = 0.42*w; |
|
|
|
float markerTip = (tickmarkLeft*2+tickmarkRightMajor)/3; |
|
|
|
float markerTip = (tickmarkLeft*2+tickmarkRightMajor)/3; |
|
|
|
|
|
|
|
float markerOffset = 0.2* markerHalfHeight; |
|
|
|
float scaleCenterAltitude = isnan(primaryAltitude) ? 0 : primaryAltitude; |
|
|
|
float scaleCenterAltitude = isnan(primaryAltitude) ? 0 : primaryAltitude; |
|
|
|
|
|
|
|
|
|
|
|
// altitude scale
|
|
|
|
// altitude scale
|
|
|
@ -967,12 +968,20 @@ void PrimaryFlightDisplay::drawAltimeter( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QPainterPath markerPath(QPoint(markerTip, 0)); |
|
|
|
QPainterPath primaryMarkerPath(QPoint(markerTip, 0)); |
|
|
|
markerPath.lineTo(markerTip+markerHalfHeight, markerHalfHeight); |
|
|
|
primaryMarkerPath.lineTo(markerTip + markerHalfHeight, markerHalfHeight); |
|
|
|
markerPath.lineTo(rightEdge, markerHalfHeight); |
|
|
|
primaryMarkerPath.lineTo(rightEdge, markerHalfHeight); |
|
|
|
markerPath.lineTo(rightEdge, -markerHalfHeight); |
|
|
|
primaryMarkerPath.lineTo(rightEdge, -markerHalfHeight); |
|
|
|
markerPath.lineTo(markerTip+markerHalfHeight, -markerHalfHeight); |
|
|
|
primaryMarkerPath.lineTo(markerTip + markerHalfHeight, -markerHalfHeight); |
|
|
|
markerPath.closeSubpath(); |
|
|
|
primaryMarkerPath.closeSubpath(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QPainterPath secondaryMarkerPath(QPoint(markerTip + markerHalfHeight, markerHalfHeight + markerOffset)); |
|
|
|
|
|
|
|
if (!isnan(climbRate)) { |
|
|
|
|
|
|
|
secondaryMarkerPath.lineTo(markerTip + markerHalfHeight, 2 * markerHalfHeight + markerOffset); |
|
|
|
|
|
|
|
secondaryMarkerPath.lineTo(rightEdge, 2 * markerHalfHeight + markerOffset); |
|
|
|
|
|
|
|
secondaryMarkerPath.lineTo(rightEdge, 1 * markerHalfHeight + markerOffset); |
|
|
|
|
|
|
|
secondaryMarkerPath.closeSubpath(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
painter.resetTransform(); |
|
|
|
painter.resetTransform(); |
|
|
|
painter.translate(area.left(), area.center().y()); |
|
|
|
painter.translate(area.left(), area.center().y()); |
|
|
@ -982,7 +991,8 @@ void PrimaryFlightDisplay::drawAltimeter( |
|
|
|
painter.setPen(pen); |
|
|
|
painter.setPen(pen); |
|
|
|
|
|
|
|
|
|
|
|
painter.setBrush(Qt::SolidPattern); |
|
|
|
painter.setBrush(Qt::SolidPattern); |
|
|
|
painter.drawPath(markerPath); |
|
|
|
painter.drawPath(primaryMarkerPath); |
|
|
|
|
|
|
|
if (!isnan(climbRate)) painter.drawPath(secondaryMarkerPath); |
|
|
|
painter.setBrush(Qt::NoBrush); |
|
|
|
painter.setBrush(Qt::NoBrush); |
|
|
|
|
|
|
|
|
|
|
|
pen.setColor(Qt::white); |
|
|
|
pen.setColor(Qt::white); |
|
|
@ -992,20 +1002,25 @@ void PrimaryFlightDisplay::drawAltimeter( |
|
|
|
if (isnan(primaryAltitude)) |
|
|
|
if (isnan(primaryAltitude)) |
|
|
|
s_alt.sprintf("---"); |
|
|
|
s_alt.sprintf("---"); |
|
|
|
else |
|
|
|
else |
|
|
|
s_alt.sprintf("%3.0f", primaryAltitude); |
|
|
|
s_alt.sprintf("h:%3.0f", primaryAltitude); |
|
|
|
|
|
|
|
|
|
|
|
float xCenter = (markerTip+rightEdge)/2; |
|
|
|
drawTextRightCenter(painter, s_alt, mediumTextSize, rightEdge - 4 * lineWidth, 0); |
|
|
|
drawTextCenter(painter, s_alt, mediumTextSize, xCenter, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// draw simple in-tape VVI.
|
|
|
|
// draw simple in-tape VVI.
|
|
|
|
if (!isnan(climbRate)) { |
|
|
|
if (!isnan(climbRate)) { |
|
|
|
|
|
|
|
// Draw label
|
|
|
|
|
|
|
|
QString s_climb; |
|
|
|
|
|
|
|
s_climb.sprintf("vZ:%2.1f", climbRate); |
|
|
|
|
|
|
|
drawTextRightCenter(painter, s_climb, smallTextSize, rightEdge - 4 * lineWidth, 1.5*mediumTextSize + markerOffset); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Draw climb rate indicator as an arrow
|
|
|
|
float vvPixHeight = -climbRate/ALTIMETER_VVI_SPAN * effectiveHalfHeight; |
|
|
|
float vvPixHeight = -climbRate/ALTIMETER_VVI_SPAN * effectiveHalfHeight; |
|
|
|
if (abs (vvPixHeight) < markerHalfHeight) |
|
|
|
if (vvPixHeight > -markerHalfHeight && vvPixHeight < 2 * markerHalfHeight + markerOffset) |
|
|
|
return; // hidden behind marker.
|
|
|
|
return; // hidden behind marker.
|
|
|
|
|
|
|
|
|
|
|
|
float vvSign = vvPixHeight>0 ? 1 : -1; // reverse y sign
|
|
|
|
float vvSign = vvPixHeight>0 ? 1 : -1; // reverse y sign
|
|
|
|
|
|
|
|
|
|
|
|
QPointF vvArrowBegin(rightEdge - w*ALTIMETER_VVI_WIDTH/2, markerHalfHeight*vvSign); |
|
|
|
QPointF vvArrowBegin(rightEdge - w*ALTIMETER_VVI_WIDTH / 2, (vvSign>0 ? 2*markerHalfHeight+markerOffset : -markerHalfHeight)); |
|
|
|
QPointF vvArrowEnd(rightEdge - w*ALTIMETER_VVI_WIDTH/2, vvPixHeight); |
|
|
|
QPointF vvArrowEnd(rightEdge - w*ALTIMETER_VVI_WIDTH/2, vvPixHeight); |
|
|
|
painter.drawLine(vvArrowBegin, vvArrowEnd); |
|
|
|
painter.drawLine(vvArrowBegin, vvArrowEnd); |
|
|
|
|
|
|
|
|
|
|
@ -1048,27 +1063,30 @@ void PrimaryFlightDisplay::drawVelocityMeter( |
|
|
|
float w = area.width(); |
|
|
|
float w = area.width(); |
|
|
|
float effectiveHalfHeight = h*0.45; |
|
|
|
float effectiveHalfHeight = h*0.45; |
|
|
|
float markerHalfHeight = mediumTextSize; |
|
|
|
float markerHalfHeight = mediumTextSize; |
|
|
|
float leftEdge = instrumentEdgePen.widthF()*2; |
|
|
|
float leftEdge = instrumentEdgePen.widthF() * 2; |
|
|
|
float tickmarkRight = w-leftEdge; |
|
|
|
float tickmarkRight = w - leftEdge; |
|
|
|
float tickmarkLeftMajor = tickmarkRight-w*TAPE_GAUGES_TICKWIDTH_MAJOR; |
|
|
|
float tickmarkLeftMajor = tickmarkRight - w*TAPE_GAUGES_TICKWIDTH_MAJOR; |
|
|
|
float tickmarkLeftMinor = tickmarkRight-w*TAPE_GAUGES_TICKWIDTH_MINOR; |
|
|
|
float tickmarkLeftMinor = tickmarkRight - w*TAPE_GAUGES_TICKWIDTH_MINOR; |
|
|
|
float numbersRight = 0.42*w; |
|
|
|
float numbersRight = 0.42*w; |
|
|
|
float markerTip = (tickmarkLeftMajor+tickmarkRight*2)/3; |
|
|
|
float markerTip = (tickmarkLeftMajor + tickmarkRight * 2) / 3; |
|
|
|
|
|
|
|
float markerOffset = 0.2 * markerHalfHeight; |
|
|
|
|
|
|
|
|
|
|
|
// Select between air and ground speed:
|
|
|
|
// Select between air and ground speed:
|
|
|
|
float speed = (isAirplane() && !isnan(airSpeed)) ? airSpeed : groundSpeed; |
|
|
|
bool bSpeedIsAirspeed = (isAirplane() && !isnan(airSpeed)); |
|
|
|
float centerScaleSpeed = isnan(speed) ? 0 : speed; |
|
|
|
float primarySpeed = bSpeedIsAirspeed ? airSpeed : groundSpeed; |
|
|
|
|
|
|
|
float secondarySpeed = !bSpeedIsAirspeed ? airSpeed : groundSpeed; |
|
|
|
|
|
|
|
float centerScaleSpeed = isnan(primarySpeed) ? 0 : primarySpeed; |
|
|
|
|
|
|
|
|
|
|
|
float start = centerScaleSpeed - AIRSPEED_LINEAR_SPAN/2; |
|
|
|
float start = centerScaleSpeed - AIRSPEED_LINEAR_SPAN / 2; |
|
|
|
float end = centerScaleSpeed + AIRSPEED_LINEAR_SPAN/2; |
|
|
|
float end = centerScaleSpeed + AIRSPEED_LINEAR_SPAN / 2; |
|
|
|
|
|
|
|
|
|
|
|
int firstTick = ceil(start / AIRSPEED_LINEAR_RESOLUTION) * AIRSPEED_LINEAR_RESOLUTION; |
|
|
|
int firstTick = ceil(start / AIRSPEED_LINEAR_RESOLUTION) * AIRSPEED_LINEAR_RESOLUTION; |
|
|
|
int lastTick = floor(end / AIRSPEED_LINEAR_RESOLUTION) * AIRSPEED_LINEAR_RESOLUTION; |
|
|
|
int lastTick = floor(end / AIRSPEED_LINEAR_RESOLUTION) * AIRSPEED_LINEAR_RESOLUTION; |
|
|
|
for (int tickSpeed = firstTick; tickSpeed <= lastTick; tickSpeed += AIRSPEED_LINEAR_RESOLUTION) { |
|
|
|
for (int tickSpeed = firstTick; tickSpeed <= lastTick; tickSpeed += AIRSPEED_LINEAR_RESOLUTION) { |
|
|
|
pen.setColor(tickSpeed<0 ? redColor : Qt::white); |
|
|
|
pen.setColor(tickSpeed < 0 ? redColor : Qt::white); |
|
|
|
painter.setPen(pen); |
|
|
|
painter.setPen(pen); |
|
|
|
|
|
|
|
|
|
|
|
float y = (tickSpeed-centerScaleSpeed)*effectiveHalfHeight/(AIRSPEED_LINEAR_SPAN/2); |
|
|
|
float y = (tickSpeed - centerScaleSpeed)*effectiveHalfHeight / (AIRSPEED_LINEAR_SPAN / 2); |
|
|
|
bool hasText = tickSpeed % AIRSPEED_LINEAR_MAJOR_RESOLUTION == 0; |
|
|
|
bool hasText = tickSpeed % AIRSPEED_LINEAR_MAJOR_RESOLUTION == 0; |
|
|
|
painter.resetTransform(); |
|
|
|
painter.resetTransform(); |
|
|
|
|
|
|
|
|
|
|
@ -1079,17 +1097,27 @@ void PrimaryFlightDisplay::drawVelocityMeter( |
|
|
|
QString s_speed; |
|
|
|
QString s_speed; |
|
|
|
s_speed.sprintf("%d", abs(tickSpeed)); |
|
|
|
s_speed.sprintf("%d", abs(tickSpeed)); |
|
|
|
drawTextRightCenter(painter, s_speed, mediumTextSize, numbersRight, 0); |
|
|
|
drawTextRightCenter(painter, s_speed, mediumTextSize, numbersRight, 0); |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
painter.drawLine(tickmarkLeftMinor, 0, tickmarkRight, 0); |
|
|
|
painter.drawLine(tickmarkLeftMinor, 0, tickmarkRight, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QPainterPath markerPath(QPoint(markerTip, 0)); |
|
|
|
//Paint the label background
|
|
|
|
markerPath.lineTo(markerTip-markerHalfHeight, markerHalfHeight); |
|
|
|
QPainterPath primaryMarkerPath(QPoint(markerTip, 0)); |
|
|
|
markerPath.lineTo(leftEdge, markerHalfHeight); |
|
|
|
primaryMarkerPath.lineTo(markerTip - markerHalfHeight, markerHalfHeight); |
|
|
|
markerPath.lineTo(leftEdge, -markerHalfHeight); |
|
|
|
primaryMarkerPath.lineTo(leftEdge, markerHalfHeight); |
|
|
|
markerPath.lineTo(markerTip-markerHalfHeight, -markerHalfHeight); |
|
|
|
primaryMarkerPath.lineTo(leftEdge, -markerHalfHeight); |
|
|
|
markerPath.closeSubpath(); |
|
|
|
primaryMarkerPath.lineTo(markerTip - markerHalfHeight, -markerHalfHeight); |
|
|
|
|
|
|
|
primaryMarkerPath.closeSubpath(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QPainterPath secondaryMarkerPath(QPoint(markerTip - markerHalfHeight, 1 * markerHalfHeight + markerOffset)); |
|
|
|
|
|
|
|
if (!isnan(secondarySpeed)) { |
|
|
|
|
|
|
|
secondaryMarkerPath.lineTo(markerTip - markerHalfHeight, 2 * markerHalfHeight + markerOffset); |
|
|
|
|
|
|
|
secondaryMarkerPath.lineTo(leftEdge, 2 * markerHalfHeight + markerOffset); |
|
|
|
|
|
|
|
secondaryMarkerPath.lineTo(leftEdge, 1 * markerHalfHeight + markerOffset); |
|
|
|
|
|
|
|
secondaryMarkerPath.closeSubpath(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
painter.resetTransform(); |
|
|
|
painter.resetTransform(); |
|
|
|
painter.translate(area.left(), area.center().y()); |
|
|
|
painter.translate(area.left(), area.center().y()); |
|
|
@ -1099,18 +1127,27 @@ void PrimaryFlightDisplay::drawVelocityMeter( |
|
|
|
painter.setPen(pen); |
|
|
|
painter.setPen(pen); |
|
|
|
|
|
|
|
|
|
|
|
painter.setBrush(Qt::SolidPattern); |
|
|
|
painter.setBrush(Qt::SolidPattern); |
|
|
|
painter.drawPath(markerPath); |
|
|
|
painter.drawPath(primaryMarkerPath); |
|
|
|
|
|
|
|
if (!isnan(secondarySpeed)) painter.drawPath(secondaryMarkerPath); |
|
|
|
painter.setBrush(Qt::NoBrush); |
|
|
|
painter.setBrush(Qt::NoBrush); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Draw primary speed
|
|
|
|
pen.setColor(Qt::white); |
|
|
|
pen.setColor(Qt::white); |
|
|
|
painter.setPen(pen); |
|
|
|
painter.setPen(pen); |
|
|
|
QString s_alt; |
|
|
|
QString s_alt; |
|
|
|
if (isnan(speed)) |
|
|
|
if (isnan(primarySpeed)) |
|
|
|
s_alt.sprintf("---"); |
|
|
|
s_alt.sprintf("---"); |
|
|
|
else |
|
|
|
else |
|
|
|
s_alt.sprintf("%3.1f", speed); |
|
|
|
s_alt.sprintf("%s:%3.1f", (bSpeedIsAirspeed ? "AS" : "GS"), primarySpeed); |
|
|
|
float xCenter = (markerTip+leftEdge)/2; |
|
|
|
drawTextLeftCenter(painter, s_alt, mediumTextSize, 4 * lineWidth, 0); |
|
|
|
drawTextCenter(painter, s_alt, mediumTextSize, xCenter, 0); |
|
|
|
|
|
|
|
|
|
|
|
// Draw secondary speed
|
|
|
|
|
|
|
|
if (!isnan(secondarySpeed)) { |
|
|
|
|
|
|
|
pen.setColor(Qt::white); |
|
|
|
|
|
|
|
painter.setPen(pen); |
|
|
|
|
|
|
|
s_alt.sprintf("%s:%3.1f", (!bSpeedIsAirspeed ? "AS" : "GS"), secondarySpeed); |
|
|
|
|
|
|
|
drawTextLeftCenter(painter, s_alt, smallTextSize, 4 * lineWidth, 1.5 * markerHalfHeight + markerOffset); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static const int TOP = (1<<0); |
|
|
|
static const int TOP = (1<<0); |
|
|
|