Index: trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java	(revision 1747)
@@ -16,4 +16,10 @@
         super(coor.lat(), coor.lon());
         proj = null;
+    }
+
+    public CachedLatLon(EastNorth eastNorth) {
+        super(Main.proj.eastNorth2latlon(eastNorth));
+        proj = Main.proj;
+        this.eastNorth = eastNorth;
     }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/Node.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 1747)
@@ -37,9 +37,15 @@
 
     public final void setEastNorth(EastNorth eastNorth) {
-        coor.setEastNorth(eastNorth);
+        if(eastNorth != null)
+        {
+            if(coor != null)
+                coor.setEastNorth(eastNorth);
+            else
+                coor = new CachedLatLon(eastNorth);
+        }
     }
 
     public final EastNorth getEastNorth() {
-        return coor.getEastNorth();
+        return coor != null ? coor.getEastNorth() : null;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java	(revision 1747)
@@ -14,4 +14,5 @@
         this.maxScale = maxScale;
         this.minScale = minScale;
+        this.rules = a.rules;
     }
 
@@ -23,4 +24,5 @@
         this.maxScale = a.maxScale;
         this.minScale = a.minScale;
+        this.rules = a.rules;
         this.line = l;
         this.code = a.code;
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java	(revision 1747)
@@ -19,5 +19,15 @@
     public Boolean equals(ElemStyle s)
     {
-        return s != null && s.code.equals(code);
+        return s != null && s.getCode().equals(getCode());
+    }
+    public String getCode()
+    {
+        if(code == null && rules != null)
+        {
+            code = "";
+            for(Rule r: rules)
+                code += r.toCode();
+        }
+        return code;
     }
     public boolean check(Map<String, String> keys)
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java	(revision 1747)
@@ -155,6 +155,6 @@
                     if(rule.rules == null)
                         rule.rules = new LinkedList<Rule>();
+                    rule.rules.add(new Rule(rule.rule));
                     r = new Rule();
-                    r.init();
                     rule.rules.add(r);
                 }
@@ -230,24 +230,20 @@
             if(hadLine)
             {
-                rule.line.rules = rule.rules;
-                styles.add(styleName, rule.rule,
+                styles.add(styleName, rule.rule, rule.rules,
                 new LineElemStyle(rule.line, rule.scaleMax, rule.scaleMin));
             }
             if(hadLineMod)
             {
-                rule.linemod.rules = rule.rules;
-                styles.addModifier(styleName, rule.rule,
+                styles.addModifier(styleName, rule.rule, rule.rules,
                 new LineElemStyle(rule.linemod, rule.scaleMax, rule.scaleMin));
             }
             if(hadIcon)
             {
-                rule.icon.rules = rule.rules;
-                styles.add(styleName, rule.rule,
+                styles.add(styleName, rule.rule, rule.rules,
                 new IconElemStyle(rule.icon, rule.scaleMax, rule.scaleMin));
             }
             if(hadArea)
             {
-                rule.area.rules = rule.rules;
-                styles.add(styleName, rule.rule,
+                styles.add(styleName, rule.rule, rule.rules,
                 new AreaElemStyle(rule.area, rule.scaleMax, rule.scaleMin));
             }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 1747)
@@ -1,4 +1,5 @@
 package org.openstreetmap.josm.gui.mappaint;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -21,4 +22,8 @@
         private HashMap<String, AreaElemStyle> areas;
         private HashMap<String, LineElemStyle> modifiers;
+        private LinkedList<IconElemStyle> iconsList;
+        private LinkedList<LineElemStyle> linesList;
+        private LinkedList<AreaElemStyle> areasList;
+        private LinkedList<LineElemStyle> modifiersList;
         public StyleSet()
         {
@@ -27,4 +32,8 @@
             modifiers = new HashMap<String, LineElemStyle>();
             areas = new HashMap<String, AreaElemStyle>();
+            iconsList = new LinkedList<IconElemStyle>();
+            linesList = new LinkedList<LineElemStyle>();
+            modifiersList = new LinkedList<LineElemStyle>();
+            areasList = new LinkedList<AreaElemStyle>();
         }
         private IconElemStyle getNode(Map<String, String> keys)
@@ -39,17 +48,22 @@
                 if((style = icons.get("n" + key + "=" + val)) != null)
                 {
-                    if((ret == null || style.priority > ret.priority) && style.check(keys))
+                    if(ret == null || style.priority > ret.priority)
                         ret = style;
                 }
                 if((style = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null)
                 {
-                    if((ret == null || style.priority > ret.priority) && style.check(keys))
+                    if(ret == null || style.priority > ret.priority)
                         ret = style;
                 }
                 if((style = icons.get("x" + key)) != null)
                 {
-                    if((ret == null || style.priority > ret.priority) && style.check(keys))
+                    if(ret == null || style.priority > ret.priority)
                         ret = style;
                 }
+            }
+            for(IconElemStyle s : iconsList)
+            {
+                if((ret == null || s.priority > ret.priority) && s.check(keys))
+                    ret = s;
             }
             return ret;
@@ -71,40 +85,57 @@
                 if((styleArea = areas.get(idx)) != null && (retArea == null
                 || styleArea.priority > retArea.priority) && (!noclosed
-                || !styleArea.closed) && styleArea.check(keys))
+                || !styleArea.closed))
                     retArea = styleArea;
                 if((styleLine = lines.get(idx)) != null && (retLine == null
-                || styleLine.priority > retLine.priority) && styleLine.check(keys))
+                || styleLine.priority > retLine.priority))
                 {
                     retLine = styleLine;
                     linestring = idx;
                 }
