本文整理汇总了Java中org.mapsforge.core.model.BoundingBox类的典型用法代码示例。如果您正苦于以下问题:Java BoundingBox类的具体用法?Java BoundingBox怎么用?Java BoundingBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BoundingBox类属于org.mapsforge.core.model包,在下文中一共展示了BoundingBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
@Override
public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas) {
if (!this.myLocationEnabled) {
return;
}
double canvasPixelLeft = MercatorProjection.longitudeToPixelX(boundingBox.minLongitude, zoomLevel);
double canvasPixelTop = MercatorProjection.latitudeToPixelY(boundingBox.maxLatitude, zoomLevel);
Point canvasPosition = new Point(canvasPixelLeft, canvasPixelTop);
this.circle.draw(boundingBox, zoomLevel, canvas, canvasPosition);
this.marker.draw(boundingBox, zoomLevel, canvas, canvasPosition);
}
示例2: HeatmapBuilder
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
public HeatmapBuilder(final HeatmapBuilderListener listener, final int width, final int height,
final BoundingBox bbox, final byte zoom, final float scaleFactor,
final int tilesize, final float radius) {
this.mListener = listener;
this.mBbox = bbox;
this.mBackbuffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
this.mZoom = zoom;
this.mCanvas = new Canvas(mBackbuffer);
this.mScaleFactor = scaleFactor;
this.mTileSize = tilesize;
final Paint p = new Paint();
p.setStyle(Paint.Style.FILL);
p.setColor(Color.TRANSPARENT);
this.mWidth = width;
this.mHeight = height;
this.mCanvas.drawRect(0, 0, width, height, p);
this.mRadius = radius;
}
示例3: proceedAfterHeatmapCompleted
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
/**
*
*/
private void proceedAfterHeatmapCompleted() {
if (pointsLoaded && layoutInflated && !updatePending) {
updatePending = true;
clearLayer();
final BoundingBox bbox = MapPositionUtil.getBoundingBox(
mMapView.getModel().mapViewPosition.getMapPosition(),
mMapView.getDimension(), mMapView.getModel().displayModel.getTileSize());
target = mMapView.getModel().mapViewPosition.getCenter();
zoomAtTrigger = mMapView.getModel().mapViewPosition.getZoomLevel();
heatmapLayer = new Marker(target, null, 0, 0);
mMapView.getLayerManager().getLayers().add(heatmapLayer);
builder = new HeatmapBuilder(
WifiDetailsMap.this, mMapView.getWidth(), mMapView.getHeight(), bbox,
mMapView.getModel().mapViewPosition.getZoomLevel(), mMapView.getModel().displayModel.getScaleFactor(), mMapView.getModel().displayModel.getTileSize(), RADIUS).execute(points);
} else {
Log.i(TAG, "Another heat-map is currently generated. Skipped");
}
}
示例4: proceedAfterCatalogLoaded
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
/**
* Loads reference wifis around location from openbmap wifi catalog.
* Callback function, upon completion onCatalogLoaded is called for drawing
*/
private void proceedAfterCatalogLoaded() {
final BoundingBox bbox = MapPositionUtil.getBoundingBox(
mMapView.getModel().mapViewPosition.getMapPosition(),
mMapView.getDimension(), mMapView.getModel().displayModel.getTileSize());
double minLatitude = bbox.minLatitude;
double maxLatitude = bbox.maxLatitude;
double minLongitude = bbox.minLongitude;
double maxLongitude = bbox.maxLongitude;
// query more than visible objects for smoother data scrolling / less database queries?
if (PREFETCH_MAP_OBJECTS) {
final double latSpan = maxLatitude - minLatitude;
final double lonSpan = maxLongitude - minLongitude;
minLatitude -= latSpan * 0.5;
maxLatitude += latSpan * 0.5;
minLongitude -= lonSpan * 0.5;
maxLongitude += lonSpan * 0.5;
}
final WifiCatalogMapObjectsLoader task = new WifiCatalogMapObjectsLoader(getActivity(), this);
task.execute(minLatitude, maxLatitude, minLongitude, maxLongitude);
}
示例5: proceedAfterHeatmapCompleted
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
/**
*
*/
private void proceedAfterHeatmapCompleted() {
if (mPointsLoaded && mLayoutInflated && !mUpdatePending) {
mUpdatePending = true;
clearLayer();
final BoundingBox bbox = MapPositionUtil.getBoundingBox(
mMapView.getModel().mapViewPosition.getMapPosition(),
mMapView.getDimension(), mMapView.getModel().displayModel.getTileSize());
mTarget = mMapView.getModel().mapViewPosition.getCenter();
mZoomAtTrigger = mMapView.getModel().mapViewPosition.getZoomLevel();
mHeatmapLayer = new Marker(mTarget, null, 0, 0);
mMapView.getLayerManager().getLayers().add(mHeatmapLayer);
new HeatmapBuilder(
CellDetailsMap.this, mMapView.getWidth(), mMapView.getHeight(), bbox,
mMapView.getModel().mapViewPosition.getZoomLevel(), mMapView.getModel().displayModel.getScaleFactor(),
mMapView.getModel().displayModel.getTileSize(), RADIUS).execute(points);
} else {
Log.i(TAG, "Another heat-map is currently generated. Skipped");
}
}
示例6: addLayers
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
private BoundingBox addLayers(MapView mapView, List<File> mapFiles) {
Layers layers = mapView.getLayerManager().getLayers();
// layers.add(createTileDownloadLayer(tileCache,
// mapView.getModel().mapViewPosition));
BoundingBox result = null;
for (int i = 0; i < mapFiles.size(); i++) {
File mapFile = mapFiles.get(i);
TileRendererLayer tileRendererLayer = createTileRendererLayer(
createTileCache(i), mapView.getModel().mapViewPosition,
true, true, mapFile);
BoundingBox boundingBox = tileRendererLayer.getMapDataStore()
.boundingBox();
result = result == null ? boundingBox : result.extend(boundingBox);
layers.add(tileRendererLayer);
}
if (SHOW_DEBUG_LAYERS) {
layers.add(new TileGridLayer(GRAPHIC_FACTORY,
mapView.getModel().displayModel));
layers.add(new TileCoordinatesLayer(GRAPHIC_FACTORY, mapView
.getModel().displayModel));
}
return result;
}
示例7: getBoundingBox
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
static BoundingBox getBoundingBox(Polyline pl) {
List<LatLong> latlongs = pl.getLatLongs();
double minLat = latlongs.get(0).latitude;
double minLon = latlongs.get(0).longitude;
double maxLat = latlongs.get(0).latitude;
double maxLon = latlongs.get(0).longitude;
for (int i = 0; i < latlongs.size(); i++) {
minLat = Math.min(minLat, latlongs.get(i).latitude);
minLon = Math.min(minLon, latlongs.get(i).longitude);
maxLat = Math.max(maxLat, latlongs.get(i).latitude);
maxLon = Math.max(maxLon, latlongs.get(i).longitude);
}
BoundingBox bbox = new BoundingBox(minLat, minLon, maxLat, minLon);
return bbox;
}
示例8: draw
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
@Override
public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) {
if (getLatLong() == null || getBitmap() == null) {
return;
}
long mapSize = MercatorProjection.getMapSize(zoomLevel, displayModel.getTileSize());
double pixelX = MercatorProjection.longitudeToPixelX(getLatLong().longitude, mapSize);
double pixelY = MercatorProjection.latitudeToPixelY(getLatLong().latitude, mapSize);
int halfBitmapWidth = getBitmap().getWidth() / 2;
int halfBitmapHeight = getBitmap().getHeight() / 2;
int left = (int) (pixelX - topLeftPoint.x - halfBitmapWidth + getHorizontalOffset());
int top = (int) (pixelY - topLeftPoint.y - halfBitmapHeight + getVerticalOffset());
int right = left + getBitmap().getWidth();
int bottom = top + 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;
}
android.graphics.Canvas androidCanvas = AndroidGraphicFactory.getCanvas(canvas);
androidCanvas.save();
androidCanvas.rotate(degree, (float) (pixelX - topLeftPoint.x), (float) (pixelY - topLeftPoint.y));
canvas.drawBitmap(getBitmap(), left, top);
androidCanvas.restore();
}
示例9: draw
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
@Override
public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) {
if (!getLatLongs().isEmpty()) {
int bl = getLatLongs().size() / 3 * 2;
int index = 0;
Iterator<LatLong> iterator = getLatLongs().iterator();
if (iterator.hasNext()) {
long mapSize = MercatorProjection.getMapSize(zoomLevel, displayModel.getTileSize());
LatLong from = iterator.next();
while (iterator.hasNext()) {
LatLong to = iterator.next();
if (boundingBox.contains(to) || boundingBox.contains(from)) {
Paint paint = getPaintStroke(from, to, index<bl?2:1);
int x1 = (int) (MercatorProjection.longitudeToPixelX(from.longitude, mapSize) - topLeftPoint.x);
int y1 = (int) (MercatorProjection.latitudeToPixelY(from.latitude, mapSize) - topLeftPoint.y);
int x2 = (int) (MercatorProjection.longitudeToPixelX(to.longitude, mapSize) - topLeftPoint.x);
int y2 = (int) (MercatorProjection.latitudeToPixelY(to.latitude, mapSize) - topLeftPoint.y);
canvas.drawLine(x1, y1, x2, y2, paint);
index++;
}
from = to;
}
}
}
//if (DEBUG) Log.d(TAG, "AlternatingLine.draw count=" + count);
}
示例10: proceedAfterHeatmapCompleted
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
/**
*
*/
private void proceedAfterHeatmapCompleted() {
if (pointsLoaded && layoutInflated && !updatePending) {
updatePending = true;
clearLayer();
final BoundingBox bbox = MapPositionUtil.getBoundingBox(
mMapView.getModel().mapViewPosition.getMapPosition(),
mMapView.getDimension(), mMapView.getModel().displayModel.getTileSize());
target = mMapView.getModel().mapViewPosition.getCenter();
zoomAtTrigger = mMapView.getModel().mapViewPosition.getZoomLevel();
heatmapLayer = new Marker(target, null, 0, 0);
mMapView.getLayerManager().getLayers().add(heatmapLayer);
builder = new HeatmapBuilder(
WifiDetailsMap.this, mMapView.getWidth(), mMapView.getHeight(), bbox,
mMapView.getModel().mapViewPosition.getZoomLevel(), mMapView.getModel().displayModel.getScaleFactor(), mMapView.getModel().displayModel.getTileSize(), RADIUS).execute(points);
} else {
Log.i(TAG, "Another heat-map is currently generated. Skipped");
}
}
示例11: getBoundingBox
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
/**
* @return the currently visible boundaries of the map.
*/
public synchronized BoundingBox getBoundingBox() {
double pixelX = MercatorProjection.longitudeToPixelX(this.longitude, this.zoomLevel);
double pixelY = MercatorProjection.latitudeToPixelY(this.latitude, this.zoomLevel);
int halfCanvasWidth = this.mapView.getWidth() / 2;
int halfCanvasHeight = this.mapView.getHeight() / 2;
long mapSize = MercatorProjection.getMapSize(this.zoomLevel);
double pixelXMin = Math.max(0, pixelX - halfCanvasWidth);
double pixelYMin = Math.max(0, pixelY - halfCanvasHeight);
double pixelXMax = Math.min(mapSize, pixelX + halfCanvasWidth);
double pixelYMax = Math.min(mapSize, pixelY + halfCanvasHeight);
double minLatitude = MercatorProjection.pixelYToLatitude(pixelYMax, this.zoomLevel);
double minLongitude = MercatorProjection.pixelXToLongitude(pixelXMin, this.zoomLevel);
double maxLatitude = MercatorProjection.pixelYToLatitude(pixelYMin, this.zoomLevel);
double maxLongitude = MercatorProjection.pixelXToLongitude(pixelXMax, this.zoomLevel);
return new BoundingBox(minLatitude, minLongitude, maxLatitude, maxLongitude);
}
示例12: draw
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
@Override
public synchronized boolean draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point canvasPosition) {
if (this.geoPoint == null || this.drawable == null) {
return false;
}
double latitude = this.geoPoint.latitude;
double longitude = this.geoPoint.longitude;
int pixelX = (int) (MercatorProjection.longitudeToPixelX(longitude, zoomLevel) - canvasPosition.x);
int pixelY = (int) (MercatorProjection.latitudeToPixelY(latitude, zoomLevel) - canvasPosition.y);
Rect drawableBounds = this.drawable.copyBounds();
int left = pixelX + drawableBounds.left;
int top = pixelY + drawableBounds.top;
int right = pixelX + drawableBounds.right;
int bottom = pixelY + drawableBounds.bottom;
if (!intersect(canvas, left, top, right, bottom)) {
return false;
}
this.drawable.setBounds(left, top, right, bottom);
this.drawable.draw(canvas);
this.drawable.setBounds(drawableBounds);
return true;
}
示例13: draw
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
@Override
public synchronized boolean draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point canvasPosition) {
synchronized (this.polygonalChains) {
if (this.polygonalChains.isEmpty() || (this.paintStroke == null && this.paintFill == null)) {
return false;
}
Path path = new Path();
path.setFillType(FillType.EVEN_ODD);
for (int i = 0; i < this.polygonalChains.size(); ++i) {
PolygonalChain polygonalChain = this.polygonalChains.get(i);
Path closedPath = polygonalChain.draw(zoomLevel, canvasPosition, true);
if (closedPath != null) {
path.addPath(closedPath);
}
}
if (this.paintStroke != null) {
canvas.drawPath(path, this.paintStroke);
}
if (this.paintFill != null) {
canvas.drawPath(path, this.paintFill);
}
return true;
}
}
示例14: draw
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
@Override
public synchronized boolean draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point canvasPosition) {
if (this.geoPoint == null || (this.paintStroke == null && this.paintFill == null)) {
return false;
}
double latitude = this.geoPoint.latitude;
double longitude = this.geoPoint.longitude;
float pixelX = (float) (MercatorProjection.longitudeToPixelX(longitude, zoomLevel) - canvasPosition.x);
float pixelY = (float) (MercatorProjection.latitudeToPixelY(latitude, zoomLevel) - canvasPosition.y);
float radiusInPixel = (float) metersToPixels(latitude, this.radius, zoomLevel);
if (this.paintStroke != null) {
canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintStroke);
}
if (this.paintFill != null) {
canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintFill);
}
return true;
}
示例15: redraw
import org.mapsforge.core.model.BoundingBox; //导入依赖的package包/类
private void redraw() {
if (this.overlayCanvas == null) {
this.overlayCanvas = new Canvas();
}
this.bitmap2.eraseColor(Color.TRANSPARENT);
this.overlayCanvas.setBitmap(this.bitmap2);
MapPosition mapPositionBefore = this.mapView.getMapViewPosition().getMapPosition();
BoundingBox boundingBox = this.mapView.getMapViewPosition().getBoundingBox();
List<Overlay> overlays = this.mapView.getOverlays();
synchronized (overlays) {
for (Overlay overlay : overlays) {
overlay.draw(boundingBox, mapPositionBefore.zoomLevel, this.overlayCanvas);
}
}
MapPosition mapPositionAfter = this.mapView.getMapViewPosition().getMapPosition();
synchronized (this.matrix) {
adjustMatrix(mapPositionBefore, mapPositionAfter);
swapBitmaps();
}
this.mapView.postInvalidate();
}