Changeset 34653 in osm for applications
- Timestamp:
- 2018-09-15T14:06:08+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/PublicTransportAStar.java
r33765 r34653 29 29 @Override 30 30 public boolean equals(Object o) { 31 if ( (NodeVertex) o == null)31 if (!(o instanceof NodeVertex)) 32 32 return false; 33 33 return node.equals(((NodeVertex) o).node); -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/GTFSImporterAction.java
r34548 r34653 296 296 297 297 for (int i = 0; i < table.getRowCount(); ++i) { 298 if ( (nodes.elementAt(i) != null) && (ds.isSelected(nodes.elementAt(i))))298 if (nodes.elementAt(i) != null && ds.isSelected(nodes.elementAt(i))) 299 299 table.addRowSelectionInterval(i, i); 300 300 } -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/RoutePatternAction.java
r34548 r34653 88 88 @Override 89 89 public boolean isCellEditable(int row, int column) { 90 if ( (column == 0) && (hasFixedKeys))90 if (column == 0 && hasFixedKeys) 91 91 return false; 92 92 return true; … … 136 136 if (key == null) 137 137 return; 138 if ( (blacklist == null) || (!blacklist.contains(key))) {138 if (blacklist == null || !blacklist.contains(key)) { 139 139 relation.setModified(true); 140 140 if ("".equals(getValueAt(e.getFirstRow(), 1))) … … 212 212 buf[0] = curName; 213 213 } else { 214 buf[0] = tr("[ID] {0}", (Long.valueOf(node.getId())).toString());214 buf[0] = tr("[ID] {0}", Long.valueOf(node.getId()).toString()); 215 215 } 216 216 String curRef = node.get("ref"); … … 1082 1082 1083 1083 for (int i = 0; i < itineraryData.getRowCount(); ++i) { 1084 if ( (itineraryData.ways.elementAt(i) != null)1085 && (mainDataSet.isSelected(itineraryData.ways.elementAt(i))))1084 if (itineraryData.ways.elementAt(i) != null 1085 && mainDataSet.isSelected(itineraryData.ways.elementAt(i))) 1086 1086 itineraryTable.addRowSelectionInterval(i, i); 1087 1087 } … … 1090 1090 if (itineraryTable.getSelectedRowCount() > 0) { 1091 1091 for (int i = 0; i < itineraryData.getRowCount(); ++i) { 1092 if ( (itineraryTable.isRowSelected(i))1093 && (itineraryData.ways.elementAt(i) != null)) {1092 if (itineraryTable.isRowSelected(i) 1093 && itineraryData.ways.elementAt(i) != null) { 1094 1094 itineraryData.ways.elementAt(i).accept((PrimitiveVisitor) box); 1095 1095 } … … 1112 1112 if (itineraryTable.getSelectedRowCount() > 0) { 1113 1113 for (int i = 0; i < itineraryData.getRowCount(); ++i) { 1114 if ( (itineraryTable.isRowSelected(i))1115 && (itineraryData.ways.elementAt(i) != null)) {1114 if (itineraryTable.isRowSelected(i) 1115 && itineraryData.ways.elementAt(i) != null) { 1116 1116 mainDataSet.addSelected(itineraryData.ways.elementAt(i)); 1117 1117 1118 1118 RelationMember markedWay = new RelationMember( 1119 (String) (itineraryData.getValueAt(i, 1)),1119 (String) itineraryData.getValueAt(i, 1), 1120 1120 itineraryData.ways.elementAt(i)); 1121 1121 markedWays.addElement(markedWay); … … 1128 1128 1129 1129 RelationMember markedWay = new RelationMember( 1130 (String) (itineraryData.getValueAt(i, 1)),1130 (String) itineraryData.getValueAt(i, 1), 1131 1131 itineraryData.ways.elementAt(i)); 1132 1132 markedWays.addElement(markedWay); … … 1143 1143 while (relIter.hasNext()) { 1144 1144 RelationMember curMember = relIter.next(); 1145 if ( (curMember.isWay()) && (mainDataSet.isSelected(curMember.getWay()))) {1145 if (curMember.isWay() && mainDataSet.isSelected(curMember.getWay())) { 1146 1146 itineraryData.insertRow(insPos, curMember.getWay(), curMember.getRole()); 1147 1147 if (insPos >= 0) … … 1157 1157 while (wayIter.hasNext()) { 1158 1158 Way curMember = wayIter.next(); 1159 if (! (addedWays.contains(curMember))) {1159 if (!addedWays.contains(curMember)) { 1160 1160 itineraryData.insertRow(insPos, curMember, ""); 1161 1161 if (insPos >= 0) … … 1179 1179 } else if ("routePattern.itineraryDelete".equals(event.getActionCommand())) { 1180 1180 for (int i = itineraryData.getRowCount() - 1; i >= 0; --i) { 1181 if ( (itineraryTable.isRowSelected(i))1182 && (itineraryData.ways.elementAt(i) != null)) {1181 if (itineraryTable.isRowSelected(i) 1182 && itineraryData.ways.elementAt(i) != null) { 1183 1183 itineraryData.ways.removeElementAt(i); 1184 1184 itineraryData.removeRow(i); … … 1198 1198 if (itineraryTable.getSelectedRowCount() > 0) { 1199 1199 for (int i = itineraryData.getRowCount() - 1; i >= 0; --i) { 1200 if ( (itineraryTable.isRowSelected(i))1201 && (itineraryData.ways.elementAt(i) != null)) {1202 if (! (usedWays.contains(itineraryData.ways.elementAt(i)))) {1200 if (itineraryTable.isRowSelected(i) 1201 && itineraryData.ways.elementAt(i) != null) { 1202 if (!usedWays.contains(itineraryData.ways.elementAt(i))) { 1203 1203 addWayToSortingData(itineraryData.ways.elementAt(i), frontNodes, 1204 1204 backNodes, loops); … … 1213 1213 for (int i = itineraryData.getRowCount() - 1; i >= 0; --i) { 1214 1214 if (itineraryData.ways.elementAt(i) != null) { 1215 if (! (usedWays.contains(itineraryData.ways.elementAt(i)))) {1215 if (!usedWays.contains(itineraryData.ways.elementAt(i))) { 1216 1216 addWayToSortingData(itineraryData.ways.elementAt(i), frontNodes, 1217 1217 backNodes, loops); … … 1256 1256 if (itineraryTable.getSelectedRowCount() > 0) { 1257 1257 for (int i = itineraryData.getRowCount() - 1; i >= 0; --i) { 1258 if ( (itineraryTable.isRowSelected(i))1259 && (itineraryData.ways.elementAt(i) != null)) {1260 String role = (String) (itineraryData.getValueAt(i, 1));1258 if (itineraryTable.isRowSelected(i) 1259 && itineraryData.ways.elementAt(i) != null) { 1260 String role = (String) itineraryData.getValueAt(i, 1); 1261 1261 if ("backward".equals(role)) 1262 1262 role = "forward"; … … 1276 1276 for (int i = itineraryData.getRowCount() - 1; i >= 0; --i) { 1277 1277 if (itineraryData.ways.elementAt(i) != null) { 1278 String role = (String) (itineraryData.getValueAt(i, 1));1278 String role = (String) itineraryData.getValueAt(i, 1); 1279 1279 if ("backward".equals(role)) 1280 1280 role = "forward"; … … 1315 1315 1316 1316 for (int i = 0; i < stoplistData.getRowCount(); ++i) { 1317 if ( (stoplistData.nodes.elementAt(i) != null)1318 && (mainDataSet.isSelected(stoplistData.nodes.elementAt(i))))1317 if (stoplistData.nodes.elementAt(i) != null 1318 && mainDataSet.isSelected(stoplistData.nodes.elementAt(i))) 1319 1319 stoplistTable.addRowSelectionInterval(i, i); 1320 1320 } … … 1346 1346 1347 1347 RelationMember markedNode = new RelationMember( 1348 (String) (stoplistData.getValueAt(i, 1)),1348 (String) stoplistData.getValueAt(i, 1), 1349 1349 stoplistData.nodes.elementAt(i)); 1350 1350 markedNodes.addElement(markedNode); … … 1356 1356 1357 1357 RelationMember markedNode = new RelationMember( 1358 (String) (stoplistData.getValueAt(i, 1)),1358 (String) stoplistData.getValueAt(i, 1), 1359 1359 stoplistData.nodes.elementAt(i)); 1360 1360 markedNodes.addElement(markedNode); … … 1370 1370 while (relIter.hasNext()) { 1371 1371 RelationMember curMember = relIter.next(); 1372 if ( (curMember.isNode()) && (mainDataSet.isSelected(curMember.getNode()))) {1372 if (curMember.isNode() && mainDataSet.isSelected(curMember.getNode())) { 1373 1373 StopReference sr = detectMinDistance(curMember.getNode(), segmentMetrics, 1374 1374 cbRight.isSelected(), cbLeft.isSelected()); … … 1387 1387 while (nodeIter.hasNext()) { 1388 1388 Node curMember = nodeIter.next(); 1389 if (! (addedNodes.contains(curMember))) {1389 if (!addedNodes.contains(curMember)) { 1390 1390 StopReference sr = detectMinDistance(curMember, segmentMetrics, 1391 1391 cbRight.isSelected(), cbLeft.isSelected()); … … 1487 1487 for (int i = stoplistData.getRowCount() - 1; i >= 0; --i) { 1488 1488 if (stoplistTable.isRowSelected(i)) { 1489 String role = (String) (stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN));1489 String role = (String) stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN); 1490 1490 RelationMember markedNode = new RelationMember(role, 1491 1491 stoplistData.nodes.elementAt(i)); … … 1498 1498 } else { 1499 1499 for (int i = stoplistData.getRowCount() - 1; i >= 0; --i) { 1500 String role = (String) (stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN));1500 String role = (String) stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN); 1501 1501 RelationMember markedNode = new RelationMember(role, 1502 1502 stoplistData.nodes.elementAt(i)); … … 1651 1651 if (itineraryData.ways.elementAt(i) != null) { 1652 1652 RelationMember member = new RelationMember( 1653 (String) (itineraryData.getValueAt(i, 1)), itineraryData.ways.elementAt(i));1653 (String) itineraryData.getValueAt(i, 1), itineraryData.ways.elementAt(i)); 1654 1654 members.add(member); 1655 1655 } … … 1668 1668 for (int i = 0; i < stoplistData.getRowCount(); ++i) { 1669 1669 RelationMember member = new RelationMember( 1670 (String) (stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN)),1670 (String) stoplistData.getValueAt(i, STOPLIST_ROLE_COLUMN), 1671 1671 stoplistData.nodes.elementAt(i)); 1672 1672 currentRoute.addMember(member); … … 1865 1865 if (itineraryData.ways.elementAt(i) != null) { 1866 1866 Way way = itineraryData.ways.elementAt(i); 1867 if (! (way.isIncomplete())) {1868 if ("backward".equals( (itineraryData.getValueAt(i, 1)))) {1867 if (!way.isIncomplete()) { 1868 if ("backward".equals(itineraryData.getValueAt(i, 1))) { 1869 1869 for (int j = way.getNodesCount() - 2; j >= 0; --j) { 1870 1870 SegmentMetric sm = new SegmentMetric(way.getNode(j + 1).getCoor().lat(), … … 1928 1928 boolean vertexOnSeg = (vertexAngle == segAngle) 1929 1929 || (vertexAngle == lastSegAngle); 1930 boolean vertexOnTheLeft = (!vertexOnSeg)1930 boolean vertexOnTheLeft = !vertexOnSeg 1931 1931 && (((lastSegAngle > vertexAngle) && (vertexAngle > segAngle)) 1932 1932 || ((vertexAngle > segAngle) && (segAngle > lastSegAngle)) … … 1943 1943 curPosition += 2 * Math.PI; 1944 1944 if ((Math.abs(currentDistance) < distance) 1945 && (( (!vertexOnTheLeft) && (rhsPossible))1946 || ( (vertexOnTheLeft) && (lhsPossible)) || (vertexOnSeg))) {1945 && ((!vertexOnTheLeft && rhsPossible) 1946 || (vertexOnTheLeft && lhsPossible) || vertexOnSeg)) { 1947 1947 distance = Math.abs(currentDistance); 1948 1948 minIndex = curIndex - 1; … … 1958 1958 double currentDistance = (lat - sm.aLat) * sm.o1 + (lon - sm.aLon) * sm.o2; 1959 1959 if ((Math.abs(currentDistance) < distance) 1960 && (( (currentDistance >= 0) && (rhsPossible))1961 || ( (currentDistance <= 0) && (lhsPossible)))) {1960 && ((currentDistance >= 0 && rhsPossible) 1961 || (currentDistance <= 0 && lhsPossible))) { 1962 1962 distance = Math.abs(currentDistance); 1963 1963 minIndex = curIndex; -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/StopImporterAction.java
r34548 r34653 124 124 refreshData(); 125 125 } else if ("stopImporter.settingsGPSTimeStart".equals(event.getActionCommand())) { 126 if ( (!inEvent) && (dialog.gpsTimeStartValid()) && (currentTrack != null))126 if (!inEvent && dialog.gpsTimeStartValid() && currentTrack != null) 127 127 UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this)); 128 128 } else if ("stopImporter.settingsStopwatchStart".equals(event.getActionCommand())) { 129 if ( (!inEvent) && (dialog.stopwatchStartValid()) && (currentTrack != null))129 if (!inEvent && dialog.stopwatchStartValid() && currentTrack != null) 130 130 UndoRedoHandler.getInstance().add(new TrackStoplistRelocateCommand(this)); 131 131 } else if ("stopImporter.settingsTimeWindow".equals(event.getActionCommand())) { … … 239 239 public void tracksSelectionChanged(int selectedPos) { 240 240 if (selectedPos >= 0) { 241 currentTrack = (tracksListModel.elementAt(selectedPos));241 currentTrack = tracksListModel.elementAt(selectedPos); 242 242 dialog.setTrackValid(true); 243 243 … … 328 328 329 329 for (int i = 0; i < table.getRowCount(); ++i) { 330 if ( (nodes.elementAt(i) != null) && (ds.isSelected(nodes.elementAt(i))))330 if (nodes.elementAt(i) != null && ds.isSelected(nodes.elementAt(i))) 331 331 table.addRowSelectionInterval(i, i); 332 332 } -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/commands/AbstractGTFSCatchJoinCommand.java
r33817 r34653 53 53 while (iter.hasNext()) { 54 54 Node n = iter.next(); 55 if ( (n != null) && (n.equals(gtfsStopTM.nodes.elementAt(j))))55 if (n != null && n.equals(gtfsStopTM.nodes.elementAt(j))) 56 56 continue; 57 57 if (dest != null) -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/models/GTFSStopTableModel.java
r34166 r34653 112 112 if ('"' == s.charAt(pos)) 113 113 insideDoubleQuoted = !insideDoubleQuoted; 114 else if ( (separator == s.charAt(pos)) && (!insideDoubleQuoted))114 else if (separator == s.charAt(pos) && !insideDoubleQuoted) 115 115 break; 116 116 ++pos; … … 187 187 188 188 if (insPos == -1) { 189 if ( (nearBusStop) || !(tr("pending").equals(buf[2])))189 if (nearBusStop || !tr("pending").equals(buf[2])) 190 190 nodes.addElement(null); 191 191 else { … … 197 197 super.addRow(buf); 198 198 } else { 199 if ( (nearBusStop) || !(tr("pending").equals(buf[2])))199 if (nearBusStop || !tr("pending").equals(buf[2])) 200 200 nodes.insertElementAt(null, insPos); 201 201 else { -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/models/ItineraryTableModel.java
r33765 r34653 59 59 buf[0] = curName; 60 60 else 61 buf[0] = tr("[ID] {0}", (Long.valueOf(way.getId())).toString());61 buf[0] = tr("[ID] {0}", Long.valueOf(way.getId())); 62 62 buf[1] = role; 63 63 if (insPos == -1) { … … 94 94 break; 95 95 96 boolean gapRequired = gapNecessary(ways.elementAt(i), (String) (getValueAt(i, 1)),96 boolean gapRequired = gapNecessary(ways.elementAt(i), (String) getValueAt(i, 1), 97 97 lastNode); 98 if ( (i > 0) && (!gapRequired) && (ways.elementAt(i - 1) == null)) {98 if (i > 0 && !gapRequired && ways.elementAt(i - 1) == null) { 99 99 ways.removeElementAt(i - 1); 100 100 removeRow(i - 1); 101 101 --i; 102 } else if ( (i > 0) && gapRequired && (ways.elementAt(i - 1) != null)) {102 } else if (i > 0 && gapRequired && ways.elementAt(i - 1) != null) { 103 103 String[] buf = {"", ""}; 104 104 buf[0] = tr("[gap]"); … … 106 106 ++i; 107 107 } 108 lastNode = getLastNode(ways.elementAt(i), (String) (getValueAt(i, 1)));108 lastNode = getLastNode(ways.elementAt(i), (String) getValueAt(i, 1)); 109 109 } 110 while ( (getRowCount() > 0) && (ways.elementAt(getRowCount() - 1) == null)) {110 while (getRowCount() > 0 && ways.elementAt(getRowCount() - 1) == null) { 111 111 ways.removeElementAt(getRowCount() - 1); 112 112 removeRow(getRowCount() - 1); … … 126 126 127 127 private Node getLastNode(Way way, String role) { 128 if ( (way == null) || (way.isIncomplete()) || (way.getNodesCount() < 1))128 if (way == null || way.isIncomplete() || way.getNodesCount() < 1) 129 129 return null; 130 130 else { … … 137 137 138 138 private boolean gapNecessary(Way way, String role, Node lastNode) { 139 if ( (way != null) && (!(way.isIncomplete())) && (way.getNodesCount() >= 1)) {139 if (way != null && !way.isIncomplete() && way.getNodesCount() >= 1) { 140 140 Node firstNode = null; 141 141 if ("backward".equals(role)) … … 143 143 else 144 144 firstNode = way.getNode(0); 145 if ( (lastNode != null) && (!lastNode.equals(firstNode)))145 if (lastNode != null && !lastNode.equals(firstNode)) 146 146 return true; 147 147 } -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/refs/TrackReference.java
r34548 r34653 51 51 if (track != null) { 52 52 Iterator<GpxTrackSegment> siter = track.getSegments().iterator(); 53 while ( (siter.hasNext()) && (this.gpsSyncTime == null)) {53 while (siter.hasNext() && this.gpsSyncTime == null) { 54 54 Iterator<WayPoint> witer = siter.next().getWayPoints().iterator(); 55 55 if (witer.hasNext()) {
Note:
See TracChangeset
for help on using the changeset viewer.