public synchronized boolean contains(Point center, Point point, double latitude, byte zoomLevel) { // Touch min 20x20 px at baseline mdpi (160dpi) double distance = Math.max(20 / 2 * this.displayModel.getScaleFactor(), getRadiusInPixels(latitude, zoomLevel)); return center.distance(point) < distance; }
@Override public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.latLong == null || (this.paintStroke == null && this.paintFill == null)) { return; } double latitude = this.latLong.latitude; double longitude = this.latLong.longitude; long mapSize = MercatorProjection.getMapSize(zoomLevel, displayModel.getTileSize()); int pixelX = (int) (MercatorProjection.longitudeToPixelX(longitude, mapSize) - topLeftPoint.x); int pixelY = (int) (MercatorProjection.latitudeToPixelY(latitude, mapSize) - topLeftPoint.y); int radiusInPixel = getRadiusInPixels(latitude, zoomLevel); Rectangle canvasRectangle = new Rectangle(0, 0, canvas.getWidth(), canvas.getHeight()); if (!canvasRectangle.intersectsCircle(pixelX, pixelY, radiusInPixel)) { return; } if (this.paintStroke != null) { if (this.keepAligned) { this.paintStroke.setBitmapShaderShift(topLeftPoint); } canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintStroke); } if (this.paintFill != null) { if (this.keepAligned) { this.paintFill.setBitmapShaderShift(topLeftPoint); } canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintFill); } }
public synchronized boolean contains(Point center, Point point, double latitude, byte zoomLevel) { // Touch min 20x20 px at baseline mdpi (160dpi) double distance = Math.max(20 / 2 * this.displayModel.getScaleFactor(), getRadiusInPixels(latitude, zoomLevel)); return center.distance(point) < distance; }
@Override public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.latLong == null || (this.paintStroke == null && this.paintFill == null)) { return; } double latitude = this.latLong.latitude; double longitude = this.latLong.longitude; long mapSize = MercatorProjection.getMapSize(zoomLevel, displayModel.getTileSize()); int pixelX = (int) (MercatorProjection.longitudeToPixelX(longitude, mapSize) - topLeftPoint.x); int pixelY = (int) (MercatorProjection.latitudeToPixelY(latitude, mapSize) - topLeftPoint.y); int radiusInPixel = getRadiusInPixels(latitude, zoomLevel); Rectangle canvasRectangle = new Rectangle(0, 0, canvas.getWidth(), canvas.getHeight()); if (!canvasRectangle.intersectsCircle(pixelX, pixelY, radiusInPixel)) { return; } if (this.paintStroke != null) { if (this.keepAligned) { this.paintStroke.setBitmapShaderShift(topLeftPoint); } canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintStroke); } if (this.paintFill != null) { if (this.keepAligned) { this.paintFill.setBitmapShaderShift(topLeftPoint); } canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintFill); } }