Changeset 23853 in osm
- Timestamp:
- 2010-10-26T21:30:10+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressEditContainer.java
r23850 r23853 139 139 140 140 if (sNode != null) { 141 // TODO: Check if sgemnt really belongs to the street, even if the 142 // names are the same. 141 143 sNode.addStreetSegment(newSegment); 142 144 } else { -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressNode.java
r23846 r23853 14 14 package org.openstreetmap.josm.plugins.addressEdit; 15 15 16 import org.openstreetmap.josm.Main;17 import org.openstreetmap.josm.command.ChangeCommand;18 import org.openstreetmap.josm.data.osm.Node;19 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 17 -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/gui/AddressEditDialog.java
r23851 r23853 34 34 import javax.swing.JSeparator; 35 35 import javax.swing.JSplitPane; 36 import javax.swing.JTabbedPane; 36 37 import javax.swing.JTable; 37 38 import javax.swing.ListSelectionModel; … … 41 42 import org.openstreetmap.gui.jmapviewer.JMapViewer; 42 43 import org.openstreetmap.gui.jmapviewer.MapMarkerDot; 43 import org.openstreetmap.josm.data.osm.BBox;44 44 import org.openstreetmap.josm.data.osm.Node; 45 45 import org.openstreetmap.josm.data.osm.Way; … … 49 49 import org.openstreetmap.josm.plugins.addressEdit.INodeEntity; 50 50 import org.openstreetmap.josm.plugins.addressEdit.StreetNode; 51 import org.openstreetmap.josm.plugins.addressEdit.Str eetSegmentNode;51 import org.openstreetmap.josm.plugins.addressEdit.StringUtils; 52 52 53 53 public class AddressEditDialog extends JFrame implements ActionListener, ListSelectionListener, IAddressEditContainerListener { … … 64 64 private JTable unresolvedTable; 65 65 private JTable incompleteTable; 66 private JTable street List;66 private JTable streetTable; 67 67 68 68 private AssignAddressToStreetAction resolveAction = new AssignAddressToStreetAction(); … … 96 96 /* Panel for street table */ 97 97 JPanel streetPanel = new JPanel(new BorderLayout()); 98 street List= new JTable(new StreetTableModel(editContainer));99 street List.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);100 street List.getSelectionModel().addListSelectionListener(this);101 102 JScrollPane scroll1 = new JScrollPane(street List);98 streetTable = new JTable(new StreetTableModel(editContainer)); 99 streetTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 100 streetTable.getSelectionModel().addListSelectionListener(this); 101 102 JScrollPane scroll1 = new JScrollPane(streetTable); 103 103 streetPanel.add(scroll1, BorderLayout.CENTER); 104 104 … … 112 112 unresolvedTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 113 113 unresolvedTable.getSelectionModel().addListSelectionListener(this); 114 unresolvedTable.getSelectionModel().addListSelectionListener(new IncompleteAddressListener()); 114 115 115 116 JScrollPane scroll2 = new JScrollPane(unresolvedTable); … … 138 139 incompletePanel.setMinimumSize(new Dimension(350, 200)); 139 140 141 142 140 143 /* Edit panel for incomplete addresses */ 141 144 JPanel incompleteEditPanel = new JPanel(); 142 145 incompleteEditPanel.setMinimumSize(new Dimension(350, 300)); 143 144 /* Combine panels */ 145 JSplitPane unresSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, streetPanel, unresolvedPanel); 146 JSplitPane addrSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, incompleteEditPanel, incompletePanel); 147 JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, unresSplitPane, addrSplitPane); 148 146 149 147 /* Map Panel */ 150 148 JPanel mapPanel = new JPanel(new BorderLayout()); … … 152 150 mapPanel.add(mapViewer, BorderLayout.CENTER); 153 151 mapPanel.setMinimumSize(new Dimension(200, 200)); 154 mapLabel = createHeaderLabel(tr("Map"));155 mapPanel.add(mapLabel, BorderLayout.NORTH);156 mapPanel.add(new JSeparator(), BorderLayout.SOUTH);157 152 mapViewer.setVisible(false); 158 153 154 JTabbedPane tab = new JTabbedPane(); 155 tab.addTab(tr("Properties"), incompleteEditPanel); 156 tab.addTab(tr("Map"), mapPanel); 157 158 /* Combine panels */ 159 JSplitPane unresSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, streetPanel, unresolvedPanel); 160 JSplitPane addrSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tab, incompletePanel); 161 JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, unresSplitPane, addrSplitPane); 162 159 163 this.getContentPane().add(pane, BorderLayout.CENTER); 160 this.getContentPane().add(mapPanel, BorderLayout.EAST);164 //this.getContentPane().add(mapPanel, BorderLayout.SOUTH); 161 165 } else { 162 166 this.getContentPane().add(new JLabel(tr("(No data)")), BorderLayout.CENTER); … … 218 222 219 223 AddressEditSelectionEvent ev = new AddressEditSelectionEvent(e.getSource(), 220 street List, unresolvedTable, incompleteTable, editContainer);224 streetTable, unresolvedTable, incompleteTable, editContainer); 221 225 222 226 for (AbstractAddressEditAction action : actions) { … … 274 278 updateHeaders(); 275 279 } 280 281 /** 282 * Special listener to react on selection changes in the incomplete address list. 283 * It searches the street table for the streets which matches best matching to the 284 * street name given in the address. 285 * 286 * @author Oliver Wieland <oliver.wieland@online.de> 287 */ 288 289 class IncompleteAddressListener implements ListSelectionListener { 290 291 @Override 292 public void valueChanged(ListSelectionEvent e) { 293 if (unresolvedTable.getSelectedRowCount() == 1) { 294 String streetOfAddr = (String) unresolvedTable. 295 getModel().getValueAt(unresolvedTable.getSelectedRow(), 0); 296 297 int maxScore = 0, score = 0, row = -1; 298 for (int i = 0; i < streetTable.getRowCount(); i++) { 299 String streetName = (String) streetTable.getModel().getValueAt(i, 1); 300 301 score = StringUtils.lcsLength(streetOfAddr, streetName); 302 if (score > maxScore) { 303 maxScore = score; 304 row = i; 305 } 306 } 307 308 if (row > 0) { 309 streetTable.getSelectionModel().clearSelection(); 310 streetTable.getSelectionModel().addSelectionInterval(row, row); 311 streetTable.scrollRectToVisible(streetTable.getCellRect(row, 0, true)); 312 } 313 } 314 } 315 316 } 276 317 277 318 }
Note:
See TracChangeset
for help on using the changeset viewer.