public Point getPoint(GeoPoint geoPoint) { double x = MITMapView.computeGoogleX(geoPoint.getLongitudeE6(), mZoom); double y = MITMapView.computeGoogleY(geoPoint.getLatitudeE6(), mZoom); int pixelX = (int) Math.round((x - mLeftCol) * MITMapView.IMAGE_TILE_SIZE) - mLeftOffset; int pixelY = (int) Math.round((y - mTopRow) * MITMapView.IMAGE_TILE_SIZE) - mTopOffset; return new Point(pixelX, pixelY); }
public MapCanvasDrawer(int width, int height, GeoPoint geoPoint, int zoom) { initCanvasBitmap(width, height); mZoom = zoom; double centerY = MITMapView.computeGoogleY(geoPoint.getLatitudeE6(), mZoom); double centerX = MITMapView.computeGoogleX(geoPoint.getLongitudeE6(), mZoom); initTileCoordinates(centerX, centerY, width, height); }
public MapCanvasDrawer(int width, int height, List<GeoPoint> geoPoints, Integer zoom) { initCanvasBitmap(width, height); GeoRect geoRect = new GeoRect(geoPoints); // note maxLat corresponds to minY likewise minLat corresponds to maxY double minY = MITMapView.computeGoogleY(geoRect.getMaxLatitudeE6(), 0); double maxY = MITMapView.computeGoogleY(geoRect.getMinLatitudeE6(), 0); double maxX = MITMapView.computeGoogleX(geoRect.getMaxLongitudeE6(), 0); double minX = MITMapView.computeGoogleX(geoRect.getMinLongitudeE6(), 0); if (zoom != null) { mZoom = zoom; } else { mZoom = Math.min(zoomLevel(height, maxY - minY), zoomLevel(width, maxX - minX)); mZoom = Math.min(mZoom, MAX_ZOOM); } double centerY = 0.5 * (maxY + minY) * Math.pow(2, mZoom); double centerX = 0.5 * (maxX + minX) * Math.pow(2, mZoom); initTileCoordinates(centerX, centerY, width, height); }