Changeset 5590 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2012-11-18T16:40:44+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r5571 r5590 24 24 import java.awt.geom.Rectangle2D; 25 25 import java.util.ArrayList; 26 import java.util.Arrays;27 26 import java.util.Collection; 28 27 import java.util.Collections; … … 61 60 import org.openstreetmap.josm.gui.mappaint.TextElement; 62 61 import org.openstreetmap.josm.tools.ImageProvider; 63 import org.openstreetmap.josm.tools.Pair;64 62 import org.openstreetmap.josm.tools.Utils; 65 63 … … 1194 1192 1195 1193 while (dist < segmentLength) { 1196 for ( Pair<Float, GeneralPath> sizeAndPath : Arrays.asList(new Pair[]{1197 new Pair<Float, GeneralPath>(3f, onewayArrowsCasing),1198 new Pair<Float, GeneralPath>(2f, onewayArrows)})) {1194 for (int i=0; i<2; ++i) { 1195 float onewaySize = i == 0 ? 3f : 2f; 1196 GeneralPath onewayPath = i == 0 ? onewayArrowsCasing : onewayArrows; 1199 1197 1200 1198 // scale such that border is 1 px 1201 final double fac = - (onewayReversed ? -1 : 1) * sizeAndPath.a* (1 + sinPHI) / (sinPHI * cosPHI);1199 final double fac = - (onewayReversed ? -1 : 1) * onewaySize * (1 + sinPHI) / (sinPHI * cosPHI); 1202 1200 final double sx = nx * fac; 1203 1201 final double sy = ny * fac; … … 1205 1203 // Attach the triangle at the incenter and not at the tip. 1206 1204 // Makes the border even at all sides. 1207 final double x = p1.x + nx * (dist + (onewayReversed ? -1 : 1) * ( sizeAndPath.a/ sinPHI));1208 final double y = p1.y + ny * (dist + (onewayReversed ? -1 : 1) * ( sizeAndPath.a/ sinPHI));1209 1210 sizeAndPath.b.moveTo(x, y);1211 sizeAndPath.b.lineTo (x + cosPHI * sx - sinPHI * sy, y + sinPHI * sx + cosPHI * sy);1212 sizeAndPath.b.lineTo (x + cosPHI * sx + sinPHI * sy, y - sinPHI * sx + cosPHI * sy);1213 sizeAndPath.b.lineTo(x, y);1205 final double x = p1.x + nx * (dist + (onewayReversed ? -1 : 1) * (onewaySize / sinPHI)); 1206 final double y = p1.y + ny * (dist + (onewayReversed ? -1 : 1) * (onewaySize / sinPHI)); 1207 1208 onewayPath.moveTo(x, y); 1209 onewayPath.lineTo (x + cosPHI * sx - sinPHI * sy, y + sinPHI * sx + cosPHI * sy); 1210 onewayPath.lineTo (x + cosPHI * sx + sinPHI * sy, y - sinPHI * sx + cosPHI * sy); 1211 onewayPath.lineTo(x, y); 1214 1212 } 1215 1213 dist += interval;
Note:
See TracChangeset
for help on using the changeset viewer.