Example #1
0
 @Override
 public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
   switch (seekBar.getId()) {
     case R.id.trackbar:
       if (fromUser) {
         application.editingTrack.editingPos = progress;
       }
       Track.TrackPoint tp = application.editingTrack.getPoint(progress);
       // double ele = tp.elevation * elevationFactor;
       ((TextView) findViewById(R.id.tp_number)).setText("#" + (progress + 1));
       // FIXME Need UTM support here
       ((TextView) findViewById(R.id.tp_latitude))
           .setText(StringFormatter.coordinate(tp.latitude));
       ((TextView) findViewById(R.id.tp_longitude))
           .setText(StringFormatter.coordinate(tp.longitude));
       // ((TextView) findViewById(R.id.tp_elevation)).setText(String.valueOf(Math.round(ele)) + "
       // " + elevationAbbr);
       ((TextView) findViewById(R.id.tp_time))
           .setText(
               SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT)
                   .format(new Date(tp.time)));
       boolean mapChanged =
           application.setMapCenter(tp.latitude, tp.longitude, true, false, false);
       if (mapChanged) map.updateMapInfo();
       map.updateMapCenter();
       break;
   }
 }
Example #2
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.cutbefore:
       // application.editingTrack.cutBefore(trackBar.getProgress());
       int nb = application.editingTrack.getAllPoints().size() - 1;
       trackBar.setMax(nb);
       trackBar.setProgress(0);
       break;
     case R.id.cutafter:
       // application.editingTrack.cutAfter(trackBar.getProgress());
       int na = application.editingTrack.getAllPoints().size() - 1;
       trackBar.setMax(na);
       trackBar.setProgress(0);
       trackBar.setProgress(na);
       break;
     case R.id.finishtrackedit:
       application.editingTrack.editing = false;
       application.editingTrack.editingPos = -1;
       application.editingTrack = null;
       //				findViewById(R.id.edittrack).setVisibility(View.GONE);
       //				findViewById(R.id.trackdetails).setVisibility(View.GONE);
       // updateGPSStatus();
       if (showDistance == 2) {
         application.overlayManager.distanceOverlay.setEnabled(true);
       }
       map.setFocusable(true);
       map.setFocusableInTouchMode(true);
       map.requestFocus();
       break;
   }
 }
Example #3
0
  public boolean onScale(ScaleGestureDetector detector) {
    // the velocity of the pinch in scale factor per ms
    float velocity =
        (detector.getCurrentSpan() - detector.getPreviousSpan()) / detector.getTimeDelta();
    float currentSpan = detector.getCurrentSpanX();
    float prevSpan = detector.getPreviousSpanX();

    double diff = Math.abs(currentSpan - prevSpan);

    /*
     * If Shove is in progress do not handle scale
     * If previous scale is handled then keep on handling scale
     * else give some buffer for shove to be processed
     */
    if (mDoubleTapScale
        || mScaleHandled
        || (!mShoveHandled
            && diff
                > PINCH_THRESHOLD
                    * Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels))) {
      mScaleHandled = true;
      float focusX = mDoubleTapScale ? mapView.getWidth() * 0.5f : detector.getFocusX();
      float focusY = mDoubleTapScale ? mapView.getHeight() * 0.5f : detector.getFocusY();
      mLastDoubleGestureTime = detector.getEventTime();
      handlePinchGesture(focusX, focusY, detector.getScaleFactor(), velocity);
      return true;
    }
    mScaleHandled = false;
    return false;
  }
Example #4
0
    @Override
    public void onRunAnimation() {
      final MapView mapview = MapController.this.mOsmv;
      final IGeoPoint mapCenter = mapview.getMapCenter();
      final int stepDuration = this.mStepDuration;
      final float amountStretch = this.mAmountStretch;
      try {
        int newMapCenterLatE6;
        int newMapCenterLonE6;

        for (int i = 0; i < this.mSmoothness; i++) {

          final double delta =
              (this.mYOffset + Math.cos(this.mStepIncrement * i + this.mStart)) * amountStretch;
          final int deltaLatitudeE6 = (int) (this.mPanTotalLatitudeE6 * delta);
          final int deltaLongitudeE6 = (int) (this.mPanTotalLongitudeE6 * delta);

          newMapCenterLatE6 = mapCenter.getLatitudeE6() - deltaLatitudeE6;
          newMapCenterLonE6 = mapCenter.getLongitudeE6() - deltaLongitudeE6;
          mapview.setMapCenter(newMapCenterLatE6, newMapCenterLonE6);

          Thread.sleep(stepDuration);
        }
        mapview.setMapCenter(super.mTargetLatitudeE6, super.mTargetLongitudeE6);
      } catch (final Exception e) {
        this.interrupt();
      }
    }
