コード例 #1
0
ファイル: ARLayout.java プロジェクト: dotfeng/Android
 public void replaceAllPoi() {
   Iterator<ARSphericalView> it = getArViews().iterator();
   View v;
   while (it.hasNext()) {
     v = it.next();
     ((MagnitudePOI) v).setShifted(false);
     ((MagnitudePOI) v).setShiftX(0);
     ((MagnitudePOI) v).setShiftY(0);
   }
   poiMove = false;
 }
コード例 #2
0
ファイル: ARLayout.java プロジェクト: dotfeng/Android
  public void updatePoiDistance() {
    // Mise a jour de la distance avec les POI.
    Enumeration<ARSphericalView> e = getArViews().elements();
    if (getArViews().size() == 0) return;
    while (e.hasMoreElements()) {

      ARSphericalView view = e.nextElement();
      view.setDistance(this.getCurLocation().distanceTo(view.getLocation()));
      if (view.getDistance() > this.maxDistance) ((MagnitudePOI) view).setVisibleDist(false);
      else ((MagnitudePOI) view).setVisibleDist(true);
      // update scale
      updateScalePOIImage();
      if (view.getDistance() > this.maxDistance) ((MagnitudePOI) view).setVisibleDist(false);
      else ((MagnitudePOI) view).setVisibleDist(true);
    }
    Collections.sort(getArViews(), Collections.reverseOrder());
  }
コード例 #3
0
ファイル: ARLayout.java プロジェクト: dotfeng/Android
 public void updateScalePOIImage() {
   float tempScale;
   // Mise a jour de la taille des images des POI.
   // en fonction de la nouvelle distance
   Enumeration<ARSphericalView> e = getArViews().elements();
   if (getArViews().size() == 0) return;
   while (e.hasMoreElements()) {
     try {
       MagnitudePOI view = (MagnitudePOI) e.nextElement();
       float rapportDist = (view.getDistance() / this.getMaxDistance());
       if (rapportDist <= 0.1) {
         view.setScale((float) 1.0);
       } else if (rapportDist > 0.1 && rapportDist <= 0.8) {
         tempScale = (float) ((-5.0 / 7.0) * rapportDist + 15.0 / 14.0);
         view.setScale(tempScale);
       } else {
         view.setScale((float) 0.5);
       }
     } catch (Exception x) {
       Log.e("ArLayout", x.getMessage());
     }
   }
 }
コード例 #4
0
ファイル: ARLayout.java プロジェクト: dotfeng/Android
  @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);
  }