public class TMSLayer extends ImageryLayer implements java.awt.image.ImageObserver, TileLoaderListener
Modifier and Type | Class and Description |
---|---|
private static class |
TMSLayer.CachedAttributionBingAerialTileSource |
private class |
TMSLayer.DeepTileSet |
static interface |
TMSLayer.TileLoaderFactory |
private class |
TMSLayer.TileSet |
private static class |
TMSLayer.TileSetInfo |
private static class |
TMSLayer.TmsTileClearController |
ImageryLayer.ApplyOffsetAction, ImageryLayer.OffsetAction
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
Modifier and Type | Field and Description |
---|---|
private AttributionSupport |
attribution |
protected boolean |
autoLoad |
(package private) javax.swing.JCheckBoxMenuItem |
autoLoadPopup |
protected boolean |
autoZoom |
(package private) javax.swing.JCheckBoxMenuItem |
autoZoomPopup |
private Tile |
clickedTile |
int |
currentZoomLevel
Zoomlevel at which tiles is currently downloaded.
|
static int |
DEFAULT_MAX_ZOOM |
static int |
DEFAULT_MIN_ZOOM |
private static java.awt.Font |
InfoFont |
(package private) java.awt.Image |
lastScaledImage |
static TMSLayer.TileLoaderFactory |
loaderFactory |
static int |
MAX_ZOOM |
static int |
MIN_ZOOM |
private boolean |
needRedraw |
private static boolean |
newcache |
private TMSLayer.TileSet |
nullTileSet |
static java.lang.String |
PREFERENCE_PREFIX |
static BooleanProperty |
PROP_ADD_TO_SLIPPYMAP_CHOOSER |
static BooleanProperty |
PROP_DEFAULT_AUTOLOAD |
static BooleanProperty |
PROP_DEFAULT_AUTOZOOM |
static BooleanProperty |
PROP_DEFAULT_SHOWERRORS |
static IntegerProperty |
PROP_MAX_ZOOM_LVL |
static IntegerProperty |
PROP_MIN_ZOOM_LVL |
static StringProperty |
PROP_TILECACHE_DIR |
static IntegerProperty |
PROP_TMS_JOBS |
protected boolean |
showErrors |
(package private) javax.swing.JCheckBoxMenuItem |
showErrorsPopup |
(package private) Tile |
showMetadataTile |
protected MemoryTileCache |
tileCache |
protected OsmTileLoader |
tileLoader |
private javax.swing.JPopupMenu |
tileOptionMenu |
private java.util.Set<Tile> |
tileRequestsOutstanding |
protected TileSource |
tileSource |
dx, dy, icon, info, PROP_FADE_AMOUNT, PROP_FADE_COLOR, PROP_SHARPEN_LEVEL, sharpenLevel
ICON_SIZE, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
Constructor and Description |
---|
TMSLayer(ImageryInfo info) |
Modifier and Type | Method and Description |
---|---|
(package private) static int |
checkMaxZoomLvl(int maxZoomLvl,
TileSource ts) |
(package private) static int |
checkMinZoomLvl(int minZoomLvl,
TileSource ts) |
static void |
checkUrl(java.lang.String url)
Checks validity of given URL.
|
(package private) void |
clearTileCache(ProgressMonitor monitor)
Clears the tile cache.
|
boolean |
decreaseZoomLevel()
Zoom out from map.
|
(package private) void |
drawImageInside(java.awt.Graphics g,
java.awt.Image sourceImg,
java.awt.Rectangle source,
java.awt.Rectangle border) |
private int |
getBestZoom() |
(package private) java.awt.Image |
getLoadedTileImage(Tile tile)
Returns the image for the given tile if both tile and image are loaded.
|
(package private) int |
getMaxZoomLvl() |
static int |
getMaxZoomLvl(TileSource ts) |
javax.swing.Action[] |
getMenuEntries()
Returns list of actions.
|
(package private) int |
getMinZoomLvl() |
static int |
getMinZoomLvl(TileSource ts) |
(package private) Tile |
getOrCreateTile(int x,
int y,
int zoom) |
private double |
getScaleFactor(int zoom)
Returns average number of screen pixels per tile pixel for current mapview
|
private Coordinate |
getShiftedCoord(EastNorth en) |
private LatLon |
getShiftedLatLon(EastNorth en) |
(package private) Tile |
getTile(int x,
int y,
int zoom) |
(package private) Tile |
getTileForPixelpos(int px,
int py)
This isn't very efficient, but it is only used when the
user right-clicks on the map.
|
private static TMSLayer.TileSetInfo |
getTileSetInfo(TMSLayer.TileSet ts) |
static TileSource |
getTileSource(ImageryInfo info)
Creates and returns a new TileSource instance depending on the
ImageryInfo.ImageryType
of the passed ImageryInfo object. |
java.lang.String |
getToolTipText() |
void |
hookUpMapView()
Adds a context menu to the mapView.
|
(package private) boolean |
imageLoaded(java.awt.Image i) |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height) |
boolean |
increaseZoomLevel() |
private void |
initTileSource(TileSource tileSource) |
boolean |
isChanged()
Check changed status of layer
|
boolean |
isProjectionSupported(Projection proj)
allows to check whether a projection is supported or not
|
(package private) void |
loadAllErrorTiles(boolean force) |
(package private) void |
loadAllTiles(boolean force) |
(package private) boolean |
loadTile(Tile tile,
boolean force) |
(package private) void |
myDrawString(java.awt.Graphics g,
java.lang.String text,
int x,
int y) |
java.lang.String |
nameSupportedProjections()
Specify user information about projections
|
void |
paint(java.awt.Graphics2D g,
MapView mv,
Bounds bounds)
Paint the dataset using the engine set.
|
(package private) java.util.List<Tile> |
paintTileImages(java.awt.Graphics g,
TMSLayer.TileSet ts,
int zoom,
Tile border) |
(package private) void |
paintTileText(TMSLayer.TileSet ts,
Tile tile,
java.awt.Graphics g,
MapView mv,
int zoom,
Tile t) |
private java.awt.Point |
pixelPos(LatLon ll) |
private java.awt.Point |
pixelPos(Tile t) |
(package private) void |
redraw()
Initiates a repaint of Main.map
|
static void |
setCustomTileLoaderFactory(TMSLayer.TileLoaderFactory loaderFactory)
Plugins that wish to set custom tile loader should call this method
|
static void |
setMaxWorkers()
Function to set the maximum number of workers for tile loading to the value defined
in preferences.
|
static void |
setMaxZoomLvl(int maxZoomLvl) |
static void |
setMinZoomLvl(int minZoomLvl) |
void |
setOffset(double dx,
double dy) |
boolean |
setZoomLevel(int zoom) |
(package private) Tile |
tempCornerTile(Tile t) |
(package private) LatLon |
tileLatLon(Tile t) |
void |
tileLoadingFinished(Tile tile,
boolean success)
Will be called if a new
Tile has been loaded successfully. |
(package private) java.awt.Rectangle |
tileToRect(Tile t1) |
void |
visitBoundingBox(BoundingXYVisitor v) |
(package private) void |
zoomChanged() |
boolean |
zoomDecreaseAllowed()
Check if zooming out is allowed
|
boolean |
zoomIncreaseAllowed()
Zoom in, go closer to map.
|
create, destroy, displace, drawErrorTile, getDx, getDy, getFadeColor, getFadeColorWithAlpha, getIcon, getInfo, getInfoComponent, getOffsetMenuItem, getOffsetMenuItem, getPPD, isMergable, mergeFrom, sharpenImage
addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getName, getOpacity, isBackgroundLayer, isInfoResizable, isSavable, isVisible, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, setAssociatedFile, setBackgroundLayer, setName, setOpacity, setVisible, toggleVisible
public static final java.lang.String PREFERENCE_PREFIX
public static final int MAX_ZOOM
public static final int MIN_ZOOM
public static final int DEFAULT_MAX_ZOOM
public static final int DEFAULT_MIN_ZOOM
public static final BooleanProperty PROP_DEFAULT_AUTOZOOM
public static final BooleanProperty PROP_DEFAULT_AUTOLOAD
public static final BooleanProperty PROP_DEFAULT_SHOWERRORS
public static final IntegerProperty PROP_MIN_ZOOM_LVL
public static final IntegerProperty PROP_MAX_ZOOM_LVL
public static final BooleanProperty PROP_ADD_TO_SLIPPYMAP_CHOOSER
public static final IntegerProperty PROP_TMS_JOBS
public static final StringProperty PROP_TILECACHE_DIR
private static final boolean newcache
protected MemoryTileCache tileCache
protected TileSource tileSource
protected OsmTileLoader tileLoader
public static TMSLayer.TileLoaderFactory loaderFactory
private java.util.Set<Tile> tileRequestsOutstanding
public int currentZoomLevel
private Tile clickedTile
private boolean needRedraw
private javax.swing.JPopupMenu tileOptionMenu
javax.swing.JCheckBoxMenuItem autoZoomPopup
javax.swing.JCheckBoxMenuItem autoLoadPopup
javax.swing.JCheckBoxMenuItem showErrorsPopup
Tile showMetadataTile
private AttributionSupport attribution
private static final java.awt.Font InfoFont
protected boolean autoZoom
protected boolean autoLoad
protected boolean showErrors
java.awt.Image lastScaledImage
private final TMSLayer.TileSet nullTileSet
public TMSLayer(ImageryInfo info)
public static void setCustomTileLoaderFactory(TMSLayer.TileLoaderFactory loaderFactory)
public void tileLoadingFinished(Tile tile, boolean success)
TileLoaderListener
Tile
has been loaded successfully.
Loaded can mean downloaded or loaded from file cache.tileLoadingFinished
in interface TileLoaderListener
tile
- The tilesuccess
- true
if the tile has been loaded successfully, false
otherwisevoid clearTileCache(ProgressMonitor monitor)
static int checkMaxZoomLvl(int maxZoomLvl, TileSource ts)
public static int getMaxZoomLvl(TileSource ts)
public static void setMaxZoomLvl(int maxZoomLvl)
static int checkMinZoomLvl(int minZoomLvl, TileSource ts)
public static int getMinZoomLvl(TileSource ts)
public static void setMinZoomLvl(int minZoomLvl)
public static TileSource getTileSource(ImageryInfo info) throws java.lang.IllegalArgumentException
ImageryInfo.ImageryType
of the passed ImageryInfo object.
If no appropriate TileSource is found, null is returned.
Currently supported ImageryType are ImageryInfo.ImageryType.TMS
,
ImageryInfo.ImageryType.BING
, ImageryInfo.ImageryType.SCANEX
.info
- java.lang.IllegalArgumentException
public static void checkUrl(java.lang.String url)
url
- URL to checkjava.lang.IllegalArgumentException
- if url is null or invalidprivate void initTileSource(TileSource tileSource)
public void setOffset(double dx, double dy)
setOffset
in class ImageryLayer
private double getScaleFactor(int zoom)
private final int getBestZoom()
public static void setMaxWorkers()
public void hookUpMapView()
hookUpMapView
in class Layer
void zoomChanged()
int getMaxZoomLvl()
int getMinZoomLvl()
public boolean zoomIncreaseAllowed()
public boolean increaseZoomLevel()
public boolean setZoomLevel(int zoom)
public boolean zoomDecreaseAllowed()
public boolean decreaseZoomLevel()
Tile tempCornerTile(Tile t)
Tile getOrCreateTile(int x, int y, int zoom)
void loadAllTiles(boolean force)
void loadAllErrorTiles(boolean force)
public boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
imageUpdate
in interface java.awt.image.ImageObserver
boolean imageLoaded(java.awt.Image i)
java.awt.Image getLoadedTileImage(Tile tile)
tile
- the Tile for which the image should be returnedLatLon tileLatLon(Tile t)
java.awt.Rectangle tileToRect(Tile t1)
void drawImageInside(java.awt.Graphics g, java.awt.Image sourceImg, java.awt.Rectangle source, java.awt.Rectangle border)
java.util.List<Tile> paintTileImages(java.awt.Graphics g, TMSLayer.TileSet ts, int zoom, Tile border)
void myDrawString(java.awt.Graphics g, java.lang.String text, int x, int y)
void paintTileText(TMSLayer.TileSet ts, Tile tile, java.awt.Graphics g, MapView mv, int zoom, Tile t)
private LatLon getShiftedLatLon(EastNorth en)
private Coordinate getShiftedCoord(EastNorth en)
private static TMSLayer.TileSetInfo getTileSetInfo(TMSLayer.TileSet ts)
public void paint(java.awt.Graphics2D g, MapView mv, Bounds bounds)
Layer
paint
in interface MapViewPaintable
paint
in class Layer
mv
- The object that can translate GeoPoints to screen coordinates.Tile getTileForPixelpos(int px, int py)
public javax.swing.Action[] getMenuEntries()
Layer
getMenuEntries
in class Layer
public java.lang.String getToolTipText()
getToolTipText
in class Layer
public void visitBoundingBox(BoundingXYVisitor v)
visitBoundingBox
in class Layer
public boolean isChanged()
Layer
public final boolean isProjectionSupported(Projection proj)
Layer
isProjectionSupported
in class Layer
public final java.lang.String nameSupportedProjections()
Layer
nameSupportedProjections
in class Layer