Ignore:
Timestamp:
2008-08-16T01:02:24+02:00 (16 years ago)
Author:
stoecker
Message:

don't try loading all the mappaint icons from disk

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java

    r790 r791  
    8787                                for (int count=0; count<atts.getLength(); count++) {
    8888                                        if (atts.getQName(count).equals("src")) {
    89                                                 String imageFile = MapPaintStyles.getImageDir()+atts.getValue(count);
    90                                                 File f = new File(imageFile);
    91                                                 if (f.exists()) {
    92                                                         //open icon from user directory
    93                                                         curIcon = new ImageIcon(imageFile);
    94                                                 } else {
    95                                                         try {
    96                                                                 URL path = getClass().getResource(MapPaintStyles.getImageDir()+atts.getValue(count));
    97                                                                 if (path == null) {
    98                                                                         /* icon not found, using default */
    99                                                                         System.out.println("Mappaint: Icon " + atts.getValue(count) + " not found, using default icon");
    100                                                                         path = getClass().getResource(MapPaintStyles.getImageDir()+"misc/no_icon.png");
    101                                                                         curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
    102                                                                 } else {
    103                                                                         curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
    104                                                                 }
     89                                                if(!MapPaintStyles.isInternal())
     90                                                {
     91                                                        String imageFile = MapPaintStyles.getImageDir()+atts.getValue(count);
     92                                                        File f = new File(imageFile);
     93                                                        if (f.exists()) {
     94                                                                //open icon from user directory
     95                                                                curIcon = new ImageIcon(imageFile);
     96                                                                continue;
    10597                                                        }
    106                                                         catch (Exception e){
    107                                                                 URL path = getClass().getResource(MapPaintStyles.getImageDir()+"incomming/amenity.png");
     98                                                }
     99                                                try {
     100                                                        URL path = getClass().getResource(MapPaintStyles.getInternalImageDir()+atts.getValue(count));
     101                                                        if (path == null) {
     102                                                                /* icon not found, using default */
     103                                                                System.out.println("Mappaint: Icon " + atts.getValue(count) + " not found, using default icon");
     104                                                                path = getClass().getResource(MapPaintStyles.getInternalImageDir()+"misc/no_icon.png");
     105                                                                curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
     106                                                        } else {
    108107                                                                curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
    109108                                                        }
     109                                                }
     110                                                catch (Exception e){
     111                                                        URL path = getClass().getResource(MapPaintStyles.getInternalImageDir()+"incomming/amenity.png");
     112                                                        curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
    110113                                                }
    111114                                        } else if (atts.getQName(count).equals("annotate")) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r627 r791  
    88{
    99        HashMap<String, ElemStyle> styles;
    10         static int nr = 0;
     10        // static int nr = 0;
    1111
    1212
     
    6969                                }
    7070                        }
    71 
     71/**
    7272            // not a known key/value combination
    7373                        boolean first_line = true;
     
    103103                                }
    104104                        }
     105*/             
    105106                }
    106                
    107107                return null;
    108108        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r790 r791  
    1616public class MapPaintStyles {
    1717
    18         public static String styleDir;
    19         public static String imageDir;
     18        private static String styleDir;
     19        private static String imageDir;
     20        private static String internalImageDir;
     21        private static Boolean isInternal = false;
    2022        private static HashMap<String, ElemStyle> styles = new HashMap<String, ElemStyle>();
    2123       
     
    2527        public static String getImageDir(){
    2628                return imageDir;
     29        }
     30        public static String getInternalImageDir(){
     31                return internalImageDir;
     32        }
     33        public static Boolean isInternal(){
     34                return isInternal;
    2735        }
    2836
     
    6270                        if (elemStylesPath != null)
    6371                        {
    64                                 imageDir = "/images/styles/standard/";
     72                                internalImageDir = "/images/styles/"+styleName+"/";
     73                                isInternal = true;
    6574                                try
    6675                                {
Note: See TracChangeset for help on using the changeset viewer.