AndroidGCS PFD: Update the graphics for the PFD
BIN
androidgcs/res/drawable-hdpi/im_pfd_fixed.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 9.7 KiB |
BIN
androidgcs/res/drawable-hdpi/im_pfd_reticule.png
Normal file
After Width: | Height: | Size: 18 KiB |
@ -81,7 +81,7 @@ public class AttitudeView extends View {
|
|||||||
result = specSize;
|
result = specSize;
|
||||||
} else {
|
} else {
|
||||||
// Measure the text (beware: ascent is a negative number)
|
// Measure the text (beware: ascent is a negative number)
|
||||||
result = 600;
|
result = 1600;
|
||||||
if (specMode == MeasureSpec.AT_MOST) {
|
if (specMode == MeasureSpec.AT_MOST) {
|
||||||
// Respect AT_MOST value if that was what is called for by measureSpec
|
// Respect AT_MOST value if that was what is called for by measureSpec
|
||||||
result = Math.min(result, specSize);
|
result = Math.min(result, specSize);
|
||||||
@ -136,25 +136,35 @@ public class AttitudeView extends View {
|
|||||||
|
|
||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.rotate(-roll, PX / 2, PY / 2);
|
canvas.rotate(-roll, PX / 2, PY / 2);
|
||||||
|
canvas.save();
|
||||||
|
|
||||||
canvas.translate(0, pitch * DEG_TO_PX);
|
canvas.translate(0, pitch * DEG_TO_PX);
|
||||||
Drawable horizon = getContext().getResources().getDrawable(
|
Drawable horizon = getContext().getResources().getDrawable(
|
||||||
R.drawable.im_pfd_horizon);
|
R.drawable.im_pfd_horizon);
|
||||||
|
Drawable reticule = getContext().getResources().getDrawable(
|
||||||
|
R.drawable.im_pfd_reticule);
|
||||||
|
Drawable fixed = getContext().getResources().getDrawable(
|
||||||
|
R.drawable.im_pfd_fixed);
|
||||||
|
|
||||||
|
// Starting with a square image, want to size it equally
|
||||||
|
double margin = 0.2;
|
||||||
|
int screenSize = Math.min(PX, PY);
|
||||||
|
int imageHalfSize = (int) ((screenSize + screenSize * margin) / 2);
|
||||||
|
|
||||||
// This puts the image at the center of the PFD canvas (after it was
|
// This puts the image at the center of the PFD canvas (after it was
|
||||||
// translated)
|
// translated)
|
||||||
double margin = 0.5;
|
horizon.setBounds( PX/2 - imageHalfSize, PY/2 - imageHalfSize, PX/2 + imageHalfSize, PY/2 + imageHalfSize);
|
||||||
horizon.setBounds( (int) (-margin * PX), (int) (-margin * PY), (int) ((1 + margin) * PX), (int) ((1+margin) *PY));
|
|
||||||
horizon.draw(canvas);
|
horizon.draw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
|
||||||
canvas.drawLine(0, 0, PX, 0, markerPaint);
|
// Draw the overlay that only rolls
|
||||||
canvas.drawLine(0, 0, 0, PY, markerPaint);
|
reticule.setBounds( PX/2 - imageHalfSize, PY/2 - imageHalfSize, PX/2 + imageHalfSize, PY/2 + imageHalfSize);
|
||||||
canvas.drawLine(PX, 0, PX, PY, markerPaint);
|
reticule.draw(canvas);
|
||||||
canvas.drawLine(0, PY, PX, PY, markerPaint);
|
canvas.restore();
|
||||||
|
|
||||||
canvas.drawLine(0,PY/2,PX,PY/2,markerPaint);
|
// Draw the overlay that never moves
|
||||||
canvas.drawLine(PX/2,0,PX/2,PY,markerPaint);
|
fixed.setBounds( PX/2 - imageHalfSize, PY/2 - imageHalfSize, PX/2 + imageHalfSize, PY/2 + imageHalfSize);
|
||||||
|
fixed.draw(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BIN
artwork/Android/hdpi/im_pfd_fixed.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 9.7 KiB |
BIN
artwork/Android/hdpi/im_pfd_reticule.png
Normal file
After Width: | Height: | Size: 18 KiB |