- Timestamp:
- 2009-01-18T18:42:14+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1295 r1296 46 46 protected boolean drawMultipolygon; 47 47 protected boolean drawRestriction; 48 protected boolean leftHandTraffic; 48 49 protected boolean restrictionDebug; 49 50 protected int showNames; … … 660 661 double dy = (pFrom.y >= pVia.y) ? (pFrom.y - pVia.y) : (pVia.y - pFrom.y); 661 662 663 double fromAngle; 662 664 if(dx == 0.0) { 663 System.out.println("dx " + dx);664 return;665 }666 double fromAngle = Math.atan(dy / dx);665 fromAngle = Math.PI/2; 666 } else { 667 fromAngle = Math.atan(dy / dx); 668 } 667 669 double fromAngleDeg = Math.toDegrees(fromAngle); 668 670 … … 684 686 685 687 if(pFrom.x >= pVia.x && pFrom.y >= pVia.y) { 686 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg - 90)); 687 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg - 90)); 688 if(leftHandTraffic) { 689 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg - 90)); 690 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg - 90)); 691 } else { 692 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 90)); 693 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 90)); 694 } 688 695 iconAngle = 270+fromAngleDeg; 689 696 } 690 697 if(pFrom.x < pVia.x && pFrom.y >= pVia.y) { 691 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg)); 692 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg)); 698 if(leftHandTraffic) { 699 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg)); 700 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg)); 701 } else { 702 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 180)); 703 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 180)); 704 } 693 705 iconAngle = 90-fromAngleDeg; 694 706 } 695 707 if(pFrom.x < pVia.x && pFrom.y < pVia.y) { 696 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 90)); 697 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 90)); 708 if(leftHandTraffic) { 709 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 90)); 710 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 90)); 711 } else { 712 vx2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg - 90)); 713 vy2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg - 90)); 714 } 698 715 iconAngle = 90+fromAngleDeg; 699 716 } 700 717 if(pFrom.x >= pVia.x && pFrom.y < pVia.y) { 701 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg+180)); 702 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg+180)); 718 if(leftHandTraffic) { 719 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 180)); 720 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 180)); 721 } else { 722 vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg)); 723 vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg)); 724 } 703 725 iconAngle = 270-fromAngleDeg; 704 726 } … … 1193 1215 drawRestriction = Main.pref.getBoolean("mappaint.restriction",false); 1194 1216 restrictionDebug = Main.pref.getBoolean("mappaint.restriction.debug",false); 1217 leftHandTraffic = Main.pref.getBoolean("mappaint.lefthandtraffic",false); 1195 1218 orderFont = new Font(Main.pref.get("mappaint.font","Helvetica"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8)); 1196 1219 String currentLocale = Locale.getDefault().getLanguage();
Note:
See TracChangeset
for help on using the changeset viewer.