Changeset 31142 in osm for applications/viewer/jmapviewer
- Timestamp:
- 2015-05-23T00:47:24+02:00 (9 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java
r31127 r31142 336 336 337 337 public Map<String,String> getMetadata() { 338 if (metadata == null) { 339 metadata = new HashMap<>(); 340 } 338 341 return metadata; 339 342 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
r31122 r31142 73 73 /** 74 74 * A unique id for this tile source. 75 * 75 * 76 76 * Unlike the name it has to be unique and has to consist only of characters 77 77 * valid for filenames. 78 * 78 * 79 79 * @return the id 80 80 */ … … 169 169 */ 170 170 public boolean isNoTileAtZoom(Map<String, List<String>> headers, int statusCode, byte[] content); 171 172 /** 173 * Extracts metadata about the tile based on HTTP headers 174 * 175 * @param headers HTTP headers from Tile Source server 176 * @return tile metadata 177 */ 178 public Map<String, String> getMetadata(Map<String, List<String>> headers); 171 179 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
r31133 r31142 3 3 4 4 import java.io.IOException; 5 import java.util.HashMap; 5 6 import java.util.List; 6 7 import java.util.Map; … … 15 16 protected String id; 16 17 private Map<String, String> noTileHeaders; 18 private Map<String, String> metadataHeaders; 17 19 protected int tileSize; 18 20 protected OsmMercator osmMercator; … … 26 28 this.id = info.getUrl(); 27 29 this.noTileHeaders = info.getNoTileHeaders(); 30 this.metadataHeaders = info.getMetadataHeaders(); 28 31 this.tileSize = info.getTileSize(); 29 32 osmMercator = new OsmMercator(this.tileSize); … … 149 152 return super.isNoTileAtZoom(headers, statusCode, content); 150 153 } 154 155 @Override 156 public Map<String, String> getMetadata(Map<String, List<String>> headers) { 157 Map<String, String> ret = new HashMap<>(); 158 if (metadataHeaders != null && headers != null) { 159 for (Entry<String, String> searchEntry: metadataHeaders.entrySet()) { 160 List<String> headerVals = headers.get(searchEntry.getKey()); 161 if (headerVals != null) { 162 for (String headerValue: headerVals) { 163 ret.put(searchEntry.getValue(), headerValue); 164 } 165 } 166 } 167 } 168 return ret; 169 } 151 170 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TileSourceInfo.java
r31125 r31142 19 19 20 20 /** headers meaning, that there is no tile at this zoom level */ 21 protected Map<String, String> no tileHeaders;21 protected Map<String, String> noTileHeaders; 22 22 23 23 /** minimum zoom level supported by the tile source */ … … 32 32 /** tile size of the displayed tiles */ 33 33 private int tileSize = OsmMercator.DEFAUL_TILE_SIZE; 34 35 /** mapping <header key, metadata key> */ 36 protected Map<String, String> metadataHeaders; 34 37 35 38 /** … … 82 85 */ 83 86 public Map<String, String> getNoTileHeaders() { 84 return no tileHeaders;87 return noTileHeaders; 85 88 } 86 89 … … 127 130 this.tileSize = tileSize; 128 131 } 132 133 public Map<String, String> getMetadataHeaders() { 134 return metadataHeaders; 135 } 129 136 }
Note:
See TracChangeset
for help on using the changeset viewer.