Ignore:
Timestamp:
2015-12-09T15:45:35+01:00 (8 years ago)
Author:
wiktorn
Message:

Fix 12168.

  • added testcase for bug #12168. I removed all but one layers from the GetCapabilities document to avoid showing dialog
  • added case, that when ResourceURL is provided, but no OperationsMetadata information are present - to assume REST transfer mode
  • added ignore-case paramter for {style} replacement, as some servers use lowercase name, and some capitalized versions

Closes #12168

File:
1 edited

Legend:

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

    r9081 r9095  
    5959    private static final String PATTERN_HEADER  = "\\{header\\(([^,]+),([^}]+)\\)\\}";
    6060
    61     private static final String URL_GET_ENCODING_PARAMS = "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER={layer}&STYLE={Style}&"
     61    private static final String URL_GET_ENCODING_PARAMS = "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER={layer}&STYLE={style}&"
    6262            + "FORMAT={format}&tileMatrixSet={TileMatrixSet}&tileMatrix={TileMatrix}&tileRow={TileRow}&tileCol={TileCol}";
    6363
     
    648648        }
    649649
    650         switch (transferMode) {
    651         case KVP:
    652             url = baseUrl + URL_GET_ENCODING_PARAMS;
    653             break;
    654         case REST:
     650        if (currentLayer.baseUrl != null && transferMode == null) {
    655651            url = currentLayer.baseUrl;
    656             break;
    657         default:
    658             url = "";
    659             break;
     652        } else {
     653            switch (transferMode) {
     654            case KVP:
     655                url = baseUrl + URL_GET_ENCODING_PARAMS;
     656                break;
     657            case REST:
     658                url = currentLayer.baseUrl;
     659                break;
     660            default:
     661                url = "";
     662                break;
     663            }
    660664        }
    661665
     
    672676                .replaceAll("\\{TileRow\\}", Integer.toString(tiley))
    673677                .replaceAll("\\{TileCol\\}", Integer.toString(tilex))
    674                 .replaceAll("\\{Style\\}", this.currentLayer.style);
     678                .replaceAll("(?i)\\{style\\}", this.currentLayer.style);
    675679    }
    676680
Note: See TracChangeset for help on using the changeset viewer.