Changeset 32477 in osm for applications/editors
- Timestamp:
- 2016-07-01T02:43:04+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantPaintVisitor.java
r32457 r32477 10 10 import org.openstreetmap.josm.data.osm.Node; 11 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 12 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 12 13 import org.openstreetmap.josm.data.osm.Relation; 13 14 import org.openstreetmap.josm.data.osm.RelationMember; … … 39 40 for (RelationMember rm : r.getMembers()) { 40 41 41 if (RouteUtils.isPTStop(rm)) { 42 // if (rm.getMember().isIncomplete() && (rm.isNode() || 43 // rm.hasRole("stop") || rm.hasRole("stop_entry_only") 44 // || rm.hasRole("stop_exit_only") || rm.hasRole("platform") || 45 // rm.hasRole("platform_entry_only") 46 // || rm.hasRole("platform_exit_only"))) { 47 // 48 // if (stopOrderMap.containsKey(rm.getUniqueId())) { 49 // label = stopOrderMap.get(rm.getUniqueId()); 50 // label = label + ";" + stopCount; 51 // } else { 52 // 53 // } 54 // } 55 56 if (RouteUtils.isPTStop(rm) || (rm.getMember().isIncomplete() && (rm.isNode() || rm.hasRole("stop") 57 || rm.hasRole("stop_entry_only") || rm.hasRole("stop_exit_only") || rm.hasRole("platform") 58 || rm.hasRole("platform_entry_only") || rm.hasRole("platform_exit_only")))) { 42 59 43 60 String label = ""; 44 61 45 if (stopOrderMap.containsKey(rm.get Member().getId())) {46 label = stopOrderMap.get(rm.get Member().getId());62 if (stopOrderMap.containsKey(rm.getUniqueId())) { 63 label = stopOrderMap.get(rm.getUniqueId()); 47 64 label = label + ";" + stopCount; 48 65 } else { … … 51 68 } else if (r.hasKey("name")) { 52 69 label = label + r.get("name"); 70 } else { 71 label = "NA"; 53 72 } 54 label = label + ":" + stopCount; 55 } 56 57 stopOrderMap.put(rm.getMember().getId(), label); 58 drawStop(rm.getMember(), label); 73 label = label + " - " + stopCount; 74 } 75 76 stopOrderMap.put(rm.getUniqueId(), label); 77 drawStopLabel(rm.getMember(), label); 78 if (!rm.getMember().isIncomplete()) { 79 drawStop(rm.getMember(), label); 80 } 81 59 82 stopCount++; 60 83 … … 200 223 int[] yDrawTriangle = { (int) (middleY - sinTriangle), (int) (middleY + sinTriangle), 201 224 (int) (middleY - 2 * cosTriangle) }; 202 g. fillPolygon(xDrawTriangle, yDrawTriangle, 3);225 g.drawPolygon(xDrawTriangle, yDrawTriangle, 3); 203 226 } 204 227 } … … 216 239 int[] yDrawTriangle = { (int) (middleY - sinTriangle), (int) (middleY + sinTriangle), 217 240 (int) (middleY + 2 * cosTriangle) }; 218 g. fillPolygon(xDrawTriangle, yDrawTriangle, 3);241 g.drawPolygon(xDrawTriangle, yDrawTriangle, 3); 219 242 } 220 243 } … … 253 276 Point p = mv.getPoint(n); 254 277 255 g.setColor(Color.WHITE);256 Font stringFont = new Font("SansSerif", Font.PLAIN, 24);257 g.setFont(stringFont);258 g.drawString(label, p.x + 20, p.y - 20);259 260 278 Color fillColor = null; 261 279 … … 275 293 } 276 294 295 protected void drawStopLabel(OsmPrimitive primitive, String label) { 296 297 // find the point to which the stop visualization will be linked: 298 Node n = new Node(primitive.getBBox().getCenter()); 299 300 Point p = mv.getPoint(n); 301 302 g.setColor(Color.WHITE); 303 Font stringFont = new Font("SansSerif", Font.PLAIN, 24); 304 g.setFont(stringFont); 305 g.drawString(label, p.x + 20, p.y - 20); 306 307 // get the parents of the primitive that are routes: 308 String parentsLabel = ""; 309 for (OsmPrimitive parent: primitive.getReferrers()) { 310 if (parent.getType().equals(OsmPrimitiveType.RELATION)) { 311 Relation relation = (Relation) parent; 312 if (RouteUtils.isTwoDirectionRoute(relation)) { 313 parentsLabel = parentsLabel + relation.get("ref") + ";"; 314 } 315 } 316 } 317 if (!parentsLabel.equals("")) { 318 // remove the last semicolon: 319 parentsLabel = parentsLabel.substring(0, parentsLabel.length()-1); 320 g.setColor(new Color(200, 200, 200)); 321 Font parentLabelFont = new Font("SansSerif", Font.ITALIC, 20); 322 g.setFont(parentLabelFont); 323 g.drawString(parentsLabel, p.x + 20, p.y); 324 } 325 326 } 327 328 // protected void drawStopParentLabel(OsmPrimitive primitive, String label) { 329 // // find the point to which the stop visualization will be linked: 330 // Node n = new Node(primitive.getBBox().getCenter()); 331 // 332 // Point p = mv.getPoint(n); 333 // 334 // g.setColor(Color.WHITE); 335 // Font stringFont = new Font("SansSerif", Font.PLAIN, 24); 336 // g.setFont(stringFont); 337 // g.drawString(label, p.x - 20, p.y - 20); 338 // } 339 277 340 protected Graphics getGraphics() { 278 341 return this.g;
Note:
See TracChangeset
for help on using the changeset viewer.