-                if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys))
+                if((styleLine = modifiers.get(idx)) != null)
                     over.put(idx, styleLine);
                 idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
                 if((styleArea = areas.get(idx)) != null && (retArea == null
                 || styleArea.priority > retArea.priority) && (!noclosed
-                || !styleArea.closed) && styleArea.check(keys))
+                || !styleArea.closed))
                     retArea = styleArea;
                 if((styleLine = lines.get(idx)) != null && (retLine == null
-                || styleLine.priority > retLine.priority) && styleLine.check(keys))
+                || styleLine.priority > retLine.priority))
                 {
                     retLine = styleLine;
                     linestring = idx;
                 }
-                if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys))
+                if((styleLine = modifiers.get(idx)) != null)
                     over.put(idx, styleLine);
                 idx = "x" + key;
                 if((styleArea = areas.get(idx)) != null && (retArea == null
                 || styleArea.priority > retArea.priority) && (!noclosed
-                || !styleArea.closed) && styleArea.check(keys))
+                || !styleArea.closed))
                     retArea = styleArea;
                 if((styleLine = lines.get(idx)) != null && (retLine == null
-                || styleLine.priority > retLine.priority) && styleLine.check(keys))
+                || styleLine.priority > retLine.priority))
                 {
                     retLine = styleLine;
                     linestring = idx;
                 }
-                if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys))
+                if((styleLine = modifiers.get(idx)) != null)
                     over.put(idx, styleLine);
+            }
+            for(AreaElemStyle s : areasList)
+            {
+                if((retArea == null || s.priority > retArea.priority)
+                && (!noclosed || !s.closed) && s.check(keys))
+                    retArea = s;
+            }
+            for(LineElemStyle s : linesList)
+            {
+                if((retLine == null || s.priority > retLine.priority)
+                && s.check(keys))
+                    retLine = s;
+            }
+            for(LineElemStyle s : modifiersList)
+            {
+                if(s.check(keys))
+                    over.put(s.getCode(), s);
             }
             over.remove(linestring);
@@ -167,4 +198,9 @@
                         return true;
                 }
+                for(AreaElemStyle s : areasList)
+                {
+                    if(!(s.closed && noclosed) && s.check(o.keys))
+                        return true;
+                }
             }
             return false;
@@ -183,30 +219,62 @@
     }
 
-    public void add(String name, Rule r, LineElemStyle style)
-    {
-        String key = r.getKey();
-        style.code = key;
-        getStyleSet(name, true).lines.put(key, style);
-    }
-
-    public void addModifier(String name, Rule r, LineElemStyle style)
-    {
-        String key = r.getKey();
-        style.code = key;
-        getStyleSet(name, true).modifiers.put(key, style);
-    }
-
-    public void add(String name, Rule r, AreaElemStyle style)
-    {
-        String key = r.getKey();
-        style.code = key;
-        getStyleSet(name, true).areas.put(key, style);
-    }
-
-    public void add(String name, Rule r, IconElemStyle style)
-    {
-        String key = r.getKey();
-        style.code = key;
-        getStyleSet(name, true).icons.put(key, style);
+    public void add(String name, Rule r, Collection<Rule> rules, LineElemStyle style)
+    {
+        if(rules != null)
+        {
+            style.rules = rules;
+            getStyleSet(name, true).linesList.add(style);
+        }
+        else
+        {
+            String key = r.getKey();
+            style.code = key;
+            getStyleSet(name, true).lines.put(key, style);
+        }
+    }
+
+    public void addModifier(String name, Rule r, Collection<Rule> rules, LineElemStyle style)
+    {
+        if(rules != null)
+        {
+            style.rules = rules;
+            getStyleSet(name, true).modifiersList.add(style);
+        }
+        else
+        {
+            String key = r.getKey();
+            style.code = key;
+            getStyleSet(name, true).modifiers.put(key, style);
+        }
+    }
+
+    public void add(String name, Rule r, Collection<Rule> rules, AreaElemStyle style)
+    {
+        if(rules != null)
+        {
+            style.rules = rules;
+            getStyleSet(name, true).areasList.add(style);
+        }
+        else
+        {
+            String key = r.getKey();
+            style.code = key;
+            getStyleSet(name, true).areas.put(key, style);
+        }
+    }
+
+    public void add(String name, Rule r, Collection<Rule> rules, IconElemStyle style)
+    {
+        if(rules != null)
+        {
+            style.rules = rules;
+            getStyleSet(name, true).iconsList.add(style);
+        }
+        else
+        {
+            String key = r.getKey();
+            style.code = key;
+            getStyleSet(name, true).icons.put(key, style);
+        }
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/IconElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/IconElemStyle.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/IconElemStyle.java	(revision 1747)
@@ -13,4 +13,5 @@
         this.maxScale = maxScale;
         this.minScale = minScale;
+        this.rules = i.rules;
     }
     public IconElemStyle() { init(); }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java	(revision 1747)
@@ -30,4 +30,5 @@
         this.maxScale = maxScale;
         this.minScale = minScale;
+        this.rules = s.rules;
     }
 
