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

string fixes, button and menu update

Location:
applications/editors/josm/plugins/imagery_offset_db/src/iodb
Files:
10 edited

Legend:

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

    r29429 r29430  
    4141    @Override
    4242    public void paint( Graphics2D g, MapView mv, Bounds box ) {
     43        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    4344        Stroke oldStroke = g.getStroke();
    4445        g.setColor(color);
     
    9899    @Override
    99100    public String getToolTipText() {
    100         if(obj.isDeprecated())
    101             return tr("A deprecated calibration of type {0} by {1}",
    102                 OffsetInfoAction.getGeometryType(obj), obj.getAuthor());
     101        if( obj.isDeprecated() )
     102            return tr("A deprecated calibration {0} by {1}", OffsetInfoAction.getGeometryType(obj), obj.getAuthor());
    103103        else
    104             return tr("A calibration of type {0} by {1}",
    105                 OffsetInfoAction.getGeometryType(obj), obj.getAuthor());
     104            return tr("A calibration {0} by {1}", OffsetInfoAction.getGeometryType(obj), obj.getAuthor());
    106105    }
    107106
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java

    r29427 r29430  
    4545                tr("Are you sure this calibration geometry is aligned badly?");
    4646        if( JOptionPane.showConfirmDialog(Main.parent,
    47                 tr("Warning: deprecation is basically irreversible!\n{0}", desc),
     47                tr("Warning: deprecation is basically irreversible!")+ "\n" + desc,
    4848                ImageryOffsetTools.DIALOG_TITLE, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION ) {
    4949            return;
     
    7878        }
    7979
    80         String message = "Please enter the reason why you mark this "
    81                 + (offset instanceof ImageryOffset ? "imagery offset" : "calibraion geometry") + " as deprecated:";
     80        String message = tr("Please enter the reason why you mark {0} as deprecated",
     81                offset instanceof ImageryOffset ? tr("this imagery offset") : tr("this calibration geometry")) + ":";
    8282        String reason = StoreImageryOffsetAction.queryDescription(message);
    8383        if( reason == null )
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java

    r29399 r29430  
    159159                offsets = new IODBReader(inp).parse();
    160160            } catch( Exception e ) {
    161                 throw new UploadException("Error processing XML response: " + e.getMessage());
     161                throw new UploadException(tr("Error processing XML response") + ": " + e.getMessage());
    162162            }
    163163        }
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/IODBReader.java

    r29388 r29430  
    225225            if( geometry.isEmpty() ) {
    226226                if( imagery == null || imageryPos == null )
    227                     throw new IllegalArgumentException("Both imagery and imageryPos should be sepcified for the offset");
     227                    throw new IllegalArgumentException("Both imagery and imageryPos should be specified for the offset");
    228228                result = new ImageryOffset(imagery, imageryPos);
    229229                if( minZoom >= 0 )
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java

    r29412 r29430  
    4040        offsetMenu.add(getAction);
    4141        offsetMenu.add(storeAction);
    42         if( version >= 5803 ) // todo: check if this is needed
    43             offsetMenu.addSeparator();
    4442
    4543        // an ugly hack to add this plugin to the toolbar
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java

    r29390 r29430  
    2121     * A title for all dialogs created in this plugin.
    2222     */
    23     public static final String DIALOG_TITLE = tr("Imagery Offset");
     23    public static final String DIALOG_TITLE = tr("Imagery Offset Database");
    2424   
    2525    /**
  • 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);
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java

    r29429 r29430  
    4848                // ask for a reason
    4949                Object reason = JOptionPane.showInputDialog(Main.parent,
    50                         tr("You are to notify moderators of this offset. Why they should look into this case?"),
     50                        tr("You are to notify moderators of this offset. Why?"),
    5151                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE);
    5252                if( reason != null && reason.toString().length() > 0 ) {
     
    7676            sb.append(tr("Imagery ID")).append(": ").append(((ImageryOffset)offset).getImagery()).append('\n');
    7777        } else {
    78             sb.append(tr("A calibration of type {0}", getGeometryType((CalibrationObject)offset))).append('\n');
     78            sb.append(tr("A calibration {0}", getGeometryType((CalibrationObject)offset))).append('\n');
    7979        }
    8080       
     
    108108    public static String getGeometryType( CalibrationObject obj ) {
    109109        if( obj.getGeometry() == null )
    110             return tr("nothing");
     110            return "nothing"; // meant never to happen, so no translation
    111111        int n = obj.getGeometry().length;
    112112        if( n == 1 )
     
    117117            return tr("polygon ({0} nodes)", n - 1);
    118118        else
    119             return tr("geometry");
     119            return "geometry"; // meant never to happen, so no translation
    120120    }
    121121}
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/SimpleOffsetQueryTask.java

    r29384 r29430  
    3030     */
    3131    public SimpleOffsetQueryTask( String query, String title ) {
    32         super(tr("Uploading"));
     32        super(ImageryOffsetTools.DIALOG_TITLE);
    3333        this.query = query;
    3434        this.title = title;
     
    121121    protected void finish() {
    122122        if( errorMessage != null ) {
    123             JOptionPane.showMessageDialog(Main.parent, errorMessage, tr("Imagery Offset"), JOptionPane.ERROR_MESSAGE);
     123            JOptionPane.showMessageDialog(Main.parent, errorMessage,
     124                    ImageryOffsetTools.DIALOG_TITLE, JOptionPane.ERROR_MESSAGE);
    124125        } else if( listener != null ) {
    125126            listener.queryPassed();
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java

    r29384 r29430  
    2727    public StoreImageryOffsetAction() {
    2828        super(tr("Store Imagery Offset..."), "storeoffset",
    29                 tr("Upload an offset for current imagery (or calibration object information) to a server"),
     29                tr("Upload an offset for current imagery (or calibration object geometry) to a server"),
    3030                null, true);
    3131    }
     
    4949        String userName = JosmUserIdentityManager.getInstance().getUserName();
    5050        if( userName == null || userName.length() == 0 ) {
    51             JOptionPane.showMessageDialog(Main.parent, tr("To store imagery offsets you must be a registered OSM user."), ImageryOffsetTools.DIALOG_TITLE, JOptionPane.ERROR_MESSAGE);
     51            JOptionPane.showMessageDialog(Main.parent,
     52                    tr("To store imagery offsets you must be a registered OSM user."),
     53                    ImageryOffsetTools.DIALOG_TITLE, JOptionPane.ERROR_MESSAGE);
    5254            return;
    5355        }
     
    8284            if( Math.abs(layer.getDx()) < 1e-8 && Math.abs(layer.getDy()) < 1e-8 ) {
    8385                if( JOptionPane.showConfirmDialog(Main.parent,
    84                         tr("The topmost imagery layer has no offset. Are you sure you want to upload it?"), ImageryOffsetTools.DIALOG_TITLE, JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION )
     86                        tr("The topmost imagery layer has no offset. Are you sure you want to upload this?"),
     87                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION )
    8588                    return;
    8689            }
    8790            LatLon offset = ImageryOffsetTools.getLayerOffset(layer, center);
    8891            offsetObj = new ImageryOffset(ImageryOffsetTools.getImageryID(layer), offset);
    89             message = "You are registering an imagery offset. Other users in this area will be able to use it for mapping.\n"
    90                     + "Please make sure it is as precise as possible, and describe a region this offset is applicable to.";
     92            message = tr("You are registering an imagery offset. Other users in this area will be able to use it for mapping.\n"
     93                    + "Please make sure it is as precise as possible, and describe a region this offset is applicable to.");
    9194        } else {
    9295            // register calibration object
    9396            offsetObj = new CalibrationObject(calibration);
    94             message = "You are registering a calibration geometry. It should be the most precisely positioned object, with\n"
    95                     + "clearly visible boundaries on various satellite imagery. Please describe this object and its whereabouts.";
     97            message = tr("You are registering a calibration geometry. It should be the most precisely positioned object, with\n"
     98                    + "clearly visible boundaries on various satellite imagery. Please describe this object and its whereabouts.");
    9699        }
    97100        String description = queryDescription(message);
     
    114117                query.append(key).append('=').append(URLEncoder.encode(params.get(key), "UTF8"));
    115118            }
    116             Main.main.worker.submit(new SimpleOffsetQueryTask(query.toString(), tr("Uploading the new offset...")));
     119            Main.main.worker.submit(new SimpleOffsetQueryTask(query.toString(), tr("Uploading a new offset...")));
    117120        } catch( UnsupportedEncodingException ex ) {
    118121            // WTF
Note: See TracChangeset for help on using the changeset viewer.