int x = (int) (tilePosition.point.x + (tile.tileSize - this.paintBack.getTextWidth(text)) / 2); int y = (int) (tilePosition.point.y + (tile.tileSize + this.paintBack.getTextHeight(text)) / 2); canvas.drawText(text, x, y, this.paintBack); canvas.drawText(text, x, y, this.paintFront); } else { int x = (int) (tilePosition.point.x + 8 * displayModel.getScaleFactor()); stringBuilder.append(tile.tileX); String text = stringBuilder.toString(); canvas.drawText(text, x, y, this.paintBack); canvas.drawText(text, x, y, this.paintFront); stringBuilder.append(tile.tileY); text = stringBuilder.toString(); canvas.drawText(text, x, (int) (y + 24 * displayModel.getScaleFactor()), this.paintBack); canvas.drawText(text, x, (int) (y + 24 * displayModel.getScaleFactor()), this.paintFront); stringBuilder.append(tile.zoomLevel); text = stringBuilder.toString(); canvas.drawText(text, x, (int) (y + 48 * displayModel.getScaleFactor()), this.paintBack); canvas.drawText(text, x, (int) (y + 48 * displayModel.getScaleFactor()), this.paintFront);
case BOTTOM_CENTER: if (scaleText2.length() == 0) { canvas.drawText(scaleText1, Math.round((canvas.getWidth() - this.paintScaleTextStroke.getTextWidth(scaleText1)) * 0.5f), Math.round(canvas.getHeight() - SCALE_BAR_MARGIN * scale - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); } else { canvas.drawText(scaleText1, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() * 0.5f - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); canvas.drawText(scaleText2, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() * 0.5f + STROKE_EXTERNAL * scale * 0.5f + TEXT_MARGIN * scale + this.paintScaleTextStroke.getTextHeight(scaleText2)), paint); case BOTTOM_LEFT: if (scaleText2.length() == 0) { canvas.drawText(scaleText1, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() - SCALE_BAR_MARGIN * scale - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); } else { canvas.drawText(scaleText1, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() * 0.5f - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); canvas.drawText(scaleText2, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() * 0.5f + STROKE_EXTERNAL * scale * 0.5f + TEXT_MARGIN * scale + this.paintScaleTextStroke.getTextHeight(scaleText2)), paint); case BOTTOM_RIGHT: if (scaleText2.length() == 0) { canvas.drawText(scaleText1, Math.round(canvas.getWidth() - STROKE_EXTERNAL * scale - TEXT_MARGIN * scale - this.paintScaleTextStroke.getTextWidth(scaleText1)), Math.round(canvas.getHeight() - SCALE_BAR_MARGIN * scale - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); } else { canvas.drawText(scaleText1, Math.round(canvas.getWidth() - STROKE_EXTERNAL * scale - TEXT_MARGIN * scale - this.paintScaleTextStroke.getTextWidth(scaleText1)), Math.round(canvas.getHeight() * 0.5f - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); canvas.drawText(scaleText2, Math.round(canvas.getWidth() - STROKE_EXTERNAL * scale - TEXT_MARGIN * scale - this.paintScaleTextStroke.getTextWidth(scaleText2)), Math.round(canvas.getHeight() * 0.5f + STROKE_EXTERNAL * scale * 0.5f + TEXT_MARGIN * scale + this.paintScaleTextStroke.getTextHeight(scaleText2)), paint);
int pixelX = (canvas.getWidth() - this.textFront.getTextWidth(text)) / 2; int pixelY = (int) (MercatorProjection.latitudeToPixelY(latitude, mapSize) - topLeftPoint.y) + this.textFront.getTextHeight(text) / 2; canvas.drawText(text, pixelX, pixelY, this.textBack); canvas.drawText(text, pixelX, pixelY, this.textFront); int pixelX = (int) (MercatorProjection.longitudeToPixelX(longitude, mapSize) - topLeftPoint.x) - this.textFront.getTextWidth(text) / 2; int pixelY = (canvas.getHeight() + this.textFront.getTextHeight(text)) / 2; canvas.drawText(text, pixelX, pixelY, this.textBack); canvas.drawText(text, pixelX, pixelY, this.textFront);
int x = (int) (tilePosition.point.x + (tile.tileSize - this.paintBack.getTextWidth(text)) / 2); int y = (int) (tilePosition.point.y + (tile.tileSize + this.paintBack.getTextHeight(text)) / 2); canvas.drawText(text, x, y, this.paintBack); canvas.drawText(text, x, y, this.paintFront); } else { int x = (int) (tilePosition.point.x + 8 * displayModel.getScaleFactor()); stringBuilder.append(tile.tileX); String text = stringBuilder.toString(); canvas.drawText(text, x, y, this.paintBack); canvas.drawText(text, x, y, this.paintFront); stringBuilder.append(tile.tileY); text = stringBuilder.toString(); canvas.drawText(text, x, (int) (y + 24 * displayModel.getScaleFactor()), this.paintBack); canvas.drawText(text, x, (int) (y + 24 * displayModel.getScaleFactor()), this.paintFront); stringBuilder.append(tile.zoomLevel); text = stringBuilder.toString(); canvas.drawText(text, x, (int) (y + 48 * displayModel.getScaleFactor()), this.paintBack); canvas.drawText(text, x, (int) (y + 48 * displayModel.getScaleFactor()), this.paintFront);
this.paintBack.setColor(GraphicUtils.filterColor(color, filter)); canvas.drawText(this.text, (int) (pointAdjusted.x + boundary.left), (int) (pointAdjusted.y + boundary.top + this.textHeight), this.paintBack); if (filter != Filter.NONE) { this.paintBack.setColor(color); this.paintFront.setColor(GraphicUtils.filterColor(color, filter)); canvas.drawText(this.text, (int) (pointAdjusted.x + boundary.left), (int) (pointAdjusted.y + boundary.top + this.textHeight), this.paintFront); if (filter != Filter.NONE) { this.paintFront.setColor(color);
case BOTTOM_CENTER: if (scaleText2.length() == 0) { canvas.drawText(scaleText1, Math.round((canvas.getWidth() - this.paintScaleTextStroke.getTextWidth(scaleText1)) * 0.5f), Math.round(canvas.getHeight() - SCALE_BAR_MARGIN * scale - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); } else { canvas.drawText(scaleText1, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() * 0.5f - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); canvas.drawText(scaleText2, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() * 0.5f + STROKE_EXTERNAL * scale * 0.5f + TEXT_MARGIN * scale + this.paintScaleTextStroke.getTextHeight(scaleText2)), paint); case BOTTOM_LEFT: if (scaleText2.length() == 0) { canvas.drawText(scaleText1, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() - SCALE_BAR_MARGIN * scale - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); } else { canvas.drawText(scaleText1, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() * 0.5f - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); canvas.drawText(scaleText2, Math.round(STROKE_EXTERNAL * scale + TEXT_MARGIN * scale), Math.round(canvas.getHeight() * 0.5f + STROKE_EXTERNAL * scale * 0.5f + TEXT_MARGIN * scale + this.paintScaleTextStroke.getTextHeight(scaleText2)), paint); case BOTTOM_RIGHT: if (scaleText2.length() == 0) { canvas.drawText(scaleText1, Math.round(canvas.getWidth() - STROKE_EXTERNAL * scale - TEXT_MARGIN * scale - this.paintScaleTextStroke.getTextWidth(scaleText1)), Math.round(canvas.getHeight() - SCALE_BAR_MARGIN * scale - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); } else { canvas.drawText(scaleText1, Math.round(canvas.getWidth() - STROKE_EXTERNAL * scale - TEXT_MARGIN * scale - this.paintScaleTextStroke.getTextWidth(scaleText1)), Math.round(canvas.getHeight() * 0.5f - STROKE_EXTERNAL * scale * 0.5f - TEXT_MARGIN * scale), paint); canvas.drawText(scaleText2, Math.round(canvas.getWidth() - STROKE_EXTERNAL * scale - TEXT_MARGIN * scale - this.paintScaleTextStroke.getTextWidth(scaleText2)), Math.round(canvas.getHeight() * 0.5f + STROKE_EXTERNAL * scale * 0.5f + TEXT_MARGIN * scale + this.paintScaleTextStroke.getTextHeight(scaleText2)), paint);
@Override public void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { super.draw(boundingBox, zoomLevel, canvas, topLeftPoint); long mapSize = MercatorProjection.getMapSize(zoomLevel, this.displayModel.getTileSize()); int pixelX = (int) (MercatorProjection.longitudeToPixelX(position.longitude, mapSize) - topLeftPoint.x); int pixelY = (int) (MercatorProjection.latitudeToPixelY(position.latitude, mapSize) - topLeftPoint.y); String text = Integer.toString(count); canvas.drawText(text, pixelX - BLACK.getTextWidth(text) / 2, pixelY + BLACK.getTextHeight(text) / 2, BLACK); }
int pixelX = (canvas.getWidth() - this.textFront.getTextWidth(text)) / 2; int pixelY = (int) (MercatorProjection.latitudeToPixelY(latitude, mapSize) - topLeftPoint.y) + this.textFront.getTextHeight(text) / 2; canvas.drawText(text, pixelX, pixelY, this.textBack); canvas.drawText(text, pixelX, pixelY, this.textFront); int pixelX = (int) (MercatorProjection.longitudeToPixelX(longitude, mapSize) - topLeftPoint.x) - this.textFront.getTextWidth(text) / 2; int pixelY = (canvas.getHeight() + this.textFront.getTextHeight(text)) / 2; canvas.drawText(text, pixelX, pixelY, this.textBack); canvas.drawText(text, pixelX, pixelY, this.textFront);
+ cluster.getClusterManager().markerIconBmps .get(markerType).getPaint().getTextHeight(cluster.getTitle()) / 2); canvas.drawText(cluster.getTitle(), x, y, cluster.getClusterManager().markerIconBmps .get(markerType).getPaint());
@Override public void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.getLatLong() == null || this.getBitmap() == null || this.getBitmap().isDestroyed()) { return; } long mapSize = MercatorProjection.getMapSize(zoomLevel, this.displayModel.getTileSize()); double pixelX = MercatorProjection.longitudeToPixelX(this.getLatLong().longitude, mapSize); double pixelY = MercatorProjection.latitudeToPixelY(this.getLatLong().latitude, mapSize); int halfBitmapWidth = this.getBitmap().getWidth() / 2; int halfBitmapHeight = this.getBitmap().getHeight() / 2; int left = (int) (pixelX - topLeftPoint.x - halfBitmapWidth + this.getHorizontalOffset()); int top = (int) (pixelY - topLeftPoint.y - halfBitmapHeight + this.getVerticalOffset()); int right = left + this.getBitmap().getWidth(); int bottom = top + this.getBitmap().getHeight(); Rectangle bitmapRectangle = new Rectangle(left, top, right, bottom); Rectangle canvasRectangle = new Rectangle(0, 0, canvas.getWidth(), canvas.getHeight()); if (!canvasRectangle.intersects(bitmapRectangle)) { return; } canvas.drawBitmap(this.getBitmap(), left, top); if (this.paintText != null) { String text = String.valueOf(this.children.size()); canvas.drawText(text, left + halfBitmapWidth - 5, top + halfBitmapHeight + 5, this.paintText); } }
this.paintBack.setColor(GraphicUtils.filterColor(color, filter)); canvas.drawText(this.text, (int) (pointAdjusted.x + boundary.left), (int) (pointAdjusted.y + boundary.top + this.textHeight), this.paintBack); if (filter != Filter.NONE) { this.paintBack.setColor(color); this.paintFront.setColor(GraphicUtils.filterColor(color, filter)); canvas.drawText(this.text, (int) (pointAdjusted.x + boundary.left), (int) (pointAdjusted.y + boundary.top + this.textHeight), this.paintFront); if (filter != Filter.NONE) { this.paintFront.setColor(color);