[Pkg-osm-commits] [SCM] josm branch, master, updated. debian/0.0.svn5576+dfsg1-1-14-g6ff6036

David Paleino dapal at debian.org
Thu Dec 20 23:18:14 UTC 2012


The following commit has been merged in the master branch:
commit ee2394354f4f8ec0d1b704e8ac4b781b350b4ac0
Author: David Paleino <dapal at debian.org>
Date:   Thu Dec 20 19:40:20 2012 +0100

    Fixed patch to load images from the openstreetmap-map-icons package (Closes: #693486).

diff --git a/debian/changelog b/debian/changelog
index ff81b6d..6112851 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,10 @@ josm (0.0.svn5608+dfsg1-1) UNRELEASED; urgency=low
   * New tested snapshot (Closes: #695197).
   * Update josm.desktop to make it work also in Unity
     (Closes: #690585)
+  * Fixed patch to load images from the openstreetmap-map-icons
+    package (Closes: #693486).
 
- -- David Paleino <dapal at debian.org>  Wed, 19 Dec 2012 22:31:27 +0100
+ -- David Paleino <dapal at debian.org>  Thu, 20 Dec 2012 19:39:56 +0100
 
 josm (0.0.svn5576+dfsg1-1) unstable; urgency=low
 
diff --git a/debian/patches/02-elemstyles.patch b/debian/patches/02-elemstyles.patch
index fbea55d..d55d772 100644
--- a/debian/patches/02-elemstyles.patch
+++ b/debian/patches/02-elemstyles.patch
@@ -8,10 +8,9 @@ the openstreetmap-map-icons-* packages, so they can be used also by other
 applications. This patch points josm to the shared directories.
 
 ---
- src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java |   11 ++++++--
- src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java   |   16 +++++++++++-
- src/org/openstreetmap/josm/tools/ImageProvider.java         |    4 +--
- 3 files changed, 25 insertions(+), 6 deletions(-)
+ src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java |   11 +++-
+ src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java   |   30 +++++++++---
+ 2 files changed, 32 insertions(+), 9 deletions(-)
 
 --- josm.orig/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
 +++ josm/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
@@ -28,7 +27,7 @@ applications. This patch points josm to the shared directories.
          return dirs;
      }
  
-+    public static void addDebianDirs(List<String> f) {
++    public static void addDebianDirs(Collection<String> f) {
 +        f.add("/usr/share/icons/openstreetmap/classic.small");
 +        f.add("/usr/share/icons/openstreetmap/square.small");
 +        f.add("/usr/share/icons/openstreetmap/classic.big");
@@ -48,45 +47,56 @@ applications. This patch points josm to the shared directories.
  import org.openstreetmap.josm.gui.preferences.SourceEntry;
  import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference.PresetPrefHelper;
  import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
-@@ -1289,7 +1290,20 @@ public class TaggingPreset extends Abstr
+@@ -1284,12 +1285,22 @@ public class TaggingPreset extends Abstr
+     }
+ 
+     protected static ImageIcon loadImageIcon(String iconName, File zipIcons, Integer maxSize) {
+-        final Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null);
+-        ImageProvider imgProv = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true);
++        LinkedList<String> s = new LinkedList<String>();
++        MapPaintStyles.addDebianDirs(s);
++        String realIconName = iconName;
++        if (iconName.startsWith("styles/standard/")) {
++            realIconName = iconName.replace("styles/standard/", "");
++        }
++        ImageProvider imgProv = new ImageProvider(realIconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true);
          if (maxSize != null) {
              imgProv.setMaxSize(maxSize);
          }
 -        return imgProv.get();
 +        ImageIcon icon = imgProv.get();
 +        if (icon == null) {
-+            if (iconName.startsWith("styles/standard/")) {
-+                String realIconName = iconName.replaceAll("styles/standard/", "");
-+                LinkedList<String> dirs = new LinkedList<String>();
-+                MapPaintStyles.addDebianDirs(dirs);
-+                icon = new ImageProvider(realIconName).setDirs(dirs).setId("presets").setArchive(zipIcons).setOptional(true).get();
-+            }
-+            if (icon == null) {
-+                System.out.println("Could not get presets icon " + iconName);
-+                icon = new ImageIcon(iconName);
-+            }
++            System.out.println("Could not get presets icon " + realIconName);
++            icon = new ImageIcon(realIconName);
 +        }
 +        return icon;
      }
  
      /*
---- josm.orig/src/org/openstreetmap/josm/tools/ImageProvider.java
-+++ josm/src/org/openstreetmap/josm/tools/ImageProvider.java
-@@ -424,7 +424,7 @@ public class ImageProvider {
-                     String full_name = subdir + name + ext;
-                     String cache_name = full_name;
-                     /* cache separately */
--                    if (dirs != null && dirs.size() > 0) {
-+                    if (this.dirs != null && this.dirs.size() > 0) {
-                         cache_name = "id:" + id + ":" + full_name;
-                         if(archive != null) {
-                             cache_name += ":" + archive.getName();
-@@ -450,7 +450,7 @@ public class ImageProvider {
-                         // index the cache by the name of the icon we're looking for
-                         // and don't bother to create a URL unless we're actually
-                         // creating the image.
--                        URL path = getImageUrl(full_name, dirs, additionalClassLoaders);
-+                        URL path = getImageUrl(full_name, this.dirs, additionalClassLoaders);
-                         if (path == null) {
-                             continue;
+@@ -1300,8 +1311,15 @@ public class TaggingPreset extends Abstr
+      * and the 16x16 icons for SMALL_ICON.
+      */
+     public void setIcon(final String iconName) {
+-        ImageProvider imgProv = new ImageProvider(iconName);
+-        final Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null);
++        LinkedList<String> s = new LinkedList<String>();
++        MapPaintStyles.addDebianDirs(s);
++        final String realIconName;
++        if (iconName.startsWith("styles/standard/")) {
++            realIconName = iconName.replace("styles/standard/", "");
++        } else {
++            realIconName = iconName;
++        }
++        ImageProvider imgProv = new ImageProvider(realIconName);
+         imgProv.setDirs(s);
+         imgProv.setId("presets");
+         imgProv.setArchive(TaggingPreset.zipIcons);
+@@ -1318,7 +1336,7 @@ public class TaggingPreset extends Abstr
                          }
+                     });
+                 } else {
+-                    System.out.println("Could not get presets icon " + iconName);
++                    System.out.println("Could not get presets icon " + realIconName);
+                 }
+             }
+         });

-- 
Editor for OpenStreetMap



More information about the Pkg-osm-commits mailing list