Esempio n. 1
0
  /** Initiation of the GUI. */
  public void initGui() {
    int margin = 5;
    int yMargin = 0;
    int yCorrection = 0;

    gpsIcon = new GpsIndicator(ctx);
    gpsIcon.setX(screenWidth - (gpsIcon.getImage().getWidth() + margin));
    gpsIcon.setY(margin);
    gpsIcon.updateLayout();
    yMargin = gpsIcon.getImage().getHeight() + margin;

    radar = new Radar(ctx, this);
    radar.setX(getScreenWidth() - (radar.getImage().getWidth() + margin));
    radar.setY(getScreenHeight() - (radar.getImage().getHeight() + margin));
    radar.updateLayout();
    yCorrection = radar.getImage().getHeight() + 2 * margin + yMargin;

    rightSlide = new SlideBar(ctx, this);
    rightSlide.setX(getScreenWidth() - (rightSlide.getImage().getWidth()));
    rightSlide.setY(
        ((getScreenHeight() - yCorrection) / 2)
            - (rightSlide.getImage().getHeight() / 2)
            + yMargin);
    rightSlide.updateLayout();

    titleBar = new TitleBar(ctx, this);
    titleBar.setX(getLeft());
    titleBar.setY(getTop());
    titleBar.updateLayout();

    poiReinit = new ReplacePoi(ctx, this);
    poiReinit.setX(margin);
    poiReinit.setY(getScreenHeight() - (poiReinit.getImage().getHeight() + margin));
    poiReinit.updateLayout();
    yCorrection = poiReinit.getImage().getHeight() + 2 * margin + yMargin;

    splash = new SplashScreen(ctx, getScreenWidth(), getScreenHeight());
    splash.setX(0);
    splash.setY(0);
    splash.updateLayout();
  }
Esempio n. 2
0
  public boolean evaluateTouch(MotionEvent event) {
    if (SPLASH
        && gpsIcon.getGpsStatus() == GpsIndicator.GPS_STATUS_DISCONNECTED
        && splash.dispatchTouchEvent(event)) return true;
    else if (gpsIcon.dispatchTouchEvent(event)) return true;
    else if (radar.dispatchTouchEvent(event)) return true;
    else if (rightSlide.dispatchTouchEvent(event)) return true;
    else if (titleBar.dispatchTouchEvent(event)) return true;
    else if (poiReinit.dispatchTouchEvent(event)) return true;

    return false;
  }
Esempio n. 3
0
  @Override
  public void onDraw(Canvas c) {
    // Log.e("Spec","Updating "+arViews.size()+" views");
    // long time = System.currentTimeMillis();
    Enumeration<ARSphericalView> e = getArViews().elements();
    Enumeration<ARSphericalView> e2 = getArViews().elements();
    Paint p = new Paint();
    float precision = 10000;

    if (DEBUG) {
      p.setColor(Color.WHITE);

      c.drawText(
          "Compass:"******"Inclination" + String.valueOf(Math.round(getInclination() * precision) / precision),
          150,
          20,
          p);
      // ---------------------------------
      ARSphericalView view;
      if (e2.hasMoreElements()) {
        view = e2.nextElement();
        c.drawText("POI1: " + view.isVisible(), 20, 80, p);
      }
      if (e2.hasMoreElements()) {
        view = e2.nextElement();
        c.drawText("POI2: " + view.isVisible(), 20, 100, p);
      }
      if (e2.hasMoreElements()) {
        view = e2.nextElement();
        c.drawText("POI3: " + view.isVisible(), 20, 120, p);
      }
      // ------------------
      if (getCurLocation() != null) {
        c.drawText("Lat : " + String.valueOf(getCurLocation().getLatitude()), 20, 60, p);
        c.drawText("Long : " + String.valueOf(getCurLocation().getLongitude()), 250, 60, p);
      }
    }
    while (e.hasMoreElements()) {
      MagnitudePOI view = (MagnitudePOI) e.nextElement();

      if (view.getAzimuth() < 330 && view.getAzimuth() > 30) {
        if (Math.abs(view.getAzimuth() - direction) < 30) {
          view.drawLine(c);
        }
      } else {
        view.drawLine(c);
      }
    }
    e = getArViews().elements();
    while (e.hasMoreElements()) {
      MagnitudePOI view = (MagnitudePOI) e.nextElement();

      if (view.getAzimuth() < 330 && view.getAzimuth() > 30) {
        if (Math.abs(view.getAzimuth() - direction) < 30) {
          view.setVisible(true);
          view.draw(c);
        } else {
          view.setVisible(false);
        }
      } else {
        view.setVisible(true);
        view.draw(c);
      }
    }

    if (TITLEBAR) titleBar.draw(c);
    if (RADAR) radar.draw(c);
    if (SCROLL) rightSlide.draw(c);
    if (GPS) gpsIcon.draw(c);
    if (poiMove) poiReinit.draw(c);
    if (SPLASH && gpsIcon.getGpsStatus() == GpsIndicator.GPS_STATUS_DISCONNECTED) splash.draw(c);
  }