Changeset 43 in josm for src/org/openstreetmap/josm/gui
- Timestamp:
- 2006-01-22T16:10:57+01:00 (20 years ago)
- Location:
- src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
-
MapView.java (modified) (4 diffs)
-
PreferenceDialog.java (modified) (5 diffs)
-
WorldChooser.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/MapView.java
r42 r43 20 20 import org.openstreetmap.josm.data.GeoPoint; 21 21 import org.openstreetmap.josm.data.osm.DataSet; 22 import org.openstreetmap.josm.data.osm.Node;23 22 import org.openstreetmap.josm.data.projection.Projection; 24 23 import org.openstreetmap.josm.gui.layer.Layer; … … 97 96 */ 98 97 public void addLayer(Layer layer) { 99 // initialize the projection if it is the first layer100 if (layers.isEmpty())101 getProjection().init(layer.getBoundsLatLon());102 103 98 // reinitialize layer's data 104 99 layer.init(getProjection()); … … 339 334 // reset all datasets. 340 335 Projection p = getProjection(); 341 for ( Node n : Main.main.ds.nodes)342 p.latlon2xy(n.coor);336 for (Layer l : layers) 337 l.init(p); 343 338 recalculateCenterScale(); 344 339 } … … 351 346 */ 352 347 public void propertyChange(PropertyChangeEvent evt) { 353 if (!evt.getPropertyName().equals("projection")) 354 return; 355 if (evt.getOldValue() != null) 356 ((Projection)evt.getOldValue()).removeChangeListener(this); 357 if (evt.getNewValue() != null) { 358 Projection p = (Projection)evt.getNewValue(); 359 p.addChangeListener(this); 360 348 if (evt.getPropertyName().equals("projection")) 361 349 stateChanged(new ChangeEvent(this)); 362 }363 350 } 364 351 } -
src/org/openstreetmap/josm/gui/PreferenceDialog.java
r38 r43 15 15 import javax.swing.JCheckBox; 16 16 import javax.swing.JComboBox; 17 import javax.swing.JComponent;18 17 import javax.swing.JDialog; 19 18 import javax.swing.JLabel; … … 51 50 public void actionPerformed(ActionEvent e) { 52 51 Main.pref.laf = (LookAndFeelInfo)lafCombo.getSelectedItem(); 53 Projection projection = (Projection)projectionCombo.getSelectedItem(); 54 projection.commitConfigurationPanel(); 55 Main.pref.setProjection(projection); 52 Main.pref.setProjection((Projection)projectionCombo.getSelectedItem()); 56 53 Main.pref.osmDataServer = osmDataServer.getText(); 57 54 Main.pref.osmDataUsername = osmDataUsername.getText(); … … 99 96 * Combobox with all projections available 100 97 */ 101 JComboBox projectionCombo = new JComboBox(Preferences.allProjections .clone());98 JComboBox projectionCombo = new JComboBox(Preferences.allProjections); 102 99 /** 103 100 * The main tab panel. … … 160 157 } 161 158 } 162 JButton projectionDetail = new JButton("Configure");163 projectionDetail.addActionListener(new ActionListener(){164 public void actionPerformed(ActionEvent e) {165 Projection p = (Projection)projectionCombo.getSelectedItem();166 JComponent configurationPanel = p.getConfigurationPanel();167 if (configurationPanel == null) {168 JOptionPane.showMessageDialog(PreferenceDialog.this,169 "This projection does not need any configuration.");170 return;171 }172 JPanel detail = new JPanel(new GridBagLayout());173 detail.setLayout(new GridBagLayout());174 detail.add(configurationPanel, GBC.eop().fill());175 int result = JOptionPane.showConfirmDialog(176 PreferenceDialog.this, detail, "Configuration of "+p,177 JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);178 if (result != JOptionPane.OK_OPTION)179 p.getConfigurationPanel(); // rollback180 }181 });182 159 183 160 // drawRawGpsLines … … 242 219 map.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 243 220 map.add(projectionCombo, GBC.eol().fill(GBC.HORIZONTAL).insets(0,0,0,5)); 244 map.add(new JLabel("Projection details:"), GBC.std());245 map.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL));246 map.add(projectionDetail, GBC.eop());247 221 map.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 248 222 -
src/org/openstreetmap/josm/gui/WorldChooser.java
r42 r43 13 13 14 14 import javax.swing.ImageIcon; 15 import javax.swing.JComponent;16 15 import javax.swing.JTextField; 17 16 import javax.swing.SwingUtilities; … … 63 62 new MapMover(this); 64 63 projection = new Projection(){ 65 @Override66 64 public void latlon2xy(GeoPoint p) { 67 65 p.x = (p.lon+180) / 360 * world.getIconWidth(); 68 66 p.y = (p.lat+90) / 180 * world.getIconHeight(); 69 67 } 70 @Override71 68 public void xy2latlon(GeoPoint p) { 72 69 p.lon = p.x*360/world.getIconWidth() - 180; … … 76 73 public String toString() { 77 74 return "WorldChooser"; 78 }79 @Override80 public JComponent getConfigurationPanel() {81 return null;82 }83 @Override84 public void commitConfigurationPanel() {85 75 } 86 76 };
Note:
See TracChangeset
for help on using the changeset viewer.
