38 |
int heading; |
int heading; |
39 |
String headingText = "-"; |
String headingText = "-"; |
40 |
|
|
41 |
|
|
42 |
|
int width; |
43 |
|
int height; |
44 |
|
int hcenter; |
45 |
|
int vcenter; |
46 |
|
|
47 |
|
|
48 |
boolean mRun = true; |
boolean mRun = true; |
92 |
} |
} |
93 |
|
|
94 |
protected void myDraw(Canvas canvas) { |
protected void myDraw(Canvas canvas) { |
|
int w = this.getWidth(); |
|
|
int h = this.getHeight(); |
|
|
int hcenter = w / 2; |
|
|
int vcenter = hcenter + 20; |
|
|
|
|
|
|
|
95 |
|
|
96 |
canvas.drawColor(0xff000000); |
canvas.drawColor(0xff000000); |
97 |
canvas.drawLine(hcenter-5, vcenter-5, hcenter+5, vcenter+5, p); |
canvas.drawLine(hcenter-5, vcenter-5, hcenter+5, vcenter+5, p); |
101 |
canvas.drawCircle(hcenter, vcenter+5, 115, p); |
canvas.drawCircle(hcenter, vcenter+5, 115, p); |
102 |
canvas.drawCircle(hcenter, vcenter+5, 150, p); |
canvas.drawCircle(hcenter, vcenter+5, 150, p); |
103 |
|
|
104 |
canvas.drawText(distanceText1, (w-textWidth1)/2, vcenter+40+6, p3); |
canvas.drawText(distanceText1, (width-textWidth1)/2, vcenter+40+6, p3); |
105 |
canvas.drawText(distanceText2, (w-textWidth2)/2, vcenter+80+6, p3); |
canvas.drawText(distanceText2, (width-textWidth2)/2, vcenter+80+6, p3); |
106 |
canvas.drawText(distanceText3, (w-textWidth3)/2, vcenter+115+6, p3); |
canvas.drawText(distanceText3, (width-textWidth3)/2, vcenter+115+6, p3); |
107 |
canvas.drawText(distanceText4, (w-textWidth4)/2, vcenter+150+6, p3); |
canvas.drawText(distanceText4, (width-textWidth4)/2, vcenter+150+6, p3); |
108 |
|
|
109 |
final float correction = 5; |
final float correction = 5; |
110 |
final float lineLength = 150; |
final float lineLength = 150; |
150 |
@Override |
@Override |
151 |
public void surfaceCreated(SurfaceHolder holder) { //surfaceholder.CallBack |
public void surfaceCreated(SurfaceHolder holder) { //surfaceholder.CallBack |
152 |
Log.i("surfacCreated()","-"); |
Log.i("surfacCreated()","-"); |
153 |
|
|
154 |
|
width = this.getWidth(); |
155 |
|
height = this.getHeight(); |
156 |
|
hcenter = width / 2; |
157 |
|
vcenter = hcenter + 20; |
158 |
|
|
159 |
t.start(); |
t.start(); |
160 |
} |
} |
161 |
|
|
275 |
} |
} |
276 |
|
|
277 |
void drawLocation(Canvas canvas, Location location) { |
void drawLocation(Canvas canvas, Location location) { |
|
int w = this.getWidth(); |
|
|
int h = this.getHeight(); |
|
|
int hcenter = w / 2; |
|
|
int vcenter = hcenter + 20; |
|
278 |
|
|
279 |
float bearing = currentLocation.bearingTo(location); |
float bearing = currentLocation.bearingTo(location); |
280 |
float distance = currentLocation.distanceTo(location); |
float distance = currentLocation.distanceTo(location); |