Changeset 9619 in josm
- Timestamp:
- 2016-01-24T22:53:29+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r9614 r9619 19 19 import javax.swing.ImageIcon; 20 20 21 import org.openstreetmap.gui.jmapviewer.OsmMercator;22 21 import org.openstreetmap.gui.jmapviewer.interfaces.Attributed; 23 22 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; … … 221 220 @pref Map<String, List<String>> noTileHeaders; 222 221 @pref Map<String, List<String>> noTileChecksums; 223 @pref int tileSize = OsmMercator.DEFAUL_TILE_SIZE;222 @pref int tileSize = -1; 224 223 @pref Map<String, String> metadataHeaders; 225 224 @pref boolean valid_georeference; -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r9617 r9619 594 594 */ 595 595 public void initProjection(Projection proj) { 596 String layerName = null; 597 if (currentLayer != null) { 598 layerName = currentLayer.name; 599 } 600 Collection<Layer> candidates = getLayers(layerName, proj.toCode()); 596 // getLayers will return only layers matching the name, if the user already choose the layer 597 // so we will not ask the user again to chose the layer, if he just changes projection 598 Collection<Layer> candidates = getLayers(currentLayer != null ? currentLayer.name : null, proj.toCode()); 601 599 if (!candidates.isEmpty()) { 602 600 Layer newLayer = userSelectLayer(candidates); … … 610 608 } 611 609 610 /** 611 * 612 * @param name of the layer to match 613 * @param projectionCode projection code to match 614 * @return Collection of layers matching the name of the layer and projection, or only projection if name is not provided 615 */ 612 616 private Collection<Layer> getLayers(String name, String projectionCode) { 613 617 Collection<Layer> ret = new ArrayList<>(); 614 for (Layer layer: this.layers) { 615 if ((name == null || name.equals(layer.name)) && (projectionCode == null || projectionCode.equals(layer.tileMatrixSet.crs))) { 616 ret.add(layer); 618 if (this.layers != null) { 619 for (Layer layer: this.layers) { 620 if ((name == null || name.equals(layer.name)) && (projectionCode == null || projectionCode.equals(layer.tileMatrixSet.crs))) { 621 ret.add(layer); 622 } 617 623 } 618 624 } … … 621 627 622 628 @Override 623 public int getDefaultTileSize() { 624 return getTileSize(); 629 public int getTileSize() { 630 // no support for non-square tiles (tileHeight != tileWidth) 631 // and for different tile sizes at different zoom levels 632 Collection<Layer> layers = getLayers(null, Main.getProjection().toCode()); 633 if (!layers.isEmpty()) { 634 return layers.iterator().next().tileMatrixSet.tileMatrix.first().tileHeight; 635 } 636 // if no layers is found, fallback to default mercator tile size. Maybe it will work 637 Main.warn("WMTS: Could not determine tile size. Using default tile size of: {0}", getDefaultTileSize()); 638 return getDefaultTileSize(); 625 639 } 626 640 -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r9615 r9619 152 152 "icon", 153 153 "tile-size", 154 "valid Georeference",154 "valid-georeference", 155 155 "epsg4326to3857Supported", 156 156 }).contains(qName)) {
Note:
See TracChangeset
for help on using the changeset viewer.