Example #5
0
    @Override
    public void onRunAnimation() {
      final MapView mapview = MapController.this.mOsmv;
      final IGeoPoint mapCenter = mapview.getMapCenter();
      final int stepDuration = this.mStepDuration;
      try {
        int newMapCenterLatE6;
        int newMapCenterLonE6;

        for (int i = 0; i < this.mSmoothness; i++) {

          final double delta = Math.pow(0.5, i + 1);
          final int deltaLatitudeE6 = (int) (this.mPanTotalLatitudeE6 * delta);
          final int detlaLongitudeE6 = (int) (this.mPanTotalLongitudeE6 * delta);

          newMapCenterLatE6 = mapCenter.getLatitudeE6() - deltaLatitudeE6;
          newMapCenterLonE6 = mapCenter.getLongitudeE6() - detlaLongitudeE6;
          mapview.setMapCenter(newMapCenterLatE6, newMapCenterLonE6);

          Thread.sleep(stepDuration);
        }
        mapview.setMapCenter(super.mTargetLatitudeE6, super.mTargetLongitudeE6);
      } catch (final Exception e) {
        this.interrupt();
      }
    }
 @Override
 public GeoPoint fromPixels(int x, int y) {
   Point center = mView.getController().getCenter();
   x = x + center.x - mView.getWidth() / 2;
   y = y + center.y - mView.getHeight() / 2;
   double[] coords = TileFactory.PixelToLatLng(new int[] {x, y}, mView.getZoomLevel());
   GeoPoint geoPoint = new GeoPoint(coords[0], coords[1]);
   return geoPoint;
 }
Example #7
0
 private void updatepos() {
   MapView map;
   Gob pl;
   if (((map = getparent(GameUI.class).map) == null)
       || ((pl = map.player()) == null)
       || (pl.sc == null)) return;
   pcc = pl.sc;
   pho = (int) (pl.sczu.mul(20f).y) - 20;
 }
Example #8
0
 protected final void a() {
   if (!m) i = i - l;
   else i = i + l;
   Matrix matrix = new Matrix();
   matrix.setScale(i, i, g, h);
   f.c().a(i);
   f.c().a(matrix);
   f.postInvalidate();
 }
