Changeset 2676 in josm for trunk/src/org
- Timestamp:
- 2009-12-24T08:48:40+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r2637 r2676 329 329 && o.text.equals(this.text)); 330 330 } 331 332 @Override 333 public int hashCode() { 334 return text.hashCode(); 335 } 331 336 } 332 337 -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
r2611 r2676 23 23 private static class PrefixSuffixSwitcher { 24 24 25 private static final String SEPARATOR = "[:_]?"; 26 25 27 private final String a; 26 28 private final String b; 27 29 private final Pattern startPattern; 28 30 private final Pattern endPattern; 29 30 private final String SEPARATOR = "[:_]?";31 31 32 32 public PrefixSuffixSwitcher(String a, String b) { -
trunk/src/org/openstreetmap/josm/corrector/TagCorrector.java
r2017 r2676 13 13 import java.util.Map; 14 14 import java.util.Set; 15 import java.util.Map.Entry; 15 16 16 17 import javax.swing.JLabel; … … 151 152 152 153 if (answer == JOptionPane.YES_OPTION) { 153 for ( OsmPrimitive primitive : tagCorrectionsMap.keySet()) {154 List<TagCorrection> tagCorrections = 155 tagCorrectionsMap.get(primitive);154 for (Entry<OsmPrimitive, List<TagCorrection>> entry : tagCorrectionsMap.entrySet()) { 155 List<TagCorrection> tagCorrections = entry.getValue(); 156 OsmPrimitive primitive = entry.getKey(); 156 157 157 158 // create the clone … … 186 187 } 187 188 } 188 for ( OsmPrimitive primitive : roleCorrectionMap.keySet()) {189 List<RoleCorrection> roleCorrections = roleCorrectionMap190 .get(primitive);189 for (Entry<OsmPrimitive, List<RoleCorrection>> entry : roleCorrectionMap.entrySet()) { 190 OsmPrimitive primitive = entry.getKey(); 191 List<RoleCorrection> roleCorrections = entry.getValue(); 191 192 192 193 for (int i = 0; i < roleCorrections.size(); i++) { -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r2613 r2676 230 230 @Override 231 231 public int hashCode() { 232 final int prime = 31;233 int result = 1;234 result = prime * result + (id ^ (id >>> 32));235 232 if (id > 0) 236 return prime * result + getClass().hashCode();233 return id; 237 234 else 238 235 return super.hashCode(); -
trunk/src/org/openstreetmap/josm/data/osm/Filter.java
r2512 r2676 1 1 package org.openstreetmap.josm.data.osm; 2 2 3 import org.openstreetmap.josm.actions.search.SearchAction ;3 import org.openstreetmap.josm.actions.search.SearchAction.SearchMode; 4 4 import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting; 5 import org.openstreetmap.josm.actions.search.SearchAction.SearchMode;6 5 7 6 /** … … 10 9 */ 11 10 public class Filter extends SearchSetting { 12 private final String version = "1"; 13 public Boolean enable = true; 14 public Boolean hide = false; 15 public Boolean inverted = false; 16 public Boolean applyForChildren = true; 17 public Filter() { 18 super("", SearchMode.add, false, false); 19 } 20 public Filter(String text, SearchMode mode, boolean caseSensitive, boolean regexSearch) { 21 super(text, mode, caseSensitive, regexSearch); 22 } 11 private static final String version = "1"; 23 12 24 public Filter(String prefText){ 25 super("", SearchMode.add, false, false); 26 String[] prfs = prefText.split(";"); 27 if(prfs.length != 10 && !prfs[0].equals(version)) 28 throw new Error("Incompatible filter preferences"); 29 text = prfs[1]; 30 if(prfs[2].equals("replace")) mode = SearchMode.replace; 31 if(prfs[2].equals("add")) mode = SearchMode.add; 32 if(prfs[2].equals("remove")) mode = SearchMode.remove; 33 if(prfs[2].equals("in_selection")) mode = SearchMode.in_selection; 34 caseSensitive = Boolean.parseBoolean(prfs[3]); 35 regexSearch = Boolean.parseBoolean(prfs[4]); 36 enable = Boolean.parseBoolean(prfs[6]); 37 hide = Boolean.parseBoolean(prfs[7]); 38 inverted = Boolean.parseBoolean(prfs[8]); 39 applyForChildren = Boolean.parseBoolean(prfs[9]); 13 public Boolean enable = true; 14 public Boolean hide = false; 15 public Boolean inverted = false; 16 public Boolean applyForChildren = true; 17 public Filter() { 18 super("", SearchMode.add, false, false); 19 } 20 public Filter(String text, SearchMode mode, boolean caseSensitive, boolean regexSearch) { 21 super(text, mode, caseSensitive, regexSearch); 22 } 40 23 41 } 24 public Filter(String prefText){ 25 super("", SearchMode.add, false, false); 26 String[] prfs = prefText.split(";"); 27 if(prfs.length != 10 && !prfs[0].equals(version)) 28 throw new Error("Incompatible filter preferences"); 29 text = prfs[1]; 30 if(prfs[2].equals("replace")) { 31 mode = SearchMode.replace; 32 } 33 if(prfs[2].equals("add")) { 34 mode = SearchMode.add; 35 } 36 if(prfs[2].equals("remove")) { 37 mode = SearchMode.remove; 38 } 39 if(prfs[2].equals("in_selection")) { 40 mode = SearchMode.in_selection; 41 } 42 caseSensitive = Boolean.parseBoolean(prfs[3]); 43 regexSearch = Boolean.parseBoolean(prfs[4]); 44 enable = Boolean.parseBoolean(prfs[6]); 45 hide = Boolean.parseBoolean(prfs[7]); 46 inverted = Boolean.parseBoolean(prfs[8]); 47 applyForChildren = Boolean.parseBoolean(prfs[9]); 42 48 43 public String getPrefString(){ 44 return version + ";" + 45 text + ";" + mode + ";" + caseSensitive + ";" + regexSearch + ";" + 46 "legacy" + ";" + enable + ";" + hide + ";" + 47 inverted + ";" + applyForChildren; 48 } 49 } 50 51 public String getPrefString(){ 52 return version + ";" + 53 text + ";" + mode + ";" + caseSensitive + ";" + regexSearch + ";" + 54 "legacy" + ";" + enable + ";" + hide + ";" + 55 inverted + ";" + applyForChildren; 56 } 49 57 } -
trunk/src/org/openstreetmap/josm/data/projection/Puwg.java
r2516 r2676 3 3 package org.openstreetmap.josm.data.projection; 4 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 7 import java.awt.GridBagLayout; 5 8 import java.text.DecimalFormat; 6 7 import static org.openstreetmap.josm.tools.I18n.tr;8 9 import java.awt.GridBagLayout;10 9 import java.util.Collection; 11 10 import java.util.Collections; … … 40 39 private static DecimalFormat decFormatter = new DecimalFormat("###0"); 41 40 41 @Override 42 42 public EastNorth latlon2eastNorth(LatLon p) { 43 43 PuwgData z = Zones[zone]; … … 50 50 } 51 51 52 @Override 52 53 public LatLon eastNorth2latlon(EastNorth p) { 53 54 PuwgData z = Zones[zone]; … … 63 64 } 64 65 66 @Override 65 67 public String toCode() { 66 68 return Zones[zone].toCode(); … … 72 74 } 73 75 76 @Override 74 77 public String getCacheDirectoryName() { 75 78 return Zones[zone].getCacheDirectoryName(); 76 79 } 77 80 81 @Override 78 82 public Bounds getWorldBoundsLatLon() { 79 83 return Zones[zone].getWorldBoundsLatLon(); 80 84 } 81 85 86 @Override 82 87 public double getDefaultZoomInPPD() { 83 88 // This will set the scale bar to about 100 km … … 93 98 } 94 99 100 @Override 95 101 public void setupPreferencePanel(JPanel p) { 96 102 JComboBox prefcb = new JComboBox(Puwg.Zones); … … 105 111 } 106 112 113 @Override 107 114 public Collection<String> getPreferences(JPanel p) { 108 Object prefcb = p.getComponent(2);115 Object prefcb = p.getComponent(2); 109 116 if(!(prefcb instanceof JComboBox)) 110 117 return null; … … 113 120 } 114 121 122 @Override 115 123 public Collection<String> getPreferencesFromCode(String code) 116 124 { … … 118 126 { 119 127 if(code.equals(p.toCode())) 120 return Collections.singleton(code);128 return Collections.singleton(code); 121 129 } 122 130 return null; 123 131 } 124 132 133 @Override 125 134 public void setPreferences(Collection<String> args) 126 135 { … … 131 140 for(String s : args) 132 141 { 133 for (int i=0; i < Puwg.Zones.length; ++i) 134 if(s.equals(Zones[i].toCode())) 135 zone = i; 136 break; 142 for (int i=0; i < Puwg.Zones.length; ++i) 143 if(s.equals(Zones[i].toCode())) { 144 zone = i; 145 } 146 break; 137 147 } 138 } catch (NullPointerException e) {} ;148 } catch (NullPointerException e) {} 139 149 } 140 150 } … … 151 161 class Epsg2180 implements PuwgData { 152 162 153 final privatedouble Epsg2180FalseEasting = 500000.0; /* y */154 final privatedouble Epsg2180FalseNorthing = -5300000.0; /* x */155 final privatedouble Epsg2180ScaleFactor = 0.9993;156 final privatedouble Epsg2180CentralMeridian = 19.0;163 private static final double Epsg2180FalseEasting = 500000.0; /* y */ 164 private static final double Epsg2180FalseNorthing = -5300000.0; /* x */ 165 private static final double Epsg2180ScaleFactor = 0.9993; 166 private static final double Epsg2180CentralMeridian = 19.0; 157 167 private static DecimalFormat decFormatter = new DecimalFormat("###0"); 158 168 … … 202 212 abstract class Puwg2000 implements PuwgData { 203 213 204 final privatedouble PuwgFalseEasting = 500000.0;205 final privatedouble PuwgFalseNorthing = 0;206 final privatedouble PuwgScaleFactor = 0.999923;207 final private double[] Puwg2000CentralMeridian = {15.0, 18.0, 21.0, 24.0};214 private static final double PuwgFalseEasting = 500000.0; 215 private static final double PuwgFalseNorthing = 0; 216 private static final double PuwgScaleFactor = 0.999923; 217 //final private double[] Puwg2000CentralMeridian = {15.0, 18.0, 21.0, 24.0}; 208 218 final private String[] Puwg2000Code = { "EPSG:2176", "EPSG:2177", "EPSG:2178", "EPSG:2179"}; 209 219 final private String[] Puwg2000CDName = { "epsg2176", "epsg2177", "epsg2178", "epsg2179"}; … … 258 268 259 269 class Epsg2176 extends Puwg2000 implements Projection { 260 final private int PuwgZone = 5; 261 270 private static final int PuwgZone = 5; 271 272 @Override 262 273 public int getZone() { return PuwgZone; } 263 274 } 264 275 265 276 class Epsg2177 extends Puwg2000 implements Projection { 266 final private int PuwgZone = 6; 267 277 private static final int PuwgZone = 6; 278 279 @Override 268 280 public int getZone() { return PuwgZone; } 269 281 } 270 282 271 283 class Epsg2178 extends Puwg2000 implements Projection { 272 final private int PuwgZone = 7; 273 284 private static final int PuwgZone = 7; 285 286 @Override 274 287 public int getZone() { return PuwgZone; } 275 288 } 276 289 277 290 class Epsg2179 extends Puwg2000 implements Projection { 278 final private int PuwgZone = 8; 279 280 public int getZone() { return PuwgZone; } 281 } 291 private static final int PuwgZone = 8; 292 293 @Override 294 public int getZone() { return PuwgZone; } 295 } -
trunk/src/org/openstreetmap/josm/gui/FileDrop.java
r2626 r2676 320 320 321 321 // Get a useful list 322 List fileList = (java.util.List) 323 tr.getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor); 322 List<?> fileList = (List<?>)tr.getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor); 324 323 325 324 // Convert list to array … … 429 428 { 430 429 boolean support = false; 431 try 432 { Class arbitraryDndClass = Class.forName( "java.awt.dnd.DnDConstants" ); 433 support = true; 434 } // end try 435 catch( Exception e ) 436 { support = false; 437 } // end catch 430 try { 431 Class.forName( "java.awt.dnd.DnDConstants" ); 432 support = true; 433 } catch( Exception e ) { 434 support = false; 435 } 438 436 supportsDnD = support; 439 437 } // end if: first time through -
trunk/src/org/openstreetmap/josm/gui/ScrollViewport.java
r2512 r2676 13 13 import java.awt.event.MouseAdapter; 14 14 import java.awt.event.MouseEvent; 15 16 15 import java.util.ArrayList; 17 16 import java.util.List; … … 145 144 int direction = scrollDirection; 146 145 147 if (component == null || direction == NO_SCROLL) {146 if (component == null || direction == NO_SCROLL) 148 147 return; 149 } 150 151 Dimension compSize = component.getSize(); 148 152 149 Rectangle viewRect = vp.getViewRect(); 153 150 … … 162 159 163 160 switch (direction) { 164 165 166 167 168 169 161 case UP_DIRECTION : 162 deltaY *= -1; 163 break; 164 case LEFT_DIRECTION : 165 deltaX *= -1; 166 break; 170 167 } 171 168 … … 173 170 } 174 171 public synchronized void scroll(int deltaX, int deltaY) { 175 if (component == null) {172 if (component == null) 176 173 return; 177 }178 174 Dimension compSize = component.getSize(); 179 175 Rectangle viewRect = vp.getViewRect(); … … 204 200 public void showOrHideButtons() { 205 201 boolean needButtons = vp.getViewSize().height > vp.getViewRect().height || 206 202 vp.getViewSize().width > vp.getViewRect().width; 207 203 for (JButton b : buttons) { 208 204 b.setVisible(needButtons); -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r2626 r2676 47 47 import org.openstreetmap.josm.data.Bounds; 48 48 import org.openstreetmap.josm.data.coor.LatLon; 49 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;50 49 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 51 50 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 158 157 public double lon; 159 158 public int zoom; 160 public int osmId;161 public OsmPrimitiveType type;162 159 163 160 public Bounds getDownloadArea() { … … 200 197 currentResult.lon = Double.parseDouble(atts.getValue("lon")); 201 198 currentResult.zoom = Integer.parseInt(atts.getValue("zoom")); 202 currentResult.osmId = Integer.parseInt(atts.getValue("id"));203 currentResult.type = OsmPrimitiveType.from(atts.getValue("type"));199 //currentResult.osmId = Integer.parseInt(atts.getValue("id")); 200 //currentResult.type = OsmPrimitiveType.from(atts.getValue("type")); 204 201 data.add(currentResult); 205 202 } else if (qName.equals("description") && (depth == 3)) { … … 383 380 } 384 381 385 class NamedResultTableColumnModel extends DefaultTableColumnModel {382 static class NamedResultTableColumnModel extends DefaultTableColumnModel { 386 383 protected void createColumns() { 387 384 TableColumn col = null; -
trunk/src/org/openstreetmap/josm/gui/help/HelpApplication.java
r2512 r2676 6 6 import java.awt.Rectangle; 7 7 import java.awt.Toolkit; 8 import java.io.IOException;9 8 import java.io.PrintWriter; 10 9 import java.io.StringWriter; 11 10 import java.lang.Thread.UncaughtExceptionHandler; 12 import java.util.Arrays;13 11 import java.util.Collection; 14 12 import java.util.HashMap; 15 13 import java.util.LinkedList; 16 import java.util.List;17 14 import java.util.Map; 18 import java.util.logging.FileHandler;19 15 import java.util.logging.Level; 20 import java.util.logging.LogManager;21 16 import java.util.logging.Logger; 22 import java.util.logging.SimpleFormatter;23 24 import javax.swing.JOptionPane;25 17 26 18 import org.openstreetmap.josm.Main; … … 66 58 67 59 // construct argument table 68 List<String> argList = Arrays.asList(argArray);69 60 final Map<String, Collection<String>> args = new HashMap<String, Collection<String>>(); 70 61 for (String arg : argArray) { -
trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java
r2626 r2676 140 140 * 141 141 */ 142 class PrimitiveList extends JList {142 static class PrimitiveList extends JList { 143 143 public PrimitiveList() { 144 144 super(new PrimitiveListModel()); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r2662 r2676 40 40 import javax.swing.AbstractListModel; 41 41 import javax.swing.BorderFactory; 42 import javax.swing.ButtonGroup;43 42 import javax.swing.JButton; 44 43 import javax.swing.JCheckBox; … … 49 48 import javax.swing.JOptionPane; 50 49 import javax.swing.JPanel; 51 import javax.swing.JRadioButton;52 50 import javax.swing.JScrollPane; 53 51 import javax.swing.JSeparator; … … 90 88 double timezone; 91 89 long delta; 92 90 93 91 public CorrelateGpxWithImages(GeoImageLayer layer) { 94 92 this.yLayer = layer; … … 123 121 JLabel statusBarText; 124 122 StatusBarListener statusBarListener; 125 123 126 124 // remember the last number of matched photos 127 125 int lastNumMatched = 0; … … 440 438 public void actionPerformed(ActionEvent arg0) { 441 439 // Construct the list of loaded GPX tracks 442 Collection<Layer> layerLst = Main.ma in.map.mapView.getAllLayers();440 Collection<Layer> layerLst = Main.map.mapView.getAllLayers(); 443 441 GpxDataWrapper defaultItem = null; 444 442 Iterator<Layer> iterLayer = layerLst.iterator(); … … 491 489 timezone = 0; 492 490 } 493 491 494 492 tfTimezone = new JTextField(10); 495 493 tfTimezone.setText(formatTimezone(timezone)); 496 494 497 495 try { 498 delta = parseOffset(Main.pref.get("geoimage.delta", "0"));496 delta = parseOffset(Main.pref.get("geoimage.delta", "0")); 499 497 } catch (ParseException e) { 500 498 delta = 0; 501 499 } 502 500 delta = delta / 1000; 503 501 504 502 tfOffset = new JTextField(10); 505 503 tfOffset.setText(Long.toString(delta)); 506 507 JPanel panelBtn = new JPanel(); 508 504 509 505 JButton buttonViewGpsPhoto = new JButton(tr("<html>Use photo of an accurate clock,<br>" 510 506 + "e.g. GPS receiver display</html>")); … … 519 515 520 516 JLabel labelPosition = new JLabel(tr("Override position for: ")); 521 517 522 518 int numAll = getSortedImgList(true, true).size(); 523 519 int numExif = numAll - getSortedImgList(false, true).size(); … … 529 525 cbTaggedImg = new JCheckBox(tr("Images that are already tagged ({0}/{1})", numTagged, numAll), true); 530 526 cbTaggedImg.setEnabled(numTagged != 0); 531 527 532 528 labelPosition.setEnabled(cbExifImg.isEnabled() || cbTaggedImg.isEnabled()); 533 529 … … 540 536 yLayer.loadThumbs(); 541 537 } else { 542 } 538 } 543 539 } 544 540 });*/ … … 549 545 gbc.gridy = y++; 550 546 panelTf.add(panelCb, gbc); 551 552 547 548 553 549 gbc = GBC.eol().fill(GBC.HORIZONTAL).insets(0,0,0,12); 554 550 gbc.gridx = 0; … … 578 574 gbc.weightx = 1.; 579 575 panelTf.add(tfOffset, gbc); 580 576 581 577 gbc = GBC.std().insets(5,5,5,5); 582 578 gbc.gridx = 2; … … 593 589 gbc.weightx = 0.5; 594 590 panelTf.add(buttonAutoGuess, gbc); 595 591 596 592 gbc.gridx = 3; 597 593 panelTf.add(buttonAdjust, gbc); … … 628 624 statusBarText.setFont(statusBarText.getFont().deriveFont(8)); 629 625 statusBar.add(statusBarText); 630 626 631 627 statusBarListener = new StatusBarListener() { 632 628 @Override … … 639 635 delta = parseOffset(tfOffset.getText().trim()); 640 636 } catch (ParseException e) { 641 642 } 643 637 return e.getMessage(); 638 } 639 644 640 // Construct a list of images that have a date, and sort them on the date. 645 641 ArrayList<ImageEntry> dateImgLst = getSortedImgList(); … … 647 643 ie.cleanTmp(); 648 644 } 649 645 650 646 GpxDataWrapper selGpx = selectedGPX(false); 651 647 if (selGpx == null) 652 648 return tr("No gpx selected"); 653 649 654 650 lastNumMatched = matchGpxTrack(dateImgLst, selGpx.data, (long) (timezone * 3600) + delta); 655 651 … … 657 653 } 658 654 }; 659 655 660 656 tfTimezone.getDocument().addDocumentListener(statusBarListener); 661 657 tfOffset.getDocument().addDocumentListener(statusBarListener); 662 658 cbExifImg.addItemListener(statusBarListener); 663 659 cbTaggedImg.addItemListener(statusBarListener); 664 660 665 661 statusBarListener.updateStatusBar(); 666 662 … … 683 679 syncDialog.pack(); 684 680 syncDialog.addWindowListener(new WindowAdapter() { 685 final int CANCEL = -1;686 final int DONE = 0;687 final int AGAIN = 1;688 final int NOTHING = 2;681 final static int CANCEL = -1; 682 final static int DONE = 0; 683 final static int AGAIN = 1; 684 final static int NOTHING = 2; 689 685 private int checkAndSave() { 690 if (syncDialog.isVisible()) {686 if (syncDialog.isVisible()) 691 687 // nothing happened: JOSM was minimized or similar 692 return NOTHING; 693 } 688 return NOTHING; 694 689 int answer = syncDialog.getValue(); 695 690 if(answer != 1) … … 704 699 return AGAIN; 705 700 } 706 701 707 702 try { 708 703 delta = parseOffset(tfOffset.getText().trim()); 709 704 } catch (ParseException e) { 710 711 705 JOptionPane.showMessageDialog(Main.parent, e.getMessage(), 706 tr("Invalid offset"), JOptionPane.ERROR_MESSAGE); 712 707 return AGAIN; 713 708 } 714 709 715 710 if (lastNumMatched == 0) { 716 711 if (new ExtendedDialog( … … 718 713 tr("Correlate images with GPX track"), 719 714 new String[] { tr("OK"), tr("Try Again") }). 720 setContent(tr("No images could be matched!")).721 setButtonIcons(new String[] { "ok.png", "dialogs/refresh.png"}).722 showDialog().getValue() == 2)723 715 setContent(tr("No images could be matched!")). 716 setButtonIcons(new String[] { "ok.png", "dialogs/refresh.png"}). 717 showDialog().getValue() == 2) 718 return AGAIN; 724 719 } 725 720 return DONE; 726 721 } 727 722 723 @Override 728 724 public void windowDeactivated(WindowEvent e) { 729 725 int result = checkAndSave(); 730 726 switch (result) { 731 case NOTHING: 732 break; 733 case CANCEL: 734 { 735 for (ImageEntry ie : yLayer.data) { 736 ie.tmp = null; 737 } 738 yLayer.updateBufferAndRepaint(); 739 break; 727 case NOTHING: 728 break; 729 case CANCEL: 730 { 731 for (ImageEntry ie : yLayer.data) { 732 ie.tmp = null; 740 733 } 741 case AGAIN: 742 actionPerformed(null); 743 break; 744 case DONE: 745 { 746 Main.pref.put("geoimage.timezone", formatTimezone(timezone)); 747 Main.pref.put("geoimage.delta", Long.toString(delta * 1000)); 748 Main.pref.put("geoimage.showThumbs", yLayer.useThumbs); 749 750 yLayer.useThumbs = cbShowThumbs.isSelected();//FIXME 751 yLayer.loadThumbs(); 752 753 // Search whether an other layer has yet defined some bounding box. 754 // If none, we'll zoom to the bounding box of the layer with the photos. 755 boolean boundingBoxedLayerFound = false; 756 for (Layer l: Main.map.mapView.getAllLayers()) { 757 if (l != yLayer) { 758 BoundingXYVisitor bbox = new BoundingXYVisitor(); 759 l.visitBoundingBox(bbox); 760 if (bbox.getBounds() != null) { 761 boundingBoxedLayerFound = true; 762 break; 763 } 734 yLayer.updateBufferAndRepaint(); 735 break; 736 } 737 case AGAIN: 738 actionPerformed(null); 739 break; 740 case DONE: 741 { 742 Main.pref.put("geoimage.timezone", formatTimezone(timezone)); 743 Main.pref.put("geoimage.delta", Long.toString(delta * 1000)); 744 Main.pref.put("geoimage.showThumbs", yLayer.useThumbs); 745 746 yLayer.useThumbs = cbShowThumbs.isSelected();//FIXME 747 yLayer.loadThumbs(); 748 749 // Search whether an other layer has yet defined some bounding box. 750 // If none, we'll zoom to the bounding box of the layer with the photos. 751 boolean boundingBoxedLayerFound = false; 752 for (Layer l: Main.map.mapView.getAllLayers()) { 753 if (l != yLayer) { 754 BoundingXYVisitor bbox = new BoundingXYVisitor(); 755 l.visitBoundingBox(bbox); 756 if (bbox.getBounds() != null) { 757 boundingBoxedLayerFound = true; 758 break; 764 759 } 765 760 } 766 if (! boundingBoxedLayerFound) {767 BoundingXYVisitor bbox = new BoundingXYVisitor();768 yLayer.visitBoundingBox(bbox);769 Main.map.mapView.recalculateCenterScale(bbox);770 }771 772 773 for (ImageEntry ie : yLayer.data) {774 ie.applyTmp();775 }776 777 yLayer.updateBufferAndRepaint();778 779 780 break;781 761 } 782 default: 783 throw new IllegalStateException(); 762 if (! boundingBoxedLayerFound) { 763 BoundingXYVisitor bbox = new BoundingXYVisitor(); 764 yLayer.visitBoundingBox(bbox); 765 Main.map.mapView.recalculateCenterScale(bbox); 766 } 767 768 769 for (ImageEntry ie : yLayer.data) { 770 ie.applyTmp(); 771 } 772 773 yLayer.updateBufferAndRepaint(); 774 775 776 break; 777 } 778 default: 779 throw new IllegalStateException(); 784 780 } 785 781 } … … 807 803 */ 808 804 private class AdjustActionListener implements ActionListener { 809 805 810 806 public void actionPerformed(ActionEvent arg0) { 811 807 812 808 long diff = delta + Math.round(timezone*60*60); 813 809 814 810 double diffInH = (double)diff/(60*60); // hours 815 811 816 812 // Find day difference 817 813 final int dayOffset = (int)Math.round(diffInH / 24); // days 818 double tmz = diff - dayOffset*24*60*60 ; // seconds814 double tmz = diff - dayOffset*24*60*60l; // seconds 819 815 820 816 // In hours, rounded to two decimal places … … 881 877 tfTimezone.getDocument().removeDocumentListener(statusBarListener); 882 878 tfOffset.getDocument().removeDocumentListener(statusBarListener); 883 879 884 880 tfTimezone.setText(formatTimezone(timezone)); 885 tfOffset.setText(Long.toString(delta + dayOffset*24*60*60 )); // add the day offset to the offset field881 tfOffset.setText(Long.toString(delta + dayOffset*24*60*60l)); // add the day offset to the offset field 886 882 887 883 tfTimezone.getDocument().addDocumentListener(statusBarListener); … … 937 933 tr("Adjust timezone and offset"), 938 934 new String[] { tr("Close")}). 939 setContent(p).setButtonIcons(new String[] {"ok.png"}).showDialog();935 setContent(p).setButtonIcons(new String[] {"ok.png"}).showDialog(); 940 936 } 941 937 } 942 938 943 939 private class AutoGuessActionListener implements ActionListener { 944 940 945 941 public void actionPerformed(ActionEvent arg0) { 946 942 GpxDataWrapper gpxW = selectedGPX(true); … … 948 944 return; 949 945 GpxData gpx = gpxW.data; 950 946 951 947 ArrayList<ImageEntry> imgs = getSortedImgList(); 952 948 PrimaryDateParser dateParser = new PrimaryDateParser(); … … 996 992 // Find day difference 997 993 int dayOffset = (int)Math.round(diffInH / 24); // days 998 double tz = diff - dayOffset*24*60*60 ; // seconds994 double tz = diff - dayOffset*24*60*60l; // seconds 999 995 1000 996 // In hours, rounded to two decimal places … … 1004 1000 // -2 minutes offset. This determines the real timezone and finds offset. 1005 1001 timezone = (double)Math.round(tz * 2)/2; // hours, rounded to one decimal place 1006 delta = (long)Math.round(diff - timezone*60*60); // seconds1002 delta = Math.round(diff - timezone*60*60); // seconds 1007 1003 1008 1004 /*System.out.println("phto " + firstExifDate); … … 1017 1013 tfTimezone.getDocument().removeDocumentListener(statusBarListener); 1018 1014 tfOffset.getDocument().removeDocumentListener(statusBarListener); 1019 1015 1020 1016 tfTimezone.setText(formatTimezone(timezone)); 1021 1017 tfOffset.setText(Long.toString(delta)); … … 1024 1020 tfTimezone.getDocument().addDocumentListener(statusBarListener); 1025 1021 tfOffset.getDocument().addDocumentListener(statusBarListener); 1026 1022 1027 1023 statusBarListener.updateStatusBar(); 1028 1024 yLayer.updateBufferAndRepaint(); … … 1033 1029 return getSortedImgList(cbExifImg.isSelected(), cbTaggedImg.isSelected()); 1034 1030 } 1035 1031 1036 1032 /** 1037 1033 * Returns a list of images that fulfill the given criteria. 1038 1034 * Default setting is to return untagged images, but may be overwritten. 1039 1035 * @param boolean all -- returns all available images 1040 * @param boolean noexif -- returns untagged images without EXIF-GPS coords 1036 * @param boolean noexif -- returns untagged images without EXIF-GPS coords 1041 1037 * this parameter is irrelevant if <code>all</code> is true 1042 1038 * @param boolean exif -- also returns images with exif-gps info … … 1047 1043 ArrayList<ImageEntry> dateImgLst = new ArrayList<ImageEntry>(yLayer.data.size()); 1048 1044 for (ImageEntry e : yLayer.data) { 1049 if (e.time == null) 1045 if (e.time == null) { 1050 1046 continue; 1051 1047 } 1048 1052 1049 if (e.exifCoor != null) { 1053 if (!exif) 1050 if (!exif) { 1054 1051 continue; 1055 } 1056 1052 } 1053 } 1054 1057 1055 if (e.isTagged() && e.exifCoor == null) { 1058 if (!tagged) 1056 if (!tagged) { 1059 1057 continue; 1060 } 1061 1058 } 1059 } 1060 1062 1061 dateImgLst.add(e); 1063 1062 } 1064 1063 1065 1064 Collections.sort(dateImgLst, new Comparator<ImageEntry>() { 1066 1065 public int compare(ImageEntry arg0, ImageEntry arg1) { … … 1251 1250 1252 1251 private double parseTimezone(String timezone) throws ParseException { 1253 1252 1254 1253 String error = tr("Error while parsing timezone.\nExpected format: {0}", "+H:MM"); 1255 1256 1254 1255 1257 1256 if (timezone.length() == 0) 1258 1257 return 0; … … 1324 1323 private long parseOffset(String offset) throws ParseException { 1325 1324 String error = tr("Error while parsing offset.\nExpected format: {0}", "number"); 1326 1325 1327 1326 if (offset.length() > 0) { 1328 1327 try { … … 1334 1333 throw new ParseException(error,0); 1335 1334 } 1336 } else {1335 } else 1337 1336 return 0; 1338 }1339 1337 } 1340 1338 } -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r2512 r2676 77 77 } catch (OsmTransferException e) { 78 78 throw e; 79 } catch ( Exception e) {79 } catch (RuntimeException e) { 80 80 if (cancel) 81 81 return null; 82 if (e instanceof RuntimeException) 83 throw (RuntimeException)e; 84 throw new RuntimeException(e); 82 throw e; 85 83 } finally { 86 84 progressMonitor.finishTask(); -
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r2655 r2676 233 233 private boolean ParseNMEASentence(String s, NMEAParserState ps) { 234 234 try { 235 if(s.equals("")) throw(null); 235 if (s.equals("")) 236 throw new NullPointerException(); 236 237 237 238 // checksum check: … … 444 445 return true; 445 446 446 } catch( Exception x) {447 } catch(RuntimeException x) { 447 448 // out of bounds and such 448 449 // x.printStackTrace(); -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r2642 r2676 31 31 */ 32 32 public class XmlObjectParser implements Iterable<Object> { 33 public class PresetParsingException extends SAXException {33 public static class PresetParsingException extends SAXException { 34 34 private int columnNumber; 35 35 private int lineNumber; … … 110 110 public void setDocumentLocator(Locator locator) { 111 111 this.locator = locator; 112 }113 114 protected void throwException(String msg) throws PresetParsingException{115 throw new PresetParsingException(msg).rememberLocation(locator);116 112 } 117 113
Note:
See TracChangeset
for help on using the changeset viewer.