Exemplo n.º 1
0
  public void drawTextBlock2(PaintScreen dw, float x, float y) {

    float maxHeight = Math.round(dw.getWidth() / 10f) + 1;

    // TODO: change textblock only when distance changes
    String textStr = "";

    double d = distance;
    DecimalFormat df = new DecimalFormat("@#");
    if (d < 1000.0) {
      textStr = title + " (" + df.format(d) + "m)";
    } else {
      d = d / 1000.0;
      textStr = title + " (" + df.format(d) + "km)";
    }

    textBlock = new TextObj(textStr, Math.round(maxHeight / 2f) + 1, 250, dw, underline);

    // if (isVisible) {
    if (true) {

      dw.setColor(DataSource.getColor(datasource));

      txtLab.prepare(textBlock);

      dw.setStrokeWidth(1f);
      dw.setFill(true);

      // dw.paintObj2(txtLab, x - txtLab.getWidth()/ 2, y + maxHeight, 0, 1);
      dw.paintObj2(txtLab, x, y, 0, 1);
      // Log.d("TextBlock","textblock x = "+(x - txtLab.getWidth()/ 2)+", y = "+(y + maxHeight));
      // Log.d("TextBlock","x= "+x+", y= "+y);
    }
  }
Exemplo n.º 2
0
  public void drawCircle(PaintScreen dw) {

    if (isVisible) {
      // float maxHeight = Math.round(dw.getHeight() / 10f) + 1;
      float maxHeight = dw.getHeight();
      dw.setStrokeWidth(maxHeight / 100f);
      dw.setFill(false);
      dw.setColor(DataSource.getColor(datasource));

      // draw circle with radius depending on distance
      // 0.44 is approx. vertical fov in radians
      double angle = 2.0 * Math.atan2(10, distance);
      double radius = Math.max(Math.min(angle / 0.44 * maxHeight, maxHeight), maxHeight / 25f);
      // double radius = angle/0.44d * (double)maxHeight;

      dw.paintCircle(cMarker.x, cMarker.y, (float) radius);
    }
  }
Exemplo n.º 3
0
  public void draw(PaintScreen dw) {

    float maxHeight = Math.round(dw.getHeight() / 10f) + 1;
    Bitmap bitmap = DataSource.building;
    if (bitmap != null) {
      //	dw.paintBitmap(bitmap, cMarker.x - maxHeight/1.5f, cMarker.y - maxHeight/1.5f);
      //	dw.paintBitmap(bitmap, cMarker.x, cMarker.y);
    }
    // bogus
    // drawCircle(dw);
    // drawTextBlock(dw);
    // Log.d("cMarker","cMarker.x = "+cMarker.x+", cMarker.y = "+cMarker.y);
  }
Exemplo n.º 4
0
  public void drawTextBlock(PaintScreen dw) {
    // TODO: grandezza cerchi e trasparenza
    float maxHeight = Math.round(dw.getHeight() / 10f) + 1;

    // TODO: change textblock only when distance changes
    String textStr = "";

    double d = distance;
    DecimalFormat df = new DecimalFormat("@#");
    if (d < 1000.0) {
      textStr = title + " (" + df.format(d) + "m)";
    } else {
      d = d / 1000.0;
      textStr = title + " (" + df.format(d) + "km)";
    }

    textBlock = new TextObj(textStr, Math.round(maxHeight / 2f) + 1, 250, dw, underline);

    if (isVisible) {

      dw.setColor(DataSource.getColor(datasource));

      float currentAngle = MixUtils.getAngle(cMarker.x, cMarker.y, signMarker.x, signMarker.y);

      txtLab.prepare(textBlock);

      dw.setStrokeWidth(1f);
      dw.setFill(true);

      dw.paintObj(
          txtLab,
          signMarker.x - txtLab.getWidth() / 2,
          signMarker.y + maxHeight,
          currentAngle + 90,
          1);
    }
  }
Exemplo n.º 5
0
  public void draw_radar_point(PaintScreen dw, float x, float z, float scale, float radius) {

    Bitmap bitmap = DataSource.building;

    radiusM = radius;
    // Log.d("TextBlock","before : x = "+x+", y = "+z);
    if (bitmap != null) {
      x = x - bitmap.getWidth() / scale;
      z = z - bitmap.getHeight() + 10;

      dw.paintBitmap(bitmap, x, z);
    }
    // Log.d("TextBlock","after : x = "+x+", y = "+z);
    drawTextBlock2(dw, x, z);
    // drawTextBlock(dw);
  }
Exemplo n.º 6
0
 public void paint(PaintScreen dw) {
   dw.paintObj(obj, x, y, 0, 1);
 }