Ignore:
Timestamp:
2013-03-29T20:04:22+01:00 (13 years ago)
Author:
zverik
Message:

string fixes, button and menu update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java

    r29394 r29430  
    7777        descriptionLabel.setFont(descriptionFont);
    7878
     79        OffsetIcon offsetIcon = new OffsetIcon(offset);
    7980        double offsetDistance = offset instanceof ImageryOffset
    80                 ? ((ImageryOffset)offset).getImageryPos().greatCircleDistance(offset.getPosition()) : 0.0;
    81         JLabel offsetLabel = new JLabel(offsetDistance > 1 ? ImageryOffsetTools.formatDistance(offsetDistance) : "",
    82                 new OffsetIcon(offset), SwingConstants.CENTER);
     81                ? offsetIcon.getDistance() : 0.0;
     82//                ? ((ImageryOffset)offset).getImageryPos().greatCircleDistance(offset.getPosition()) : 0.0;
     83        JLabel offsetLabel = new JLabel(offsetDistance > 0.2 ? ImageryOffsetTools.formatDistance(offsetDistance) : "",
     84                offsetIcon, SwingConstants.CENTER);
    8385        Font offsetFont = new Font(offsetLabel.getFont().getName(), Font.PLAIN, offsetLabel.getFont().getSize() - 2);
    8486        offsetLabel.setFont(offsetFont);
     
    150152        private boolean isCalibration;
    151153        private double direction = -1.0;
    152         private double length;
     154        private double distance;
    153155        private ImageIcon background;
    154156
     
    163165                background = ImageProvider.get("offset");
    164166                double[] ld = getLengthAndDirection((ImageryOffset)offset);
    165                 length = ld[0];
     167                distance = ld[0];
    166168                direction = ld[1];
    167169            } else {
    168170                background = ImageProvider.get("calibration");
    169171            }
     172        }
     173
     174        public double getDistance() {
     175            return distance;
    170176        }
    171177
     
    181187                g2.setColor(Color.black);
    182188                Point c = new Point(x + getIconWidth() / 2, y + getIconHeight() / 2);
    183                 if( length < 1e-2 ) {
     189                if( distance < 1e-2 ) {
    184190                    // no offset
    185191                    g2.fillOval(c.x - 3, c.y - 3, 7, 7);
    186192                } else {
    187193                    // draw an arrow
    188                     double arrowLength = length < 10 ? getIconWidth() / 2 - 1 : getIconWidth() - 4;
     194                    double arrowLength = distance < 10 ? getIconWidth() / 2 - 1 : getIconWidth() - 4;
    189195                    g2.setStroke(new BasicStroke(2));
    190196                    drawArrow(g2, c.x, c.y, arrowLength, direction);
Note: See TracChangeset for help on using the changeset viewer.