Example #9
0
 public boolean mousedown(Coord c, int button) {
   if (cc == null) return (false);
   Gob gob = findicongob(c);
   if (gob == null) mv.wdgmsg("click", rootpos().add(c), c2p(c), button, ui.modflags());
   else
     mv.wdgmsg(
         "click", rootpos().add(c), c2p(c), button, ui.modflags(), 0, (int) gob.id, gob.rc, 0, -1);
   return (true);
 }
 @Override
 public Point toPixels(GeoPoint in, Point out) {
   double[] coords = new double[] {in.getLatitudeE6() / 1E6, in.getLongitudeE6() / 1E6};
   int[] pixels = TileFactory.LatLngToPixel(coords, mView.getZoomLevel());
   Point center = mView.getController().getCenter();
   out.x = pixels[0] - center.x + mView.getWidth() / 2;
   out.y = pixels[1] - center.y + mView.getHeight() / 2;
   return out;
 }
  private void DrawPath(GeoPoint src, GeoPoint dest, int color, MapView mMapView01, Document doc) {

    if (doc != null && doc.getElementsByTagName("GeometryCollection").getLength() > 0) {
      List<Overlay> maliste = mMapView01.getOverlays();
      int pos = maliste.size();
      while (pos > 2) {
        // Codes.mondebug(""+maliste.get(pos-1).getClass());
        mMapView01.getOverlays().remove(pos - 1);

        pos--;
      }
      // String path =
      // doc.getElementsByTagName("GeometryCollection").item(0).getFirstChild().getFirstChild().getNodeName();
      String path =
          doc.getElementsByTagName("GeometryCollection")
              .item(0)
              .getFirstChild()
              .getFirstChild()
              .getFirstChild()
              .getNodeValue();
      // //Log.d("xxx","path="+ path);
      String[] pairs = path.split(" ");
      String[] lngLat = pairs[0].split(","); // lngLat[0]=longitude
      // lngLat[1]=latitude
      // lngLat[2]=height
      // src
      GeoPoint startGP =
          new GeoPoint(
              (int) (Double.parseDouble(lngLat[1]) * 1E6),
              (int) (Double.parseDouble(lngLat[0]) * 1E6));
      mMapView01.getOverlays().add(new MyOverLay(startGP, startGP, 1));
      GeoPoint gp1;
      GeoPoint gp2 = startGP;
      Log.i("", "" + pairs.length);
      for (int i = 1; i < pairs.length; i++) // the last one would be
      // crash
      {
        lngLat = pairs[i].split(",");
        gp1 = gp2;
        // watch out! For GeoPoint, first:latitude, second:longitude
        gp2 =
            new GeoPoint(
                (int) (Double.parseDouble(lngLat[1]) * 1E6),
                (int) (Double.parseDouble(lngLat[0]) * 1E6));
        mMapView01.getOverlays().add(new MyOverLay(gp1, gp2, 2, color));
        // //Log.d("xxx","pair:" + pairs[i]);
      }
      mMapView01.getOverlays().add(new MyOverLay(dest, dest, color)); // use
      // //
      // color
    } else Toast.makeText(getBaseContext(), R.string.txt_error, Toast.LENGTH_LONG).show();
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case 102:
       mMap.setSatellite(!mMap.isSatellite());
       break;
       // case 103: maMap.setTraffic(!maMap.isTraffic()) ;break;
       // case 104: maMap.setStreetView(!maMap.isStreetView()) ;break;
     case android.R.id.home:
       finish();
   }
   return true;
 }
Example #13
0
 /** Invalidates the ViewSettings instances shown on top of the MapView */
 public void invalidate() {
   mapView.setLogoMargins(
       getLogoMarginLeft(), getLogoMarginTop(), getLogoMarginRight(), getLogoMarginBottom());
   mapView.setCompassMargins(
       getCompassMarginLeft(),
       getCompassMarginTop(),
       getCompassMarginRight(),
       getCompassMarginBottom());
   mapView.setAttributionMargins(
       getAttributionMarginLeft(),
       getAttributionMarginTop(),
       getAttributionMarginRight(),
       getAttributionMarginBottom());
 }
  private void reimage() {
    floor_Image.post(
        new Runnable() {

          @Override
          public void run() {
            int device_width = getWindow().getWindowManager().getDefaultDisplay().getWidth();
            int imageWidth = ((BitmapDrawable) floor_Image.getDrawable()).getBounds().width();
            float scale = device_width / (float) imageWidth;
            floor_Image.adjustWidth(scale);
          }
        });
    floor_Image.postInvalidate();
  }
Example #15
0
    public LinearAnimationRunner(
        final int aTargetLatitudeE6,
        final int aTargetLongitudeE6,
        final int aSmoothness,
        final int aDuration) {
      super(aTargetLatitudeE6, aTargetLongitudeE6, aSmoothness, aDuration);

      /* Get the current mapview-center. */
      final MapView mapview = MapController.this.mOsmv;
      final IGeoPoint mapCenter = mapview.getMapCenter();

      this.mPanPerStepLatitudeE6 = (mapCenter.getLatitudeE6() - aTargetLatitudeE6) / aSmoothness;
      this.mPanPerStepLongitudeE6 = (mapCenter.getLongitudeE6() - aTargetLongitudeE6) / aSmoothness;

      this.setName("LinearAnimationRunner");
    }
