Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Buildings.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Buildings.java	(revision 20930)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Buildings.java	(revision 20931)
@@ -55,4 +55,6 @@
         public Point p;
         public int dir;
+        @SuppressWarnings("unused")
+        public boolean toKeep;
         public Pixel(int x, int y, int dir) {
             this.p = new Point(x,y);
@@ -69,9 +71,16 @@
             return p.equals(obj);
         }
+        @Override
+        public String toString() {
+            return new String("p="+p+", dir="+dir);
+        }
     }
     private ArrayList<Pixel> listPixels = new ArrayList<Pixel>();
     
-    private static final int cMaxnode = 10000;
-    private static final double cDistanceForOptimization = 0.7;
+    //  5 6 7
+    //   \|/ 
+    //  4-*-0       'dir' index vs pixel direction
+    //   /|\
+    //  3 2 1
     private int[] dirsX = new int[] {1,1,0,-1,-1,-1,0,1};
     private int[] dirsY = new int[] {0,1,1,1,0,-1,-1,-1};
@@ -80,8 +89,11 @@
     BuildingsImageModifier bim = new BuildingsImageModifier();
 
-    private double snapDistance = Main.pref.getDouble("cadastrewms.snap-distance", 50); // in centimeters
+    private static final int cMaxnode = 10000;
+    private static final double cDistanceForOptimization = 0.5;
+    private double snapDistance = Main.pref.getDouble("cadastrewms.snap-distance", 25); // in centimeters
+    private double SimplifyFactor = 0.1;
+
     private double snapDistanceSq = snapDistance*snapDistance;
     private double dx, dy;
-
     
     public Buildings(MapFrame mapFrame) {
@@ -154,5 +166,5 @@
                     }
                     wayToCreate.addNode(wayToCreate.getNode(0)); // close the way
-                    new SimplifyWay().simplifyWay(wayToCreate, 0.2);
+                    new SimplifyWay().simplifyWay(wayToCreate, SimplifyFactor);
                     // move the node closing the loop and simplify again
                     for (int i = 1; i < wayToCreate.getNodesCount(); i++) {
@@ -160,5 +172,5 @@
                     }
                     way2.addNode(way2.getNode(0));
-                    new SimplifyWay().simplifyWay(way2, 0.2);
+                    new SimplifyWay().simplifyWay(way2, SimplifyFactor);
                     simplifyAngles(way2);
                     Way wayToAdd = new Way();
@@ -315,4 +327,5 @@
             addPixeltoList(x, y, new_dir);
         }
+        inflate();
         System.out.println("list size="+listPixels.size());
         return true;
@@ -322,4 +335,45 @@
         listPixels.add( new Pixel(x, y, dir));
         System.out.println("added pixel at "+x+","+y);
+    }
+    
+    private void inflate() {
+        // TODO
+        if (listPixels.size() > 1) {
+//            for (int i=1; i<listPixels.size()-1; i++) {
+//                int delta_dir = Math.abs((listPixels.get(i+1).dir - listPixels.get(i-1).dir + 8)%8);
+//                if (delta_dir > 1 && delta_dir < 4) {
+//                    System.out.println(listPixels.get(i).dir);
+//                    int j = i;
+//                    if (listPixels.get(i).dir == 0 || listPixels.get(i).dir == 1 || listPixels.get(i).dir == 4 || listPixels.get(i).dir == 2)
+//                        j = i-1;
+//                    listPixels.get(j).toKeep = true;
+//                    i+=2;
+//                    selectedImage.image.setRGB(listPixels.get(j).p.x, listPixels.get(j).p.y, Color.GREEN.getRGB());
+//                }
+//            }
+            ArrayList<Pixel> newList = new ArrayList<Pixel>();
+            for (int i=0; i<listPixels.size(); i++) {
+//                    selectedImage.image.setRGB(listPixels.get(i).p.x, listPixels.get(i).p.y, Color.GREEN.getRGB());
+                boolean inflatedPixel = false;
+                for (int j=0; j<3; j++) {
+                    if ((i+j-1) > 0 && (i+j-1) < listPixels.size()) {
+                        int inflate_dir = (listPixels.get(i+j-1).dir+6)%8;
+                        Pixel p = new Pixel(listPixels.get(i).p.x+dirsX[inflate_dir],
+                              listPixels.get(i).p.y+dirsY[inflate_dir],
+                              listPixels.get(i).dir);
+                        if (bim.isParcelColor(selectedImage.image, p.p.x, p.p.y)) {
+                            if (!newList.contains(p))
+                                newList.add(p);
+                            inflatedPixel = true;
+                        } 
+                    }
+                }
+                if (!inflatedPixel) {
+                    if (!newList.contains(listPixels.get(i)))
+                        newList.add(listPixels.get(i));
+                }
+            }
+            listPixels = newList;
+        }
     }
     
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java	(revision 20930)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java	(revision 20931)
@@ -94,23 +94,30 @@
     public boolean loadCacheIfExist() {
         try {
-            File file = new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "." + WMSFileExtension());
-            if (file.exists()) {
-                JOptionPane pane = new JOptionPane(
-                        tr("Location \"{0}\" found in cache.\n"+
-                        "Load cache first ?\n"+
-                        "(No = new cache)", wmsLayer.getName()),
-                        JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null);
-                // this below is a temporary workaround to fix the "always on top" issue
-                JDialog dialog = pane.createDialog(Main.parent, tr("Select Feuille"));
-                CadastrePlugin.prepareDialog(dialog);
-                dialog.setVisible(true);
-                int reply = (Integer)pane.getValue();
-                // till here
-
-                if (reply == JOptionPane.OK_OPTION && loadCache(file, wmsLayer.getLambertZone())) {
-                    return true;
-                } else {
-                    delete(file);
+            if (!wmsLayer.isBuildingsOnly()) {
+                File file = new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "." + WMSFileExtension());
+                if (file.exists()) {
+                    JOptionPane pane = new JOptionPane(
+                            tr("Location \"{0}\" found in cache.\n"+
+                            "Load cache first ?\n"+
+                            "(No = new cache)", wmsLayer.getName()),
+                            JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null);
+                    // this below is a temporary workaround to fix the "always on top" issue
+                    JDialog dialog = pane.createDialog(Main.parent, tr("Select Feuille"));
+                    CadastrePlugin.prepareDialog(dialog);
+                    dialog.setVisible(true);
+                    int reply = (Integer)pane.getValue();
+                    // till here
+    
+                    if (reply == JOptionPane.OK_OPTION && loadCache(file, wmsLayer.getLambertZone())) {
+                        return true;
+                    } else {
+                        delete(file);
+                    }
                 }
+            } else {
+                int i=0;
+                while (new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "."+i+"."+ WMSFileExtension()).exists())
+                    i++;
+                wmsLayer.setName(wmsLayer.getName()+"."+i);
             }
         } catch (Exception e) {
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java	(revision 20930)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java	(revision 20931)
@@ -132,4 +132,9 @@
     }
 
+    public boolean isParcelColor(BufferedImage img, int x, int y) {
+        int rgb = img.getRGB(x, y);
+        return (rgb == parcelColor);
+    }
+
     public boolean isBuildingOrRoofColor(BufferedImage img, int x, int y, boolean ignoreParcelColor) {
         int rgb = img.getRGB(x, y);
@@ -147,5 +152,5 @@
         return ret;
     }
-
+    
     /**
      * Checks if the rgb value is the black background color
