Ticket #12933: patch-mapview-remove-paint-poly.patch

File patch-mapview-remove-paint-poly.patch, 3.7 KB (added by michael2402, 9 years ago)
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

    diff --git a/src/org/openstreetmap/josm/gui/NavigatableComponent.java b/src/org/openstreetmap/josm/gui/NavigatableComponent.java
    index 9334562..aca69f4 100644
    a b  
    22package org.openstreetmap.josm.gui;
    33
    44import java.awt.Cursor;
    5 import java.awt.Graphics;
    65import java.awt.Point;
    7 import java.awt.Polygon;
    86import java.awt.Rectangle;
    97import java.awt.geom.AffineTransform;
    108import java.awt.geom.Point2D;
    import org.openstreetmap.josm.data.osm.Relation;  
    4341import org.openstreetmap.josm.data.osm.Way;
    4442import org.openstreetmap.josm.data.osm.WaySegment;
    4543import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    46 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    4744import org.openstreetmap.josm.data.preferences.BooleanProperty;
    4845import org.openstreetmap.josm.data.preferences.DoubleProperty;
    4946import org.openstreetmap.josm.data.preferences.IntegerProperty;
    public class NavigatableComponent extends JComponent implements Helpful {  
    142139     */
    143140    protected EastNorth center = calculateDefaultCenter();
    144141
    145     private final transient Object paintRequestLock = new Object();
    146     private Rectangle paintRect;
    147     private Polygon paintPoly;
    148 
    149142    protected transient ViewportData initialViewport;
    150143
    151144    protected final transient CursorManager cursorManager = new CursorManager(this);
    public class NavigatableComponent extends JComponent implements Helpful {  
    15711564        return cursorManager;
    15721565    }
    15731566
    1574     @Override
    1575     public void paint(Graphics g) {
    1576         synchronized (paintRequestLock) {
    1577             if (paintRect != null) {
    1578                 Graphics g2 = g.create();
    1579                 g2.setColor(Utils.complement(PaintColors.getBackgroundColor()));
    1580                 g2.drawRect(paintRect.x, paintRect.y, paintRect.width, paintRect.height);
    1581                 g2.dispose();
    1582             }
    1583             if (paintPoly != null) {
    1584                 Graphics g2 = g.create();
    1585                 g2.setColor(Utils.complement(PaintColors.getBackgroundColor()));
    1586                 g2.drawPolyline(paintPoly.xpoints, paintPoly.ypoints, paintPoly.npoints);
    1587                 g2.dispose();
    1588             }
    1589         }
    1590         super.paint(g);
    1591     }
    1592 
    1593     /**
    1594      * Requests to paint the given {@code Rectangle}.
    1595      * @param r The Rectangle to draw
    1596      * @see #requestClearRect
    1597      * @since 5500
    1598      */
    1599     public void requestPaintRect(Rectangle r) {
    1600         if (r != null) {
    1601             synchronized (paintRequestLock) {
    1602                 paintRect = r;
    1603             }
    1604             repaint();
    1605         }
    1606     }
    1607 
    1608     /**
    1609      * Requests to paint the given {@code Polygon} as a polyline (unclosed polygon).
    1610      * @param p The Polygon to draw
    1611      * @see #requestClearPoly
    1612      * @since 5500
    1613      */
    1614     public void requestPaintPoly(Polygon p) {
    1615         if (p != null) {
    1616             synchronized (paintRequestLock) {
    1617                 paintPoly = p;
    1618             }
    1619             repaint();
    1620         }
    1621     }
    1622 
    1623     /**
    1624      * Requests to clear the rectangled previously drawn.
    1625      * @see #requestPaintRect
    1626      * @since 5500
    1627      */
    1628     public void requestClearRect() {
    1629         synchronized (paintRequestLock) {
    1630             paintRect = null;
    1631         }
    1632         repaint();
    1633     }
    1634 
    1635     /**
    1636      * Requests to clear the polyline previously drawn.
    1637      * @see #requestPaintPoly
    1638      * @since 5500
    1639      */
    1640     public void requestClearPoly() {
    1641         synchronized (paintRequestLock) {
    1642             paintPoly = null;
    1643         }
    1644         repaint();
    1645     }
    1646 
    16471567    /**
    16481568     * Get a max scale for projection that describes world in 1/512 of the projection unit
    16491569     * @return max scale