Example #16
0
    public AbstractAnimationRunner(
        final int aTargetLatitudeE6,
        final int aTargetLongitudeE6,
        final int aSmoothness,
        final int aDuration) {
      this.mTargetLatitudeE6 = aTargetLatitudeE6;
      this.mTargetLongitudeE6 = aTargetLongitudeE6;
      this.mSmoothness = aSmoothness;
      this.mStepDuration = aDuration / aSmoothness;

      /* Get the current mapview-center. */
      final MapView mapview = MapController.this.mOsmv;
      final IGeoPoint mapCenter = mapview.getMapCenter();

      this.mPanTotalLatitudeE6 = mapCenter.getLatitudeE6() - aTargetLatitudeE6;
      this.mPanTotalLongitudeE6 = mapCenter.getLongitudeE6() - aTargetLongitudeE6;
    }
 // Calibration successful, positioning can be started
 public void onCalibrationFinished() {
   Log.d("&5", "onCalibrationFinished");
   showMessageOnUI("onCalibrationFinished(): starting positioning.");
   vib.vibrate(100);
   calibrated = true;
   indoorAtlas.startPositioning(
       buildingId, levelId, Building_Data.floor[floor_Image.getCurrent_floor()], false);
 }
Example #18
0
  @Override
  public boolean onPrepareOptionsMenu(final Menu menu) {
    if (application.editingRoute != null || application.editingTrack != null) return false;

    menu.findItem(R.id.menuSetAnchor).setVisible(showDistance > 0 && !map.isFollowing());

    return true;
  }
Example #19
0
  private void initCameraPanel() {
    int x = 0, y = 0, my = 0;

    int tx = x + camera.add(new Label("Camera:"), x, y).sz.x + 5;
    camera.add(
                new Dropbox<String>(100, 5, 16) {
                  @Override
                  protected String listitem(int i) {
                    return new LinkedList<>(MapView.camlist()).get(i);
                  }

                  @Override
                  protected int listitems() {
                    return MapView.camlist().size();
                  }

                  @Override
                  protected void drawitem(GOut g, String item, int i) {
                    g.text(item, Coord.z);
                  }

                  @Override
                  public void change(String item) {
                    super.change(item);
                    MapView.defcam(item);
                    if (ui.gui != null && ui.gui.map != null) {
                      ui.gui.map.camera = ui.gui.map.restorecam();
                    }
                  }
                },
                tx,
                y)
            .sel =
        MapView.defcam();

    y += 35;
    camera.add(new Label("Brighten view"), x, y);
    y += 15;
    camera.add(
                new HSlider(200, 0, 500, 0) {
                  public void changed() {
                    CFG.CAMERA_BRIGHT.set(val / 1000.0f);
                    if (ui.sess != null && ui.sess.glob != null) {
                      ui.sess.glob.brighten();
                    }
                  }
                },
                x,
                y)
            .val =
        (int) (1000 * CFG.CAMERA_BRIGHT.get());

    y += 25;
    my = Math.max(my, y);

    camera.add(new PButton(200, "Back", 27, main), 0, my + 35);
    camera.pack();
  }
Example #20
0
 public boolean onDoubleTapEvent(MotionEvent event) {
   if (event.getAction() == 2) { // Move action during double tap
     // Set TapScaling only if sufficient Y movement has happened
     float movement = event.getY() - doubleTapDownY;
     if (Math.abs(movement) > DOUBLETAP_MOVE_THRESHOLD) {
       mDoubleTapScale = true;
     }
   } else if (event.getAction()
       == 1) { // DoubleTap Up; handleDoubleTap zoom-in if not moved (scale happened)
     if (!mDoubleTapScale) {
       handleDoubleTapGesture(mapView.getWidth() * 0.5f, mapView.getHeight() * 0.5f);
     }
     mDoubleTapScale = false;
   } else { // DoubleTap down event
     doubleTapDownY = event.getY();
   }
   return true;
 }
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   menu.findItem(102)
       .setIcon(
           mMap.isSatellite()
               ? android.R.drawable.checkbox_on_background
               : android.R.drawable.checkbox_off_background);
   return true;
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.my_map);
    setResult(RESULT_OK);

    mMap = (MapView) findViewById(R.id.myGmap);
    mMap.setBuiltInZoomControls(true);
    mMap.setSatellite(false);
    mController = mMap.getController();

    Bundle extras = getIntent().getExtras();

    double glat = 0;
    double glon = 0;

    if (extras != null) {
      name = extras.getString("Name");
      glat = extras.getDouble("lat");
      glon = extras.getDouble("lon");
    } else Toast.makeText(this, "Error while getting train position", Toast.LENGTH_LONG).show();

    // Toast.makeText(this, glat + " // " + glon, Toast.LENGTH_LONG).show();

    gpStation = new GeoPoint((int) (glat * 1E6), (int) (glon * 1E6));

    marker = getResources().getDrawable(R.drawable.ic_station_pixelart);
    stationsOverlay = new ItemizedOverlayStation(marker, name, this);
    stationsOverlay.addPoint(gpStation);
    mMap.getOverlays().add(stationsOverlay);

    mController.setCenter(gpStation);
    mController.setZoom(15);

    // adding me= MyLocation(GPS) and also a compass ...

    myLocationOverlay = new FixedMyLocationOverlay(this, mMap);
    myLocationOverlay.enableMyLocation();
    myLocationOverlay.enableCompass();
    mMap.getOverlays().add(myLocationOverlay);

    stationDetailDialog(name, 0);
  }
