Class AbstractWMSTileSource

  • All Implemented Interfaces:
    org.openstreetmap.gui.jmapviewer.interfaces.Attributed, org.openstreetmap.gui.jmapviewer.interfaces.TileSource
    Direct Known Subclasses:
    TemplatedWMSTileSource, WMSEndpointTileSource

    public abstract class AbstractWMSTileSource
    extends org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
    Base class for different WMS tile sources those based on URL templates and those based on WMS endpoints
    Since:
    10990
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private EastNorth anchorPosition  
      private double[] degreesPerTile  
      (package private) static NumberFormat LATLON_FORMAT  
      private static double SCALE_DENOMINATOR_ZOOM_LEVEL_1  
      private Projection tileProjection  
      private int[] tileXMax  
      private int[] tileXMin  
      private int[] tileYMax  
      private int[] tileYMin  
      • Fields inherited from class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource

        maxZoom, minZoom, osmMercator
      • Fields inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource

        baseUrl, id, modTileFeatures, name, tileSize
      • Fields inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource

        attributionImage, attributionImageURL, attributionLinkURL, attributionText, termsOfUseText, termsOfUseURL
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractWMSTileSource​(org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo info, Projection tileProjection)
      Constructs a new AbstractWMSTileSource.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.openstreetmap.gui.jmapviewer.TileXY eastNorthToTileXY​(EastNorth enPoint, int zoom)  
      protected String getBbox​(int zoom, int tilex, int tiley, boolean switchLatLon)  
      private static String getBboxstr​(double x1, double x2, double x3, double x4)  
      private double getDegreesPerTile​(int zoom)  
      String getServerCRS()  
      protected EastNorth getTileEastNorth​(int x, int y, int z)  
      Projection getTileProjection()  
      int getTileXMax​(int zoom)  
      int getTileXMin​(int zoom)  
      int getTileYMax​(int zoom)  
      int getTileYMin​(int zoom)  
      private void initAnchorPosition​(Projection proj)  
      void initProjection()
      Initializes class with current projection in JOSM.
      void initProjection​(Projection proj)
      Initializes class with projection in JOSM.
      org.openstreetmap.gui.jmapviewer.TileXY latLonToTileXY​(double lat, double lon, int zoom)  
      org.openstreetmap.gui.jmapviewer.TileXY latLonToTileXY​(org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate point, int zoom)  
      Point latLonToXY​(double lat, double lon, int zoom)  
      Point latLonToXY​(org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate point, int zoom)  
      org.openstreetmap.gui.jmapviewer.TileXY projectedToTileXY​(org.openstreetmap.gui.jmapviewer.interfaces.IProjected p, int zoom)  
      void setTileProjection​(Projection tileProjection)  
      org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate tileXYToLatLon​(int x, int y, int zoom)  
      org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate tileXYToLatLon​(org.openstreetmap.gui.jmapviewer.Tile tile)  
      org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate tileXYToLatLon​(org.openstreetmap.gui.jmapviewer.TileXY xy, int zoom)  
      org.openstreetmap.gui.jmapviewer.interfaces.IProjected tileXYtoProjected​(int x, int y, int zoom)  
      org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate xyToLatLon​(int x, int y, int zoom)  
      org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate xyToLatLon​(Point point, int zoom)  
      • Methods inherited from class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource

        getCoveringTileRange, getDistance, getMaxZoom, getMinZoom, isInside
      • Methods inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource

        getBaseUrl, getDefaultTileSize, getExtension, getId, getMetadata, getName, getTileId, getTilePath, getTileSize, getTileUrl, isModTileFeatures, isNoTileAtZoom, toString
      • Methods inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource

        getAttributionImage, getAttributionImageURL, getAttributionLinkURL, getAttributionText, getTermsOfUseText, getTermsOfUseURL, requiresAttribution, setAttributionImage, setAttributionImageURL, setAttributionLinkURL, setAttributionText, setTermsOfUseText, setTermsOfUseURL
    • Constructor Detail

      • AbstractWMSTileSource

        protected AbstractWMSTileSource​(org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo info,
                                        Projection tileProjection)
        Constructs a new AbstractWMSTileSource.
        Parameters:
        info - tile source info
        tileProjection - the tile projection
    • Method Detail

      • initProjection

        public void initProjection()
        Initializes class with current projection in JOSM. This call is needed every time projection changes.
      • initProjection

        public void initProjection​(Projection proj)
        Initializes class with projection in JOSM. This call is needed every time projection changes.
        Parameters:
        proj - new projection that shall be used for computations
      • tileXYToLatLon

        public org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate tileXYToLatLon​(org.openstreetmap.gui.jmapviewer.Tile tile)
        Specified by:
        tileXYToLatLon in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        tileXYToLatLon in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • tileXYToLatLon

        public org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate tileXYToLatLon​(org.openstreetmap.gui.jmapviewer.TileXY xy,
                                                                                      int zoom)
        Specified by:
        tileXYToLatLon in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        tileXYToLatLon in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • tileXYToLatLon

        public org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate tileXYToLatLon​(int x,
                                                                                      int y,
                                                                                      int zoom)
        Specified by:
        tileXYToLatLon in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        tileXYToLatLon in class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
      • latLonToTileXY

        public org.openstreetmap.gui.jmapviewer.TileXY latLonToTileXY​(double lat,
                                                                      double lon,
                                                                      int zoom)
        Specified by:
        latLonToTileXY in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        latLonToTileXY in class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
      • latLonToTileXY

        public org.openstreetmap.gui.jmapviewer.TileXY latLonToTileXY​(org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate point,
                                                                      int zoom)
        Specified by:
        latLonToTileXY in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        latLonToTileXY in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • getTileXMax

        public int getTileXMax​(int zoom)
        Specified by:
        getTileXMax in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        getTileXMax in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • getTileXMin

        public int getTileXMin​(int zoom)
        Specified by:
        getTileXMin in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        getTileXMin in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • getTileYMax

        public int getTileYMax​(int zoom)
        Specified by:
        getTileYMax in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        getTileYMax in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • getTileYMin

        public int getTileYMin​(int zoom)
        Specified by:
        getTileYMin in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        getTileYMin in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • latLonToXY

        public Point latLonToXY​(double lat,
                                double lon,
                                int zoom)
        Specified by:
        latLonToXY in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        latLonToXY in class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
      • latLonToXY

        public Point latLonToXY​(org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate point,
                                int zoom)
        Specified by:
        latLonToXY in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        latLonToXY in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • xyToLatLon

        public org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate xyToLatLon​(Point point,
                                                                                  int zoom)
        Specified by:
        xyToLatLon in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        xyToLatLon in class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
      • xyToLatLon

        public org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate xyToLatLon​(int x,
                                                                                  int y,
                                                                                  int zoom)
        Specified by:
        xyToLatLon in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        xyToLatLon in class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
      • tileXYtoProjected

        public org.openstreetmap.gui.jmapviewer.interfaces.IProjected tileXYtoProjected​(int x,
                                                                                        int y,
                                                                                        int zoom)
        Specified by:
        tileXYtoProjected in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        tileXYtoProjected in class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
      • projectedToTileXY

        public org.openstreetmap.gui.jmapviewer.TileXY projectedToTileXY​(org.openstreetmap.gui.jmapviewer.interfaces.IProjected p,
                                                                         int zoom)
        Specified by:
        projectedToTileXY in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        projectedToTileXY in class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
      • getServerCRS

        public String getServerCRS()
        Specified by:
        getServerCRS in interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
        Overrides:
        getServerCRS in class org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
      • getBbox

        protected String getBbox​(int zoom,
                                 int tilex,
                                 int tiley,
                                 boolean switchLatLon)
      • getBboxstr

        private static String getBboxstr​(double x1,
                                         double x2,
                                         double x3,
                                         double x4)