Changeset 29382 in osm for applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
- Timestamp:
- 2013-03-21T21:30:58+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
r29380 r29382 11 11 import javax.swing.border.EmptyBorder; 12 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.data.Bounds; 13 14 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 15 import org.openstreetmap.josm.gui.MapView; 14 16 import org.openstreetmap.josm.gui.NavigatableComponent; 15 17 import org.openstreetmap.josm.gui.layer.ImageryLayer; 18 import org.openstreetmap.josm.gui.layer.MapViewPaintable; 16 19 import static org.openstreetmap.josm.tools.I18n.tr; 17 20 import org.openstreetmap.josm.tools.ImageProvider; … … 23 26 * @author zverik 24 27 */ 25 public class OffsetDialog extends JDialog implements ActionListener, NavigatableComponent.ZoomChangeListener { 28 public class OffsetDialog extends JDialog implements ActionListener, NavigatableComponent.ZoomChangeListener, MapViewPaintable { 26 29 protected static final String PREF_CALIBRATION = "iodb.show.calibration"; 27 30 protected static final String PREF_DEPRECATED = "iodb.show.deprecated"; … … 106 109 } 107 110 pack(); 111 Main.map.mapView.repaint(); 108 112 } 109 113 … … 131 135 } 132 136 } 137 138 public void paint( Graphics2D g, MapView mv, Bounds bbox ) { 139 if( offsets == null ) 140 return; 141 142 Graphics2D g2 = (Graphics2D)g.create(); 143 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 144 g2.setStroke(new BasicStroke(2)); 145 for( ImageryOffsetBase offset : filterOffsets() ) { 146 Point p = mv.getPoint(offset.getPosition()); 147 g2.setColor(Color.BLACK); 148 g2.fillOval(p.x - 2, p.y - 2, 5, 5); 149 g2.setColor(Color.WHITE); 150 g2.drawOval(p.x - 3, p.y - 3, 7, 7); 151 } 152 } 133 153 134 154 public ImageryOffsetBase showDialog() { 155 // todo: add a temporary layer showing all offsets 135 156 selectedOffset = null; 136 157 prepareDialog(); 158 if( !MODAL ) { 159 Main.map.mapView.addTemporaryLayer(this); 160 Main.map.mapView.repaint(); 161 } 137 162 setVisible(true); 138 163 return selectedOffset; … … 173 198 NavigatableComponent.removeZoomChangeListener(this); 174 199 setVisible(false); 175 if( !MODAL && selectedOffset != null ) 176 applyOffset(); 200 if( !MODAL ) { 201 Main.map.mapView.removeTemporaryLayer(this); 202 Main.map.mapView.repaint(); 203 if( selectedOffset != null ) 204 applyOffset(); 205 } 177 206 } 178 207
Note:
See TracChangeset
for help on using the changeset viewer.