Changeset 36103 in osm for applications
- Timestamp:
- 2023-07-24T17:55:34+02:00 (17 months ago)
- Location:
- applications/editors/josm/plugins/reltoolbox
- Files:
-
- 9 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/AssociatedStreetFixer.java
r36102 r36103 12 12 import org.openstreetmap.josm.command.Command; 13 13 import org.openstreetmap.josm.command.SequenceCommand; 14 import org.openstreetmap.josm.data.osm.DataSet; 14 15 import org.openstreetmap.josm.data.osm.Node; 15 16 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 18 19 import org.openstreetmap.josm.data.osm.Way; 19 20 import org.openstreetmap.josm.gui.MainApplication; 21 import org.openstreetmap.josm.tools.Utils; 20 22 21 23 public class AssociatedStreetFixer extends RelationFixer { … … 135 137 List<Command> commandList = new ArrayList<>(); 136 138 if (fixed) { 137 commandList.add(new ChangeCommand(MainApplication.getLayerManager().getEditDataSet(), source, rel)); 139 final DataSet ds = Utils.firstNonNull(source.getDataSet(), MainApplication.getLayerManager().getEditDataSet()); 140 commandList.add(new ChangeCommand(ds, source, rel)); 138 141 } 139 142 -
applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/BoundaryFixer.java
r36102 r36103 6 6 import org.openstreetmap.josm.command.ChangeCommand; 7 7 import org.openstreetmap.josm.command.Command; 8 import org.openstreetmap.josm.data.osm.DataSet; 8 9 import org.openstreetmap.josm.data.osm.Node; 9 10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 11 12 import org.openstreetmap.josm.data.osm.RelationMember; 12 13 import org.openstreetmap.josm.gui.MainApplication; 14 import org.openstreetmap.josm.tools.Utils; 13 15 14 16 /** … … 66 68 r = rr; 67 69 } 68 return fixed ? new ChangeCommand(MainApplication.getLayerManager().getEditDataSet(), rel, r) : null; 70 if (fixed) { 71 final DataSet ds = Utils.firstNonNull(rel.getDataSet(), MainApplication.getLayerManager().getEditDataSet()); 72 return new ChangeCommand(ds, rel, r); 73 } 74 return null; 69 75 } 70 76 -
applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/MultipolygonFixer.java
r36102 r36103 11 11 import org.openstreetmap.josm.command.ChangeCommand; 12 12 import org.openstreetmap.josm.command.Command; 13 import org.openstreetmap.josm.data.osm.DataSet; 13 14 import org.openstreetmap.josm.data.osm.MultipolygonBuilder; 14 import org.openstreetmap.josm.data.osm.OsmPrimitive;15 15 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 16 16 import org.openstreetmap.josm.data.osm.Relation; … … 18 18 import org.openstreetmap.josm.data.osm.Way; 19 19 import org.openstreetmap.josm.gui.MainApplication; 20 import org.openstreetmap.josm.tools.Utils; 20 21 21 22 /** … … 47 48 public Command fixRelation(Relation rel) { 48 49 Relation rr = fixMultipolygonRoles(rel); 49 return rr != null ? new ChangeCommand(MainApplication.getLayerManager().getEditDataSet(), rel, rr) : null; 50 if (rr != null) { 51 final DataSet ds = Utils.firstNonNull(rel.getDataSet(), MainApplication.getLayerManager().getEditDataSet()); 52 return new ChangeCommand(ds, rel, rr); 53 } 54 return null; 50 55 } 51 56 … … 54 59 */ 55 60 protected Relation fixMultipolygonRoles(Relation source) { 56 Collection<Way> ways = new ArrayList<>(); 57 for (OsmPrimitive p : source.getMemberPrimitives()) { 58 if (p instanceof Way) { 59 ways.add((Way) p); 60 } 61 } 61 Collection<Way> ways = new ArrayList<>(source.getMemberPrimitives(Way.class)); 62 62 MultipolygonBuilder mpc = new MultipolygonBuilder(); 63 63 String error = mpc.makeFromWays(ways); -
applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/PublicTransportFixer.java
r36102 r36103 6 6 import org.openstreetmap.josm.command.ChangeCommand; 7 7 import org.openstreetmap.josm.command.Command; 8 import org.openstreetmap.josm.data.osm.DataSet; 8 9 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 9 10 import org.openstreetmap.josm.data.osm.Relation; … … 11 12 import org.openstreetmap.josm.gui.MainApplication; 12 13 14 import org.openstreetmap.josm.tools.Utils; 13 15 import relcontext.actions.PublicTransportHelper; 14 16 … … 61 63 r = rr; 62 64 } 63 return fixed ? new ChangeCommand(MainApplication.getLayerManager().getEditDataSet(), rel, r) : null; 65 if (fixed) { 66 final DataSet ds = Utils.firstNonNull(rel.getDataSet(), MainApplication.getLayerManager().getEditDataSet()); 67 return new ChangeCommand(ds, rel, r); 68 } 69 return null; 64 70 } 65 71
Note:
See TracChangeset
for help on using the changeset viewer.