- Timestamp:
- 2018-12-30T22:12:38+01:00 (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r14596 r14615 227 227 } 228 228 try { 229 String key = line.substring(0, 2); 230 line = line.substring(2); 231 232 switch (key) { 233 case "S:": 234 ignoreDataStartsWith.add(line); 235 break; 236 case "E:": 237 ignoreDataEquals.add(line); 238 break; 239 case "F:": 240 ignoreDataEndsWith.add(line); 241 break; 242 case "K:": 243 ignoreDataTag.add(Tag.ofString(line)); 244 break; 245 default: 246 if (!key.startsWith(";")) { 247 Logging.warn("Unsupported TagChecker key: " + key); 229 String key = line.substring(0, 2); 230 line = line.substring(2); 231 232 switch (key) { 233 case "S:": 234 ignoreDataStartsWith.add(line); 235 break; 236 case "E:": 237 ignoreDataEquals.add(line); 238 break; 239 case "F:": 240 ignoreDataEndsWith.add(line); 241 break; 242 case "K:": 243 ignoreDataTag.add(Tag.ofString(line)); 244 break; 245 default: 246 if (!key.startsWith(";")) { 247 Logging.warn("Unsupported TagChecker key: " + key); 248 } 248 249 } 249 }250 250 } catch (IllegalArgumentException e) { 251 251 Logging.error("Invalid line in {0} : {1}", source, e.getMessage()); 252 Logging.trace(e); 252 253 } 253 254 } else if (tagcheckerfile) { -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r14590 r14615 514 514 515 515 ImageEntry e = data.getSelectedImage(); 516 if (e != null) { 517 if (e.getPos() != null) { 518 Point p = mv.getPoint(e.getPos()); 519 520 int imgWidth; 521 int imgHeight; 522 if (useThumbs && e.hasThumbnail()) { 523 Dimension d = scaledDimension(e.getThumbnail()); 524 if (d != null) { 525 imgWidth = d.width; 526 imgHeight = d.height; 527 } else { 528 imgWidth = -1; 529 imgHeight = -1; 530 } 516 if (e != null && e.getPos() != null) { 517 Point p = mv.getPoint(e.getPos()); 518 519 int imgWidth; 520 int imgHeight; 521 if (useThumbs && e.hasThumbnail()) { 522 Dimension d = scaledDimension(e.getThumbnail()); 523 if (d != null) { 524 imgWidth = d.width; 525 imgHeight = d.height; 531 526 } else { 532 imgWidth = selectedIcon.getIconWidth(); 533 imgHeight = selectedIcon.getIconHeight(); 534 } 535 536 if (e.getExifImgDir() != null) { 537 // Multiplier must be larger than sqrt(2)/2=0.71. 538 double arrowlength = Math.max(25, Math.max(imgWidth, imgHeight) * 0.85); 539 double arrowwidth = arrowlength / 1.4; 540 541 double dir = e.getExifImgDir(); 542 // Rotate 90 degrees CCW 543 double headdir = (dir < 90) ? dir + 270 : dir - 90; 544 double leftdir = (headdir < 90) ? headdir + 270 : headdir - 90; 545 double rightdir = (headdir > 270) ? headdir - 270 : headdir + 90; 546 547 double ptx = p.x + Math.cos(Utils.toRadians(headdir)) * arrowlength; 548 double pty = p.y + Math.sin(Utils.toRadians(headdir)) * arrowlength; 549 550 double ltx = p.x + Math.cos(Utils.toRadians(leftdir)) * arrowwidth/2; 551 double lty = p.y + Math.sin(Utils.toRadians(leftdir)) * arrowwidth/2; 552 553 double rtx = p.x + Math.cos(Utils.toRadians(rightdir)) * arrowwidth/2; 554 double rty = p.y + Math.sin(Utils.toRadians(rightdir)) * arrowwidth/2; 555 556 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 557 g.setColor(new Color(255, 255, 255, 192)); 558 int[] xar = {(int) ltx, (int) ptx, (int) rtx, (int) ltx}; 559 int[] yar = {(int) lty, (int) pty, (int) rty, (int) lty}; 560 g.fillPolygon(xar, yar, 4); 561 g.setColor(Color.black); 562 g.setStroke(new BasicStroke(1.2f)); 563 g.drawPolyline(xar, yar, 3); 564 } 565 566 if (useThumbs && e.hasThumbnail()) { 567 g.setColor(new Color(128, 0, 0, 122)); 568 g.fillRect(p.x - imgWidth / 2, p.y - imgHeight / 2, imgWidth, imgHeight); 569 } else { 570 selectedIcon.paintIcon(mv, g, 571 p.x - imgWidth / 2, 572 p.y - imgHeight / 2); 573 574 } 527 imgWidth = -1; 528 imgHeight = -1; 529 } 530 } else { 531 imgWidth = selectedIcon.getIconWidth(); 532 imgHeight = selectedIcon.getIconHeight(); 533 } 534 535 if (e.getExifImgDir() != null) { 536 // Multiplier must be larger than sqrt(2)/2=0.71. 537 double arrowlength = Math.max(25, Math.max(imgWidth, imgHeight) * 0.85); 538 double arrowwidth = arrowlength / 1.4; 539 540 double dir = e.getExifImgDir(); 541 // Rotate 90 degrees CCW 542 double headdir = (dir < 90) ? dir + 270 : dir - 90; 543 double leftdir = (headdir < 90) ? headdir + 270 : headdir - 90; 544 double rightdir = (headdir > 270) ? headdir - 270 : headdir + 90; 545 546 double ptx = p.x + Math.cos(Utils.toRadians(headdir)) * arrowlength; 547 double pty = p.y + Math.sin(Utils.toRadians(headdir)) * arrowlength; 548 549 double ltx = p.x + Math.cos(Utils.toRadians(leftdir)) * arrowwidth/2; 550 double lty = p.y + Math.sin(Utils.toRadians(leftdir)) * arrowwidth/2; 551 552 double rtx = p.x + Math.cos(Utils.toRadians(rightdir)) * arrowwidth/2; 553 double rty = p.y + Math.sin(Utils.toRadians(rightdir)) * arrowwidth/2; 554 555 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 556 g.setColor(new Color(255, 255, 255, 192)); 557 int[] xar = {(int) ltx, (int) ptx, (int) rtx, (int) ltx}; 558 int[] yar = {(int) lty, (int) pty, (int) rty, (int) lty}; 559 g.fillPolygon(xar, yar, 4); 560 g.setColor(Color.black); 561 g.setStroke(new BasicStroke(1.2f)); 562 g.drawPolyline(xar, yar, 3); 563 } 564 565 if (useThumbs && e.hasThumbnail()) { 566 g.setColor(new Color(128, 0, 0, 122)); 567 g.fillRect(p.x - imgWidth / 2, p.y - imgHeight / 2, imgWidth, imgHeight); 568 } else { 569 selectedIcon.paintIcon(mv, g, 570 p.x - imgWidth / 2, 571 p.y - imgHeight / 2); 575 572 } 576 573 } -
trunk/src/org/openstreetmap/josm/tools/ShapeClipper.java
r14587 r14615 69 69 points[num++] = x; 70 70 points[num++] = y; 71 // } else if (type != PathIterator.SEG_CLOSE) {72 //Logging.warn("unhandled path iterator");73 71 } 74 72 pit.next(); … … 125 123 path.moveTo(lastX, lastY); 126 124 int numOut = 1; 127 for (int i = 2; i < num; ) {128 double x = points[i ++], y = points[i++];125 for (int i = 2; i < num; i += 2) { 126 double x = points[i], y = points[i+1]; 129 127 if (Double.compare(x, lastX) != 0 || Double.compare(y, lastY) != 0) { 130 128 path.lineTo(x, y); -
trunk/test/unit/org/openstreetmap/josm/data/ImageDataTest.java
r14603 r14615 51 51 52 52 @Test 53 public void test mageEntryWithImages() {53 public void testImageEntryWithImages() { 54 54 assertEquals(1, new ImageData(getOneImage()).getImages().size()); 55 55 }
Note:
See TracChangeset
for help on using the changeset viewer.