Changeset 10342 in josm


Ignore:
Timestamp:
2016-06-08T22:55:13+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #12933 - remove unused methods from NavigatableComponent (patch by michael2402, extended) - gsoc-core

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r10308 r10342  
    501501            if (ctrl && Main.isPlatformOsx()) {
    502502                selectionManager.unregister(mv);
    503                 mv.requestClearRect();
    504503                // Make sure correct cursor is displayed
    505504                mv.setNewCursor(Cursor.MOVE_CURSOR, this);
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r10234 r10342  
    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;
     
    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;
     
    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
     
    299292    public static String getDistText(final double dist, final NumberFormat format, final double threshold) {
    300293        return SystemOfMeasurement.getSystemOfMeasurement().getDistText(dist, format, threshold);
    301     }
    302 
    303     /**
    304      * Returns the text describing the given area in the current system of measurement.
    305      * @param area The distance in square metres.
    306      * @return the text describing the given area in the current system of measurement.
    307      * @since 5560
    308      */
    309     public static String getAreaText(double area) {
    310         return SystemOfMeasurement.getSystemOfMeasurement().getAreaText(area);
    311     }
    312 
    313     /**
    314      * Returns the text describing the given area in the current system of measurement.
    315      * @param area The area in square metres
    316      * @param format A {@link NumberFormat} to format the area value
    317      * @param threshold Values lower than this {@code threshold} are displayed as {@code "< [threshold]"}
    318      * @return the text describing the given area in the current system of measurement.
    319      * @since 7135
    320      */
    321     public static String getAreaText(final double area, final NumberFormat format, final double threshold) {
    322         return SystemOfMeasurement.getSystemOfMeasurement().getAreaText(area, format, threshold);
    323294    }
    324295
     
    607578    public void zoomTo(LatLon newCenter) {
    608579        zoomTo(Projections.project(newCenter));
    609     }
    610 
    611     public void smoothScrollTo(LatLon newCenter) {
    612         smoothScrollTo(Projections.project(newCenter));
    613580    }
    614581
     
    14021369    }
    14031370
    1404     public static double perDist(Point2D pt, Point2D a, Point2D b) {
    1405         if (pt != null && a != null && b != null) {
    1406             double pd =
    1407                     (a.getX()-pt.getX())*(b.getX()-a.getX()) -
    1408                     (a.getY()-pt.getY())*(b.getY()-a.getY());
    1409             return Math.abs(pd) / a.distance(b);
    1410         }
    1411         return 0d;
    1412     }
    1413 
    1414     /**
    1415      *
    1416      * @param pt point to project onto (ab)
    1417      * @param a root of vector
    1418      * @param b vector
    1419      * @return point of intersection of line given by (ab)
    1420      *      with its orthogonal line running through pt
    1421      */
    1422     public static Point2D project(Point2D pt, Point2D a, Point2D b) {
    1423         if (pt != null && a != null && b != null) {
    1424             double r = (
    1425                     (pt.getX()-a.getX())*(b.getX()-a.getX()) +
    1426                     (pt.getY()-a.getY())*(b.getY()-a.getY()))
    1427                     / a.distanceSq(b);
    1428             return project(r, a, b);
    1429         }
    1430         return null;
    1431     }
    1432 
    14331371    /**
    14341372     * if r = 0 returns a, if r=1 returns b,
     
    15721510    }
    15731511
    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 
    16471512    /**
    16481513     * Get a max scale for projection that describes world in 1/512 of the projection unit
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/MapViewMock.java

    r10271 r10342  
    4949
    5050    @Override
    51     public void requestClearRect() {}
    52 
    53     @Override
    5451    public Point2D getPoint2D(EastNorth p) {
    5552        return p != null ? new Point2D.Double(p.getX(), p.getY()) : null;
Note: See TracChangeset for help on using the changeset viewer.