Changeset 13742 in josm for trunk/src/org
- Timestamp:
- 2018-05-13T09:15:34+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelper.java
r13732 r13742 117 117 * @param reader XMLStreamReader that should point to start of element 118 118 * @return content of current tag 119 * @throws XMLStreamException 119 * @throws XMLStreamException if any XML stream error occurs 120 120 */ 121 121 public static String getElementTextWithSubtags(XMLStreamReader reader) throws XMLStreamException { -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r13733 r13742 1432 1432 /** 1433 1433 * Sets custom HTTP headers that should be sent with request towards imagery provider 1434 * @param customHttpHeaders 1434 * @param customHttpHeaders http headers 1435 1435 */ 1436 1436 public void setCustomHttpHeaders(Map<String, String> customHttpHeaders) { … … 1462 1462 /** 1463 1463 * Sets minimum tile expiration in seconds 1464 * @param minimumTileExpire 1464 * @param minimumTileExpire minimum tile expiration in seconds 1465 1465 */ 1466 1466 public void setMinimumTileExpire(int minimumTileExpire) { -
trunk/src/org/openstreetmap/josm/data/imagery/LayerDetails.java
r13733 r13742 38 38 * This is needed to properly handle layer attributes inheritance. 39 39 * 40 * @param parentLayer 40 * @param parentLayer parent layer 41 41 */ 42 42 public LayerDetails(LayerDetails parentLayer) { … … 70 70 71 71 /** 72 * @return title "Human readable" title of this layer 72 73 * @see LayerDetails#getName() 73 * @return title "Human readable" title of this layer74 74 */ 75 75 public String getTitle() { … … 78 78 79 79 /** 80 * @param title set title of this layer 80 81 * @see LayerDetails#getName() 81 * @param title set title of this layer82 82 */ 83 83 public void setTitle(String title) { … … 88 88 * 89 89 * Citation from OGC WMS specification (WMS 1.3.0): 90 * > A number of elements have both a <Name> and a <Title>. The Name is a text string used for machine-to-machine90 * > A number of elements have both a {@literal <Name>} and a {@literal <Title>}. The Name is a text string used for machine-to-machine 91 91 * > communication while the Title is for the benefit of humans. For example, a dataset might have the descriptive Title 92 92 * > “Maximum Atmospheric Temperature” and be requested using the abbreviated Name “ATMAX”. 93 93 * 94 94 * And second citation: 95 * > If, and only if, a layer has a <Name>, then it is a map layer that can be requested by using that Name in the96 * > LAYERS parameter of a GetMap request. A Layer that contains a <Name>element is referred to as a “named95 * > If, and only if, a layer has a {@literal <Name>}, then it is a map layer that can be requested by using that Name in the 96 * > LAYERS parameter of a GetMap request. A Layer that contains a {@literal <Name>} element is referred to as a “named 97 97 * > layer” in this International Standard. If the layer has a Title but no Name, then that layer is only a category title for 98 98 * > all the layers nested within. … … 104 104 105 105 /** 106 * @param name sets the name of this Layer 106 107 * @see LayerDetails#getName() 107 * @param name sets the name of this Layer108 108 */ 109 109 public void setName(String name) { … … 138 138 /** 139 139 * sets bounds of this layer 140 * @param bounds 140 * @param bounds of this layer 141 141 */ 142 142 public void setBounds(Bounds bounds) { … … 160 160 /** 161 161 * sets children layers for this layer 162 * @param children 162 * @param children children of this layer 163 163 */ 164 164 public void setChildren(List<LayerDetails> children) { … … 192 192 /** 193 193 * Sets abstract of this layer 194 * @param abstr 194 * @param abstr abstract of this layer 195 195 */ 196 196 public void setAbstract(String abstr) { -
trunk/src/org/openstreetmap/josm/data/imagery/TileJobOptions.java
r13733 r13742 23 23 * @param connectTimeout in milliseconds 24 24 * @param readTimeout in milliseconds 25 * @param headers 25 * @param headers http headers 26 26 * @param minimumExpiryTime in seconds 27 27 */ -
trunk/src/org/openstreetmap/josm/data/imagery/WMSEndpointTileSource.java
r13733 r13742 31 31 private List<DefaultLayer> layers; 32 32 private String urlPattern; 33 private static final Pattern PATTERN_PARAM 33 private static final Pattern PATTERN_PARAM = Pattern.compile("\\{([^}]+)\\}"); 34 34 private final Map<String, String> headers = new ConcurrentHashMap<>(); 35 35 -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r13740 r13742 303 303 * @param info imagery info 304 304 * @throws IOException if any I/O error occurs 305 * @throws WMTSGetCapabilitiesException 305 * @throws WMTSGetCapabilitiesException when document didn't contain any layers 306 306 * @throws IllegalArgumentException if any other error happens for the given imagery info 307 307 */ … … 312 312 this.baseUrl = GetCapabilitiesParseHelper.normalizeCapabilitiesUrl(handleTemplate(info.getUrl())); 313 313 WMTSCapabilities capabilities = getCapabilities(baseUrl, headers); 314 this.layers = 314 this.layers = capabilities.getLayers(); 315 315 this.baseUrl = capabilities.getBaseUrl(); 316 316 this.transferMode = capabilities.getTransferMode(); … … 374 374 * @return capabilities 375 375 * @throws IOException in case of any I/O error 376 * @throws WMTSGetCapabilitiesException 376 * @throws WMTSGetCapabilitiesException when document didn't contain any layers 377 377 * @throws IllegalArgumentException in case of any other error 378 378 */ -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r13733 r13742 66 66 public WMSLayer(ImageryInfo info) { 67 67 super(info); 68 CheckParameterUtil.ensureThat(info.getImageryType() == ImageryType.WMS || info.getImageryType() == ImageryType.WMS_ENDPOINT, "ImageryType is WMS"); 68 CheckParameterUtil.ensureThat( 69 info.getImageryType() == ImageryType.WMS || info.getImageryType() == ImageryType.WMS_ENDPOINT, "ImageryType is WMS"); 69 70 CheckParameterUtil.ensureParameterNotNull(info.getUrl(), "info.url"); 70 71 if (info.getImageryType() == ImageryType.WMS) { -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryPanel.java
r13734 r13742 48 48 protected final transient Collection<ContentValidationListener> listeners = new ArrayList<>(); 49 49 50 private final JCheckBox validGeoreference = new JCheckBox(tr("Is layer properly georeferenced?"));50 private final JCheckBox validGeoreference = new JCheckBox(tr("Is layer properly georeferenced?")); 51 51 private HeadersTable headersTable; 52 52 private JSpinner minimumCacheExpiry; … … 72 72 headersTable = new HeadersTable(); 73 73 minimumCacheExpiry = new JSpinner(new SpinnerNumberModel( 74 (Number) TimeUnit.MILLISECONDS.toSeconds(TMSCachedTileLoaderJob.MINIMUM_EXPIRES.get()),74 (Number) TimeUnit.MILLISECONDS.toSeconds(TMSCachedTileLoaderJob.MINIMUM_EXPIRES.get()), 75 75 0L, 76 76 Long.valueOf(Integer.MAX_VALUE), … … 101 101 break; 102 102 default: 103 Logging.warn(" Dupa: " + units.indexOf(e.getItem()));103 Logging.warn("Unkown unit: " + units.indexOf(e.getItem())); 104 104 } 105 105 minimumCacheExpiry.setValue(newValue); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMTSLayerPanel.java
r13741 r13742 100 100 Layer selectedLayer = layers.get(layerTable.convertRowIndexToModel(index)).getValue().get(0); 101 101 ret.setDefaultLayers( 102 Collections.<DefaultLayer> 102 Collections.<DefaultLayer>singletonList( 103 103 new DefaultLayer( 104 104 ImageryType.WMTS, -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/HeadersTable.java
r13733 r13742 72 72 73 73 } else if (row == headers.size()) { 74 String[] entry = new String[] { "", ""};74 String[] entry = new String[] {"", ""}; 75 75 entry[col] = (String) value; 76 76 headers.add(entry); … … 93 93 /** 94 94 * Create table prefilled with headers 95 * @param headers 95 * @param headers contents of table 96 96 */ 97 97 public HeadersTable(Map<String, String> headers) { … … 108 108 private static List<String[]> getHeadersAsVector(Map<String, String> headers) { 109 109 return headers.entrySet().stream().sorted((e1, e2) -> e1.getKey().compareTo(e2.getKey())) 110 .map(e -> new String[] { e.getKey(), e.getValue()}).collect(Collectors.toList());110 .map(e -> new String[] {e.getKey(), e.getValue()}).collect(Collectors.toList()); 111 111 } 112 112 -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r13733 r13742 290 290 if ("layer".equals(qName)) { 291 291 newState = State.NOOP; 292 defaultLayers.add(new DefaultLayer(entry.getImageryType(), atts.getValue("name"),atts.getValue("style"), atts.getValue("tileMatrixSet"))); 292 defaultLayers.add(new DefaultLayer( 293 entry.getImageryType(), 294 atts.getValue("name"), 295 atts.getValue("style"), 296 atts.getValue("tileMatrixSet") 297 )); 293 298 } 294 299 break; -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r13741 r13742 132 132 * Make getCapabilities request towards given URL 133 133 * @param url service url 134 * @throws IOException 135 * @throws WMSGetCapabilitiesException 134 * @throws IOException when connection error when fetching get capabilities document 135 * @throws WMSGetCapabilitiesException when there are errors when parsing get capabilities document 136 136 */ 137 137 public WMSImagery(String url) throws IOException, WMSGetCapabilitiesException { … … 143 143 * @param url service url 144 144 * @param headers HTTP headers to be sent with request 145 * @throws IOException 146 * @throws WMSGetCapabilitiesException 145 * @throws IOException when connection error when fetching get capabilities document 146 * @throws WMSGetCapabilitiesException when there are errors when parsing get capabilities document 147 147 */ 148 148 public WMSImagery(String url, Map<String, String> headers) throws IOException, WMSGetCapabilitiesException { … … 185 185 } catch (MalformedURLException e1) { // NOPMD 186 186 // do nothing, raise original exception 187 Logging.trace(e1); 187 188 } 188 189 } … … 287 288 288 289 /** 289 * @see #buildGetMapUrl(List, boolean)290 *291 290 * @param selectedLayers selected layers as subset of the tree returned by {@link #getLayers()} 292 291 * @param selectedStyles selected styles for all selectedLayers 293 292 * @param transparent whether returned images should contain transparent pixels (if supported by format) 294 293 * @return URL template for GetMap service 294 * @see #buildGetMapUrl(List, boolean) 295 295 */ 296 296 public String buildGetMapUrl(List<LayerDetails> selectedLayers, List<String> selectedStyles, boolean transparent) { … … 303 303 304 304 /** 305 * @see #buildGetMapUrl(List, boolean)306 *307 305 * @param selectedLayers selected layers as list of strings 308 306 * @param selectedStyles selected styles of layers as list of strings … … 310 308 * @param transparent whether returned images should contain transparent pixels (if supported by format) 311 309 * @return URL template for GetMap service 310 * @see #buildGetMapUrl(List, boolean) 312 311 */ 313 312 public String buildGetMapUrl(List<String> selectedLayers, … … 385 384 if (GetCapabilitiesParseHelper.moveReaderToTag(reader, this::tagEquals, QN_TITLE)) { 386 385 this.title = reader.getElementText(); 386 // CHECKSTYLE.OFF: EmptyBlock 387 387 for (int event = reader.getEventType(); 388 388 reader.hasNext() && !(event == XMLStreamReader.END_ELEMENT && tagEquals(QN_SERVICE, reader.getName())); … … 390 390 // empty loop, just move reader to the end of Service tag, if moveReaderToTag return false, it's already done 391 391 } 392 // CHECKSTYLE.ON: EmptyBlock 392 393 } 393 394 } … … 591 592 } 592 593 593 594 594 private String normalizeUrl(String serviceUrlStr) throws MalformedURLException { 595 595 URL getCapabilitiesUrl = null; … … 641 641 } 642 642 643 644 643 static boolean imageFormatHasTransparency(final String format) { 645 644 return format != null && (format.startsWith("image/png") || format.startsWith("image/gif") … … 686 685 687 686 /** 688 * @param defaultLayers 687 * @param defaultLayers default layers that should select layer object 689 688 * @return collection of LayerDetails specified by DefaultLayers 690 689 */
Note:
See TracChangeset
for help on using the changeset viewer.