Skip to content

Commit b53953f

Browse files
elharoamitkdutta
authored andcommitted
Remove buggy, unused code
1 parent 185876f commit b53953f

File tree

1 file changed

+0
-82
lines changed

1 file changed

+0
-82
lines changed

presto-main/src/main/java/com/facebook/presto/geospatial/BingTileFunctions.java

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import static com.facebook.presto.common.function.OperatorType.CAST;
3737
import static com.facebook.presto.common.type.BigintType.BIGINT;
3838
import static com.facebook.presto.common.type.IntegerType.INTEGER;
39-
import static com.facebook.presto.geospatial.BingTile.MAX_ZOOM_LEVEL;
4039
import static com.facebook.presto.geospatial.BingTileUtils.EARTH_RADIUS_KM;
4140
import static com.facebook.presto.geospatial.BingTileUtils.LATITUDE_OUT_OF_RANGE;
4241
import static com.facebook.presto.geospatial.BingTileUtils.LONGITUDE_OUT_OF_RANGE;
@@ -59,8 +58,6 @@
5958
import static com.facebook.presto.geospatial.BingTileUtils.mapSize;
6059
import static com.facebook.presto.geospatial.BingTileUtils.tileToEnvelope;
6160
import static com.facebook.presto.geospatial.BingTileUtils.tileXYToLatitudeLongitude;
62-
import static com.facebook.presto.geospatial.GeometryUtils.contains;
63-
import static com.facebook.presto.geospatial.GeometryUtils.disjoint;
6461
import static com.facebook.presto.geospatial.GeometryUtils.isPointOrRectangle;
6562
import static com.facebook.presto.geospatial.serde.EsriGeometrySerde.deserialize;
6663
import static com.facebook.presto.geospatial.serde.EsriGeometrySerde.deserializeEnvelope;
@@ -69,8 +66,6 @@
6966
import static com.facebook.presto.geospatial.type.GeometryType.GEOMETRY_TYPE_NAME;
7067
import static com.facebook.presto.spi.StandardErrorCode.INVALID_CAST_ARGUMENT;
7168
import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
72-
import static com.google.common.base.Preconditions.checkArgument;
73-
import static com.google.common.base.Verify.verify;
7469
import static io.airlift.slice.Slices.utf8Slice;
7570
import static java.lang.Math.asin;
7671
import static java.lang.Math.atan2;
@@ -90,7 +85,6 @@
9085
*/
9186
public class BingTileFunctions
9287
{
93-
private static final int OPTIMIZED_TILING_MIN_ZOOM_LEVEL = 10;
9488
private static final Block EMPTY_TILE_ARRAY = BIGINT.createFixedSizeBlockBuilder(0).build();
9589

9690
private BingTileFunctions() {}
@@ -547,82 +541,6 @@ private static double addDistanceToLatitude(
547541
return newLatitude;
548542
}
549543

550-
private static BingTile[] getTilesInBetween(BingTile leftUpperTile, BingTile rightLowerTile, int zoomLevel)
551-
{
552-
checkArgument(leftUpperTile.getZoomLevel() == rightLowerTile.getZoomLevel());
553-
checkArgument(leftUpperTile.getZoomLevel() > zoomLevel);
554-
555-
int divisor = 1 << (leftUpperTile.getZoomLevel() - zoomLevel);
556-
int minX = (int) Math.floor(leftUpperTile.getX() / divisor);
557-
int maxX = (int) Math.floor(rightLowerTile.getX() / divisor);
558-
int minY = (int) Math.floor(leftUpperTile.getY() / divisor);
559-
int maxY = (int) Math.floor(rightLowerTile.getY() / divisor);
560-
561-
BingTile[] tiles = new BingTile[(maxX - minX + 1) * (maxY - minY + 1)];
562-
int index = 0;
563-
for (int x = minX; x <= maxX; x++) {
564-
for (int y = minY; y <= maxY; y++) {
565-
tiles[index] = BingTile.fromCoordinates(x, y, OPTIMIZED_TILING_MIN_ZOOM_LEVEL);
566-
index++;
567-
}
568-
}
569-
570-
return tiles;
571-
}
572-
573-
/**
574-
* Identifies a minimum set of tiles at specified zoom level that cover intersection of the
575-
* specified geometry and a specified tile of the same or lower level. Adds tiles to provided
576-
* BlockBuilder.
577-
*/
578-
private static void appendIntersectingSubtiles(
579-
OGCGeometry ogcGeometry,
580-
int zoomLevel,
581-
BingTile tile,
582-
BlockBuilder blockBuilder)
583-
{
584-
int tileZoomLevel = tile.getZoomLevel();
585-
checkArgument(tileZoomLevel <= zoomLevel);
586-
587-
Envelope tileEnvelope = tileToEnvelope(tile);
588-
if (tileZoomLevel == zoomLevel) {
589-
if (!disjoint(tileEnvelope, ogcGeometry)) {
590-
BIGINT.writeLong(blockBuilder, tile.encode());
591-
}
592-
return;
593-
}
594-
595-
if (contains(ogcGeometry, tileEnvelope)) {
596-
int subTileCount = 1 << (zoomLevel - tileZoomLevel);
597-
int minX = subTileCount * tile.getX();
598-
int minY = subTileCount * tile.getY();
599-
for (int x = minX; x < minX + subTileCount; x++) {
600-
for (int y = minY; y < minY + subTileCount; y++) {
601-
BIGINT.writeLong(blockBuilder, BingTile.fromCoordinates(x, y, zoomLevel).encode());
602-
}
603-
}
604-
return;
605-
}
606-
607-
if (disjoint(tileEnvelope, ogcGeometry)) {
608-
return;
609-
}
610-
611-
int minX = 2 * tile.getX();
612-
int minY = 2 * tile.getY();
613-
int nextZoomLevel = tileZoomLevel + 1;
614-
verify(nextZoomLevel <= MAX_ZOOM_LEVEL);
615-
for (int x = minX; x < minX + 2; x++) {
616-
for (int y = minY; y < minY + 2; y++) {
617-
appendIntersectingSubtiles(
618-
ogcGeometry,
619-
zoomLevel,
620-
BingTile.fromCoordinates(x, y, nextZoomLevel),
621-
blockBuilder);
622-
}
623-
}
624-
}
625-
626544
private static boolean withinDistance(GreatCircleDistanceToPoint distanceFunction, double maxDistance, Point point)
627545
{
628546
return distanceFunction.distance(point.getY(), point.getX()) <= maxDistance;

0 commit comments

Comments
 (0)