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); } }