Java Screen Size getMinimumCacheSize(int tileSize, double overdrawFactor)

Here you can find the source of getMinimumCacheSize(int tileSize, double overdrawFactor)

Description

Compute the minimum cache size for a view, using the size of the screen.

License

Open Source License

Parameter

Parameter Description
tileSize the tile size
overdrawFactor the overdraw factor applied to the map view

Return

the minimum cache size for the view

Declaration

public static int getMinimumCacheSize(int tileSize, double overdrawFactor) 

Method Source Code


//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)));
    }
}

Related

  1. getMaximumWindowBounds()
  2. getMaximumWindowWidth()
  3. getMaxSize(Window frame)
  4. getMaxUsableScreenSize()
  5. getMaxWindowSize()
  6. getSizeWithScreen(double xd, double yd)
  7. getSystemSizeRate()
  8. getWindowActualSize(final Window window)
  9. makeEllipse(double x, double y, double size)