source: josm/trunk/src/org/openstreetmap/josm/gui/draw/MapPath2D.java@ 12135

Last change on this file since 12135 was 10875, checked in by Don-vip, 8 years ago

fix #13413 - Clean ImproveWayAccuracyAction, add new class MapViewPath (patch by michael2402, modified) - gsoc-core

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.draw;
3
4import java.awt.geom.Path2D;
5
6import org.openstreetmap.josm.gui.MapViewState.MapViewPoint;
7
8/**
9 * An extension of {@link Path2D} with special methods for map positions.
10 * @author Michael Zangl
11 * @since 10875
12 */
13public class MapPath2D extends Path2D.Double {
14 /**
15 * Create a new, empty path.
16 */
17 public MapPath2D() {
18 // no default definitions
19 }
20
21 /**
22 * Move the path to the view position of given point
23 * @param p The point
24 * @return this for easy chaining.
25 */
26 public MapPath2D moveTo(MapViewPoint p) {
27 moveTo(p.getInViewX(), p.getInViewY());
28 return this;
29 }
30
31 /**
32 * Draw a line to the view position of given point
33 * @param p The point
34 * @return this for easy chaining.
35 */
36 public MapPath2D lineTo(MapViewPoint p) {
37 lineTo(p.getInViewX(), p.getInViewY());
38 return this;
39 }
40
41 /**
42 * Add the given shape centered around the given point
43 * @param p The point to draw around
44 * @param symbol The symbol type
45 * @param size The size of the symbol in pixel
46 * @return this for easy chaining.
47 */
48 public MapPath2D shapeAround(MapViewPoint p, SymbolShape symbol, double size) {
49 append(symbol.shapeAround(p.getInViewX(), p.getInViewY(), size), false);
50 return this;
51 }
52}
Note: See TracBrowser for help on using the repository browser.