@@ -44,4 +45,5 @@
         this.maxScale = s.maxScale;
         this.minScale = s.minScale;
+        this.rules = s.rules;
 
         this.overlays = overlays;
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/Rule.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/Rule.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/Rule.java	(revision 1747)
@@ -9,4 +9,14 @@
     String boolValue;
 
+    public Rule()
+    {
+      init();
+    }
+    public Rule(Rule r)
+    {
+      key = r.key;
+      value = r.value;
+      boolValue = r.boolValue;
+    }
     public String getKey()
     {
@@ -23,6 +33,11 @@
     }
 
+    public String toString()
+    {
+      return "Rule["+key+","+(boolValue != null ? "b="+boolValue:"v="+value)+"]";
+    }
+    public String toCode()
+    {
+      return "[k="+key+(boolValue != null ? ",b="+boolValue:",v="+value)+"]";
+    }
 }
-
-
-
Index: trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java	(revision 1747)
@@ -54,10 +54,10 @@
         projPanel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
         projPanel.setLayout(new GridBagLayout());
+        projPanel.add(new JLabel(tr("Display coordinates as")), GBC.std().insets(5,5,0,5));
+        projPanel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL));
+        projPanel.add(coordinatesCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,5,5,5));
         projPanel.add(new JLabel(tr("Projection method")), GBC.std().insets(5,5,0,5));
         projPanel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL));
         projPanel.add(projectionCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,5,5,5));
-        projPanel.add(new JLabel(tr("Display coordinates as")), GBC.std().insets(5,5,0,5));
-        projPanel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL));
-        projPanel.add(coordinatesCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,5,5,5));
         projPanel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH));
         JScrollPane scrollpane = new JScrollPane(projPanel);
Index: trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java	(revision 1747)
@@ -95,5 +95,5 @@
     }
 
-    public StyleSources(String pref, String iconpref, String url, boolean named, final String name)
+    public StyleSources(String pref, String iconpref, final String url, boolean named, final String name)
     {
         sourcesList = new JList(new DefaultListModel());
@@ -199,4 +199,19 @@
                     ((DefaultListModel)sourcesList.getModel()).addElement(
                     ((SourceInfo)sourcesDefaults.getSelectedValue()).url);
+                }
+            }
+        });
+
+        JButton update = new JButton(tr("Update"));
+        update.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                MirroredInputStream.cleanup(url);
+                getDefaults(url);
+                int num = sourcesList.getModel().getSize();
+                if (num > 0)
+                {
+                    ArrayList<String> l = new ArrayList<String>();
+                    for (int i = 0; i < num; ++i)
+                        MirroredInputStream.cleanup((String)sourcesList.getModel().getElementAt(i));
                 }
             }
@@ -219,5 +234,6 @@
         buttonPanel.add(edit, GBC.std().insets(5,5,5,0));
         buttonPanel.add(delete, GBC.std().insets(0,5,5,0));
-        buttonPanel.add(copy, GBC.std().insets(0,5,0,0));
+        buttonPanel.add(copy, GBC.std().insets(0,5,5,0));
+        buttonPanel.add(update, GBC.std().insets(0,5,0,0));
         if(iconsList != null)
         {
@@ -265,4 +281,5 @@
     public void getDefaults(String name)
     {
+        ((DefaultListModel)sourcesDefaults.getModel()).removeAllElements();
         String lang = Main.getLanguageCode()+"_";
         try
Index: trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 1746)
+++ trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 1747)
@@ -62,4 +62,28 @@
     {
        return file;
+    }
+
+    static public void cleanup(String name)
+    {
+      cleanup(name, null);
+    }
+    static public void cleanup(String name, String destDir)
+    {
+        URL url;
+        try {
+            url = new URL(name);
+            if (!url.getProtocol().equals("file"))
+            {
+                String localPath = Main.pref.get("mirror." + url);
+                if (localPath != null && localPath.length() > 0)
+                {
+                    String[] lp = localPath.split(";");
+                    File lfile = new File(lp[1]);
+                    if(lfile.exists())
+                        lfile.delete();
+                }
+                Main.pref.put("mirror." + url, null);
+            }
+        } catch (java.net.MalformedURLException e) {}
     }
 
