Class ReprojectionTile
java.lang.Object
org.openstreetmap.gui.jmapviewer.Tile
org.openstreetmap.josm.gui.layer.imagery.ReprojectionTile
Tile class that stores a reprojected version of the original tile.
- Since:
- 11858
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TileAnchorprotected booleanprivate doubleprivate final org.openstreetmap.gui.jmapviewer.TileFields inherited from class org.openstreetmap.gui.jmapviewer.Tile
error, ERROR_IMAGE, error_message, image, key, loaded, loading, LOADING_IMAGE, metadata, source, xtile, ytile, zoom -
Constructor Summary
ConstructorsConstructorDescriptionReprojectionTile(org.openstreetmap.gui.jmapviewer.interfaces.TileSource source, int xtile, int ytile, int zoom) Constructs a newReprojectionTile.ReprojectionTile(org.openstreetmap.gui.jmapviewer.Tile tile) Create a reprojection tile for a specific tile -
Method Summary
Modifier and TypeMethodDescriptionGet the position of the tile inside the image.private static DimensiongetDimension(ProjectionBounds bounds, double scale) doubleGet the scale that was used for reprojecting the tile.voidInvalidate tile - mark it as not loaded.protected IntegerlimitScale(double lenOrig, double lenNow) Make sure, the image is not scaled up too much.voidloadImage(InputStream inputStream) booleanneedsUpdate(double currentScale) Check if it is necessary to refresh the cache to match the current mapview scale and get optimized image quality.private static ProjectionBoundspbMarginAndAlign(ProjectionBounds box, double scale, double margin) private voidreset()voidsetImage(BufferedImage image) private EastNorthtileToEastNorth(int x, int y, int z) protected voidtransform(BufferedImage imageIn) Transforms the given image.Methods inherited from class org.openstreetmap.gui.jmapviewer.Tile
equals, finishLoading, getErrorMessage, getImage, getKey, getMetadata, getSource, getStatus, getTileKey, getTileSource, getTileXY, getUrl, getValue, getXtile, getYtile, getZoom, hasError, hashCode, initLoading, isLoaded, isLoading, loadingCanceled, loadPlaceholderFromCache, paint, paint, putValue, setError, setError, setLoaded, toString
-
Field Details
-
tile
-
anchor
-
nativeScale
-
maxZoomReached
-
-
Constructor Details
-
ReprojectionTile
public ReprojectionTile(org.openstreetmap.gui.jmapviewer.interfaces.TileSource source, int xtile, int ytile, int zoom) Constructs a newReprojectionTile.- Parameters:
source- source tilextile- X coordinateytile- Y coordinatezoom- zoom level
-
ReprojectionTile
Create a reprojection tile for a specific tile- Parameters:
tile- The tile to use
-
-
Method Details
-
getAnchor
Get the position of the tile inside the image.- Returns:
- the position of the tile inside the image
- See Also:
-
Tile.getImage()
-
getNativeScale
Get the scale that was used for reprojecting the tile.This is not necessarily the mapview scale, but may be adjusted to avoid excessively large cache image.
- Returns:
- the scale that was used for reprojecting the tile
-
needsUpdate
Check if it is necessary to refresh the cache to match the current mapview scale and get optimized image quality.When the maximum zoom is exceeded, this method will generally return false.
- Parameters:
currentScale- the current mapview scale- Returns:
- true if the tile should be reprojected again from the source image.
-
loadImage
- Overrides:
loadImagein classorg.openstreetmap.gui.jmapviewer.Tile- Throws:
IOException
-
setImage
- Overrides:
setImagein classorg.openstreetmap.gui.jmapviewer.Tile
-
invalidate
Invalidate tile - mark it as not loaded. -
reset
-
tileToEastNorth
-
transform
Transforms the given image.- Parameters:
imageIn- tile image to reproject
-
pbMarginAndAlign
-
getDimension
-
limitScale
Make sure, the image is not scaled up too much.This would not give any significant improvement in image quality and may exceed the user's memory. The correction factor is a power of 2.
- Parameters:
lenOrig- tile size of original imagelenNow- (averaged) tile size of warped image- Returns:
- factor to shrink if limit is exceeded; 1 if it is already at the limit, but no change needed; null if it is well below the limit and can still be scaled up by at least a factor of 2.
-