Changeset 21702 in osm
- Timestamp:
- 2010-06-14T16:05:12+02:00 (15 years ago)
- Location:
- applications/editors/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java
r21236 r21702 35 35 36 36 private double len = 0; 37 double lwidth; 37 private double lwidth; 38 private double heading; 38 39 private boolean angconstrainted; 39 40 private double angconstraint = 0; … … 76 77 updMetrics(); 77 78 } 78 public void setPlace(EastNorth p2,double width,double lenstep) { 79 double heading = p1.heading(p2); 79 private void updatePos() { 80 en1 = p1; 81 en2 = new EastNorth(p1.east()+Math.sin(heading)*len*meter,p1.north()+Math.cos(heading)*len*meter); 82 en3 = new EastNorth(p1.east()+Math.sin(heading)*len*meter+Math.cos(heading)*lwidth*meter,p1.north()+Math.cos(heading)*len*meter-Math.sin(heading)*lwidth*meter); 83 en4 = new EastNorth(p1.east()+Math.cos(heading)*lwidth*meter,p1.north()-Math.sin(heading)*lwidth*meter); 84 } 85 public void setPlace(EastNorth p2,double width,double lenstep,boolean ignoreConstraint) { 86 heading = p1.heading(p2); 80 87 double hdang = 0; 81 if (angconstrainted) { 88 if (angconstrainted && !ignoreConstraint) { 82 89 hdang = Math.round((heading-angconstraint)/Math.PI*4); 83 90 if (hdang>=8)hdang-=8; … … 88 95 if (lenstep <= 0) len=distance; else len = Math.round(distance/lenstep)*lenstep; 89 96 if (len == 0) return; 90 91 en1 = p1;92 en2 = new EastNorth(p1.east()+Math.sin(heading)*len*meter,p1.north()+Math.cos(heading)*len*meter);93 en3 = new EastNorth(p1.east()+Math.sin(heading)*len*meter+Math.cos(heading)*width*meter,p1.north()+Math.cos(heading)*len*meter-Math.sin(heading)*width*meter);94 en4 = new EastNorth(p1.east()+Math.cos(heading)*width*meter,p1.north()-Math.sin(heading)*width*meter);95 96 97 lwidth = width; 98 updatePos(); 97 99 Main.map.statusLine.setHeading(Math.toDegrees(heading)); 98 if (angconstrainted) { 100 if (angconstrainted && !ignoreConstraint) { 99 101 Main.map.statusLine.setAngle(hdang*45); 100 102 } 103 } 104 public void setWidth(double width) { 105 lwidth = width; 106 updatePos(); 101 107 } 102 108 public void paint(Graphics2D g, MapView mv) { -
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java
r21236 r21702 184 184 p2 = latlon2eastNorth(n.getCoor()); 185 185 } 186 building.setPlace(p2, width, e.is ControlDown()?0:lenstep);186 building.setPlace(p2, width, e.isShiftDown()?0:lenstep,e.isShiftDown()); 187 187 Main.map.statusLine.setDist(building.getLength()); 188 188 return; … … 204 204 /p1.distanceSq(p2) * building.getLength(); 205 205 206 building.set Place(p2, mwidth, lenstep);206 building.setWidth(mwidth); 207 207 Main.map.statusLine.setDist(Math.abs(mwidth)); 208 208 return;
Note:
See TracChangeset
for help on using the changeset viewer.