- private void draw_positions() {
- if (map.last_position != null && here != null) {
- AltosPointDouble rocket_screen = map.transform.screen(map.last_position);
- AltosPointDouble here_screen = map.transform.screen(here);
- paint.setColor(0xff8080ff);
- canvas.drawLine((float) rocket_screen.x, (float) rocket_screen.y,
- (float) here_screen.x, (float) here_screen.y, paint);
- }
- draw_bitmap(pad, pad_bitmap, pad_off_x, pad_off_y);
- draw_bitmap(map.last_position, rocket_bitmap, rocket_off_x, rocket_off_y);
- draw_bitmap(here, here_bitmap, here_off_x, here_off_y);
- }
-
- protected void onDraw(Canvas view_canvas) {
- canvas = view_canvas;
- paint = new Paint(Paint.ANTI_ALIAS_FLAG);
- paint.setStrokeWidth(stroke_width);
- paint.setStrokeCap(Paint.Cap.ROUND);
- paint.setStrokeJoin(Paint.Join.ROUND);
- map.paint();
- draw_positions();
- canvas = null;
- }
-
- public boolean onScale(ScaleGestureDetector detector) {
- float f = detector.getScaleFactor();
- AltosDebug.debug("onScale %f\n", f);
- if (f <= 0.8) {
- map.set_zoom(map.get_zoom() - 1);
- return true;
- }
- if (f >= 1.2) {
- map.set_zoom(map.get_zoom() + 1);
- return true;
- }
- return false;
- }
-
- public boolean onScaleBegin(ScaleGestureDetector detector) {
- AltosDebug.debug("onScaleBegin %f\n", detector.getScaleFactor());
- return true;
- }
-
- public void onScaleEnd(ScaleGestureDetector detector) {
- AltosDebug.debug("onScaleEnd %f\n", detector.getScaleFactor());
- }
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent event) {
- scale_detector.onTouchEvent(event);
-
- if (scale_detector.isInProgress()) {
- scaling = true;
- }