Changeset 13536 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2018-03-17T17:01:12+01:00 (6 years 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
r13516 r13536 27 27 import org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo; 28 28 import org.openstreetmap.josm.data.Bounds; 29 import org.openstreetmap.josm.data.StructUtils; 29 30 import org.openstreetmap.josm.data.StructUtils.StructEntry; 30 31 import org.openstreetmap.josm.io.Capabilities; 31 32 import org.openstreetmap.josm.io.OsmApi; 32 33 import org.openstreetmap.josm.spi.preferences.Config; 34 import org.openstreetmap.josm.spi.preferences.IPreferences; 33 35 import org.openstreetmap.josm.tools.CheckParameterUtil; 34 36 import org.openstreetmap.josm.tools.ImageProvider; … … 199 201 */ 200 202 private boolean bestMarked; 203 /** 204 * marked as overlay 205 * @since 13536 206 */ 207 private boolean overlay; 208 /** 209 * list of old IDs, only for loading, not handled anywhere else 210 * @since 13536 211 */ 212 private Collection<String> oldIds; 201 213 /** mirrors of different type for this entry */ 202 214 private List<ImageryInfo> mirrors; … … 245 257 @StructEntry boolean bestMarked; 246 258 @StructEntry boolean modTileFeatures; 259 @StructEntry boolean overlay; 247 260 // TODO: disabled until change of layers is implemented 248 261 // @StructEntry String default_layers; … … 271 284 date = i.date; 272 285 bestMarked = i.bestMarked; 286 overlay = i.overlay; 273 287 logo_image = i.attributionImage; 274 288 logo_url = i.attributionImageURL; … … 439 453 date = e.date; 440 454 bestMarked = e.bestMarked; 455 overlay = e.overlay; 441 456 termsOfUseText = e.terms_of_use_text; 442 457 termsOfUseURL = e.terms_of_use_url; … … 494 509 this.date = i.date; 495 510 this.bestMarked = i.bestMarked; 511 this.overlay = i.overlay; 496 512 // do not copy field {@code mirrors} 497 513 this.icon = i.icon; … … 526 542 Objects.equals(this.modTileFeatures, other.modTileFeatures) && 527 543 Objects.equals(this.bestMarked, other.bestMarked) && 544 Objects.equals(this.overlay, other.overlay) && 528 545 Objects.equals(this.isGeoreferenceValid, other.isGeoreferenceValid) && 529 546 Objects.equals(this.cookies, other.cookies) && … … 901 918 902 919 /** 920 * Return the sorted list of activated Imagery IDs 921 * @since 13536 922 */ 923 static public Collection<String> getActiveIds() { 924 ArrayList<String> ids = new ArrayList<String>(); 925 IPreferences pref = Config.getPref(); 926 if (pref != null) { 927 List<ImageryPreferenceEntry> entries = StructUtils.getListOfStructs( 928 pref, "imagery.entries", null, ImageryPreferenceEntry.class); 929 if (entries != null) { 930 for (ImageryPreferenceEntry prefEntry : entries) { 931 if(prefEntry.id != null && prefEntry.id.length() != 0) 932 ids.add(prefEntry.id); 933 } 934 Collections.sort(ids); 935 } 936 } 937 return ids; 938 } 939 940 /** 903 941 * Returns a tool tip text for display. 904 942 * @return The text … … 917 955 html = true; 918 956 } 957 if (overlay) { 958 res.append("<br>").append(tr("This imagery is an overlay.")); 959 html = true; 960 } 919 961 String desc = getDescription(); 920 962 if (desc != null && !desc.isEmpty()) { … … 1215 1257 1216 1258 /** 1259 * Returns the overlay indication. 1260 * @return <code>true</code> if it is and overlay. 1261 * @since 13536 1262 */ 1263 public boolean isOverlay() { 1264 return overlay; 1265 } 1266 1267 /** 1217 1268 * Sets an indicator that in other editors it is marked as best imagery 1218 1269 * @param bestMarked <code>true</code> if it is marked as best in other editors. … … 1221 1272 public void setBestMarked(boolean bestMarked) { 1222 1273 this.bestMarked = bestMarked; 1274 } 1275 1276 /** 1277 * Sets overlay indication 1278 * @param overlay <code>true</code> if it is an overlay. 1279 * @since 13536 1280 */ 1281 public void setOverlay(boolean overlay) { 1282 this.overlay = overlay; 1283 } 1284 1285 /** 1286 * Adds an old Id. 1287 * 1288 * @param id the Id to be added 1289 * @since 13536 1290 */ 1291 public void addOldId(String id) { 1292 if (oldIds == null) { 1293 oldIds = new ArrayList<>(); 1294 } 1295 oldIds.add(id); 1296 } 1297 1298 /** 1299 * Get old Ids. 1300 * 1301 * @return collection of ids 1302 * @since 13536 1303 */ 1304 public Collection<String> getOldIds() { 1305 return oldIds; 1223 1306 } 1224 1307 -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r12851 r13536 50 50 51 51 private static final String[] DEFAULT_LAYER_SITES = { 52 Main.getJOSMWebsite()+"/maps "52 Main.getJOSMWebsite()+"/maps%<?ids=>" 53 53 }; 54 54 … … 224 224 } 225 225 idMap.put(i.getId(), i); 226 Collection<String> old = i.getOldIds(); 227 if(old != null) { 228 for (String id : old) { 229 if (idMap.containsKey(id)) { 230 Logging.error("Old Id ''{0}'' is not unique - used by ''{1}'' and ''{2}''!", 231 i.getId(), i.getName(), idMap.get(i.getId()).getName()); 232 } else { 233 idMap.put(id, i); 234 } 235 } 236 } 226 237 } 227 238 }
Note:
See TracChangeset
for help on using the changeset viewer.