Returns the number of tiles over x at a given zoom level
488893
def numberOfXTilesAtZoom(self, zoom):
        ""
        [minRow, minCol, maxRow, maxCol] = self.getExtentAddress(zoom)
        return maxCol - minCol + 1
453390
private int getLayerIndex(Layer layer) {
		for (int i = 0; i < view.getWidgetCount(); i++) {
			LayerControlPanel layerPanel = (LayerControlPanel) view.getWidgetAt(i);
			if (layerPanel.getLayer() == layer) {
				return i;
			}
		}
		return -1;
	}
208586
public int getZoomLevelProgress(int zoomLevel) {
		Integer zoomProgress = zoomLevelProgress.get(zoomLevel);
		if (zoomProgress == null) {
			zoomProgress = 0;
		}
		return zoomProgress;
	}
373140
def get_tiles(self):
        """"""
        for x, y in griditer(self.root_tile.x, self.root_tile.y, ncol=self.tiles_per_row):
            yield TileCoordinate(self.root_tile.zoom, x, y)
25926
public static double getResolution( int zoom, int tileSize ) {
        // return (2 * Math.PI * 6378137) / (this.tileSize * 2**zoom)
        double initialResolution = 2 * Math.PI * 6378137 / tileSize;
        return initialResolution / Math.pow(2, zoom);
    }
548296
def tileAddress(self, zoom, point):
        ""
        [x, y] = point
        assert x <= self.MAXX and x >= self.MINX
        assert y <= self.MAXY and y >= self.MINY
        assert zoom in range(0, len(self.RESOLUTIONS))

        tileS = self.tileSize(zoom)
        offsetX = abs(x - self.MINX)
        if self.originCorner == 'bottom-left':
            offsetY = abs(y - self.MINY)
        elif self.originCorner == 'top-left':
            offsetY = abs(self.MAXY - y)
        col = offsetX / tileS
        row = offsetY / tileS
        # We are exactly on the edge of a tile and the extent
        if x in (self.MINX, self.MAXX) and col.is_integer():
            col = max(0, col - 1)
        if y in (self.MINY, self.MAXY) and row.is_integer():
            row = max(0, row - 1)
        return [
            int(math.floor(col)),
            int(math.floor(row))
        ]
1370217
def _global_tiles_from_bounds(tp, bounds, zoom):
    """"""
    seen = set()

    # clip to tilepyramid top and bottom bounds
    left, right = bounds.left, bounds.right
    top = tp.top if bounds.top > tp.top else bounds.top
    bottom = tp.bottom if bounds.bottom < tp.bottom else bounds.bottom

    if left >= tp.left and right <= tp.right:
        for tile in _tiles_from_cleaned_bounds(tp, bounds, zoom):
            yield tile

    # bounds overlap on the Western side with antimeridian
    if left < tp.left:
        for tile in chain(
            # tiles west of antimeridian
            _tiles_from_cleaned_bounds(
                tp,
                Bounds(left + (tp.right - tp.left), bottom, tp.right, top),
                zoom
            ),
            # tiles east of antimeridian
            _tiles_from_cleaned_bounds(
                tp, Bounds(tp.left, bottom, right, top), zoom
            )
        ):
            # make output tiles unique
            if tile.id not in seen:
                seen.add(tile.id)
                yield tile

    # bounds overlap on the Eastern side with antimeridian
    if right > tp.right:
        for tile in chain(
            # tiles west of antimeridian
            _tiles_from_cleaned_bounds(
                tp, Bounds(left, bottom, tp.right, top), zoom
            ),
            # tiles east of antimeridian
            _tiles_from_cleaned_bounds(
                tp,
                Bounds(tp.left, bottom, right - (tp.right - tp.left), top),
                zoom
            )
        ):
            # make output tiles unique
            if tile.id not in seen:
                seen.add(tile.id)
                yield tile
291855
def tile_height(self, zoom):
        
        warnings.warn(DeprecationWarning("tile_height is deprecated"))
        validate_zoom(zoom)
        matrix_pixel = 2**(zoom) * self.tile_size * self.grid.shape.height
        tile_pixel = self.tile_size * self.metatiling
        return matrix_pixel if tile_pixel > matrix_pixel else tile_pixel
1043052
def for_pixels(cls, pixel_x, pixel_y, zoom):
        """"""
        tms_x = int(math.ceil(pixel_x / float(TILE_SIZE)) - 1)
        tms_y = int(math.ceil(pixel_y / float(TILE_SIZE)) - 1)
        return cls(tms_x=tms_x, tms_y=(2 ** zoom - 1) - tms_y, zoom=zoom)
379013
def tile_width(self, zoom):
        
        warnings.warn(DeprecationWarning("tile_width is deprecated"))
        validate_zoom(zoom)
        matrix_pixel = 2**(zoom) * self.tile_size * self.grid.shape.width
        tile_pixel = self.tile_size * self.metatiling
        return matrix_pixel if tile_pixel > matrix_pixel else tile_pixel
1284420
private int calculateTileLevel() {
		double baseX = layerBounds.getWidth();
		double baseY = layerBounds.getHeight();
		// choose the tile level so the area is between minimumTileSize and the next level (minimumTileSize * 4)
		double baseArea = baseX * baseY;
		double scale = layer.getMapModel().getMapView().getCurrentScale();
		double osmArea = preferredTileSize / (scale * scale);
		int tileLevel = (int) Math.round(Math.log(baseArea / osmArea) / Math.log(4.0));
		if (tileLevel < 0) {
			tileLevel = 0;
		}
		return tileLevel;
	}
559698
function() {
          return {
            tileCount: tileSpans.length,
            layoutTime: layoutTime,
            mapTime: mapTime,
            reflowTime: reflowTime,
            totalTime: layoutTime + mapTime + reflowTime
          };
        }
969079
private int getSegmentForX(int x) {
        if (autoScroll.get()) {
            int playHead = (x - (getWidth() / 2));
            int offset = Util.timeToHalfFrame(getFurthestPlaybackPosition()) / scale.get();
            return  (playHead + offset) * scale.get();
        }
        return x * scale.get();
    }
527779
def getTileUrlsByLatLngExtent(self, xmin, ymin, xmax, ymax, level):
        '''
        
        '''
        # Upper-Left Tile
        tileXMin, tileYMin = self.tileUtils.convertLngLatToTileXY(xmin, ymax,
                                                                  level)

        # Lower-Right Tile
        tileXMax, tileYMax = self.tileUtils.convertLngLatToTileXY(xmax, ymin,
                                                                  level)

        tileUrls = []

        for y in range(tileYMax, tileYMin - 1, -1):
            for x in range(tileXMin, tileXMax + 1, 1):
                tileUrls.append(self.createTileUrl(x, y, level))

        return tileUrls
1354543
def X_more(self):
        """"""
        if self.parent.value('window_length') < 0.3:
            return
        self.parent.value('window_length',
                          self.parent.value('window_length') * 2)
        self.parent.overview.update_position()
719698
static IterableWithSize<Long> getTilesCoverageIterable(final BoundingBox pBB,
                                                           final int pZoomMin, final int pZoomMax) {
        final MapTileAreaList list = new MapTileAreaList();
        for (int zoomLevel = pZoomMin; zoomLevel <= pZoomMax; zoomLevel++) {
            list.getList().add(new MapTileArea().set(zoomLevel, getTilesRect(pBB, zoomLevel)));
        }
        return list;
    }
887620
public static int pixelYToTileY(double pixelY, byte zoomLevel, int tileSize) {
        return (int) Math.min(Math.max(pixelY / tileSize, 0), Math.pow(2, zoomLevel) - 1);
    }