Changeset 801 in josm


Ignore:
Timestamp:
Aug 17, 2008 12:26:23 AM (5 years ago)
Author:
stoecker
Message:

allow configurable mappaint colors

File:
1 edited

Legend:

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

    r791 r801  
    99 
    1010import org.openstreetmap.josm.tools.ColorHelper; 
     11import org.openstreetmap.josm.Main; 
    1112import org.xml.sax.Attributes; 
    1213import org.xml.sax.helpers.DefaultHandler; 
     
    3233        } 
    3334 
    34         /* 
    35     ElemStyles getElemStyles() 
    36     { 
    37         return styles; 
    38     } 
    39         */ 
     35        Color convertColor(String colString) 
     36        { 
     37                int i = colString.indexOf("#"); 
     38                String colorString; 
     39                if(i < 0) // name only 
     40                        colorString = Main.pref.get("color.mappaint."+colString); 
     41                else if(i == 0) // value only 
     42                        colorString = colString; 
     43                else // value and name 
     44                        colorString = Main.pref.get("color.mappaint."+colString.substring(0,i), colString.substring(i)); 
     45                return ColorHelper.html2color(colorString); 
     46        } 
    4047 
    4148        @Override public void startDocument() { 
     
    7380                                                curLineWidth = Integer.parseInt(atts.getValue(count)); 
    7481                                        else if (atts.getQName(count).equals("colour")) 
    75                                                 curLineColour=ColorHelper.html2color(atts.getValue(count)); 
     82                                                curLineColour=convertColor(atts.getValue(count)); 
    7683                                        else if (atts.getQName(count).equals("realwidth")) 
    7784                                                curLineRealWidth=Integer.parseInt(atts.getValue(count)); 
     
    123130                                { 
    124131                                        if (atts.getQName(count).equals("colour")) 
    125                                                 curAreaColour=ColorHelper.html2color(atts.getValue(count)); 
     132                                                curAreaColour=convertColor(atts.getValue(count)); 
    126133                                } 
    127134                        } 
Note: See TracChangeset for help on using the changeset viewer.