Example #23
0
 public final void a(boolean flag, float f1, float f2) {
   f.a().b();
   if (g()) {
     n = true;
     f();
     a(k, flag, f1, f2);
     f.b().d.h();
     f.b().d.a = true;
     e.onAnimationStart(null);
     super.e();
     n = false;
   } else {
     a(f.c().a(), flag, f1, f2);
     f.b().d.h();
     f.b().d.a = true;
     e.onAnimationStart(null);
     super.e();
   }
 }
Example #24
0
 private void startEditTrack(Track track) {
   setFollowing(false);
   application.editingTrack = track;
   application.editingTrack.editing = true;
   int n = application.editingTrack.getAllPoints().size() - 1;
   int p = application.editingTrack.editingPos >= 0 ? application.editingTrack.editingPos : n;
   application.editingTrack.editingPos = p;
   trackBar.setMax(n);
   trackBar.setProgress(0);
   trackBar.setProgress(p);
   trackBar.setKeyProgressIncrement(1);
   onProgressChanged(trackBar, p, false);
   //		findViewById(R.id.edittrack).setVisibility(View.VISIBLE);
   //		findViewById(R.id.trackdetails).setVisibility(View.VISIBLE);
   // updateGPSStatus();
   if (showDistance > 0) application.overlayManager.distanceOverlay.setEnabled(false);
   map.setFocusable(false);
   map.setFocusableInTouchMode(false);
   trackBar.requestFocus();
   // updateMapViewArea();
 }
Example #25
0
 public final void onClick(View paramView) {
   if ((MapView.a(this.qO) == null) || (MapView.b(this.qO) == null)) return;
   MapView.a(this.qO).removeMessages(1);
   MapView.a(this.qO, System.currentTimeMillis());
   MapView.a(this.qO).sendEmptyMessageDelayed(1, 3000L);
   MapView.b(this.qO).zoomOut();
 }
