#18866 closed enhancement (fixed)
[PATCH] Remove Potlatch2 mappaint style from core
Reported by: | Stereo | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 23.11 |
Component: | Core | Version: | |
Keywords: | svg icon potlatch2 | Cc: |
Description
Since we have an icon scaling on hidpi screens now (ticket:9995#comment:110) it would be nice to transform all icons to svg. Preset icons are already all svg (#13357) and GUI icons are making great progress (#15240).
https://www.sjjb.co.uk/mapicons/contactsheet has a lot of icons that we use in the potlatch2 theme - https://www.sjjb.co.uk/mapicons/svg/accommodation/alpinehut.svg could replace resources/images/icons/accommodation_alpinehut.n.16.png etc.
http://osm-icons.org/wiki/Icons has more of the same icons
Attachments (1)
Change History (67)
comment:2 by , 5 years ago
Component: | Core → Internal mappaint style |
---|
comment:3 by , 5 years ago
Summary: | Transform Potlatch2 theme icons to SVG → Transform Potlatch2 mappaint style icons to SVG |
---|
Before changing the icons in JOSM maybe first ask the P2 guys if they are interested in switching to svg. Then the change can be made there first.
comment:4 by , 5 years ago
Yeah, I notice that the P2 style hasn't been pulled since 2016, and that the patches could, in some cases, be backported.
I'll check with Richard.
comment:5 by , 5 years ago
Keywords: | svg icon potlatch2 added |
---|
follow-up: 7 comment:6 by , 5 years ago
Richard has no plans to convert the Potlatch2 style to SVG since Flash doesn't support it. I didn't get the feeling that he was planning any changes on it, especially considering Flash's imminent demise.
Are there any reasons other than historical for which the Potlatch2 style is built-in and not a custom style like the rest of the other styles?
comment:7 by , 5 years ago
Replying to Stereo:
Are there any reasons other than historical for which the Potlatch2 style is built-in and not a custom style like the rest of the other styles?
Probably because it needs to be patched to work in JOSM.
comment:9 by , 5 years ago
Component: | Internal mappaint style → Core |
---|
Since Richard doesn't intend to work on it anymore, (one day) I will take the patched version, integrate any changes done upstream since, change the icons to vectors and host it on the wiki here, like https://josm.openstreetmap.de/wiki/Styles/iD
comment:10 by , 5 years ago
Status: | assigned → new |
---|
comment:11 by , 5 years ago
I'd say the main reason is historical. There is no need to have it internal.
comment:13 by , 4 years ago
Btw, there will probably be Potlatch3: https://forum.openstreetmap.org/viewtopic.php?pid=799795#p799795
follow-up: 16 comment:15 by , 4 years ago
I have a question reg. the icon names: Is the .svg extension wanted? My understanding was that ImageProvider should control what kind of format it uses if there are alternatives.
comment:16 by , 4 years ago
comment:17 by , 4 years ago
https://josm.openstreetmap.de/wiki/Styles/Potlatch2
The built-in P2 style can now be deleted. There should probably be a note in the next motd to tell people to activate the vectorised style.
comment:18 by , 4 years ago
comment:19 by , 4 years ago
JOSM can't render the bakery icon:
2020-10-29 20:43:31.387 WARNING: Could not load SVG svgSalamander:/icons/shopping_bakery.n.svg java.lang.NumberFormatException: For input string: "l" at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at sun.misc.FloatingDecimal.parseFloat(Unknown Source) at java.lang.Float.parseFloat(Unknown Source) at com.kitfox.svg.SVGElement.nextFloat(SVGElement.java:687) at com.kitfox.svg.SVGElement.parsePathList(SVGElement.java:758) at com.kitfox.svg.SVGElement.buildPath(SVGElement.java:811) at com.kitfox.svg.Path.build(Path.java:87) at com.kitfox.svg.Path.updateTime(Path.java:151) at com.kitfox.svg.Group.updateTime(Group.java:313) at com.kitfox.svg.Group.updateTime(Group.java:313) at com.kitfox.svg.SVGRoot.updateTime(SVGRoot.java:409) at com.kitfox.svg.SVGDiagram.updateTime(SVGDiagram.java:243) at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:616) at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:499) at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:484) at org.openstreetmap.josm.tools.ImageProvider.getIfAvailableZip(ImageProvider.java:1124) at org.openstreetmap.josm.tools.ImageProvider.getIfAvailableImpl(ImageProvider.java:937) at org.openstreetmap.josm.tools.ImageProvider.getResource(ImageProvider.java:712) at org.openstreetmap.josm.tools.ImageProvider.getResourceAsync(ImageProvider.java:747) at org.openstreetmap.josm.gui.mappaint.styleelement.MapImage.load(MapImage.java:175) at org.openstreetmap.josm.gui.mappaint.styleelement.MapImage.loadImage(MapImage.java:184) at org.openstreetmap.josm.gui.mappaint.styleelement.MapImage.getImage(MapImage.java:158) at org.openstreetmap.josm.gui.mappaint.styleelement.MapImage.getWidth(MapImage.java:230) at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.drawNodeIcon(StyledMapRenderer.java:791) at org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement.paintPrimitive(NodeElement.java:260) at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer$StyleRecord.paintPrimitive(StyledMapRenderer.java:226) at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.paintRecord(StyledMapRenderer.java:1713) at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.paintWithLock(StyledMapRenderer.java:1695) at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.render(StyledMapRenderer.java:1644) at org.openstreetmap.josm.gui.layer.OsmDataLayer.paint(OsmDataLayer.java:543) at org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable$CompatibilityModeLayerPainter.paint(AbstractMapViewPaintable.java:27) at org.openstreetmap.josm.gui.MapView.paintLayer(MapView.java:466) at org.openstreetmap.josm.gui.MapView.drawMapContent(MapView.java:581) at org.openstreetmap.josm.gui.MapView.paint(MapView.java:488) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JSplitPane.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JLayeredPane.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paintToOffscreen(Unknown Source) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) at sun.awt.SunGraphicsCallback.runComponents(Unknown Source) at java.awt.Container.paint(Unknown Source) at java.awt.Window.paint(Unknown Source) at javax.swing.RepaintManager$4.run(Unknown Source) at javax.swing.RepaintManager$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.access$1200(Unknown Source) at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 2020-10-29 20:43:31.392 SEVERE: Failed to locate image 'icons/shopping_bakery.n.svg' 2020-10-29 20:44:07.717 SEVERE: createImageFromSvg: svgSalamander:/icons/shopping_bakery.n.svg java.awt.Dimension[width=-1,height=-1] sourceWidth=0 sourceHeight=0
follow-up: 21 comment:20 by , 4 years ago
Wow, well spotted. Even the original didn't work. I fixed it by re-saving the icon, then re-minifying it.
Do you have a test script to build .osm files, or did you test them all by hand?
Thanks!
comment:21 by , 4 years ago
Replying to Stereo:
Do you have a test script to build .osm files, or did you test them all by hand?
No, if there is a problem with the style then it has a exclamation mark on top of its icon. Then you can right click -> info and then is a hint in the Errors or Warnings tab.
follow-up: 44 comment:22 by , 4 years ago
Owner: | changed from | to
---|
Removing the old core Potlatch2 mappaint style requires some code to remove it from the users list of active styles.
comment:23 by , 4 years ago
Milestone: | → 20.10 |
---|
If a message can be added to the MOTD, the built-in P2 style can be removed in 20.10.
comment:24 by , 4 years ago
Another thing: at least one external styles uses the core potlatch pngs: wiki:/Styles/PowerMapping
follow-up: 29 comment:27 by , 4 years ago
Done!
I don't have the permissions to delete, overwrite or update the old Icons_JP-Tsunami.zip attachment on https://josm.openstreetmap.de/wiki/Styles/JP-Tsunami - do you?
"You don't have permission to replace the attachment Icons_JP-Tsunami.zip. You can only replace your own attachments. Replacing other's attachments requires ATTACHMENT_DELETE permission."
comment:28 by , 4 years ago
So I guess we can now mv resources/images/icons resources/styles/standard/potlatch2.mapcss resources/images/dialogs/mappaint/pl2_small.svg nodist/
?
comment:29 by , 4 years ago
Replying to Stereo:
I don't have the permissions to delete, overwrite or update the old Icons_JP-Tsunami.zip attachment on https://josm.openstreetmap.de/wiki/Styles/JP-Tsunami - do you?
There are a lot less icons in Icons_JP-Tsunami.2.zip I guess you removed the unneeded ones? I think even if they are not used by the style atm it is better to keep them in the zip, else they are lost.
comment:30 by , 4 years ago
Yeah, I only kept the ones that were actually being used. I've also optimised the PNGs, saving a few KB.
I suppose the old zip can be renamed instead. I don't have the rights to do that either.
comment:32 by , 4 years ago
I reuploaded the original file with updated description and with (NOZIP)
https://josm.openstreetmap.de/attachment/wiki/Styles/JP-Tsunami/Icons_JP-Tsunami.zip
comment:34 by , 4 years ago
Milestone: | 20.10 → 20.11 |
---|
comment:36 by , 4 years ago
What remains to be done on this ticket is mv resources/images/icons resources/styles/standard/potlatch2.mapcss resources/images/dialogs/mappaint/pl2_small.svg nodist/
comment:38 by , 4 years ago
Milestone: | 20.12 → 21.01 |
---|
comment:39 by , 4 years ago
Milestone: | 21.01 → 21.02 |
---|
comment:41 by , 4 years ago
Milestone: | 21.03 |
---|
comment:42 by , 4 years ago
Milestone: | → 21.04 |
---|
comment:43 by , 4 years ago
Milestone: | 21.04 → Longterm |
---|
follow-up: 47 comment:44 by , 14 months ago
Replying to Klumbumbus:
Removing the old core Potlatch2 mappaint style requires some code to remove it from the users list of active styles.
Did we have any other objections to removing Potlatch2 from the built-in paintstyles? If not, I'll see if I can code something up for that in the next few weeks.
comment:46 by , 14 months ago
It looks like we are doing this in source:trunk/src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java (we still have a section removing elemstyles.xml
).
comment:47 by , 14 months ago
Replying to taylor.smock:
Did we have any other objections to removing Potlatch2 from the built-in paintstyles?
No.
Replying to stoecker:
There is a config sanitizer for such cases:
Then I guess it is pretty easy to implement it.
Additional todos:
- move icon folder, mapcss file and logo file to nodist or delete it, see comment:36
- the following folder is already in nodist, I'm not sure if this should be deleted. It is not useful anymore as potlatch2 is dead anyway, I doubt there will be updates of the style in the future.
comment:48 by , 14 months ago
Milestone: | Longterm → 23.10 |
---|---|
Summary: | Transform Potlatch2 mappaint style icons to SVG → [PATCH] Remove Potlatch2 mappaint style from core |
I've got the trunk/resources/images and trunk/nodist/styles/potlatch2 directories deleted locally, they just didn't show up in the patch file.
The patch tries to ensure that if someone has Potlatch2 enabled, they still have a Potlatch2 style after the update.
I'll plan on applying the patch in a week or two to give people a chance to look it over.
comment:49 by , 14 months ago
Please add an expire comment (I'd say at least 6 months), so the code gets removed later.
comment:50 by , 14 months ago
Example: /* Remove this code block and the related function after 2024-06-01 */
comment:51 by , 14 months ago
Fair point. I should probably go through other stuff we've deprecated and remove it. As an example, I've been meaning to go through all @Deprecated
methods as well and add a since xxx
to the @deprecated
javadoc so we can have some kind of schedule to remove those.
comment:52 by , 14 months ago
We'll that's easy. Remove all Deprecated in January together with the Java 11 upgrade. Until then all deprecate usages should be fixed thought...
follow-up: 56 comment:54 by , 14 months ago
Fixed the one icon path in the 5 power line mapping presets.
Now there is one style left which used the icons. I created: https://github.com/hotosm/HDM-JOSM-style/issues/72
comment:56 by , 14 months ago
Replying to Klumbumbus:
Fixed the one icon path in the 5 power line mapping presets.
Now there is one style left which used the icons. I created: https://github.com/hotosm/HDM-JOSM-style/issues/72
Thanks for doing that -- I was going to take a look after I finished fixing the borked test.
comment:57 by , 14 months ago
Hmm, for me on the dev machine it removed all the styles, even the built-in JOSM MapCSS for some reason.
I think I'm out of luck as the preferences cleanup is a one-time operation. I had a test file added to the run parameters, that's what I can say at the moment.
comment:58 by , 14 months ago
I think I'm out of luck as the preferences cleanup is a one-time operation
I encounter this frequently after running JOSM tests. I've been slowly fixing the root cause. Did you run any JOSM tests? Anything that has been fully migrated to JUnit5 annotations should be safe, but anything using JOSMTestRules and JOSMFixture are not.
EDIT: To clarify, in my testing with many additional paintstyles, the paint styles were not reset. It sounds like your preferences were fully reset ("preferences cleanup is a one-time operation"). That frequently occurs to me when I run unit tests. If that isn't correct, feel free to yell at me. And then I'll revert r18888.
comment:59 by , 14 months ago
Yes, I was running some tests, but as far as I know all of them were already migrated to JUnit5.
No serious issue here. It's a dev machine and the preferences are intact, except the mappaint style settings.
Upon restart, I realized neither the wireframe view option was there after the cleanup routine did its job. The wireframe option is not even a downloadable thing but a built-in feature. Really weird. I'm not reopening this ticket just yet, but it needs some more testing.
When is the next planned stable release?
comment:60 by , 14 months ago
When is the next planned stable release?
Whenever we get a new code signing certificate set up. See #23107 for details.
Yes, I was running some tests, but as far as I know all of them were already migrated to JUnit5.
There is a reason why I specified that the tests that have been fully migrated to our JUnit 5 annotations were safe. A test that uses JOSMTestRules
(which works on both JUnit 4 and 5) or JOSMFixture
will bork your preferences. I'm going through the remaining tests that use either and updating it.
Tests that can cause a reset to preferences:
CertificateAmendmentTestIT
(JOSMTestRules
)DomainValidatorTestIT
(JOSMTestRules
)GpxLayerTest
(JOSMTestRules
)HelpBrowserTest
(JOSMTestRules
)ImageryPreferenceTestIT
(JOSMTestRules
)LifecycleTest
(JOSMTestRules
)MainApplicationTest
(JOSMTestRules
)MainLayerManagerTest
(JOSMFixture
)MapCSSParserTestIT
(JOSMTestRules
)MapPaintPreferenceTestIT
(JOSMTestRules
)MemoryManagerTest
(JOSMTestRules
)MinimapDialogTest
(JOSMTestRules
)NetworkManagerTest
(JOSMTestRules
)OsmServerBackreferenceReaderTest
(JOSMFixture
)PlatformHookWindowsTest
(JOSMTestRules
)PluginDownloadTaskTest
(JOSMTestRules
)PluginHandlerTestIT
(JOSMTestRules
)RemoteControlTest
(JOSMTestRules
)SignpostAdaptersTest
(JOSMTestRules
)TaggingPresetPreferenceTestIT
(JOSMTestRules
)WebMarkerTest
(JOSMTestRules
)- And a few other tests I haven't modified today, but still need to (mostly
JOSMTestRules
).
comment:61 by , 14 months ago
No serious issue here.
To clarify, if new code is clearing out preferences, something is wrong and I need to fix it ASAP.
It's a dev machine and the preferences are intact, except the mappaint style settings.
The "except mappaint style settings" would tend to make me blame this ticket, except I often have my style preferences wiped after running tests. I'm working on fixing that so I know whether or not it was tests or new code that caused the problem in the future.
Upon restart, I realized neither the wireframe view option was there after the cleanup routine did its job. The wireframe option is not even a downloadable thing but a built-in feature.
Are you talking about View
-> Wireframe View
? Or it doesn't work when you enable it?
That button is provided by code, and I have no clue why it wouldn't have appeared.
comment:62 by , 14 months ago
Today it happened once again. I was just running some 5-8 years old versions this time, no tests at all.
I've put some log statements in the cleanup method to see what's going on if it happens again. It may not be related at all, I still have no clue.
comment:63 by , 14 months ago
I have no clue how that is happening. If I cannot figure it out this week, I'll revert this patch.
Literally the only paintstyles that should be removed/modified are those with a url == "resource://styles/standard/potlatch2.mapcss"
.
comment:66 by , 13 months ago
Is there anything to do in this ticket? I think what I found in comment:57 has a separate ticket (and hotfix r18907) now, see #23341.
Edit: Okay, it's already closed, never mind :) I thought I reopened, but seems I forgot.
In https://josm.openstreetmap.de/ticket/15240#comment:99 , stoecker writes: