- Timestamp:
- 2017-04-01T02:28:03+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/draw/MapViewPath.java
r11811 r11817 14 14 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint; 15 15 import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle; 16 17 16 18 17 /** … … 186 185 */ 187 186 public void appendFromEastNorth(Path2D.Double path) { 188 new AbstractPathVisitor() {187 new PathVisitor() { 189 188 @Override 190 void visitMoveTo(double x, double y) {189 public void visitMoveTo(double x, double y) { 191 190 moveTo(new EastNorth(x, y)); 192 191 } 193 192 194 193 @Override 195 void visitLineTo(double x, double y) {194 public void visitLineTo(double x, double y) { 196 195 lineTo(new EastNorth(x, y)); 197 196 } 198 197 199 198 @Override 200 void visitClose() {199 public void visitClose() { 201 200 closePath(); 202 201 } … … 302 301 } 303 302 304 private abstract static class AbstractPathVisitor {303 private interface PathVisitor { 305 304 /** 306 305 * Append a path to this one. The path is clipped to the current view. … … 308 307 * @return true if adding the path was successful. 309 308 */ 310 publicboolean visit(Path2D.Double path) {309 default boolean visit(Path2D.Double path) { 311 310 double[] coords = new double[8]; 312 311 PathIterator it = path.getPathIterator(null); … … 332 331 } 333 332 334 abstractvoid visitClose();335 336 abstractvoid visitMoveTo(double x, double y);337 338 abstractvoid visitLineTo(double x, double y);339 } 340 341 private abstract class AbstractMapPathVisitor extends AbstractPathVisitor {333 void visitClose(); 334 335 void visitMoveTo(double x, double y); 336 337 void visitLineTo(double x, double y); 338 } 339 340 private abstract class AbstractMapPathVisitor implements PathVisitor { 342 341 private MapViewPoint lastMoveTo; 343 342 344 343 @Override 345 void visitMoveTo(double x, double y) {344 public void visitMoveTo(double x, double y) { 346 345 MapViewPoint move = state.getForView(x, y); 347 346 lastMoveTo = move; … … 352 351 353 352 @Override 354 void visitLineTo(double x, double y) {353 public void visitLineTo(double x, double y) { 355 354 visitLineTo(state.getForView(x, y)); 356 355 } … … 359 358 360 359 @Override 361 void visitClose() {360 public void visitClose() { 362 361 visitLineTo(lastMoveTo); 363 362 }
Note:
See TracChangeset
for help on using the changeset viewer.