Ignore:
Timestamp:
2018-09-15T14:19:12+02:00 (6 years ago)
Author:
donvip
Message:

fix UnnecessaryParentheses warnings

Location:
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/SavePictureCalibrationToWorldAction.java

    r34544 r34655  
    77import java.io.BufferedWriter;
    88import java.io.File;
    9 import java.io.FileWriter;
    109import java.io.IOException;
     10import java.nio.charset.StandardCharsets;
     11import java.nio.file.Files;
    1112
    1213import javax.swing.JFileChooser;
     
    1617import org.openstreetmap.josm.gui.MainApplication;
    1718import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract;
     19import org.openstreetmap.josm.tools.Logging;
    1820
    1921/**
     
    7375                file = new File(path + "." + wext);
    7476            }
    75             try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) {
     77            try (BufferedWriter bw = Files.newBufferedWriter(file.toPath(), StandardCharsets.UTF_8)) {
    7678                for (int i = 0; i < 6; i++) {
    7779                    bw.write(Double.toString(values[i]));
     
    8183                }
    8284            } catch (IOException e) {
    83                 // Error
    84                 e.printStackTrace();
     85                Logging.error(e);
    8586                JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    8687                        tr("Saving file failed: {0}", e.getMessage()), tr("Problem occurred"), JOptionPane.WARNING_MESSAGE);
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/command/TransformCommand.java

    r34544 r34655  
    7777        afterTransform = extractTransform();
    7878
    79         boolean changed = !(beforeTransform.getTransform().equals(afterTransform.getTransform())) ||
    80             !(beforeTransform.getOriginPoints().equals(afterTransform.getOriginPoints())) ||
    81             !(beforeTransform.getImagePosition().equals(afterTransform.getImagePosition()));
     79        boolean changed = !beforeTransform.getTransform().equals(afterTransform.getTransform()) ||
     80            !beforeTransform.getOriginPoints().equals(afterTransform.getOriginPoints()) ||
     81            !beforeTransform.getImagePosition().equals(afterTransform.getImagePosition());
    8282        if (changed && !alreadyAdded) {
    8383            UndoRedoHandler.getInstance().add(this);
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java

    r34544 r34655  
    146146            EastNorth center = MainApplication.getMap().mapView.getCenter();
    147147
    148 //            imagePosition = new EastNorth(center.east(), center.north());
    149148            transformer.setImagePosition(new EastNorth(center.east(), center.north()));
    150 //            initialImagePosition = new EastNorth(imagePosition.east(), imagePosition.north());
    151149            // Initial scale at which the image was loaded
    152150            initialImageScale = MainApplication.getMap().mapView.getDist100Pixel();
     
    161159        }
    162160        // Load image completely
    163         (new ImageIcon(image)).getImage();
     161        new ImageIcon(image).getImage();
    164162
    165163        lookForCalibration();
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/kml/KMLReader.java

    r34544 r34655  
    33
    44import java.io.File;
    5 import java.io.FileReader;
    65import java.io.IOException;
     6import java.nio.charset.StandardCharsets;
     7import java.nio.file.Files;
    78import java.util.List;
    89
     
    2728            XMLReader xr = XMLReaderFactory.createXMLReader();
    2829            xr.setContentHandler(handler);
    29             xr.parse(new InputSource(new FileReader(file)));
     30            xr.parse(new InputSource(Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)));
    3031        } catch (SAXException | IOException e) {
    3132            Logging.error(e);
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/transform/Matrix3D.java

    r33822 r34655  
    5959        double s = 1/det;
    6060
    61         invert.a[0][0] = (s) * (a[1][1] * a[2][2] - a[1][2] * a[2][1]);
    62         invert.a[1][0] = (s) * (a[1][2] * a[2][0] - a[1][0] * a[2][2]);
    63         invert.a[2][0] = (s) * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);
    64         invert.a[0][1] = (s) * (a[0][2] * a[2][1] - a[0][1] * a[2][2]);
    65         invert.a[1][1] = (s) * (a[0][0] * a[2][2] - a[0][2] * a[2][0]);
    66         invert.a[2][1] = (s) * (a[0][1] * a[2][0] - a[0][0] * a[2][1]);
    67         invert.a[0][2] = (s) * (a[0][1] * a[1][2] - a[0][2] * a[1][1]);
    68         invert.a[1][2] = (s) * (a[0][2] * a[1][0] - a[0][0] * a[1][2]);
    69         invert.a[2][2] = (s) * (a[0][0] * a[1][1] - a[0][1] * a[1][0]);
     61        invert.a[0][0] = s * (a[1][1] * a[2][2] - a[1][2] * a[2][1]);
     62        invert.a[1][0] = s * (a[1][2] * a[2][0] - a[1][0] * a[2][2]);
     63        invert.a[2][0] = s * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);
     64        invert.a[0][1] = s * (a[0][2] * a[2][1] - a[0][1] * a[2][2]);
     65        invert.a[1][1] = s * (a[0][0] * a[2][2] - a[0][2] * a[2][0]);
     66        invert.a[2][1] = s * (a[0][1] * a[2][0] - a[0][0] * a[2][1]);
     67        invert.a[0][2] = s * (a[0][1] * a[1][2] - a[0][2] * a[1][1]);
     68        invert.a[1][2] = s * (a[0][2] * a[1][0] - a[0][0] * a[1][2]);
     69        invert.a[2][2] = s * (a[0][0] * a[1][1] - a[0][1] * a[1][0]);
    7070
    7171        return invert;
Note: See TracChangeset for help on using the changeset viewer.