Changeset 33470 in osm for applications/editors/josm/plugins/pt_assistant
- Timestamp:
- 2017-07-25T16:44:13+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantLayerManager.java
r33462 r33470 42 42 for (OsmPrimitive primitive : newSelection) { 43 43 if (primitive.getType().equals(OsmPrimitiveType.RELATION) 44 && RouteUtils.isVersionTwoPTRoute((Relation) primitive)) { 44 && (RouteUtils.isVersionTwoPTRoute((Relation) primitive) 45 || RouteUtils.isBicycleRoute((Relation) primitive) 46 || RouteUtils.isFootRoute((Relation) primitive) 47 || RouteUtils.isHorseRoute((Relation) primitive))) { 45 48 routes.add(primitive); 46 49 } -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantPaintVisitor.java
r33454 r33470 24 24 import org.openstreetmap.josm.data.validation.PaintVisitor; 25 25 import org.openstreetmap.josm.gui.MapView; 26 import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionType; 27 import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionTypeCalculator; 26 28 import org.openstreetmap.josm.plugins.pt_assistant.data.PTStop; 27 29 import org.openstreetmap.josm.plugins.pt_assistant.data.PTWay; … … 56 58 @Override 57 59 public void visit(Relation r) { 60 61 if (RouteUtils.isBicycleRoute(r) 62 || RouteUtils.isFootRoute(r) 63 || RouteUtils.isHorseRoute(r)) { 64 drawCycleRoute(r); 65 return; 66 } 58 67 59 68 // first, draw primitives: … … 116 125 } 117 126 127 private void drawCycleRoute(Relation r) { 128 129 List<RelationMember> members = new ArrayList<>(r.getMembers()); 130 members.removeIf(m -> !m.isWay()); 131 WayConnectionTypeCalculator connectionTypeCalculator = new WayConnectionTypeCalculator(); 132 List<WayConnectionType> links = connectionTypeCalculator.updateLinks(members); 133 134 for (int i = 0; i < links.size(); i++) { 135 WayConnectionType link = links.get(i); 136 Way way = members.get(i).getWay(); 137 if (!link.isOnewayLoopForwardPart && !link.isOnewayLoopBackwardPart) { 138 drawWay(way, new Color(0, 255, 255, 100)); 139 } else if (link.isOnewayLoopForwardPart) { 140 drawWay(way, new Color(255, 0, 0, 100)); 141 } else { 142 drawWay(way, new Color(0, 0, 255, 100)); 143 } 144 } 145 } 146 147 private void drawWay(Way way, Color color) { 148 List<Node> nodes = way.getNodes(); 149 for (int i = 0; i < nodes.size()-1; i++) { 150 drawSegment(nodes.get(i), nodes.get(i + 1), color, 1); 151 } 152 } 153 118 154 @Override 119 155 public void visit(Way w) {
Note:
See TracChangeset
for help on using the changeset viewer.