Changeset 32038 in osm for applications/editors
- Timestamp:
- 2016-01-31T19:14:35+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
r31837 r32038 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.FlowLayout; 7 import java.awt.GridLayout; 6 import java.awt.*; 8 7 import java.awt.event.ActionEvent; 9 8 import java.awt.event.KeyEvent; … … 38 37 * @author nokutu 39 38 * @see MapillaryFilterChooseSigns 40 *41 39 */ 42 40 public class MapillaryFilterDialog extends ToggleDialog implements MapillaryDataListener { … … 46 44 private static MapillaryFilterDialog instance; 47 45 48 private static final String[] TIME_LIST = { tr("All"), tr("Years"), tr("Months"), tr("Days") }; 49 50 /** Spinner to choose the range of dates. */ 46 private static final String[] TIME_LIST = {tr("All"), tr("Years"), tr("Months"), tr("Days")}; 47 48 /** 49 * Spinner to choose the range of dates. 50 */ 51 51 private final SpinnerNumberModel spinner; 52 52 … … 63 63 private final MapillaryFilterChooseSigns signFilter = MapillaryFilterChooseSigns.getInstance(); 64 64 65 /** The list of sign names */ 66 private static final String[] SIGN_TAGS = { "prohibitory_speed_limit", 67 "priority_stop", "other_give_way", "mandatory_roundabout", 68 "other_no_entry", "prohibitory_no_traffic_both_ways", 69 "danger_intersection", "mandatory_go", "mandatory_keep", 70 "danger_priority_next_intersection", "danger_uneven_road", 71 "prohibitory_no_parking", "prohibitory_on_overtaking", 72 "danger_pedestrian_crossing", "prohibitory_no_u_turn", 73 "prohibitory_noturn" }; 74 /** The {@link JCheckBox} where the respective tag should be searched */ 75 private final JCheckBox[] SIGN_CHECKBOXES = { this.signFilter.maxSpeed, 76 this.signFilter.stop, this.signFilter.giveWay, 77 this.signFilter.roundabout, this.signFilter.access, 78 this.signFilter.access, this.signFilter.intersection, 79 this.signFilter.direction, this.signFilter.direction, 80 this.signFilter.intersection, this.signFilter.uneven, 81 this.signFilter.noParking, this.signFilter.noOvertaking, 82 this.signFilter.crossing, this.signFilter.noTurn, this.signFilter.noTurn }; 65 /** 66 * The list of sign names 67 */ 68 private static final String[] SIGN_TAGS = {"prohibitory_speed_limit", 69 "priority_stop", "other_give_way", "mandatory_roundabout", 70 "other_no_entry", "prohibitory_no_traffic_both_ways", 71 "danger_intersection", "mandatory_go", "mandatory_keep", 72 "danger_priority_next_intersection", "danger_uneven_road", 73 "prohibitory_no_parking", "prohibitory_on_overtaking", 74 "danger_pedestrian_crossing", "prohibitory_no_u_turn", 75 "prohibitory_noturn"}; 76 /** 77 * The {@link JCheckBox} where the respective tag should be searched 78 */ 79 private final JCheckBox[] SIGN_CHECKBOXES = {this.signFilter.maxSpeed, 80 this.signFilter.stop, this.signFilter.giveWay, 81 this.signFilter.roundabout, this.signFilter.access, 82 this.signFilter.access, this.signFilter.intersection, 83 this.signFilter.direction, this.signFilter.direction, 84 this.signFilter.intersection, this.signFilter.uneven, 85 this.signFilter.noParking, this.signFilter.noOvertaking, 86 this.signFilter.crossing, this.signFilter.noTurn, this.signFilter.noTurn}; 83 87 84 88 private MapillaryFilterDialog() { 85 89 super(tr("Mapillary filter"), "mapillaryfilter.png", 86 tr("Open Mapillary filter dialog"), Shortcut.registerShortcut(87 tr("Mapillary filter"), tr("Open Mapillary filter dialog"),88 KeyEvent.VK_M, Shortcut.NONE), 200);90 tr("Open Mapillary filter dialog"), Shortcut.registerShortcut( 91 tr("Mapillary filter"), tr("Open Mapillary filter dialog"), 92 KeyEvent.VK_M, Shortcut.NONE), 200); 89 93 90 94 this.signChooser.setEnabled(false); … … 112 116 113 117 JPanel panel = new JPanel(); 114 JPanel col1 = new JPanel(new GridLayout(2, 1)); 115 col1.add(this.downloaded); 116 col1.add(fromPanel); 117 panel.add(col1); 118 JPanel col2 = new JPanel(new GridLayout(2, 1)); 119 col2.add(this.imported); 120 col2.add(userSearchPanel); 121 panel.add(col2); 122 JPanel col3 = new JPanel(new GridLayout(2, 1)); 123 col3.add(this.onlySigns); 124 col3.add(signChooserPanel); 125 panel.add(col3); 126 127 createLayout(panel, true, Arrays.asList(new SideButton[] { updateButton, resetButton })); 118 panel.setLayout(new GridBagLayout()); 119 GridBagConstraints c = new GridBagConstraints(); 120 c.anchor = GridBagConstraints.LINE_START; 121 panel.add(this.downloaded, c); 122 c.gridx = 1; 123 panel.add(this.imported, c); 124 c.gridx = 0; 125 c.gridy = 1; 126 c.gridwidth = 2; 127 panel.add(fromPanel, c); 128 c.gridy = 2; 129 panel.add(userSearchPanel, c); 130 c.gridwidth = 1; 131 c.gridy = 3; 132 panel.add(this.onlySigns, c); 133 c.gridx = 1; 134 panel.add(signChooserPanel, c); 135 136 createLayout(panel, true, Arrays.asList(new SideButton[]{updateButton, resetButton})); 128 137 } 129 138 … … 191 200 } 192 201 if (!"".equals(user.getText()) 193 && !this.user.getText().equals(((MapillaryImage) img).getUser())) {202 && !this.user.getText().equals(((MapillaryImage) img).getUser())) { 194 203 img.setVisible(false); 195 204 continue; … … 199 208 Long currentTime = currentTime(); 200 209 long[] timeFactor = new long[]{ 201 31_536_000_000L, // = 365 * 24 * 60 * 60 * 1000 = number of ms in a year202 2_592_000_000L, // = 30 * 24 * 60 * 60 * 1000 = number of ms in a month203 86_400_000 // = 24 * 60 * 60 * 1000 = number of ms in a day210 31_536_000_000L, // = 365 * 24 * 60 * 60 * 1000 = number of ms in a year 211 2_592_000_000L, // = 30 * 24 * 60 * 60 * 1000 = number of ms in a month 212 86_400_000 // = 24 * 60 * 60 * 1000 = number of ms in a day 204 213 }; 205 214 for (int i = 1; i <= 3; i++) { 206 215 if (TIME_LIST[i].equals(time.getSelectedItem()) 207 && img.getCapturedAt() < currentTime - ((Integer) spinner.getValue()).longValue() * timeFactor[i - 1]208 ) {216 && img.getCapturedAt() < currentTime - ((Integer) spinner.getValue()).longValue() * timeFactor[i - 1] 217 ) { 209 218 img.setVisible(false); 210 219 } … … 217 226 * Checks if the image fulfills the sign conditions. 218 227 * 219 * @param img 220 * The {@link MapillaryAbstractImage} object that is going to be 221 * checked. 228 * @param img The {@link MapillaryAbstractImage} object that is going to be 229 * checked. 222 230 * @return {@code true} if it fulfills the conditions; {@code false} 223 * 231 * otherwise. 224 232 */ 225 233 private boolean checkSigns(MapillaryImage img) { … … 307 315 * 308 316 * @author nokutu 309 *310 317 */ 311 318 private class SignChooserAction extends AbstractAction { … … 321 328 JPanel dialog = MapillaryFilterChooseSigns.getInstance(); 322 329 JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE, 323 JOptionPane.OK_CANCEL_OPTION);330 JOptionPane.OK_CANCEL_OPTION); 324 331 JDialog dlg = pane.createDialog(Main.parent, tr("Choose signs")); 325 332 dlg.setVisible(true);
Note:
See TracChangeset
for help on using the changeset viewer.