GluonMapLoadingService.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:Capstone2016 作者:
@Override
public ReadOnlyIntegerProperty preloadMapTiles(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
    ReadOnlyIntegerWrapper remainingCount = new ReadOnlyIntegerWrapper();
    int minX = getTileX(minLongitude, ZOOM);
    int maxX = getTileX(maxLongitude, ZOOM);
    int minY = getTileY(minLatitude, ZOOM);
    int maxY = getTileY(maxLatitude, ZOOM);
    int totalCount = (maxX-minX+1)*(maxY-minY+1);
    if (totalCount > MAX_TILES) {
        throw new IllegalArgumentException("The number of tiles required ("+totalCount+") is greater than the maximum allowed ("+MAX_TILES+")");
    }
    int remaining = 0;
    for (int x = minX; x <= maxX; x++) {
        for (int y = minY; y <= maxY; y++) {
            File f = getCacheFile(ZOOM, x, y);
            if (!f.exists()) {
                remaining++;
                fetchAndStoreTile(remainingCount, ZOOM, x, y);
            }
        }
    }
    remainingCount.set(remaining);
    return remainingCount;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号