Changeset 1076 in josm
- Timestamp:
- 2008-11-13T19:41:48+01:00 (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java
r655 r1076 28 28 29 29 public EastNorth interpolate(EastNorth en2, double proportion) { 30 return new EastNorth(this.x + proportion * (en2.x - this.x),this.y + proportion * (en2.y - this.y)); 30 return new EastNorth(this.x + proportion * (en2.x - this.x), 31 this.y + proportion * (en2.y - this.y)); 31 32 } 33 34 /** 35 * Returns the heading, in radians, that you have to use to get from 36 * this EastNorth to another. Heading is mapped into [0, 2pi) 37 * 38 * @param other the "destination" position 39 * @return heading 40 */ 41 public double heading(EastNorth other) { 42 double hd = Math.atan2(other.east() - east(), other.north() - north()); 43 if(hd < 0) hd = 2 * Math.PI + hd; 44 return hd; 45 } 46 47 public EastNorth sub(EastNorth en) { 48 return new EastNorth(en.east() - east(), en.north() - north()); 49 } 50 51 /** 52 * Returns an EastNorth representing the this EastNorth rotatedaround 53 * a given EastNorth by a given angle 54 * @param pivot the center of the rotation 55 * @param angle the angle of the rotation 56 * @return EastNorth rotated object 57 */ 58 public EastNorth rotate(EastNorth pivot, double angle) { 59 double cosPhi = Math.cos(angle); 60 double sinPhi = Math.sin(angle); 61 double x = east() - pivot.east(); 62 double y = north() - pivot.north(); 63 double nx = cosPhi * x + sinPhi * y + pivot.east(); 64 double ny = -sinPhi * x + cosPhi * y + pivot.north(); 65 return new EastNorth(nx, ny); 66 } 32 67 33 68 @Override public String toString() { 34 69 return "EastNorth[e="+x+", n="+y+"]"; 35 70 } 71 72 /** 73 * Compares two EastNorth values 74 * 75 * @return true if "x" and "y" values are within 1E-6 of each other 76 */ 77 public boolean equalsEpsilon(EastNorth other, double e) { 78 return (Math.abs(x - other.x) < e && Math.abs(y - other.y) < e); 79 } 36 80 } -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r1054 r1076 19 19 import org.openstreetmap.josm.actions.AlignInCircleAction; 20 20 import org.openstreetmap.josm.actions.AlignInLineAction; 21 import org.openstreetmap.josm.actions. AlignInRectangleAction;21 import org.openstreetmap.josm.actions.OrthogonalizeAction; 22 22 import org.openstreetmap.josm.actions.AutoScaleAction; 23 23 import org.openstreetmap.josm.actions.CombineWayAction; … … 106 106 public final JosmAction alignInCircle = new AlignInCircleAction(); 107 107 public final JosmAction alignInLine = new AlignInLineAction(); 108 public final JosmAction alignInRect = new AlignInRectangleAction();108 public final JosmAction ortho = new OrthogonalizeAction(); 109 109 public final JosmAction createCircle = new CreateCircleAction(); 110 110 public final JosmAction mergeNodes = new MergeNodesAction(); … … 223 223 add(toolsMenu, alignInCircle); 224 224 add(toolsMenu, alignInLine); 225 add(toolsMenu, alignInRect);225 add(toolsMenu, ortho); 226 226 toolsMenu.addSeparator(); 227 227 add(toolsMenu, createCircle);
Note:
See TracChangeset
for help on using the changeset viewer.