Example #26
0
  public void requestView(MapView view, BackgroundExecutor executor, RegionManager regionManager) {
    // round to nearest multiple of 512

    int zoomLevel = view.getRegionZoomLevel();
    int size = Region.SIZE << zoomLevel;
    int minX = ((int) view.getMinX()) & (-size);
    int minZ = ((int) view.getMinZ()) & (-size);
    int maxX = ((int) view.getMaxX()) & (-size);
    int maxZ = ((int) view.getMaxZ()) & (-size);
    int dimension = view.getDimension();
    if ((this.viewUpdateCount <= 0)
        || (minX != this.requestedMinX)
        || (minZ != this.requestedMinZ)
        || (maxX != this.requestedMaxX)
        || (maxZ != this.requestedMaxZ)
        || (zoomLevel != this.requestedZoomLevel)
        || (dimension != this.requestedDimension)) {
      this.requestedMinX = minX;
      this.requestedMinZ = minZ;
      this.requestedMaxX = maxX;
      this.requestedMaxZ = maxZ;
      this.requestedZoomLevel = zoomLevel;
      this.requestedDimension = dimension;
      this.viewUpdateCount++;
      executor.addTask(new MapUpdateViewTask(this, regionManager));
    }
  }
  private void initBaiduMap() {
    mapView = (MapView) findViewById(R.id.bmapView);
    baiduMap = mapView.getMap();
    baiduMap.setMaxAndMinZoomLevel(18, 13);
    IntentFilter iFilter = new IntentFilter();
    iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR);
    iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR);
    receiver = new BaiduReceiver();
    registerReceiver(receiver, iFilter);

    geoCoder = GeoCoder.newInstance();
    geoCoder.setOnGetGeoCodeResultListener(this);

    Intent intent = getIntent();
    intentType = intent.getStringExtra(TYPE);
    initActionBar(R.string.chat_position);
    if (intentType.equals(TYPE_SELECT)) {
      // 选择发送位置
      // 开启定位图层
      baiduMap.setMyLocationEnabled(true);
      baiduMap.setMyLocationConfigeration(
          new MyLocationConfigeration(MyLocationConfigeration.LocationMode.NORMAL, true, null));
      // 定位初始化
      locClient = new LocationClient(this);
      locClient.registerLocationListener(myListener);
      LocationClientOption option = new LocationClientOption();
      option.setProdName("avosim");
      option.setOpenGps(true);
      option.setCoorType("bd09ll");
      option.setScanSpan(1000);
      option.setOpenGps(true);
      option.setIsNeedAddress(true);
      option.setIgnoreKillProcess(true);
      locClient.setLocOption(option);
      locClient.start();
      if (locClient != null && locClient.isStarted()) {
        locClient.requestLocation();
      }
      if (lastLocation != null) {
        // 显示在地图上
        LatLng ll = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
        baiduMap.animateMapStatus(u);
      }
    } else {
      Bundle b = intent.getExtras();
      LatLng latlng = new LatLng(b.getDouble(LATITUDE), b.getDouble(LONGITUDE)); // 维度在前,经度在后
      baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(latlng));
      OverlayOptions ooA = new MarkerOptions().position(latlng).icon(descriptor).zIndex(9);
      baiduMap.addOverlay(ooA);
    }
  }
Example #28
0
 public void setFollowing(boolean follow) {
   if (application.editingRoute == null && application.editingTrack == null) {
     if (showDistance > 0 && application.overlayManager.distanceOverlay != null) {
       if (showDistance == 2 && !follow) {
         application.overlayManager.distanceOverlay.setAncor(application.getLocation());
         application.overlayManager.distanceOverlay.setEnabled(true);
       } else {
         application.overlayManager.distanceOverlay.setEnabled(false);
       }
     }
     map.setFollowing(follow);
   }
 }
 public void draw(Canvas canvas, MapView mapview, boolean flag) {
   Projection projection = mapview.getProjection();
   Paint paint = new Paint();
   Point point = new Point();
   projection.toPixels(gp1, point);
   paint.setColor(color);
   Point point1 = new Point();
   projection.toPixels(gp2, point1);
   paint.setStrokeWidth(5F);
   paint.setAlpha(120);
   canvas.drawLine(point.x, point.y, point1.x, point1.y, paint);
   super.draw(canvas, mapview, flag);
 }
Example #30
0
  /**
   * Construct a MapController using a custom scene file
   *
   * @param mainApp Activity in which the map will function; the asset bundle for this activity must
   *     contain all the local files that the map will need
   * @param view MapView where the map will be displayed; input events from this view will be
   *     handled by the resulting MapController
   * @param sceneFilePath Location of the YAML scene file within the assets directory
   */
  public MapController(Activity mainApp, MapView view, String sceneFilePath) {

    scenePath = sceneFilePath;

    // Get configuration info from application
    mainApp.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    assetManager = mainApp.getAssets();

    // Set up gesture recognizers
    gestureDetector = new GestureDetector(mainApp, this);
    scaleGestureDetector = new ScaleGestureDetector(mainApp, this);
    rotateGestureDetector = new RotateGestureDetector(mainApp, this);
    shoveGestureDetector = new ShoveGestureDetector(mainApp, this);
    gestureDetector.setOnDoubleTapListener(this);

    // Set up MapView
    mapView = view;
    view.setOnTouchListener(this);
    view.setRenderer(this);
    view.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    init(this, assetManager, scenePath);
  }