Changeset 25748 in osm for applications/editors
- Timestamp:
- 2011-03-30T20:13:24+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/relcontext
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/relcontext/TODO
r25747 r25748 3 3 - Draw icons for multipoly settings menu 4 4 - Solve width problem for narrows buttons when "fix" and "download" appear simultaneously 5 - Doubleclick on a relation list member should either select a relation or6 open relation editor for that relation (and choose it) (preferences?)7 - Add "Open editor" to relation context menu8 5 - "Reverse multipolygon": create a closed area out of outer members, move tags, delete relation and empty ways 9 - Remove "single multipolygon" from relation settings, there will be single relation in all cases10 6 11 7 == NEW ALGORITHM == -
applications/editors/josm/plugins/relcontext/src/relcontext/ChosenRelation.java
r25711 r25748 44 44 public void clear() { 45 45 set(null); 46 } 47 48 public boolean isSame( Object r ) { 49 if( r == null ) 50 return chosenRelation == null; 51 else if( !(r instanceof Relation) ) 52 return false; 53 else 54 return chosenRelation != null && r.equals(chosenRelation); 46 55 } 47 56 -
applications/editors/josm/plugins/relcontext/src/relcontext/RelContextDialog.java
r25727 r25748 180 180 relationsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 181 181 relationsTable.setTableHeader(null); 182 relationsTable.addMouseListener(new PopupMenuLauncher() {183 @Override 184 public void launch(MouseEvent evt) {185 Point p = e vt.getPoint();182 relationsTable.addMouseListener(new MouseAdapter() { 183 @Override 184 public void mouseClicked( MouseEvent e ) { 185 Point p = e.getPoint(); 186 186 int row = relationsTable.rowAtPoint(p); 187 if (row > -1) {187 if( SwingUtilities.isLeftMouseButton(e) && row >= 0 ) { 188 188 Relation relation = (Relation)relationsData.getValueAt(row, 0); 189 JPopupMenu menu = new ChosenRelationPopupMenu(new StaticChosenRelation(relation)); 190 menu.show(relationsTable, p.x, p.y-5); 189 if( e.getClickCount() > 1 ) { 190 Main.map.mapView.getEditLayer().data.setSelected(relation); 191 } 192 } 193 } 194 195 @Override 196 public void mousePressed( MouseEvent e ) { 197 checkPopup(e); 198 } 199 200 @Override 201 public void mouseReleased( MouseEvent e ) { 202 checkPopup(e); 203 } 204 205 public void checkPopup( MouseEvent e ) { 206 if( e.isPopupTrigger() ) { 207 Point p = e.getPoint(); 208 int row = relationsTable.rowAtPoint(p); 209 if (row > -1) { 210 Relation relation = (Relation)relationsData.getValueAt(row, 0); 211 JPopupMenu menu = chosenRelation.isSame(relation) ? popupMenu 212 : new ChosenRelationPopupMenu(new StaticChosenRelation(relation)); 213 menu.show(relationsTable, p.x, p.y-5); 214 } 191 215 } 192 216 } … … 203 227 public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) { 204 228 Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); 205 if( !isSelected && value instanceof Relation && chosenRelation. get() != null && value.equals(chosenRelation.get()) )229 if( !isSelected && value instanceof Relation && chosenRelation.isSame(value) ) 206 230 c.setBackground(CHOSEN_RELATION_COLOR); 207 231 else … … 215 239 public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) { 216 240 Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); 217 if( !isSelected && chosenRelation. get() != null && table.getValueAt(row, 0).equals(chosenRelation.get()) )241 if( !isSelected && chosenRelation.isSame(table.getValueAt(row, 0)) ) 218 242 c.setBackground(CHOSEN_RELATION_COLOR); 219 243 else … … 310 334 } 311 335 for( OsmPrimitive element : newSelection ) 312 if( element instanceof Relation && (chosenRelation.get() == null || !chosenRelation.get().equals(element)) )336 if( element instanceof Relation && !chosenRelation.isSame(element) ) 313 337 relationsData.addRow(new Object[] {element, ""}); 314 338 } … … 489 513 addMenuItem("boundaryways", "Add tags boundary and admin_level to boundary relation ways"); 490 514 addMenuItem("tags", "Move area tags from contour to relation"); 491 addMenuItem("single", "Create a single multipolygon for multiple outer contours").setEnabled(false);492 515 } 493 516
Note:
See TracChangeset
for help on using the changeset viewer.