Changeset 33311 in osm for applications/editors/josm/plugins
- Timestamp:
- 2017-05-13T14:56:51+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/reltoolbox/src/relcontext
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java
r33265 r33311 17 17 import org.openstreetmap.josm.data.osm.Node; 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;20 19 import org.openstreetmap.josm.data.osm.Relation; 21 20 import org.openstreetmap.josm.data.osm.Way; … … 150 149 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f * opacity)); 151 150 152 drawRelations(g, mv, bbox, chosenRelation, new HashSet< >());151 drawRelations(g, mv, bbox, chosenRelation, new HashSet<Relation>()); 153 152 154 153 g.setComposite(oldComposite); … … 160 159 visitedRelations.add(rel); 161 160 for (OsmPrimitive element : rel.getMemberPrimitives()) { 162 if (element.getType() == OsmPrimitiveType.NODE) { 163 Node node = (Node) element; 164 Point center = mv.getPoint(node); 165 g.drawOval(center.x - 4, center.y - 4, 9, 9); 166 } else if (element.getType() == OsmPrimitiveType.WAY) { 167 Way way = (Way) element; 168 if (way.getNodesCount() >= 2) { 169 GeneralPath b = new GeneralPath(); 170 Point p = mv.getPoint(way.getNode(0)); 171 b.moveTo(p.x, p.y); 172 for (int i = 1; i < way.getNodesCount(); i++) { 173 p = mv.getPoint(way.getNode(i)); 174 b.lineTo(p.x, p.y); 175 } 176 g.draw(b); 177 } 178 } else if (element.getType() == OsmPrimitiveType.RELATION) { 179 Color oldColor = g.getColor(); 180 g.setColor(Color.magenta); 181 drawRelations(g, mv, bbox, (Relation) element, visitedRelations); 182 g.setColor(oldColor); 161 if (null != element.getType()) switch(element.getType()) { 162 case NODE: 163 Node node = (Node) element; 164 Point center = mv.getPoint(node); 165 g.drawOval(center.x - 4, center.y - 4, 9, 9); 166 break; 167 case WAY: 168 Way way = (Way) element; 169 if (way.getNodesCount() >= 2) { 170 GeneralPath b = new GeneralPath(); 171 Point p = mv.getPoint(way.getNode(0)); 172 b.moveTo(p.x, p.y); 173 for (int i = 1; i < way.getNodesCount(); i++) { 174 p = mv.getPoint(way.getNode(i)); 175 b.lineTo(p.x, p.y); 176 } 177 g.draw(b); 178 } break; 179 case RELATION: 180 Color oldColor = g.getColor(); 181 g.setColor(Color.magenta); 182 drawRelations(g, mv, bbox, (Relation) element, visitedRelations); 183 g.setColor(oldColor); 184 break; 185 default: 186 break; 183 187 } 184 // todo: closedway, multipolygon - ?185 188 } 186 189 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java
r33265 r33311 443 443 while (r.ready()) { 444 444 String line = r.readLine(); 445 StringTokenizer t = new StringTokenizer(line, " ,;:\""); 446 if (t.hasMoreTokens()) { 447 String type = t.nextToken(); 445 String[] typeAndRoles = line.split(":", 2); 446 if (typeAndRoles.length == 2 && typeAndRoles[1].length() > 0) { 447 String type = typeAndRoles[0].trim(); 448 StringTokenizer t = new StringTokenizer(typeAndRoles[1], " ,;\""); 448 449 List<String> roles = new ArrayList<>(); 449 450 while (t.hasMoreTokens()) { -
applications/editors/josm/plugins/reltoolbox/src/relcontext/possible_roles.txt
r30841 r33311 1 boundary: admin_centre, label, subarea 2 route: forward, backward, stop, platform, stop_exit_only, stop_entry_only, platform_exit_only, platform_entry_only 1 associatedStreet: street, house 2 boundary: admin_centre, label, subarea, outer, inner 3 bridge: across, outline, edge, on_bridge 4 building: outline, part, contains, label, entrance, address, ridge, edge 5 destination_sign: to, from, intersection, sign 6 enforcement: device, from, to, force 7 provides_feature: target, address, entrance, parking 3 8 public_transport: stop, platform 4 9 restriction: from, to, via, location_hint 5 enforcement: device, from, to, force 6 destination_sign: to, from, intersection, sign 10 route: route, forward, backward, north, south, east, west, stop, link, stop, forward:stop, backward:stop, platform, guidepost, stop_exit_only, stop_entry_only, platform_exit_only, platform_entry_only 7 11 site: perimeter, entrance, label 8 bridge: across, under, outline, edge 9 tunnel: through, outline, edge 12 sled: sled, alternative, walk 13 street: street, address, house, associated 10 14 surveillance: camera, extent, visible, hidden 11 street: street, address, house, associated 12 collection: member, street, river, railway, address, associated 13 associatedStreet: street, house 14 lane_restriction: from, to, via 15 tunnel: through, outline, edge, in_tunnel 16 waterway: main_stream, side_stream, spring -
applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/MultipolygonFixer.java
r32395 r33311 82 82 if (m.isWay()) { 83 83 String role = null; 84 if (outerWays.contains( m.getMember())) {84 if (outerWays.contains((Way)m.getMember())) { 85 85 role = "outer"; 86 } else if (innerWays.contains( m.getMember())) {86 } else if (innerWays.contains((Way)m.getMember())) { 87 87 role = "inner"; 88 88 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/RelationFixer.java
r32395 r33311 2 2 package relcontext.relationfix; 3 3 4 import java.util.*; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 6 import java.util.ArrayList;7 import java.util.List;8 7 9 8 import javax.swing.Action; … … 25 24 public RelationFixer(String... types) { 26 25 applicableTypes = new ArrayList<>(); 27 for (String type: types) { 28 applicableTypes.add(type); 29 } 26 applicableTypes.addAll(Arrays.asList(types)); 30 27 } 31 28
Note:
See TracChangeset
for help on using the changeset viewer.