Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 2579)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 2580)
@@ -59,5 +59,4 @@
     protected boolean drawRestriction;
     protected boolean leftHandTraffic;
-    //protected boolean restrictionDebug;
     protected int showNames;
     protected int showIcons;
@@ -81,11 +80,4 @@
     private EastNorth maxEN;
 
-    //protected int profilerVisibleNodes;
-    //protected int profilerVisibleWays;
-    //protected int profilerVisibleAreas;
-    //protected int profilerSegments;
-    //protected int profilerVisibleSegments;
-    //protected boolean profilerOmitDraw;
-
     protected boolean isZoomOk(ElemStyle e) {
         if (!zoomLevelDisplay) /* show everything if the user wishes so */
@@ -151,7 +143,4 @@
         IconElemStyle nodeStyle = (IconElemStyle)getPrimitiveStyle(n);
 
-        //if(profilerOmitDraw)
-        //    return;
-
         if (nodeStyle != null && isZoomOk(nodeStyle) && showIcons > dist) {
             if (inactive || n.isDisabled()) {
@@ -219,6 +208,4 @@
         {
             /* way without style */
-            //profilerVisibleWays++;
-            //if(!profilerOmitDraw)
             drawWay(w, null, untaggedColor, data.isSelected(w));
         }
@@ -226,6 +213,4 @@
         {
             /* way with line style */
-            //profilerVisibleWays++;
-            //if(!profilerOmitDraw)
             drawWay(w, (LineElemStyle)wayStyle, untaggedColor, data.isSelected(w));
         }
@@ -234,9 +219,6 @@
             AreaElemStyle areaStyle = (AreaElemStyle) wayStyle;
             /* way with area style */
-            //if(!profilerOmitDraw)
-            //{
             if (fillAreas > dist)
             {
-                //    profilerVisibleAreas++;
                 drawArea(w, data.isSelected(w) ? selectedColor : areaStyle.color);
                 if(!w.isClosed()) {
@@ -245,5 +227,4 @@
             }
             drawWay(w, areaStyle.line, areaStyle.color, data.isSelected(w));
-            //}
         }
     }
@@ -468,5 +449,4 @@
                 w = new Way(w);
                 w.setNodes(n);
-                // Do not mess with the DataSet's contents here.
             }
             if(!w.isClosed())
@@ -544,10 +524,5 @@
     }
 
