org.mapsforge.core.graphics.Bitmap.isDestroyed()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中org.mapsforge.core.graphics.Bitmap.isDestroyed()方法的一些代码示例,展示了Bitmap.isDestroyed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bitmap.isDestroyed()方法的具体详情如下:
包路径:org.mapsforge.core.graphics.Bitmap
类名称:Bitmap
方法名:isDestroyed

Bitmap.isDestroyed介绍

暂无

代码示例

代码示例来源:origin: mapsforge/mapsforge

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

代码示例来源:origin: mapsforge/mapsforge

@Override
public void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) {
  if (this.getLatLong() == null || this.getBitmap() == null || this.getBitmap().isDestroyed()) {
    return;

代码示例来源:origin: org.mapsforge/mapsforge-map

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

代码示例来源:origin: mapsforge/mapsforge

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

相关文章