Changeset 18886 in josm
- Timestamp:
- 2023-10-30T20:42:22+01:00 (16 months ago)
- Location:
- trunk
- Files:
-
- 3 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/README
r18166 r18886 103 103 resolution and vector versions) 104 104 - styles/ files needed for map style maintenance 105 - potlatch2/README infos on how to update the Potlatch 2 style from upstream sources106 105 - README this file 107 106 - resources/ resource files that will be included in the JOSM jar file -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r18292 r18886 901 901 putInt("draw.rawgps.lines", -1); 902 902 } 903 updateMapPaintKnownDefaults(); 903 904 if (modifiedDefault) { 904 905 try { … … 913 914 914 915 /** 916 * Update the known defaults for the map paintstyles. 917 * This should be removed sometime after 2024-06-01. 918 */ 919 private void updateMapPaintKnownDefaults() { 920 final String url = "url"; 921 final String active = "active"; 922 final String potlatch2 = "resource://styles/standard/potlatch2.mapcss"; 923 final String remotePotlatch2 = "https://josm.openstreetmap.de/josmfile?page=Styles/Potlatch2&zip=1"; 924 925 // Remove potlatch2 from the known defaults 926 final List<String> knownDefaults = new ArrayList<>(getList("mappaint.style.known-defaults")); 927 // See #18866: Potlatch 2 internal theme removed in favor of remote theme by Stereo 928 knownDefaults.removeIf(potlatch2::equals); 929 930 // Moved from MapPaintPrefHelper for consistency 931 // XML style is not bundled anymore 932 knownDefaults.removeIf("resource://styles/standard/elemstyles.xml"::equals); 933 putList("mappaint.style.known-defaults", knownDefaults); 934 935 // Replace potlatch2 in the current style entries, but only if it is enabled. Otherwise, remove it. 936 final List<Map<String, String>> styleEntries = new ArrayList<>(getListOfMaps("mappaint.style.entries")); 937 final boolean potlatchEnabled = styleEntries.stream().filter(map -> potlatch2.equals(map.get(url))) 938 .anyMatch(map -> Boolean.parseBoolean(map.get(active))); 939 final boolean remotePotlatch2Present = styleEntries.stream().anyMatch(map -> remotePotlatch2.equals(map.get(url))); 940 // Remove potlatch2 if it is not enabled _or_ the remote potlatch2 version is present 941 styleEntries.removeIf(map -> (!potlatchEnabled || remotePotlatch2Present) && potlatch2.equals(map.get(url))); 942 styleEntries.replaceAll(HashMap::new); // The maps are initially immutable. 943 for (Map<String, String> map : styleEntries) { 944 if (potlatch2.equals(map.get(url))) { 945 map.put(url, remotePotlatch2); 946 } 947 } 948 putListOfMaps("mappaint.style.entries", styleEntries); 949 } 950 951 /** 915 952 * Enables or not the preferences file auto-save mechanism (save each time a setting is changed). 916 953 * This behaviour is enabled by default. -
trunk/src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java
r16468 r18886 5 5 6 6 import java.util.ArrayList; 7 import java.util.Arrays;8 7 import java.util.Collection; 8 import java.util.Collections; 9 9 import java.util.List; 10 10 import java.util.Map; … … 73 73 Config.getPref().putList("mappaint.style.known-defaults", new ArrayList<>(knownDefaults)); 74 74 75 // XML style is not bundled anymore76 list.removeIf(se -> "resource://styles/standard/elemstyles.xml".equals(se.url));77 78 75 return changed; 79 76 } … … 87 84 defJosmMapcss.title = tr("JOSM default (MapCSS)"); 88 85 defJosmMapcss.description = tr("Internal style to be used as base for runtime switchable overlay styles"); 89 ExtendedSourceEntry defPL2 = new ExtendedSourceEntry(type, "potlatch2.mapcss", "resource://styles/standard/potlatch2.mapcss"); 90 defPL2.active = false; 91 defPL2.name = "standard"; 92 defPL2.icon = new ImageProvider("dialogs/mappaint", "pl2_small").getResource(); 93 defPL2.title = tr("Potlatch 2"); 94 defPL2.description = tr("the main Potlatch 2 style"); 95 96 return Arrays.asList(defJosmMapcss, defPL2); 86 return Collections.singletonList(defJosmMapcss); 97 87 } 98 88 -
trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
r18870 r18886 88 88 89 89 @ParameterizedTest 90 @ValueSource(strings = {"resources/styles/standard/elemstyles.mapcss", "resources/styles/standard/potlatch2.mapcss"})90 @ValueSource(strings = "resources/styles/standard/elemstyles.mapcss") 91 91 void testInternalMapcss(final String resourceLocation) { 92 92 validatorCLI.processArguments(new String[]{"--input", resourceLocation});
Note:
See TracChangeset
for help on using the changeset viewer.