-    /* this current experimental implementation will only work for standard restrictions:
-       from(Way) / via(Node) / to(Way) */
     public void drawRestriction(Relation r) {
-        //if(restrictionDebug)
-        //    System.out.println("Restriction: " + r.keys.get("name") + " restriction " + r.keys.get("restriction"));
-
         Way fromWay = null;
         Way toWay = null;
@@ -557,7 +532,4 @@
         for (RelationMember m : r.getMembers())
         {
-            //if(restrictionDebug)
-            //    System.out.println("member " + m.member + " selected " + r.selected);
-
             if (m.getMember().isDeleted()) {
                 putError(r, tr("Deleted member ''{0}'' in relation.",
@@ -677,8 +649,6 @@
         Node fromNode = null;
         if(fromWay.firstNode() == via) {
-            //System.out.println("From way heading away from via");
             fromNode = fromWay.getNode(1);
         } else {
-            //System.out.println("From way heading towards via");
             fromNode = fromWay.getNode(fromWay.getNodesCount()-2);
         }
@@ -686,28 +656,4 @@
         Point pFrom = nc.getPoint(fromNode);
         Point pVia = nc.getPoint(viaNode);
-
-        //if(restrictionDebug) {
-        /* find the "direct" node after the via node */
-        //    Node toNode = null;
-        //    if(toWay.firstNode() == via) {
-        //      System.out.println("To way heading away from via");
-        //        toNode = toWay.nodes.get(1);
-        //    } else {
-        //        System.out.println("To way heading towards via");
-        //        toNode = toWay.nodes.get(toWay.nodes.size()-2);
-        //    }
-        //    Point pTo = nc.getPoint(toNode);
-
-        //    /* debug output of interesting nodes */
-        //    System.out.println("From: " + fromNode);
-        //    drawNode(fromNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
-        //    System.out.println("Via: " + via);
-        //    drawNode(via, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
-        //    System.out.println("To: " + toNode);
-        //    drawNode(toNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
-        //    System.out.println("From X: " + pFrom.x + " Y " + pFrom.y);
-        //    System.out.println("Via  X: " + pVia.x  + " Y " + pVia.y);
-        //    System.out.println("To   X: " + pTo.x   + " Y " + pTo.y);
-        //}
 
         /* starting from via, go back the "from" way a few pixels
@@ -736,7 +682,4 @@
             vy = -vy;
         }
-
-        //if(restrictionDebug)
-        //    System.out.println("vx " + vx + " vy " + vy);
 
         /* go a few pixels away from the way (in a right angle)
@@ -798,6 +741,4 @@
 
         /* rotate icon with direction last node in from to */
-        //if(restrictionDebug)
-        //    System.out.println("Deg1 " + fromAngleDeg + " Deg2 " + (fromAngleDeg + 180) + " Icon " + iconAngle);
         ImageIcon rotatedIcon = ImageProvider.createRotatedImage(null /*icon2*/, inactive || r.isDisabled() ? 
                                                                                     nodeStyle.getDisabledIcon() :
@@ -1171,11 +1112,4 @@
                         (int)nb.getHeight());
 
-                //// Draw name bounding box for debugging:
-                // g.setColor(new Color(255,255,0,128));
-                // g.drawRect((int)centeredNBounds.getMinX(),
-                //     (int)centeredNBounds.getMinY(),
-                //     (int)centeredNBounds.getWidth(),
-                //     (int)centeredNBounds.getHeight());
-
                 if ((pb.width >= nb.getWidth() && pb.height >= nb.getHeight()) && // quick check
                         polygon.contains(centeredNBounds) // slow but nice
@@ -1217,6 +1151,4 @@
         if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
 
-        //profilerVisibleNodes++;
-
         int w = icon.getIconWidth(), h=icon.getIconHeight();
         icon.paintIcon ( Main.map.mapView, g, p.x-w/2, p.y-h/2 );
@@ -1258,5 +1190,4 @@
 
     private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, float dashed[], Color dashedColor) {
-        //profilerSegments++;
         if (col != currentColor || width != currentWidth || !Arrays.equals(dashed,currentDashed) || dashedColor != currentDashedColor) {
             displaySegments(col, width, dashed, dashedColor);
@@ -1267,5 +1198,4 @@
         if (!isSegmentVisible(p1, p2))
             return;
-        //profilerVisibleSegments++;
         currentPath.moveTo(p1.x, p1.y);
         currentPath.lineTo(p2.x, p2.y);
@@ -1348,6 +1278,4 @@
                 return;
 
-            //profilerVisibleNodes++;
-
             if (inactive || n.isDisabled()) {
                 g.setColor(inactiveColor);
@@ -1419,6 +1347,4 @@
         BBox bbox = new BBox(bounds);
         this.data = data;
-        //boolean profiler = Main.pref.getBoolean("mappaint.profiler",false);
-        //profilerOmitDraw = Main.pref.getBoolean("mappaint.profiler.omitdraw",false);
 
         useStyleCache = Main.pref.getBoolean("mappaint.cache", true);
@@ -1432,14 +1358,4 @@
         dist = ll1.greatCircleDistance(ll2);
 
-        //long profilerStart = java.lang.System.currentTimeMillis();
-        //long profilerLast = profilerStart;
-        //int profilerN;
-        //if(profiler)
-        //    System.out.println("Mappaint Profiler (" +
-        //        (useStyleCache ? "cache=true, " : "cache=false, ") +
-        //        "fillareas " + fillAreas + ", " +
-        //        "fillalpha=" + fillAlpha + "%, " +
-        //        "dist=" + (int)dist + "m)");
-
         getSettings(virtual);
         useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth", false);
@@ -1449,5 +1365,4 @@
         drawMultipolygon = Main.pref.getBoolean("mappaint.multipolygon", true);
         drawRestriction = Main.pref.getBoolean("mappaint.restriction", true);
-        //restrictionDebug = Main.pref.getBoolean("mappaint.restriction.debug",false);
         leftHandTraffic = Main.pref.getBoolean("mappaint.lefthandtraffic", false);
         orderFont = new Font(Main.pref.get("mappaint.font", "Helvetica"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8));
@@ -1461,87 +1376,38 @@
         ++paintid;
 
-        //profilerVisibleNodes = 0;
-        //profilerVisibleWays = 0;
-        //profilerVisibleAreas = 0;
-        //profilerSegments = 0;
-        //profilerVisibleSegments = 0;
-
-        //if(profiler)
-        //{
-        //    System.out.format("Prepare  : %5dms\n", (java.lang.System.currentTimeMillis()-profilerLast));
-        //    profilerLast = java.lang.System.currentTimeMillis();
-        //}
-
         if (fillAreas > dist && styles != null && styles.hasAreas()) {
             Collection<Way> noAreaWays = new LinkedList<Way>();
 
             /*** RELATIONS ***/
-            //    profilerN = 0;
             for (final Relation osm: data.getRelations()) {
                 if (drawable(osm)) {
                     paintUnselectedRelation(osm);
-                    //            profilerN++;
-                }
-            }
-
-            //    if(profiler)
-            //    {
-            //        System.out.format("Relations: %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
-            //        profilerLast = java.lang.System.currentTimeMillis();
-            //    }
+                }
+            }
 
             /*** AREAS ***/
-            //    profilerN = 0;
             for (final Way osm : selectedLast(data, data.searchWays(bbox))) {
                 if (drawable(osm) && osm.mappaintDrawnCode != paintid) {
-                    if (isPrimitiveArea(osm) && osm.mappaintDrawnAreaCode != paintid) {
+                    if (isPrimitiveArea(osm) && osm.mappaintDrawnAreaCode != paintid)
                         drawWay(osm, fillAreas);
-                        //                profilerN++;
-                    }// else {
-                    noAreaWays.add(osm);
-                    //}
-                }
-            }
-
-            //    if(profiler)
-            //    {
-            //        System.out.format("Areas    : %5dms, calls=%7d, visible=%d\n",
-            //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleAreas);
-            //        profilerLast = java.lang.System.currentTimeMillis();
-            //    }
+                    else
+                        noAreaWays.add(osm);
+                }
+            }
 
             /*** WAYS ***/
-            //    profilerN = 0;
             for (final Way osm : noAreaWays) {
                 drawWay(osm, 0);
-                //        profilerN++;
-            }
-
-            //    if(profiler)
-            //    {
-            //        System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
-            //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
-            //        profilerLast = java.lang.System.currentTimeMillis();
-            //    }
+            }
         } else {
             /*** WAYS (filling disabled)  ***/
-            //    profilerN = 0;
             for (final Way way: data.getWays()) {
                 if (drawable(way) && !data.isSelected(way)) {
                     drawWay(way, 0);
-                    //            profilerN++;
-                }
-            }
-
-            //    if(profiler)
-            //    {
-            //        System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
-            //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
-            //        profilerLast = java.lang.System.currentTimeMillis();
-            //    }
+                }
+            }
         }
 
         /*** SELECTED  ***/
-        //profilerN = 0;
         for (final OsmPrimitive osm : data.getSelected()) {
             if (!osm.isIncomplete() && !osm.isDeleted() && !(osm instanceof Node)
@@ -1559,6 +1425,4 @@
                     public void visit(Relation r) {
                         /* TODO: is it possible to do this like the nodes/ways code? */
-                        //if(profilerOmitDraw)
-                        //    return;
                         for (RelationMember m : r.getMembers()) {
                             if (m.isNode() && drawable(m.getMember())) {
@@ -1568,13 +1432,6 @@
                     }
                 });
-                //        profilerN++;
-            }
-        }
-
-        //if(profiler)
-        //{
-        //    System.out.format("Selected : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
-        //    profilerLast = java.lang.System.currentTimeMillis();
-        //}
+            }
+        }
 
         /*** DISPLAY CACHED SEGMENTS (WAYS) NOW ***/
