Ignore:
Timestamp:
2018-05-12T14:18:57+02:00 (6 years ago)
Author:
wiktorn
Message:

Imagery definition refactor

Extend imagery definitions by:

  • allowing setting default layers for WMS_ENDPOINT and WMTS
  • allowing setting minimum expires time for tile for this imagery
  • allowing setting custom headers that will be sent for all requests

(get map, get capabilities) for this imagery

Additional changes in code:

  • use TileJobOptions to pass miscellaneous options to loaders
  • refactor WMSImagery to use SAX parser

See: #15981, #7953, #16224, #15940, #16249

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/AbstractWMSTileSource.java

    r12669 r13733  
    33
    44import java.awt.Point;
     5import java.text.DecimalFormat;
     6import java.text.DecimalFormatSymbols;
     7import java.text.NumberFormat;
     8import java.util.Locale;
    59
    610import org.openstreetmap.gui.jmapviewer.Projected;
     
    2428public abstract class AbstractWMSTileSource extends TMSTileSource {
    2529
     30    static final NumberFormat LATLON_FORMAT = new DecimalFormat("###0.0000000", new DecimalFormatSymbols(Locale.US));
     31
    2632    private EastNorth anchorPosition;
    2733    private int[] tileXMin;
     
    209215        return this.tileProjection.toCode();
    210216    }
     217
     218    protected String getBbox(int zoom, int tilex, int tiley, boolean switchLatLon) {
     219        EastNorth nw = getTileEastNorth(tilex, tiley, zoom);
     220        EastNorth se = getTileEastNorth(tilex + 1, tiley + 1, zoom);
     221
     222        double w = nw.getX();
     223        double n = nw.getY();
     224
     225        double s = se.getY();
     226        double e = se.getX();
     227
     228        return (
     229                switchLatLon ?
     230                        String.format("%s,%s,%s,%s",
     231                                LATLON_FORMAT.format(s), LATLON_FORMAT.format(w), LATLON_FORMAT.format(n), LATLON_FORMAT.format(e))
     232                        :
     233                        String.format("%s,%s,%s,%s",
     234                                LATLON_FORMAT.format(w), LATLON_FORMAT.format(s), LATLON_FORMAT.format(e), LATLON_FORMAT.format(n))
     235
     236                );
     237    }
    211238}
Note: See TracChangeset for help on using the changeset viewer.