Changeset 16119 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-03-14T13:26:33+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r14397 r16119 256 256 if (w.isClosed()) 257 257 throw new InvalidSelection(tr("Can not align a polygon. Abort.")); 258 nodes.addAll(w.getNodes()); 259 lines.put(w, new Line(w)); 258 if (!w.isEmpty()) { 259 nodes.addAll(w.getNodes()); 260 lines.put(w, new Line(w)); 261 } 260 262 } 261 263 if (nodes.isEmpty()) { -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r15152 r16119 200 200 nodeList.add((Node) p); 201 201 } else if (p instanceof Way) { 202 if (!p.isIncomplete()) { 203 wayDataList.add(new WayData(((Way) p).getNodes())); 202 Way w = (Way) p; 203 if (!w.isIncomplete() && !w.isEmpty()) { 204 wayDataList.add(new WayData(w.getNodes())); 204 205 } 205 206 } else { -
trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java
r14397 r16119 117 117 118 118 final Collection<Way> sel = new LinkedHashSet<>(ds.getSelectedWays()); 119 sel.removeIf( Way::isIncomplete);119 sel.removeIf(w -> w.isIncomplete() || w.isEmpty()); 120 120 if (sel.isEmpty()) { 121 121 new Notification( … … 129 129 Collection<Command> c = new LinkedList<>(); 130 130 for (Way w : sel) { 131 ReverseWayResult revResult;132 131 try { 133 revResult = reverseWay(w); 132 c.addAll(reverseWay(w).getCommands()); 133 } catch (IllegalArgumentException ex) { 134 Logging.error(ex); 134 135 } catch (UserCancelException ex) { 135 136 Logging.trace(ex); 136 137 return; 137 138 } 138 c.addAll(revResult.getCommands());139 139 } 140 140 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Reverse Ways"), c)); … … 145 145 * @param w the way 146 146 * @return the reverse command and the tag correction commands 147 * @throws IllegalArgumentException if sanity checks fail 147 148 * @throws UserCancelException if user cancels a reverse warning dialog 148 149 */ -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
r14397 r16119 504 504 return false; 505 505 506 sourceWays.removeIf(w -> w.isIncomplete() || w. getNodesCount() == 0);506 sourceWays.removeIf(w -> w.isIncomplete() || w.isEmpty()); 507 507 508 508 if (!sourceWays.contains(referenceSegment.way)) { -
trunk/src/org/openstreetmap/josm/command/ChangeCommand.java
r14283 r16119 32 32 * @param osm The existing primitive to modify. It must belong to a data set 33 33 * @param newOsm The new primitive 34 * @throws IllegalArgumentException if sanity checks fail 34 35 */ 35 36 public ChangeCommand(OsmPrimitive osm, OsmPrimitive newOsm) { … … 42 43 * @param osm The existing primitive to modify 43 44 * @param newOsm The new primitive 45 * @throws IllegalArgumentException if sanity checks fail 44 46 * @since 11240 45 47 */ … … 54 56 CheckParameterUtil.ensureParameterNotNull(osm, "osm"); 55 57 CheckParameterUtil.ensureParameterNotNull(newOsm, "newOsm"); 56 if (newOsm instanceof Way && ((Way) newOsm). getNodesCount() == 0) {58 if (newOsm instanceof Way && ((Way) newOsm).isEmpty()) { 57 59 // Do not allow to create empty ways (see #7465) 58 60 throw new IllegalArgumentException(tr("New way {0} has 0 nodes", newOsm)); -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r15891 r16119 1017 1017 1018 1018 void fireWayNodesChanged(Way way) { 1019 if ( way.getNodesCount() > 0) {1019 if (!way.isEmpty()) { 1020 1020 store.reindexWay(way, Way::updatePosition, Relation::updatePosition); 1021 1021 } -
trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
r16069 r16119 174 174 final Stopwatch stopwatch = Stopwatch.createStarted(); 175 175 for (Way way : dataSet.getWays()) { 176 if (way.isUsable() && way. getNodesCount() == 0) {176 if (way.isUsable() && way.isEmpty()) { 177 177 printError("WARN - ZERO NODES", "Way %s has zero nodes", way); 178 178 } else if (way.isUsable() && way.getNodesCount() == 1) { -
trunk/src/org/openstreetmap/josm/data/osm/IRelation.java
r15418 r16119 22 22 */ 23 23 int getMembersCount(); 24 25 /** 26 * Determines if this relation is empty, i.e. it has no members. 27 * @return {@code true} if this relation is empty, i.e. it has no members 28 * @since 16119 29 */ 30 default boolean isEmpty() { 31 return getMembersCount() == 0; 32 } 24 33 25 34 /** -
trunk/src/org/openstreetmap/josm/data/osm/IWay.java
r13922 r16119 17 17 */ 18 18 int getNodesCount(); 19 20 /** 21 * Determines if this way is empty, i.e. it has no nodes. 22 * @return {@code true} if this way is empty, i.e. it has no nodes 23 * @since 16119 24 */ 25 default boolean isEmpty() { 26 return getNodesCount() == 0; 27 } 19 28 20 29 /** -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r16115 r16119 424 424 for (Long wayId : wayIds) { 425 425 Way w = (Way) ds.getPrimitiveById(wayId, OsmPrimitiveType.WAY); 426 if (w != null && w.getNodesCount() > 0) { // fix #7173 (empty ways on purge)426 if (w != null && !w.isEmpty()) { // fix #7173 (empty ways on purge) 427 427 waysToJoin.add(w); 428 428 } … … 599 599 for (int i = 0; i < joinArray.length && left != 0; ++i) { 600 600 Way c = joinArray[i]; 601 if (c != null && c.getNodesCount() > 0) {601 if (c != null && !c.isEmpty()) { 602 602 if (nodes == null) { 603 603 // new ring -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r16078 r16119 93 93 @Override 94 94 public void visit(Relation r) { 95 if (r.isMultipolygon() && r.getMembersCount() > 0) {95 if (r.isMultipolygon() && !r.isEmpty()) { 96 96 List<TestError> tmpErrors = new ArrayList<>(30); 97 97 boolean hasUnexpectedWayRoles = checkMembersAndRoles(r, tmpErrors); -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r14143 r16119 126 126 } 127 127 128 if (w. getNodesCount() == 0) {128 if (w.isEmpty()) { 129 129 errors.add(TestError.builder(this, Severity.ERROR, EMPTY_WAY) 130 130 .message(tr("Empty ways")) -
trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java
r12865 r16119 34 34 */ 35 35 public static List<List<Way>> getWaysInCell(Way w, Map<Point2D, List<Way>> cellWays) { 36 if (w. getNodesCount() == 0)36 if (w.isEmpty()) 37 37 return Collections.emptyList(); 38 38 -
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r13434 r16119 391 391 // ways 392 392 for (Way w : ds.getWays()) { 393 if (!w.isSelectable() || w. getNodesCount() == 0) {393 if (!w.isSelectable() || w.isEmpty()) { 394 394 continue; 395 395 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java
r15586 r16119 65 65 // If the user wanted to create a new relation, but hasn't added any members or 66 66 // tags, don't add an empty relation 67 if (newRelation. getMembersCount() == 0&& !newRelation.hasKeys())67 if (newRelation.isEmpty() && !newRelation.hasKeys()) 68 68 return; 69 69 UndoRedoHandler.getInstance().add(new AddCommand(getLayer().getDataSet(), newRelation));
Note:
See TracChangeset
for help on using the changeset viewer.