Changeset 36122 in osm for applications/editors/josm/oldplugins/public_transport_layer
- Timestamp:
- 2023-08-22T17:40:36+02:00 (16 months ago)
- Location:
- applications/editors/josm/oldplugins/public_transport_layer/src/ptl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/oldplugins/public_transport_layer/src/ptl/DistanceBetweenStops.java
r34549 r36122 14 14 import org.openstreetmap.josm.actions.JosmAction; 15 15 import org.openstreetmap.josm.data.SystemOfMeasurement; 16 import org.openstreetmap.josm.data.coor.LatLon;17 16 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 18 17 import org.openstreetmap.josm.data.osm.Node; … … 46 45 final List<Node> routeNodes = new ArrayList<>(); 47 46 for (final RelationMember member : route.getMembers()) { 48 if (member.hasRole("stop", "stop_exit_only", "stop_entry_only") && OsmPrimitiveType.NODE .equals(member.getType())) {47 if (member.hasRole("stop", "stop_exit_only", "stop_entry_only") && OsmPrimitiveType.NODE == member.getType()) { 49 48 stopNodes.add(member.getNode()); 50 } else if (member.hasRole("") && OsmPrimitiveType.WAY .equals(member.getType())) {49 } else if (member.hasRole("") && OsmPrimitiveType.WAY == member.getType()) { 51 50 routeSegments.add(member); 52 51 } … … 123 122 Node lastN = null; 124 123 for (Node n : nodes) { 125 if (lastN != null) { 126 LatLon lastNcoor = lastN.getCoor(); 127 LatLon coor = n.getCoor(); 128 if (lastNcoor != null && coor != null) { 129 length += coor.greatCircleDistance(lastNcoor); 130 } 124 if (lastN != null && n != null && lastN.isLatLonKnown() && n.isLatLonKnown()) { 125 length += n.greatCircleDistance(lastN); 131 126 } 132 127 lastN = n; … … 153 148 } 154 149 155 new ExtendedDialog(MainApplication.getMainFrame(), getValue(NAME).toString(), new String[]{tr("Close")}) { 156 { 157 setButtonIcons(new String[]{"ok.png"}); 158 final JosmTextArea jte = new JosmTextArea(); 159 jte.setFont(GuiHelper.getMonospacedFont(jte)); 160 jte.setEditable(false); 161 jte.append(sb.toString()); 162 jte.setSelectionStart(0); 163 jte.setSelectionEnd(0); 164 setContent(jte); 165 } 166 167 }.showDialog(); 150 ExtendedDialog extendedDialog = new ExtendedDialog(MainApplication.getMainFrame(), getValue(NAME).toString(), tr("Close")); 151 extendedDialog.setButtonIcons("ok"); 152 final JosmTextArea jte = new JosmTextArea(); 153 jte.setFont(GuiHelper.getMonospacedFont(jte)); 154 jte.setEditable(false); 155 jte.append(sb.toString()); 156 jte.setSelectionStart(0); 157 jte.setSelectionEnd(0); 158 extendedDialog.setContent(jte); 159 extendedDialog.showDialog(); 168 160 } 169 161 } -
applications/editors/josm/oldplugins/public_transport_layer/src/ptl/PublicTransportLayer.java
r34164 r36122 38 38 import org.openstreetmap.josm.tools.MultiMap; 39 39 import org.openstreetmap.josm.tools.Pair; 40 import org.openstreetmap.josm.tools.Utils;41 40 42 41 /** … … 71 70 Node previousNode = null; 72 71 for (final RelationMember member : relation.getMembers()) { 73 if (OsmPrimitiveType.NODE .equals(member.getType()) && "stop".equals(member.getRole())) {72 if (OsmPrimitiveType.NODE == member.getType() && "stop".equals(member.getRole())) { 74 73 way.addNode(member.getNode()); 75 74 if (previousNode != null) { … … 83 82 try { 84 83 color = ColorHelper.html2color(relation.get("colour")); 85 } catch (RuntimeException ignore) {86 Logging.trace( ignore);84 } catch (RuntimeException runtimeException) { 85 Logging.trace(runtimeException); 87 86 } 88 87 renderer.drawWay(way, color, new BasicStroke(1), null, null, 0, doDrawArrows, false, false, false); … … 103 102 104 103 for (Pair<Node, Node> nodePair : segmentRefs.keySet()) { 105 final String label = Utils.join(tr(", "), new TreeSet<>(segmentRefs.get(nodePair)));104 final String label = String.join(", ", new TreeSet<>(segmentRefs.get(nodePair))); 106 105 c.put(StyleKeys.TEXT, label); 107 106 final TextLabel text = TextLabel.create(env, color, false);
Note:
See TracChangeset
for help on using the changeset viewer.