Changeset 2272 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2009-10-11T16:33:29+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/projection
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/UTM.java
r2114 r2272 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.GridBagLayout; 7 import java.util.Collection; 8 import java.util.Collections; 9 10 import javax.swing.JComboBox; 11 import javax.swing.JLabel; 12 import javax.swing.JPanel; 13 14 import org.openstreetmap.josm.Main; 6 15 import org.openstreetmap.josm.data.Bounds; 7 16 import org.openstreetmap.josm.data.coor.EastNorth; 8 17 import org.openstreetmap.josm.data.coor.LatLon; 18 import org.openstreetmap.josm.tools.GBC; 9 19 10 20 /** … … 14 24 * code based on JavaScript from Chuck Taylor 15 25 */ 16 public class UTM implements Projection { 26 public class UTM implements Projection, ProjectionSubPrefs { 27 28 private int zone = 33; 17 29 18 30 final private double UTMScaleFactor = 0.9996; … … 336 348 337 349 @Override public String toString() { 338 return tr("UTM Zone {0}", getzone()); 339 } 340 341 /* TODO - support all UTM's not only zone 33 */ 350 return tr("UTM"); 351 } 352 342 353 public int getzone() 343 354 { 344 return 33;355 return zone; 345 356 } 346 357 347 358 public String toCode() { 348 return "EPSG: 325833";359 return "EPSG:"+ (325800 + getzone()); 349 360 } 350 361 351 362 public String getCacheDirectoryName() { 352 return "epsg 325833";363 return "epsg"+ (325800 + getzone()); 353 364 } 354 365 … … 364 375 return 10; 365 376 } 377 378 private JPanel prefpanel = null; 379 private JComboBox prefcb = null; 380 public JPanel getPreferencePanel() { 381 if(prefpanel != null) 382 return prefpanel; 383 384 prefcb = new JComboBox(); 385 for(int i = 1; i <= 60; i++) { 386 prefcb.addItem(i); 387 } 388 389 prefcb.setSelectedIndex(zone - 1); 390 prefpanel = new JPanel(new GridBagLayout()); 391 prefpanel.add(new JLabel(tr("UTM Zone")), GBC.std().insets(5,5,0,5)); 392 prefpanel.add(GBC.glue(1, 0), GBC.std().fill(GBC.HORIZONTAL)); 393 prefpanel.add(prefcb, GBC.eop().fill(GBC.HORIZONTAL)); 394 prefpanel.add(GBC.glue(1, 1), GBC.eol().fill(GBC.BOTH)); 395 return prefpanel; 396 } 397 398 public Collection<String> getPreferences() { 399 if(prefcb == null) 400 return null; 401 int zone = prefcb.getSelectedIndex() + 1; 402 return Collections.singleton(Integer.toString(zone)); 403 } 404 405 public void destroyCachedPanel() { 406 prefpanel = null; 407 prefcb = null; 408 } 409 410 public void setPreferences(Collection<String> args) 411 { 412 /* TODO: parse args instead of fixed value */ 413 zone = 33; 414 } 415 416 public Collection<String> getPreferencesFromCode(String code) 417 { 418 /* TODO: implement */ 419 return null; 420 } 366 421 }
Note:
See TracChangeset
for help on using the changeset viewer.