Changeset 21806 in osm
- Timestamp:
- 2010-06-19T22:02:05+02:00 (14 years ago)
- Location:
- applications/editors/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java
r21804 r21806 73 73 private void updMetrics() { 74 74 meter = 2 * Math.PI / (Math.cos(Math.toRadians(eastNorth2latlon(en[0]).lat())) * eqlen); 75 reset();75 len = 0; 76 76 } 77 77 … … 128 128 public void setPlace(EastNorth p2, double width, double lenstep, boolean ignoreConstraints) { 129 129 if (en[0] == null) 130 en[0] = p2;130 throw new IllegalStateException("setPlace() called without the base point"); 131 131 this.heading = en[0].heading(p2); 132 132 double hdang = 0; … … 153 153 154 154 public void setPlaceRect(EastNorth p2) { 155 if (en[0] == null) 156 throw new IllegalStateException("SetPlaceRect() called without the base point"); 155 157 if (!isRectDrawing()) 156 158 throw new IllegalStateException("Invalid drawing mode"); … … 187 189 DataSet ds = Main.main.getCurrentDataSet(); 188 190 LatLon l = eastNorth2latlon(en); 189 List<Node> nodes = ds.searchNodes(new BBox(l.lon() - 0.00001, l.lat() - 0.00001, 190 l.lon() + 0.00001, l.lat() + 0.00001)); 191 List<Node> nodes = ds.searchNodes(new BBox(l.lon() - 0.0000001, l.lat() - 0.0000001, 192 l.lon() + 0.0000001, l.lat() + 0.0000001)); 193 Node bestnode = null; 194 double mindist = 0.0003; 191 195 for (Node n : nodes) { 192 if (OsmPrimitive.isUsablePredicate.evaluate(n)) 193 return n; 194 } 195 return null; 196 double dist = n.getCoor().distanceSq(l); 197 if (dist < mindist && OsmPrimitive.isUsablePredicate.evaluate(n)) { 198 bestnode = n; 199 mindist = dist; 200 } 201 } 202 return bestnode; 196 203 } 197 204 … … 202 209 final Node[] nodes = new Node[4]; 203 210 for (int i = 0; i < 4; i++) { 211 204 212 Node n = findNode(en[i]); 205 213 if (n == null) { … … 218 226 Way w = new Way(); 219 227 w.addNode(nodes[0]); 220 if (projection1( latlon2eastNorth(nodes[2].getCoor())) > 0) {228 if (projection1(en[2]) > 0) { 221 229 w.addNode(nodes[1]); 222 230 w.addNode(nodes[2]);
Note:
See TracChangeset
for help on using the changeset viewer.