Here you can find the source of getMinimumCacheSize(int tileSize, double overdrawFactor)
Parameter | Description |
---|---|
tileSize | the tile size |
overdrawFactor | the overdraw factor applied to the map view |
public static int getMinimumCacheSize(int tileSize, double overdrawFactor)
//package com.java2s; /*//from ww w . j a va 2 s .c o m * Copyright 2016-2017 devemux86 * * This program is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.Dimension; import java.awt.Toolkit; public class Main { /** * Compute the minimum cache size for a view, using the size of the screen. * <p> * Combine with <code>FrameBufferController.setUseSquareFrameBuffer(false);</code> * * @param tileSize the tile size * @param overdrawFactor the overdraw factor applied to the map view * @return the minimum cache size for the view */ public static int getMinimumCacheSize(int tileSize, double overdrawFactor) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); return (int) Math.max(4, Math.round((2 + screenSize.getWidth() * overdrawFactor / tileSize) * (2 + screenSize.getHeight() * overdrawFactor / tileSize))); } }