|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.gui.layer.Layer
org.openstreetmap.josm.gui.layer.ImageryLayer
org.openstreetmap.josm.gui.layer.TMSLayer
public class TMSLayer
Class that displays a slippy map layer.
Nested Class Summary | |
---|---|
private static class |
TMSLayer.CachedAttributionBingAerialTileSource
|
private class |
TMSLayer.DeepTileSet
|
private class |
TMSLayer.TileSet
|
private static class |
TMSLayer.TileSetInfo
|
private class |
TMSLayer.TmsTileClearController
|
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.ImageryLayer |
---|
ImageryLayer.ApplyOffsetAction, ImageryLayer.OffsetAction, ImageryLayer.OffsetServerThread |
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.Layer |
---|
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction |
Fields inherited from class org.openstreetmap.josm.gui.layer.ImageryLayer |
---|
dx, dy, icon, info, offsetServerSupported, offsetServerThread, offsetServerUsed, PROP_FADE_AMOUNT, PROP_FADE_COLOR, PROP_SHARPEN_LEVEL, sharpenLevel |
Fields inherited from class org.openstreetmap.josm.gui.layer.Layer |
---|
ICON_SIZE, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
TMSLayer(ImageryInfo info)
|
Method Summary | |
---|---|
(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)
|
(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)
|
TileCache |
getTileCache()
Return the TileCache class containing Tile
data for requested and loaded tiles |
(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 |
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. |
Methods inherited from class org.openstreetmap.josm.gui.layer.ImageryLayer |
---|
create, createoffsetServerThread, destroy, displace, drawErrorTile, enableOffsetServer, getDx, getDy, getFadeColor, getFadeColorWithAlpha, getIcon, getInfo, getInfoComponent, getOffsetMenuItem, getOffsetMenuItem, getPPD, isMergable, mergeFrom, sharpenImage |
Methods inherited from class org.openstreetmap.josm.gui.layer.Layer |
---|
addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getName, getOpacity, isBackgroundLayer, isSavable, isVisible, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, setAssociatedFile, setBackgroundLayer, setName, setOpacity, setVisible, toggleVisible |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
protected MemoryTileCache tileCache
protected TileSource tileSource
protected OsmTileLoader tileLoader
java.util.HashSet<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
Constructor Detail |
---|
public TMSLayer(ImageryInfo info)
Method Detail |
---|
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
public TileCache getTileCache()
TileLoaderListener
TileCache
class containing Tile
data for requested and loaded tiles
getTileCache
in interface TileLoaderListener
void clearTileCache(ProgressMonitor monitor)
monitor
- MemoryTileCache.clear()
,
OsmFileCacheTileLoader.clearCache(org.openstreetmap.gui.jmapviewer.interfaces.TileSource, org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader.TileClearController)
void redraw()
Main.map
,
Component.repaint()
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) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
private void initTileSource(TileSource tileSource)
public void setOffset(double dx, double dy)
setOffset
in class ImageryLayer
private double getScaleFactor(int zoom)
private 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)
Tile getTile(int x, int y, int zoom)
boolean loadTile(Tile tile, boolean force)
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 returned
LatLon 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 java.awt.Point pixelPos(LatLon ll)
private java.awt.Point pixelPos(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
isChanged
in class Layer
public boolean isProjectionSupported(Projection proj)
Layer
isProjectionSupported
in class Layer
public java.lang.String nameSupportedProjections()
Layer
nameSupportedProjections
in class Layer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |