- Timestamp:
- 2008-08-24T17:40:33+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r853 r860 30 30 import org.openstreetmap.josm.data.osm.WaySegment; 31 31 import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor; 32 import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor; 32 33 import org.openstreetmap.josm.gui.MapFrame; 33 34 import org.openstreetmap.josm.gui.MapView; … … 240 241 Point p1 = c.getPoint(w.nodes.get(nearestWaySeg.lowerIndex).eastNorth); 241 242 Point p2 = c.getPoint(w.nodes.get(nearestWaySeg.lowerIndex+1).eastNorth); 242 int xd = p2.x-p1.x; if(xd < 0) xd = -xd; 243 int yd = p2.y-p1.y; if(yd < 0) yd = -yd; 244 if(xd+yd > Main.pref.getInteger("mappaint.node.virtual-space", 70)) 243 if(SimplePaintVisitor.isLargeSegment(p1, p2, Main.pref.getInteger("mappaint.node.virtual-space", 70))) 245 244 { 246 245 Point pc = new Point((p1.x+p2.x)/2, (p1.y+p2.y)/2); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r857 r860 357 357 Point p1 = nc.getPoint(n1.eastNorth); 358 358 Point p2 = nc.getPoint(n2.eastNorth); 359 if (!isSegmentVisible(p1, p2)) { 360 return; 361 } 362 int strlen = (""+orderNumber).length(); 363 int x = (p1.x+p2.x)/2 - 4*strlen; 364 int y = (p1.y+p2.y)/2 + 4; 365 366 Color c = g.getColor(); 367 g.setColor(backgroundColor); 368 g.fillRect(x-1, y-12, 8*strlen+1, 14); 369 g.setColor(c); 370 g.drawString(""+orderNumber, x, y); 359 drawOrderNumber(p1, p2, orderNumber); 371 360 } 372 361 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r857 r860 75 75 protected int virtualNodeSize; 76 76 protected int virtualNodeSpace; 77 protected int segmentNumberSpace; 77 78 protected int taggedNodeRadius; 78 79 protected int taggedNodeSize; … … 109 110 virtualNodeSize = virtual ? Main.pref.getInteger("mappaint.node.virtual-size", 4) / 2 : 0; 110 111 virtualNodeSpace = Main.pref.getInteger("mappaint.node.virtual-space", 70); 112 segmentNumberSpace = Main.pref.getInteger("mappaint.segmentnumber.space", 40); 111 113 112 114 ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, … … 171 173 } 172 174 175 public static Boolean isLargeSegment(Point p1, Point p2, int space) 176 { 177 int xd = p1.x-p2.x; if(xd < 0) xd = -xd; 178 int yd = p1.y-p2.y; if(yd < 0) yd = -yd; 179 return (xd+yd > space); 180 } 181 173 182 public void visitVirtual(Way w) { 174 183 Iterator<Node> it = w.nodes.iterator(); … … 178 187 { 179 188 Point p = nc.getPoint(it.next().eastNorth); 180 if(isSegmentVisible(lastP, p) )189 if(isSegmentVisible(lastP, p) && isLargeSegment(lastP, p, virtualNodeSpace)) 181 190 { 182 int xd = p.x-lastP.x; if(xd < 0) xd = -xd; 183 int yd = p.y-lastP.y; if(yd < 0) yd = -yd; 184 if(xd+yd > virtualNodeSpace) 185 { 186 int x = (p.x+lastP.x)/2; 187 int y = (p.y+lastP.y)/2; 188 currentPath.moveTo(x-5, y); 189 currentPath.lineTo(x+5, y); 190 currentPath.moveTo(x, y-5); 191 currentPath.lineTo(x, y+5); 192 } 191 int x = (p.x+lastP.x)/2; 192 int y = (p.y+lastP.y)/2; 193 currentPath.moveTo(x-5, y); 194 currentPath.lineTo(x+5, y); 195 currentPath.moveTo(x, y-5); 196 currentPath.lineTo(x, y+5); 193 197 } 194 198 lastP = p; … … 282 286 */ 283 287 protected void drawOrderNumber(Point p1, Point p2, int orderNumber) { 284 int strlen = (""+orderNumber).length(); 285 int x = (p1.x+p2.x)/2 - 4*strlen; 286 int y = (p1.y+p2.y)/2 + 4; 287 288 if (isSegmentVisible(p1, p2)) { 288 if (isSegmentVisible(p1, p2) && isLargeSegment(p1, p2, segmentNumberSpace)) { 289 String on = Integer.toString(orderNumber); 290 int strlen = on.length(); 291 int x = (p1.x+p2.x)/2 - 4*strlen; 292 int y = (p1.y+p2.y)/2 + 4; 293 294 if(virtualNodeSize != 0 && isLargeSegment(p1, p2, virtualNodeSpace)) 295 { 296 y = (p1.y+p2.y)/2 - virtualNodeSize - 3; 297 } 298 299 displaySegments(currentColor); // draw nodes on top! 289 300 Color c = g.getColor(); 290 301 g.setColor(backgroundColor); 291 302 g.fillRect(x-1, y-12, 8*strlen+1, 14); 292 303 g.setColor(c); 293 g.drawString( ""+orderNumber, x, y);304 g.drawString(on, x, y); 294 305 } 295 306 } -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r845 r860 188 188 double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared 189 189 if (perDist < snapDistance && a < c+snapDistance && b < c+snapDistance) { 190 if(w.selected) // prefer selected ways a little bit 191 perDist -= 0.00001; 190 192 List<WaySegment> l; 191 193 if (nearest.containsKey(perDist)) {
Note:
See TracChangeset
for help on using the changeset viewer.