Changeset 29430 in osm
- Timestamp:
- 2013-03-29T20:04:22+01:00 (12 years ago)
- 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 41 41 @Override 42 42 public void paint( Graphics2D g, MapView mv, Bounds box ) { 43 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 43 44 Stroke oldStroke = g.getStroke(); 44 45 g.setColor(color); … … 98 99 @Override 99 100 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()); 103 103 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()); 106 105 } 107 106 -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java
r29427 r29430 45 45 tr("Are you sure this calibration geometry is aligned badly?"); 46 46 if( JOptionPane.showConfirmDialog(Main.parent, 47 tr("Warning: deprecation is basically irreversible! \n{0}", desc),47 tr("Warning: deprecation is basically irreversible!")+ "\n" + desc, 48 48 ImageryOffsetTools.DIALOG_TITLE, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION ) { 49 49 return; … … 78 78 } 79 79 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")) + ":"; 82 82 String reason = StoreImageryOffsetAction.queryDescription(message); 83 83 if( reason == null ) -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java
r29399 r29430 159 159 offsets = new IODBReader(inp).parse(); 160 160 } catch( Exception e ) { 161 throw new UploadException("Error processing XML response: " + e.getMessage()); 161 throw new UploadException(tr("Error processing XML response") + ": " + e.getMessage()); 162 162 } 163 163 } -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/IODBReader.java
r29388 r29430 225 225 if( geometry.isEmpty() ) { 226 226 if( imagery == null || imageryPos == null ) 227 throw new IllegalArgumentException("Both imagery and imageryPos should be s epcified for the offset");227 throw new IllegalArgumentException("Both imagery and imageryPos should be specified for the offset"); 228 228 result = new ImageryOffset(imagery, imageryPos); 229 229 if( minZoom >= 0 ) -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java
r29412 r29430 40 40 offsetMenu.add(getAction); 41 41 offsetMenu.add(storeAction); 42 if( version >= 5803 ) // todo: check if this is needed43 offsetMenu.addSeparator();44 42 45 43 // an ugly hack to add this plugin to the toolbar -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java
r29390 r29430 21 21 * A title for all dialogs created in this plugin. 22 22 */ 23 public static final String DIALOG_TITLE = tr("Imagery Offset"); 23 public static final String DIALOG_TITLE = tr("Imagery Offset Database"); 24 24 25 25 /** -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java
r29394 r29430 77 77 descriptionLabel.setFont(descriptionFont); 78 78 79 OffsetIcon offsetIcon = new OffsetIcon(offset); 79 80 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); 83 85 Font offsetFont = new Font(offsetLabel.getFont().getName(), Font.PLAIN, offsetLabel.getFont().getSize() - 2); 84 86 offsetLabel.setFont(offsetFont); … … 150 152 private boolean isCalibration; 151 153 private double direction = -1.0; 152 private double length;154 private double distance; 153 155 private ImageIcon background; 154 156 … … 163 165 background = ImageProvider.get("offset"); 164 166 double[] ld = getLengthAndDirection((ImageryOffset)offset); 165 length= ld[0];167 distance = ld[0]; 166 168 direction = ld[1]; 167 169 } else { 168 170 background = ImageProvider.get("calibration"); 169 171 } 172 } 173 174 public double getDistance() { 175 return distance; 170 176 } 171 177 … … 181 187 g2.setColor(Color.black); 182 188 Point c = new Point(x + getIconWidth() / 2, y + getIconHeight() / 2); 183 if( length< 1e-2 ) {189 if( distance < 1e-2 ) { 184 190 // no offset 185 191 g2.fillOval(c.x - 3, c.y - 3, 7, 7); 186 192 } else { 187 193 // draw an arrow 188 double arrowLength = length< 10 ? getIconWidth() / 2 - 1 : getIconWidth() - 4;194 double arrowLength = distance < 10 ? getIconWidth() / 2 - 1 : getIconWidth() - 4; 189 195 g2.setStroke(new BasicStroke(2)); 190 196 drawArrow(g2, c.x, c.y, arrowLength, direction); -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java
r29429 r29430 48 48 // ask for a reason 49 49 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?"), 51 51 ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE); 52 52 if( reason != null && reason.toString().length() > 0 ) { … … 76 76 sb.append(tr("Imagery ID")).append(": ").append(((ImageryOffset)offset).getImagery()).append('\n'); 77 77 } 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'); 79 79 } 80 80 … … 108 108 public static String getGeometryType( CalibrationObject obj ) { 109 109 if( obj.getGeometry() == null ) 110 return tr("nothing");110 return "nothing"; // meant never to happen, so no translation 111 111 int n = obj.getGeometry().length; 112 112 if( n == 1 ) … … 117 117 return tr("polygon ({0} nodes)", n - 1); 118 118 else 119 return tr("geometry");119 return "geometry"; // meant never to happen, so no translation 120 120 } 121 121 } -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/SimpleOffsetQueryTask.java
r29384 r29430 30 30 */ 31 31 public SimpleOffsetQueryTask( String query, String title ) { 32 super( tr("Uploading"));32 super(ImageryOffsetTools.DIALOG_TITLE); 33 33 this.query = query; 34 34 this.title = title; … … 121 121 protected void finish() { 122 122 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); 124 125 } else if( listener != null ) { 125 126 listener.queryPassed(); -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java
r29384 r29430 27 27 public StoreImageryOffsetAction() { 28 28 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"), 30 30 null, true); 31 31 } … … 49 49 String userName = JosmUserIdentityManager.getInstance().getUserName(); 50 50 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); 52 54 return; 53 55 } … … 82 84 if( Math.abs(layer.getDx()) < 1e-8 && Math.abs(layer.getDy()) < 1e-8 ) { 83 85 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 ) 85 88 return; 86 89 } 87 90 LatLon offset = ImageryOffsetTools.getLayerOffset(layer, center); 88 91 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."); 91 94 } else { 92 95 // register calibration object 93 96 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."); 96 99 } 97 100 String description = queryDescription(message); … … 114 117 query.append(key).append('=').append(URLEncoder.encode(params.get(key), "UTF8")); 115 118 } 116 Main.main.worker.submit(new SimpleOffsetQueryTask(query.toString(), tr("Uploading thenew offset...")));119 Main.main.worker.submit(new SimpleOffsetQueryTask(query.toString(), tr("Uploading a new offset..."))); 117 120 } catch( UnsupportedEncodingException ex ) { 118 121 // WTF
Note:
See TracChangeset
for help on using the changeset viewer.