Changeset 31837 in osm
- Timestamp:
- 2015-12-16T17:16:54+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
r31816 r31837 35 35 private static final long serialVersionUID = 4995924098228081806L; 36 36 37 private JFileChooser chooser;38 39 37 /** 40 38 * Main constructor. … … 51 49 @Override 52 50 public void actionPerformed(ActionEvent e) { 53 this.chooser = new JFileChooser();51 JFileChooser chooser = new JFileChooser(); 54 52 File startDirectory = new File(Main.pref.get("mapillary.start-directory", 55 53 System.getProperty("user.home"))); 56 this.chooser.setCurrentDirectory(startDirectory);57 this.chooser.setDialogTitle(tr("Select pictures"));58 this.chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);59 this.chooser.setAcceptAllFileFilterUsed(false);60 this.chooser.addChoosableFileFilter(new FileNameExtensionFilter("images", "jpg", "jpeg", "png"));61 this.chooser.setMultiSelectionEnabled(true);62 if ( this.chooser.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) {54 chooser.setCurrentDirectory(startDirectory); 55 chooser.setDialogTitle(tr("Select pictures")); 56 chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); 57 chooser.setAcceptAllFileFilterUsed(false); 58 chooser.addChoosableFileFilter(new FileNameExtensionFilter("images", "jpg", "jpeg", "png")); 59 chooser.setMultiSelectionEnabled(true); 60 if (chooser.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) { 63 61 List<MapillaryAbstractImage> images = new ArrayList<>(); 64 for (int i = 0; i < this.chooser.getSelectedFiles().length; i++) { 65 File file = this.chooser.getSelectedFiles()[i]; 62 for (File file : chooser.getSelectedFiles()) { 66 63 Main.pref.put("mapillary.start-directory", file.getParent()); 67 64 MapillaryLayer.getInstance(); … … 69 66 if (file.listFiles() == null) 70 67 continue; 71 for ( int j = 0; j < file.listFiles().length; j++) {72 String extension = MapillaryUtils.getExtension( file.listFiles()[j]);68 for (File innerFile : file.listFiles()) { 69 String extension = MapillaryUtils.getExtension(innerFile); 73 70 try { 74 71 if ("jpg".equals(extension) || "jpeg".equals(extension)) 75 images.add(MapillaryUtils.readJPG( file.listFiles()[j]));72 images.add(MapillaryUtils.readJPG(innerFile)); 76 73 else if ("png".equals(extension)) 77 images.add(MapillaryUtils.readPNG( file.listFiles()[j]));74 images.add(MapillaryUtils.readPNG(innerFile)); 78 75 } catch (ImageReadException | IOException | NullPointerException e1) { 79 76 Main.error(e1); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java
r31816 r31837 38 38 private static final long serialVersionUID = -9190217809965894878L; 39 39 40 private JFileChooser chooser;41 42 40 private List<MapillaryAbstractImage> images; 43 41 … … 59 57 this.images = new LinkedList<>(); 60 58 61 this.chooser = new JFileChooser();59 JFileChooser chooser = new JFileChooser(); 62 60 File startDirectory = new File(Main.pref.get("mapillary.start-directory", 63 61 System.getProperty("user.home"))); 64 this.chooser.setCurrentDirectory(startDirectory); 65 this.chooser.setDialogTitle(tr("Select pictures")); 66 this.chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); 67 this.chooser.setAcceptAllFileFilterUsed(false); 68 this.chooser.addChoosableFileFilter(new FileNameExtensionFilter("images", 69 "jpg", "jpeg")); 70 this.chooser.setMultiSelectionEnabled(true); 62 chooser.setCurrentDirectory(startDirectory); 63 chooser.setDialogTitle(tr("Select pictures")); 64 chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); 65 chooser.setAcceptAllFileFilterUsed(false); 66 chooser.addChoosableFileFilter(new FileNameExtensionFilter("images", "jpg", "jpeg")); 67 chooser.setMultiSelectionEnabled(true); 71 68 72 if (this.chooser.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) { 73 for (int i = 0; i < this.chooser.getSelectedFiles().length; i++) { 74 File file = this.chooser.getSelectedFiles()[i]; 69 if (chooser.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) { 70 for (File file : chooser.getSelectedFiles()) { 75 71 if (file == null) 76 72 break; … … 78 74 MapillaryLayer.getInstance(); 79 75 if (file.isDirectory()) { 80 for ( int j = 0; j < file.listFiles().length; j++) {81 String extension = MapillaryUtils.getExtension(file .listFiles()[j]);76 for (File file2 : file.listFiles()) { 77 String extension = MapillaryUtils.getExtension(file2); 82 78 try { 83 79 if ("jpg".equals(extension) || "jpeg".equals(extension)) 84 MapillaryUtils.readJPG(file .listFiles()[j], true);80 MapillaryUtils.readJPG(file2, true); 85 81 } catch (ImageReadException | NullPointerException | IOException e) { 86 82 Main.error(e); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
r31812 r31837 47 47 48 48 private static final String[] TIME_LIST = { tr("All"), tr("Years"), tr("Months"), tr("Days") }; 49 50 private final JPanel panel;51 49 52 50 /** Spinner to choose the range of dates. */ … … 90 88 KeyEvent.VK_M, Shortcut.NONE), 200); 91 89 92 this.panel = new JPanel();93 94 90 this.signChooser.setEnabled(false); 95 91 JPanel signChooserPanel = new JPanel(); … … 115 111 this.downloaded.setSelected(true); 116 112 113 JPanel panel = new JPanel(); 117 114 JPanel col1 = new JPanel(new GridLayout(2, 1)); 118 115 col1.add(this.downloaded); 119 116 col1.add(fromPanel); 120 this.panel.add(col1);117 panel.add(col1); 121 118 JPanel col2 = new JPanel(new GridLayout(2, 1)); 122 119 col2.add(this.imported); 123 120 col2.add(userSearchPanel); 124 this.panel.add(col2);121 panel.add(col2); 125 122 JPanel col3 = new JPanel(new GridLayout(2, 1)); 126 123 col3.add(this.onlySigns); 127 124 col3.add(signChooserPanel); 128 this.panel.add(col3); 129 130 createLayout(this.panel, true, 131 Arrays.asList(new SideButton[] { this.updateButton, this.resetButton })); 125 panel.add(col3); 126 127 createLayout(panel, true, Arrays.asList(new SideButton[] { updateButton, resetButton })); 132 128 } 133 129 … … 203 199 Long currentTime = currentTime(); 204 200 long[] timeFactor = new long[]{ 205 31 536000000L, // = 365 * 24 * 60 * 60 * 1000 = number of ms in a year206 2 592000000L, // = 30 * 24 * 60 * 60 * 1000 = number of ms in a month207 86 400000 // = 24 * 60 * 60 * 1000 = number of ms in a day201 31_536_000_000L, // = 365 * 24 * 60 * 60 * 1000 = number of ms in a year 202 2_592_000_000L, // = 30 * 24 * 60 * 60 * 1000 = number of ms in a month 203 86_400_000 // = 24 * 60 * 60 * 1000 = number of ms in a day 208 204 }; 209 205 for (int i = 1; i <= 3; i++) { … … 235 231 } 236 232 237 private static boolean checkSign(MapillaryImage img, JCheckBox signCheckBox, 238 String singString) { 233 private static boolean checkSign(MapillaryImage img, JCheckBox signCheckBox, String singString) { 239 234 boolean contains = false; 240 235 for (String sign : img.getSigns()) { … … 242 237 contains = true; 243 238 } 244 if (contains == signCheckBox.isSelected() && contains) 245 return true; 246 return false; 239 return contains == signCheckBox.isSelected() && contains; 247 240 } 248 241 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySequenceDownloadThread.java
r31828 r31837 122 122 123 123 private boolean isInside(MapillaryAbstractImage image) { 124 for ( int i = 0; i < MapillaryLayer.getInstance().getData().bounds.size(); i++)125 if ( MapillaryLayer.getInstance().getData().bounds.get(i).contains(image.getLatLon()))124 for (Bounds b : MapillaryLayer.getInstance().getData().bounds) { 125 if (b.contains(image.getLatLon())) { 126 126 return true; 127 } 128 } 127 129 return false; 128 130 }
Note:
See TracChangeset
for help on using the changeset viewer.