Ticket #24762: 24762.patch

File 24762.patch, 2.3 KB (added by GerdP, 21 hours ago)

quick patch to render GPSTrack in light gray if GPSImgDirection is missing

  • src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

     
    509509                Point p = mv.getPoint(e.getPos());
    510510                Dimension imgDim = getImageDimension(e);
    511511
    512                 if (e.getExifImgDir() != null) {
     512                Double direction = e.getExifImgDir();
     513                if (direction == null)
     514                    direction = e.getExifGpsTrack(); // see #24762
     515                if (direction != null) {
    513516                    Vector3D imgRotation = ImageViewerDialog.getInstance().getRotation(e);
    514                     drawDirectionArrow(g, p, e.getExifImgDir()
    515                             + (imgRotation != null ? Utils.toDegrees(imgRotation.getPolarAngle()) : 0d), imgDim);
     517                    final Color color = e.getExifImgDir() != null ? new Color(255, 255, 255, 192) : Color.darkGray;
     518                    drawDirectionArrow(g, p,
     519                            direction + (imgRotation != null ? Utils.toDegrees(imgRotation.getPolarAngle()) : 0d),
     520                            imgDim, color);
    516521                }
    517522
    518523                if (useThumbs && e.hasThumbnail()) {
     
    541546    }
    542547
    543548    protected static void drawDirectionArrow(Graphics2D g, Point p, double dir, Dimension imgDim) {
     549        drawDirectionArrow(g, p, dir, imgDim, new Color(255, 255, 255, 192));
     550    }
     551
     552    protected static void drawDirectionArrow(Graphics2D g, Point p, double dir, Dimension imgDim, Color color) {
    544553        // Multiplier must be larger than sqrt(2)/2=0.71.
    545554        double arrowlength = Math.max(25, Math.max(imgDim.width, imgDim.height) * 0.85);
    546555        double arrowwidth = arrowlength / 1.4;
     
    560569        double rty = p.y + Math.sin(Utils.toRadians(rightdir)) * arrowwidth/2;
    561570
    562571        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    563         g.setColor(new Color(255, 255, 255, 192));
     572        g.setColor(color);
    564573        int[] xar = {(int) ltx, (int) ptx, (int) rtx, (int) ltx};
    565574        int[] yar = {(int) lty, (int) pty, (int) rty, (int) lty};
    566575        g.fillPolygon(xar, yar, 4);