- Timestamp:
- 2024-02-20T16:44:22+01:00 (12 months ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/imagery
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r18723 r18989 20 20 import java.util.stream.Collectors; 21 21 22 import jakarta.json.Json;23 import jakarta.json.JsonObject;24 import jakarta.json.JsonReader;25 22 import javax.swing.ImageIcon; 26 23 … … 39 36 import org.openstreetmap.josm.tools.StreamUtils; 40 37 import org.openstreetmap.josm.tools.Utils; 38 39 import jakarta.json.Json; 40 import jakarta.json.JsonObject; 41 import jakarta.json.JsonReader; 41 42 42 43 /** … … 205 206 } 206 207 } 208 209 private static final String[] EMPTY_STRING = new String[0]; 207 210 208 211 private double pixelPerDegree; … … 567 570 * Check if this object equals another ImageryInfo with respect to the properties 568 571 * that get written to the preference file. 569 * 572 * <p> 570 573 * The field {@link #pixelPerDegree} is ignored. 571 574 * … … 965 968 966 969 /** 970 * Check to see if this info is valid (the XSD is overly permissive due to limitations of the XSD syntax). 971 * @return {@code true} if this info is valid 972 * @see ImageryInfo#getMissingFields() 973 * @since 18989 974 */ 975 public boolean isValid() { 976 return this.getName() != null && 977 this.getId() != null && 978 this.getSourceType() != null && 979 this.getUrl() != null && 980 this.getImageryCategory() != null; 981 } 982 983 /** 984 * Get the missing fields for this info 985 * @return The missing fields, or an empty array 986 * @see ImageryInfo#isValid() 987 * @since 18989 988 */ 989 public String[] getMissingFields() { 990 if (this.isValid()) { 991 return EMPTY_STRING; 992 } 993 List<String> missingFields = new ArrayList<>(); 994 if (this.getName() == null) { 995 missingFields.add("name"); 996 } 997 if (this.getId() == null) { 998 missingFields.add("id"); 999 } 1000 if (this.getSourceType() == null) { 1001 missingFields.add("type"); 1002 } 1003 if (this.getUrl() == null) { 1004 missingFields.add("url"); 1005 } 1006 if (this.getImageryCategory() == null) { 1007 missingFields.add("category"); 1008 } 1009 return missingFields.toArray(new String[0]); 1010 } 1011 1012 /** 967 1013 * Return the sorted list of activated source IDs. 968 1014 * @return sorted list of activated source IDs -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r18211 r18989 167 167 reader.setFastFail(fastFail); 168 168 Collection<ImageryInfo> result = reader.parse(); 169 // See #23485 (remove invalid source entries) 170 result.removeIf(info -> !info.isValid()); 169 171 newLayers.addAll(result); 170 172 } catch (IOException ex) {
Note:
See TracChangeset
for help on using the changeset viewer.