@@ -1582,5 +1439,4 @@
 
         /*** NODES ***/
-        //profilerN = 0;
         for (final Node osm: data.searchNodes(bbox)) {
             if (!osm.isIncomplete() && !osm.isDeleted() && (data.isSelected(osm) || !osm.isFiltered())
@@ -1588,18 +1444,9 @@
             {
                 drawNode(osm);
-                //        profilerN++;
-            }
-        }
-
-        //if(profiler)
-        //{
-        //    System.out.format("Nodes    : %5dms, calls=%7d, visible=%d\n",
-        //        (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleNodes);
-        //    profilerLast = java.lang.System.currentTimeMillis();
-        //}
+            }
+        }
 
         /*** VIRTUAL  ***/
         if (virtualNodeSize != 0) {
-            //    profilerN = 0;
             currentColor = nodeColor;
             for (final OsmPrimitive osm: data.searchWays(bbox)) {
@@ -1607,24 +1454,9 @@
                 {
                     /* TODO: move this into the SimplePaint code? */
-                    //            if(!profilerOmitDraw)
                     visitVirtual((Way)osm);
-                    //            profilerN++;
-                }
-            }
-
-            //    if(profiler)
-            //    {
-            //        System.out.format("Virtual  : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
-            //        profilerLast = java.lang.System.currentTimeMillis();
-            //    }
-
+                }
+            }
             displaySegments(null);
         }
-
-        //if(profiler)
-        //{
-        //    System.out.format("Segments :          calls=%7d, visible=%d\n", profilerSegments, profilerVisibleSegments);
-        //    System.out.format("All      : %5dms\n", (profilerLast-profilerStart));
-        //}
     }
 
