Changeset 29430 in osm for applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java
- Timestamp:
- 2013-03-29T20:04:22+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.
