Changeset 13824 in josm for trunk/src/org
- Timestamp:
- 2018-05-23T21:03:31+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r13783 r13824 123 123 // Get the list of Launchpad contributors using customary msgid “translator-credits” 124 124 String translators = tr("translator-credits"); 125 if (translators != null && !translators.isEmpty() && ! translators.equals("translator-credits")) {125 if (translators != null && !translators.isEmpty() && !"translator-credits".equals(translators)) { 126 126 about.addTab(tr("Translators"), createScrollPane(new JosmTextArea(translators))); 127 127 } -
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r13741 r13824 25 25 import org.openstreetmap.josm.data.imagery.ImageryInfo; 26 26 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 27 import org.openstreetmap.josm.data.imagery.LayerDetails; 27 28 import org.openstreetmap.josm.data.imagery.WMTSTileSource; 28 29 import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException; … … 204 205 205 206 final String url = wms.buildGetMapUrl( 206 tree.getSelectedLayers().stream().map( x -> x.getName()).collect(Collectors.toList()),207 tree.getSelectedLayers().stream().map(LayerDetails::getName).collect(Collectors.toList()), 207 208 (List<String>) null, 208 209 (String) formats.getSelectedItem(), 209 true // TODO: ask the user if (s)he wants transparent layer210 true // TODO: ask the user if transparent layer is wanted 210 211 ); 211 212 212 213 String selectedLayers = tree.getSelectedLayers().stream() 213 .map( x -> x.getName())214 .map(LayerDetails::getName) 214 215 .collect(Collectors.joining(", ")); 215 216 ImageryInfo ret = new ImageryInfo(info.getName() + selectedLayers, -
trunk/src/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelper.java
r13742 r13824 126 126 if (XMLStreamReader.START_ELEMENT == event) { 127 127 if (level > 0) { 128 ret.append( "<" + reader.getLocalName() +">");128 ret.append('<').append(reader.getLocalName()).append('>'); 129 129 } 130 130 level += 1; … … 134 134 return ret.toString(); 135 135 } 136 ret.append("</" + reader.getLocalName() +">");136 ret.append("</").append(reader.getLocalName()).append('>'); 137 137 } else if (XMLStreamReader.CHARACTERS == event) { 138 138 ret.append(reader.getText()); -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r13792 r13824 409 409 modTileFeatures = i.isModTileFeatures(); 410 410 if (!i.defaultLayers.isEmpty()) { 411 default_layers = i.defaultLayers.stream().map( x -> x.toJson()).collect(JsonCollectors.toJsonArray()).toString();411 default_layers = i.defaultLayers.stream().map(DefaultLayer::toJson).collect(JsonCollectors.toJsonArray()).toString(); 412 412 } 413 413 customHttpHeaders = i.customHttpHeaders; -
trunk/src/org/openstreetmap/josm/data/imagery/LayerDetails.java
r13818 r13824 15 15 */ 16 16 public class LayerDetails { 17 private Map<String, String> styles = new ConcurrentHashMap<>(); // name -> title18 private Collection<String> crs = new ArrayList<>();17 private final Map<String, String> styles = new ConcurrentHashMap<>(); // name -> title 18 private final Collection<String> crs = new ArrayList<>(); 19 19 /** 20 20 * The layer name (WMS {@code Title}) … … 30 30 */ 31 31 private String abstr; 32 private LayerDetails parentLayer;32 private final LayerDetails parentLayer; 33 33 private Bounds bounds; 34 34 private List<LayerDetails> children = new ArrayList<>(); -
trunk/src/org/openstreetmap/josm/data/imagery/WMSEndpointTileSource.java
r13742 r13824 24 24 * 25 25 * @author Wiktor Niesiobedzki 26 * 26 * @since 13733 27 27 */ 28 28 public class WMSEndpointTileSource extends AbstractWMSTileSource implements TemplatedTileSource { 29 29 30 30 private final WMSImagery wmsi; 31 private List<DefaultLayer> layers;32 private String urlPattern;31 private final List<DefaultLayer> layers; 32 private final String urlPattern; 33 33 private static final Pattern PATTERN_PARAM = Pattern.compile("\\{([^}]+)\\}"); 34 34 private final Map<String, String> headers = new ConcurrentHashMap<>(); -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSCapabilities.java
r13733 r13824 11 11 * 12 12 * @author Wiktor Niesiobedzki 13 * 13 * @since 13733 14 14 */ 15 15 public class WMTSCapabilities { 16 private String baseUrl;17 private TransferMode transferMode;16 private final String baseUrl; 17 private final TransferMode transferMode; 18 18 private Collection<Layer> layers; 19 20 19 21 20 /** … … 35 34 public void addLayers(Collection<Layer> layers) { 36 35 this.layers = layers; 37 38 36 } 39 37 -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r13759 r13824 274 274 275 275 private static final class SelectLayerDialog extends ExtendedDialog { 276 private final transient List<Entry<String, List<Layer>>> layers;277 276 private final WMTSLayerSelection list; 278 277 279 278 SelectLayerDialog(Collection<Layer> layers) { 280 279 super(Main.parent, tr("Select WMTS layer"), tr("Add layers"), tr("Cancel")); 281 this.layers = groupLayersByNameAndTileMatrixSet(layers); 282 this.list = new WMTSLayerSelection(this.layers); 280 this.list = new WMTSLayerSelection(groupLayersByNameAndTileMatrixSet(layers)); 283 281 setContent(list); 284 282 } … … 296 294 private TileMatrixSet currentTileMatrixSet; 297 295 private double crsScale; 298 private GetCapabilitiesParseHelper.TransferMode transferMode;296 private final GetCapabilitiesParseHelper.TransferMode transferMode; 299 297 300 298 private ScaleList nativeScaleList; … … 329 327 } 330 328 } else { 331 this.defaultLayer = info.getDefaultLayers(). iterator().next();329 this.defaultLayer = info.getDefaultLayers().get(0); 332 330 } 333 331 if (this.layers.isEmpty()) -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r13729 r13824 251 251 @Override 252 252 public void hideNotify() { 253 undoTreeModel.setRoot(undoRoot = new DefaultMutableTreeNode()); 254 redoTreeModel.setRoot(redoRoot = new DefaultMutableTreeNode()); 253 undoRoot = new DefaultMutableTreeNode(); 254 redoRoot = new DefaultMutableTreeNode(); 255 undoTreeModel.setRoot(undoRoot); 256 redoTreeModel.setRoot(redoRoot); 255 257 MainApplication.undoRedo.removeCommandQueuePreciseListener(this); 256 258 } -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/WMTSLayerSelection.java
r13758 r13824 84 84 } 85 85 86 private List<Entry<String, List<Layer>>> layers;87 private JTable list;86 private final List<Entry<String, List<Layer>>> layers; 87 private final JTable list; 88 88 89 89 /** 90 * 90 * Constructs a new {@code WMTSLayerSelection}. 91 91 * @param layers list of grouped layers (by tileMatrixSet and name) 92 92 */ -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java
r13772 r13824 22 22 import org.openstreetmap.josm.data.imagery.ImageryInfo; 23 23 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 24 import org.openstreetmap.josm.data.imagery.LayerDetails; 24 25 import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser; 25 26 import org.openstreetmap.josm.gui.util.GuiHelper; … … 154 155 if (wms != null && wms.buildRootUrl() != null) { 155 156 wmsUrl.setText(wms.buildGetMapUrl( 156 tree.getSelectedLayers().stream().map( x -> x.getName()).collect(Collectors.toList()),157 tree.getSelectedLayers().stream().map(LayerDetails::getName).collect(Collectors.toList()), 157 158 (List<String>) null, 158 159 (String) formats.getSelectedItem(), -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMTSLayerPanel.java
r13773 r13824 7 7 import java.io.IOException; 8 8 import java.util.Collections; 9 import java.util.List;10 import java.util.Map.Entry;11 9 12 10 import javax.swing.JButton; … … 30 28 * Panel for adding WMTS imagery sources 31 29 * @author Wiktor Niesiobędzki 32 * 30 * @since 8568 33 31 */ 34 32 public class AddWMTSLayerPanel extends AddImageryPanel { … … 36 34 private transient WMTSLayerSelection layerTable; 37 35 private final JCheckBox setDefaultLayer = new JCheckBox(tr("Set default layer?")); 38 private List<Entry<String, List<Layer>>> layers;39 40 36 41 37 /** … … 68 64 try { 69 65 WMTSCapabilities capabilities = WMTSTileSource.getCapabilities(rawUrl.getText(), getCommonHeaders()); 70 layers = WMTSTileSource.groupLayersByNameAndTileMatrixSet(capabilities.getLayers()); 71 layerTable = new WMTSLayerSelection(layers); 66 layerTable = new WMTSLayerSelection(WMTSTileSource.groupLayersByNameAndTileMatrixSet(capabilities.getLayers())); 72 67 layerTable.getTable().getSelectionModel().addListSelectionListener(lsl -> { 73 68 if (layerTable.getSelectedLayer() != null) { -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/WMSLayerTree.java
r13734 r13824 76 76 */ 77 77 public void updateTree(WMSImagery wms) { 78 // treeRootNode = new DefaultMutableTreeNode();79 78 while (treeRootNode.getChildCount() > 0) { 80 79 treeRootNode.remove(0); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r13507 r13824 170 170 Roles lastrole = null; 171 171 final List<Check> checks = new LinkedList<>(); 172 List<ComboMultiSelect.PresetListEntry> listEntries = new LinkedList<>();172 final List<ComboMultiSelect.PresetListEntry> listEntries = new LinkedList<>(); 173 173 final Map<String, List<Object>> byId = new HashMap<>(); 174 174 final Deque<String> lastIds = new ArrayDeque<>(); … … 297 297 ((Key) o).value = ""; // Fix #8530 298 298 } 299 listEntries = new LinkedList<>();299 listEntries.clear(); 300 300 lastrole = null; 301 301 } -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r13760 r13824 43 43 */ 44 44 public class WMSImagery { 45 46 45 47 46 private static final String CAPABILITIES_QUERY_STRING = "SERVICE=WMS&REQUEST=GetCapabilities"; … … 120 119 } 121 120 122 private Map<String, String> headers = new ConcurrentHashMap<>();121 private final Map<String, String> headers = new ConcurrentHashMap<>(); 123 122 private String version = "1.1.1"; // default version 124 123 private String getMapUrl; 125 124 private URL capabilitiesUrl; 126 private List<String> formats = new ArrayList<>();125 private final List<String> formats = new ArrayList<>(); 127 126 private List<LayerDetails> layers = new ArrayList<>(); 128 127 … … 283 282 return buildGetMapUrl( 284 283 getLayers(selectedLayers), 285 selectedLayers.stream().map( x -> x.getStyle()).collect(Collectors.toList()),284 selectedLayers.stream().map(DefaultLayer::getStyle).collect(Collectors.toList()), 286 285 transparent); 287 286 } … … 296 295 public String buildGetMapUrl(List<LayerDetails> selectedLayers, List<String> selectedStyles, boolean transparent) { 297 296 return buildGetMapUrl( 298 selectedLayers.stream().map( x -> x.getName()).collect(Collectors.toList()),297 selectedLayers.stream().map(LayerDetails::getName).collect(Collectors.toList()), 299 298 selectedStyles, 300 299 getPreferredFormat(), … … 504 503 */ 505 504 public boolean belowWMS130() { 506 return this.version.equals("1.1.1") || this.version.equals("1.1") || this.version.equals("1.0");505 return "1.1.1".equals(version) || "1.1".equals(version) || "1.0".equals(version); 507 506 } 508 507 … … 569 568 } 570 569 571 private Bounds parseBBox(Projection conv, String miny, String minx, String maxy, String maxx) {570 private static Bounds parseBBox(Projection conv, String miny, String minx, String maxy, String maxx) { 572 571 if (miny == null || minx == null || maxy == null || maxx == null) { 573 572 return null; … … 592 591 } 593 592 594 private String normalizeUrl(String serviceUrlStr) throws MalformedURLException {593 private static String normalizeUrl(String serviceUrlStr) throws MalformedURLException { 595 594 URL getCapabilitiesUrl = null; 596 595 String ret = null; … … 683 682 } 684 683 685 686 684 /** 687 685 * @param defaultLayers default layers that should select layer object … … 689 687 */ 690 688 public List<LayerDetails> getLayers(List<DefaultLayer> defaultLayers) { 691 Collection<String> layerNames = defaultLayers.stream().map( x -> x.getLayerName()).collect(Collectors.toList());689 Collection<String> layerNames = defaultLayers.stream().map(DefaultLayer::getLayerName).collect(Collectors.toList()); 692 690 return layers.stream() 693 691 .flatMap(LayerDetails::flattened) -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r13823 r13824 1175 1175 } 1176 1176 1177 private URL getImageUrl(String path, String name) {1177 private static URL getImageUrl(String path, String name) { 1178 1178 if (path != null && path.startsWith("resource://")) { 1179 1179 String p = path.substring("resource://".length()); … … 1778 1778 * @param enforceTransparency if {@code true}, makes sure to read image metadata and, if the image does not 1779 1779 * provide an alpha channel but defines a {@code TransparentColor} metadata node, that the resulting image 1780 * has a transparency set to {@code TRANSLUCENT} and uses the correct transparent color. For Java <11 only.1780 * has a transparency set to {@code TRANSLUCENT} and uses the correct transparent color. For Java < 11 only. 1781 1781 * 1782 1782 * @return a <code>BufferedImage</code> containing the decoded
Note:
See TracChangeset
for help on using the changeset viewer.