Changeset 13186 in josm for trunk


Ignore:
Timestamp:
2017-12-02T21:06:00+01:00 (6 years ago)
Author:
Don-vip
Message:

fix recent Sonar issues

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java

    r13167 r13186  
    221221            Pair<Integer, Hemisphere> utmZone = TransverseMercator.locateUtmZone(n.getCoor());
    222222            String utmLabel = tr("UTM Zone");
    223             add(utmLabel, utmLabel.endsWith(":") ? " " : ": ", Integer.toString(utmZone.a), utmZone.b.toString().substring(0, 1));
     223            add(utmLabel, utmLabel.endsWith(":") ? " " : ": ", Integer.toString(utmZone.a), utmZone.b.name().substring(0, 1));
    224224        }
    225225    }
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r13131 r13186  
    779779
    780780        // overscan to prevent empty edges when zooming in to zoom scales > 2:1
    781         if (w > imgRect.width && h > imgRect.height && !imgRect.isFullView1D()) {
    782             if (wFact != hFact) {
    783                 if (wFact > hFact) {
    784                     w = compRect.width;
    785                     x = 0;
    786                     h = wFact / imgRect.width;
    787                     y = (compRect.height - h) / 2;
    788                 } else {
    789                     h = compRect.height;
    790                     y = 0;
    791                     w = hFact / imgRect.height;
    792                     x = (compRect.width - w) / 2;
    793                 }
     781        if (w > imgRect.width && h > imgRect.height && !imgRect.isFullView1D() && wFact != hFact) {
     782            if (wFact > hFact) {
     783                w = compRect.width;
     784                x = 0;
     785                h = wFact / imgRect.width;
     786                y = (compRect.height - h) / 2;
     787            } else {
     788                h = compRect.height;
     789                y = 0;
     790                w = hFact / imgRect.height;
     791                x = (compRect.width - w) / 2;
    794792            }
    795793        }
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r13129 r13186  
    19731973     * Converts an {@link Rectangle} area of {@link Image} to a {@link BufferedImage} instance.
    19741974     * @param image image to convert
    1975      * @param crop_area rectangle to crop image with
     1975     * @param cropArea rectangle to crop image with
    19761976     * @return a {@code BufferedImage} instance for the cropped area of {@code Image}.
    19771977     * @since 13127
    19781978     */
    1979     public static BufferedImage toBufferedImage(Image image, Rectangle crop_area) {
     1979    public static BufferedImage toBufferedImage(Image image, Rectangle cropArea) {
    19801980        BufferedImage buffImage = null;
    19811981        Rectangle r = new Rectangle(image.getWidth(null), image.getHeight(null));
    1982         if (r.intersection(crop_area).equals(crop_area)) {
    1983             buffImage = new BufferedImage(crop_area.width, crop_area.height, BufferedImage.TYPE_INT_ARGB);
     1982        if (r.intersection(cropArea).equals(cropArea)) {
     1983            buffImage = new BufferedImage(cropArea.width, cropArea.height, BufferedImage.TYPE_INT_ARGB);
    19841984            Graphics2D g2 = buffImage.createGraphics();
    1985             g2.drawImage(image, 0, 0, crop_area.width, crop_area.height,
    1986                 crop_area.x, crop_area.y, crop_area.x + crop_area.width, crop_area.y + crop_area.height, null);
     1985            g2.drawImage(image, 0, 0, cropArea.width, cropArea.height,
     1986                cropArea.x, cropArea.y, cropArea.x + cropArea.width, cropArea.y + cropArea.height, null);
    19871987            g2.dispose();
    19881988        }
Note: See TracChangeset for help on using the changeset viewer.