@Override public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.latLong == null || this.bitmap == null || this.bitmap.isDestroyed()) { return; } long mapSize = MercatorProjection.getMapSize(zoomLevel, this.displayModel.getTileSize()); double pixelX = MercatorProjection.longitudeToPixelX(this.latLong.longitude, mapSize); double pixelY = MercatorProjection.latitudeToPixelY(this.latLong.latitude, mapSize); int halfBitmapWidth = this.bitmap.getWidth() / 2; int halfBitmapHeight = this.bitmap.getHeight() / 2; int left = (int) (pixelX - topLeftPoint.x - halfBitmapWidth + this.horizontalOffset); int top = (int) (pixelY - topLeftPoint.y - halfBitmapHeight + this.verticalOffset); int right = left + this.bitmap.getWidth(); int bottom = top + this.bitmap.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.bitmap, left, top); }
@Override public void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.getLatLong() == null || this.getBitmap() == null || this.getBitmap().isDestroyed()) { return;
@Override public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.latLong == null || this.bitmap == null || this.bitmap.isDestroyed()) { return; } long mapSize = MercatorProjection.getMapSize(zoomLevel, this.displayModel.getTileSize()); double pixelX = MercatorProjection.longitudeToPixelX(this.latLong.longitude, mapSize); double pixelY = MercatorProjection.latitudeToPixelY(this.latLong.latitude, mapSize); int halfBitmapWidth = this.bitmap.getWidth() / 2; int halfBitmapHeight = this.bitmap.getHeight() / 2; int left = (int) (pixelX - topLeftPoint.x - halfBitmapWidth + this.horizontalOffset); int top = (int) (pixelY - topLeftPoint.y - halfBitmapHeight + this.verticalOffset); int right = left + this.bitmap.getWidth(); int bottom = top + this.bitmap.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.bitmap, left, top); }
@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); } }