Changeset 26887 in osm for applications/editors/josm/plugins/reltoolbox/src
- Timestamp:
- 2011-10-14T09:18:45+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/reltoolbox/src/relcontext
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java
r26882 r26887 517 517 addMenuItem("tags", tr("Move area tags from contour to relation")); 518 518 addMenuItem("alltags", tr("When moving tags, consider even non-repeating ones")); 519 addMenuItem("allowsplit", tr("Al low splitting of ways inneighbouring multipolygons"));519 addMenuItem("allowsplit", tr("Always split ways of neighbouring multipolygons")); 520 520 } 521 521 -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java
r26837 r26887 64 64 Collection<Way> selectedWays = getCurrentDataSet().getSelectedWays(); 65 65 if( !isBoundary && getPref("tags") ) { 66 List<Command> commands = new ArrayList<Command>();67 66 List<Relation> rels = null; 68 if( getPref("allowsplit") ) {67 if( getPref("allowsplit") || selectedWays.size() == 1 ) { 69 68 if( SplittingMultipolygons.canProcess(selectedWays) ) 70 rels = SplittingMultipolygons.process(getCurrentDataSet().getSelectedWays() , commands);69 rels = SplittingMultipolygons.process(getCurrentDataSet().getSelectedWays()); 71 70 } else { 72 if( TheRing.areAllOfThoseRings(selectedWays) ) 71 if( TheRing.areAllOfThoseRings(selectedWays) ) { 72 List<Command> commands = new ArrayList<Command>(); 73 73 rels = TheRing.makeManySimpleMultipolygons(getCurrentDataSet().getSelectedWays(), commands); 74 } 75 if( !commands.isEmpty() && rels != null && !rels.isEmpty() ) { 76 Main.main.undoRedo.add(new SequenceCommand(tr("Create multipolygons from rings"), commands)); 74 if( !commands.isEmpty() ) 75 Main.main.undoRedo.add(new SequenceCommand(tr("Create multipolygons from rings"), commands)); 76 } 77 } 78 if( rels != null && !rels.isEmpty() ) { 77 79 if( chRel != null ) 78 80 chRel.set(rels.size() == 1 ? rels.get(0) : null); -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java
r26844 r26887 1 1 package relcontext.actions; 2 2 3 import java.awt.geom.Area; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 4 5 import java.util.*; … … 21 22 List<Way> rings = new ArrayList<Way>(); 22 23 List<Way> arcs = new ArrayList<Way>(); 24 Area a = Main.main.getCurrentDataSet().getDataSourceArea(); 23 25 for( Way way : ways ) { 26 if( way.isDeleted() ) 27 return false; 28 for( Node n : way.getNodes() ) { 29 if( n == null ) 30 System.out.println("Node is null"); 31 if( n.isIncomplete() || (a != null && !a.contains(n.getCoor())) ) 32 return false; 33 } 24 34 if( way.isClosed() ) 25 35 rings.add(way); … … 54 64 } 55 65 56 public static List<Relation> process( Collection<Way> selectedWays , List<Command> commands) {66 public static List<Relation> process( Collection<Way> selectedWays ) { 57 67 System.out.println("---------------------------------------"); 58 68 List<Relation> result = new ArrayList<Relation>(); … … 67 77 68 78 for( Way ring : rings ) { 79 List<Command> commands = new ArrayList<Command>(); 69 80 Relation newRelation = SplittingMultipolygons.attachRingToNeighbours(ring, commands); 70 if( newRelation != null ) 81 if( newRelation != null && !commands.isEmpty() ) { 82 Main.main.undoRedo.add(commands.get(0)); 71 83 result.add(newRelation); 84 } 72 85 } 73 86 74 87 for( Way arc : arcs) { 88 List<Command> commands = new ArrayList<Command>(); 75 89 Relation newRelation = SplittingMultipolygons.tryToCloseOneWay(arc, commands); 76 if( newRelation != null ) 90 if( newRelation != null && !commands.isEmpty() ) { 91 Main.main.undoRedo.add(commands.get(0)); 77 92 result.add(newRelation); 93 } 78 94 } 79 95 return result; -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java
r26844 r26887 310 310 } 311 311 } 312 // todo: когда два кольца меняют одно и то же отношение, в список команд добавляется 313 // изменение базового отношения на новое, а не предыдущего 314 // поэтому сохраняется только первое изменение 312 315 313 316 List<Command> commands = new ArrayList<Command>();
Note:
See TracChangeset
for help on using the changeset viewer.