Changeset 9983 in josm for trunk/src/org
- Timestamp:
- 2016-03-13T21:36:47+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r9439 r9983 287 287 288 288 /** 289 * Constructs a new {@code NodePair}.290 * @param other An existing {@code NodePair}291 */292 public NodePair(NodePair other) {293 this(other.a, other.b);294 }295 296 /**297 289 * Replies the first node. 298 290 * @return The first node … … 308 300 public Node getB() { 309 301 return b; 310 }311 312 public boolean isAdjacentToA(NodePair other) {313 return other.getA() == a || other.getB() == a;314 }315 316 public boolean isAdjacentToB(NodePair other) {317 return other.getA() == b || other.getB() == b;318 302 } 319 303 -
trunk/src/org/openstreetmap/josm/actions/DialogsToggleAction.java
r9006 r9983 43 43 } 44 44 45 /**46 * To call if this action must be initially run at JOSM startup.47 */48 public void initial() {49 if (isSelected()) {50 setMode();51 }52 }53 54 45 protected void setMode() { 55 46 if (Main.isDisplayingMapView()) { -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r9759 r9983 326 326 deleteFileOrDirectory(fOut); 327 327 } 328 }329 330 public static void deleteFileOrDirectory(String path) {331 deleteFileOrDirectory(new File(path));332 328 } 333 329 -
trunk/src/org/openstreetmap/josm/data/cache/ICachedLoaderJob.java
r8795 r9983 11 11 * @param <K> cache key type 12 12 */ 13 public interface ICachedLoaderJob<K> {13 public interface ICachedLoaderJob<K> extends Runnable { 14 14 /** 15 15 * returns cache entry key … … 26 26 */ 27 27 URL getUrl() throws IOException; 28 29 /**30 * implements the main algorithm for fetching31 */32 void run();33 28 34 29 /** -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r9709 r9983 45 45 * @since 8168 46 46 */ 47 public abstract class JCSCachedTileLoaderJob<K, V extends CacheEntry> implements ICachedLoaderJob<K> , Runnable{47 public abstract class JCSCachedTileLoaderJob<K, V extends CacheEntry> implements ICachedLoaderJob<K> { 48 48 private static final Logger log = FeatureAdapter.getLogger(JCSCachedTileLoaderJob.class.getCanonicalName()); 49 49 protected static final long DEFAULT_EXPIRE_TIME = 1000L * 60 * 60 * 24 * 7; // 7 days -
trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java
r9375 r9983 93 93 94 94 /** 95 * Converts to single point BBox.96 *97 * @return single point BBox defined by this coordinate.98 * @since 620399 */100 public BBox toBBox() {101 return new BBox(x, y);102 }103 104 /**105 95 * Creates bbox around this coordinate. Coordinate defines 106 96 * center of bbox, its edge will be 2*r. -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r9950 r9983 48 48 public static final double MAX_SERVER_PRECISION = 1e-7; 49 49 public static final double MAX_SERVER_INV_PRECISION = 1e7; 50 public static final int MAX_SERVER_DIGITS = 7;51 50 52 51 /** -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r9921 r9983 540 540 return (options & flag) == 0; 541 541 } 542 543 // Unit test access to pattern matcher544 Matcher matchURL(String value) {545 return URL_PATTERN.matcher(value);546 }547 542 } -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r9866 r9983 545 545 546 546 /** 547 * Call this if you "accidentally" called toggleEnable. This doesn't need548 * to be called for every dialog, as it's the default anyway.549 * @return {@code this}550 */551 public ExtendedDialog toggleDisable() {552 this.toggleable = false;553 return this;554 }555 556 /**557 547 * Sets the button that will react to ENTER. 558 548 * @param defaultButtonIdx The button index (starts to 1) -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r9623 r9983 87 87 return sources; 88 88 } 89 90 public static void addExistingSlippyMapUrl(String url) {91 existingSlippyMapUrls.add(url);92 }93 89 } 94 90 -
trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
r9078 r9983 57 57 /** Small icon size for use in graphics calculations */ 58 58 public static final int ICON_SMALL_SIZE = 16; 59 /** Large icon size for use in graphics calculations */60 public static final int ICON_LARGE_SIZE = 24;61 59 /** 24x24 icon for unresolved notes */ 62 60 public static final ImageIcon ICON_OPEN = ImageProvider.get("dialogs/notes", "note_open"); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableCellRenderer.java
r9223 r9983 19 19 */ 20 20 public abstract class MemberTableCellRenderer extends JLabel implements TableCellRenderer { 21 public static final Color BGCOLOR_EMPTY_ROW = new Color(234, 234, 234);22 21 public static final Color BGCOLOR_IN_JOSM_SELECTION = new Color(235, 255, 177); 23 22 24 public static final Color BGCOLOR_NOT_IN_OPPOSITE = new Color(255, 197, 197);25 23 public static final Color BGCOLOR_DOUBLE_ENTRY = new Color(254, 226, 214); 26 24 -
trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java
r9223 r9983 25 25 */ 26 26 public class RelationMemberListTableCellRenderer extends JLabel implements TableCellRenderer { 27 28 public static final Color BGCOLOR_EMPTY_ROW = new Color(234, 234, 234);29 public static final Color BGCOLOR_NOT_IN_OPPOSITE = new Color(255, 197, 197);30 public static final Color BGCOLOR_IN_OPPOSITE = new Color(255, 234, 213);31 public static final Color BGCOLOR_SELECTED = new Color(143, 170, 255);32 27 33 28 private final transient Map<OsmPrimitiveType, ImageIcon> icons; -
trunk/src/org/openstreetmap/josm/gui/history/VersionTableColumnModel.java
r5622 r9983 15 15 public class VersionTableColumnModel extends DefaultTableColumnModel { 16 16 17 /** Column index for version */ 17 18 public static final int COL_VERSION = 0; 19 /** Column index for reference */ 18 20 public static final int COL_REFERENCE = 1; 21 /** Column index for current */ 19 22 public static final int COL_CURRENT = 2; 23 /** Column index for date */ 20 24 public static final int COL_DATE = 3; 25 /** Column index for user */ 21 26 public static final int COL_USER = 4; 22 27 … … 26 31 27 32 // column 0 - Version 28 col = new TableColumn( 0);33 col = new TableColumn(COL_VERSION); 29 34 /* translation note: 3 letter abbr. for "Version" */ 30 35 col.setHeaderValue(tr("Ver")); … … 33 38 addColumn(col); 34 39 // column 1 - Reference 35 col = new TableColumn( 1);40 col = new TableColumn(COL_REFERENCE); 36 41 col.setHeaderValue(tr("A")); 37 42 col.setCellRenderer(bRenderer); … … 40 45 addColumn(col); 41 46 // column 2 - Current 42 col = new TableColumn( 2);47 col = new TableColumn(COL_CURRENT); 43 48 col.setHeaderValue(tr("B")); 44 49 col.setCellRenderer(bRenderer); … … 47 52 addColumn(col); 48 53 // column 3 - Date 49 col = new TableColumn( 3);54 col = new TableColumn(COL_DATE); 50 55 col.setHeaderValue(tr("Date")); 51 56 col.setResizable(false); 52 57 addColumn(col); 53 58 // column 4 - User 54 col = new TableColumn( 4);59 col = new TableColumn(COL_USER); 55 60 col.setHeaderValue(tr("User")); 56 61 col.setResizable(false); -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r9949 r9983 8 8 import java.awt.Color; 9 9 import java.awt.Component; 10 import java.awt.Font;11 import java.awt.Graphics2D;12 10 import java.awt.GridBagLayout; 13 11 import java.awt.Transparency; 14 12 import java.awt.event.ActionEvent; 15 import java.awt.font.FontRenderContext;16 import java.awt.font.LineBreakMeasurer;17 import java.awt.font.TextAttribute;18 import java.awt.font.TextLayout;19 13 import java.awt.image.BufferedImage; 20 14 import java.awt.image.BufferedImageOp; … … 23 17 import java.awt.image.LookupOp; 24 18 import java.awt.image.ShortLookupTable; 25 import java.text.AttributedCharacterIterator;26 import java.text.AttributedString;27 19 import java.util.ArrayList; 28 import java.util.HashMap;29 20 import java.util.List; 30 import java.util.Map;31 21 32 22 import javax.swing.AbstractAction; … … 387 377 } 388 378 389 /**390 * Draws a red error tile when imagery tile cannot be fetched.391 * @param img The buffered image392 * @param message Additional error message to display393 */394 public void drawErrorTile(BufferedImage img, String message) {395 Graphics2D g = (Graphics2D) img.getGraphics();396 g.setColor(Color.RED);397 g.fillRect(0, 0, img.getWidth(), img.getHeight());398 g.setFont(g.getFont().deriveFont(Font.PLAIN).deriveFont(24.0f));399 g.setColor(Color.BLACK);400 401 String text = tr("ERROR");402 g.drawString(text, (img.getWidth() - g.getFontMetrics().stringWidth(text)) / 2, g.getFontMetrics().getHeight()+5);403 if (message != null) {404 float drawPosY = 2.5f*g.getFontMetrics().getHeight()+10;405 if (!message.contains(" ")) {406 g.setFont(g.getFont().deriveFont(Font.PLAIN).deriveFont(18.0f));407 g.drawString(message, 5, (int) drawPosY);408 } else {409 // Draw message on several lines410 Map<TextAttribute, Object> map = new HashMap<>();411 map.put(TextAttribute.FAMILY, "Serif");412 map.put(TextAttribute.SIZE, new Float(18.0));413 AttributedString vanGogh = new AttributedString(message, map);414 // Create a new LineBreakMeasurer from the text415 AttributedCharacterIterator paragraph = vanGogh.getIterator();416 int paragraphStart = paragraph.getBeginIndex();417 int paragraphEnd = paragraph.getEndIndex();418 FontRenderContext frc = g.getFontRenderContext();419 LineBreakMeasurer lineMeasurer = new LineBreakMeasurer(paragraph, frc);420 // Set break width to width of image with some margin421 float breakWidth = img.getWidth()-10;422 // Set position to the index of the first character in the text423 lineMeasurer.setPosition(paragraphStart);424 // Get lines until the entire paragraph has been displayed425 while (lineMeasurer.getPosition() < paragraphEnd) {426 // Retrieve next layout427 TextLayout layout = lineMeasurer.nextLayout(breakWidth);428 429 // Compute pen x position430 float drawPosX = layout.isLeftToRight() ? 0 : breakWidth - layout.getAdvance();431 432 // Move y-coordinate by the ascent of the layout433 drawPosY += layout.getAscent();434 435 // Draw the TextLayout at (drawPosX, drawPosY)436 layout.draw(g, drawPosX, drawPosY);437 438 // Move y-coordinate in preparation for next layout439 drawPosY += layout.getDescent() + layout.getLeading();440 }441 }442 }443 }444 445 379 @Override 446 380 public void destroy() { -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r9860 r9983 43 43 /** should WMS layer autozoom in default mode */ 44 44 public static final BooleanProperty PROP_DEFAULT_AUTOZOOM = new BooleanProperty(PREFERENCE_PREFIX + "default_autozoom", true); 45 46 /** limit of concurrent connections to WMS tile source (per source) */47 public static final IntegerProperty THREAD_LIMIT = new IntegerProperty(PREFERENCE_PREFIX + "simultaneousConnections", 3);48 45 49 46 private static final String CACHE_REGION_NAME = "WMS"; -
trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java
r9341 r9983 19 19 */ 20 20 public final class Cascade implements Cloneable { 21 22 public static final Cascade EMPTY_CASCADE = new Cascade();23 21 24 22 private Map<String, Object> prop = new HashMap<>(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r9540 r9983 523 523 * @return {@code true} if the way is closed or the relation is a closed multipolygon 524 524 */ 525 static boolean closed(Environment e) { 525 static boolean closed(Environment e) { // NO_UCD (unused code) 526 526 if (e.osm instanceof Way && ((Way) e.osm).isClosed()) 527 527 return true; … … 537 537 * @see OsmPrimitive#isModified() 538 538 */ 539 static boolean modified(Environment e) { 539 static boolean modified(Environment e) { // NO_UCD (unused code) 540 540 return e.osm.isModified() || e.osm.isNewOrUndeleted(); 541 541 } … … 547 547 * @see OsmPrimitive#isNew() 548 548 */ 549 static boolean _new(Environment e) { 549 static boolean _new(Environment e) { // NO_UCD (unused code) 550 550 return e.osm.isNew(); 551 551 } … … 557 557 * @see Node#isConnectionNode() 558 558 */ 559 static boolean connection(Environment e) { 559 static boolean connection(Environment e) { // NO_UCD (unused code) 560 560 return e.osm instanceof Node && e.osm.getDataSet() != null && ((Node) e.osm).isConnectionNode(); 561 561 } … … 567 567 * @see OsmPrimitive#isTagged() 568 568 */ 569 static boolean tagged(Environment e) { 569 static boolean tagged(Environment e) { // NO_UCD (unused code) 570 570 return e.osm.isTagged(); 571 571 } … … 577 577 * @see OsmPrimitive#hasSameInterestingTags(OsmPrimitive) 578 578 */ 579 static boolean sameTags(Environment e) { 579 static boolean sameTags(Environment e) { // NO_UCD (unused code) 580 580 return e.osm.hasSameInterestingTags(Utils.firstNonNull(e.child, e.parent)); 581 581 } … … 587 587 * @see ElemStyles#hasAreaElemStyle(OsmPrimitive, boolean) 588 588 */ 589 static boolean areaStyle(Environment e) { 589 static boolean areaStyle(Environment e) { // NO_UCD (unused code) 590 590 // only for validator 591 591 return ElemStyles.hasAreaElemStyle(e.osm, false); … … 597 597 * @return {@code true} if the object is a unconnected node 598 598 */ 599 static boolean unconnected(Environment e) { 599 static boolean unconnected(Environment e) { // NO_UCD (unused code) 600 600 return e.osm instanceof Node && OsmPrimitive.getFilteredList(e.osm.getReferrers(), Way.class).isEmpty(); 601 601 } … … 607 607 * @see ExpressionFactory.Functions#is_right_hand_traffic(Environment) 608 608 */ 609 static boolean righthandtraffic(Environment e) { 609 static boolean righthandtraffic(Environment e) { // NO_UCD (unused code) 610 610 return ExpressionFactory.Functions.is_right_hand_traffic(e); 611 611 } … … 618 618 * @see ExpressionFactory.Functions#is_clockwise(Environment) 619 619 */ 620 static boolean clockwise(Environment e) { 620 static boolean clockwise(Environment e) { // NO_UCD (unused code) 621 621 return ExpressionFactory.Functions.is_clockwise(e); 622 622 } … … 629 629 * @see ExpressionFactory.Functions#is_anticlockwise(Environment) 630 630 */ 631 static boolean anticlockwise(Environment e) { 631 static boolean anticlockwise(Environment e) { // NO_UCD (unused code) 632 632 return ExpressionFactory.Functions.is_anticlockwise(e); 633 633 } … … 638 638 * @return {@code true} if the object is an unclosed multipolygon 639 639 */ 640 static boolean unclosed_multipolygon(Environment e) { 640 static boolean unclosed_multipolygon(Environment e) { // NO_UCD (unused code) 641 641 return e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && 642 642 !e.osm.isIncomplete() && !((Relation) e.osm).hasIncompleteMembers() && … … 652 652 * @see InDataSourceArea 653 653 */ 654 static boolean inDownloadedArea(Environment e) { 654 static boolean inDownloadedArea(Environment e) { // NO_UCD (unused code) 655 655 return IN_DOWNLOADED_AREA.evaluate(e.osm); 656 656 } 657 657 658 static boolean completely_downloaded(Environment e) { 658 static boolean completely_downloaded(Environment e) { // NO_UCD (unused code) 659 659 if (e.osm instanceof Relation) { 660 660 return !((Relation) e.osm).hasIncompleteMembers(); … … 664 664 } 665 665 666 static boolean closed2(Environment e) { 666 static boolean closed2(Environment e) { // NO_UCD (unused code) 667 667 if (e.osm instanceof Way && ((Way) e.osm).isClosed()) 668 668 return true; … … 672 672 } 673 673 674 static boolean selected(Environment e) { 674 static boolean selected(Environment e) { // NO_UCD (unused code) 675 675 Cascade c = e.mc.getCascade(e.layer); 676 676 c.setDefaultSelectedHandling(false); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r9952 r9983 122 122 * @return {@code o} unchanged 123 123 */ 124 public static Object eval(Object o) { 124 public static Object eval(Object o) { // NO_UCD (unused code) 125 125 return o; 126 126 } … … 131 131 * @return Sum of arguments 132 132 */ 133 public static float plus(float... args) { 133 public static float plus(float... args) { // NO_UCD (unused code) 134 134 float res = 0; 135 135 for (float f : args) { … … 144 144 * @return Substraction of arguments 145 145 */ 146 public static Float minus(float... args) { 146 public static Float minus(float... args) { // NO_UCD (unused code) 147 147 if (args.length == 0) { 148 148 return 0.0F; … … 163 163 * @return Multiplication of arguments 164 164 */ 165 public static float times(float... args) { 165 public static float times(float... args) { // NO_UCD (unused code) 166 166 float res = 1; 167 167 for (float f : args) { … … 176 176 * @return Division of arguments 177 177 */ 178 public static Float divided_by(float... args) { 178 public static Float divided_by(float... args) { // NO_UCD (unused code) 179 179 if (args.length == 0) { 180 180 return 1.0F; … … 196 196 * @see Arrays#asList(Object[]) 197 197 */ 198 public static List<Object> list(Object... args) { 198 public static List<Object> list(Object... args) { // NO_UCD (unused code) 199 199 return Arrays.asList(args); 200 200 } … … 205 205 * @return length of the list 206 206 */ 207 public static Integer count(List<?> lst) { 207 public static Integer count(List<?> lst) { // NO_UCD (unused code) 208 208 return lst.size(); 209 209 } … … 217 217 */ 218 218 @NullableArguments 219 public static Object any(Object... args) { 219 public static Object any(Object... args) { // NO_UCD (unused code) 220 220 return Utils.firstNonNull(args); 221 221 } … … 228 228 * @since 5699 229 229 */ 230 public static Object get(List<?> lst, float n) { 230 public static Object get(List<?> lst, float n) { // NO_UCD (unused code) 231 231 int idx = Math.round(n); 232 232 if (idx >= 0 && idx < lst.size()) { … … 244 244 * @since 5699 245 245 */ 246 public static List<String> split(String sep, String toSplit) { 246 public static List<String> split(String sep, String toSplit) { // NO_UCD (unused code) 247 247 return Arrays.asList(toSplit.split(Pattern.quote(sep), -1)); 248 248 } … … 256 256 * @see Color#Color(float, float, float) 257 257 */ 258 public static Color rgb(float r, float g, float b) { 258 public static Color rgb(float r, float g, float b) { // NO_UCD (unused code) 259 259 try { 260 260 return new Color(r, g, b); … … 274 274 * @see Color#Color(float, float, float, float) 275 275 */ 276 public static Color rgba(float r, float g, float b, float alpha) { 276 public static Color rgba(float r, float g, float b, float alpha) { // NO_UCD (unused code) 277 277 try { 278 278 return new Color(r, g, b, alpha); … … 289 289 * @return the corresponding color 290 290 */ 291 public static Color hsb_color(float h, float s, float b) { 291 public static Color hsb_color(float h, float s, float b) { // NO_UCD (unused code) 292 292 try { 293 293 return Color.getHSBColor(h, s, b); … … 302 302 * @return color matching the given notation 303 303 */ 304 public static Color html2color(String html) { 304 public static Color html2color(String html) { // NO_UCD (unused code) 305 305 return ColorHelper.html2color(html); 306 306 } … … 311 311 * @return HTML notation matching the given color 312 312 */ 313 public static String color2html(Color c) { 313 public static String color2html(Color c) { // NO_UCD (unused code) 314 314 return ColorHelper.color2html(c); 315 315 } … … 321 321 * @see java.awt.Color#getRed() 322 322 */ 323 public static float red(Color c) { 323 public static float red(Color c) { // NO_UCD (unused code) 324 324 return Utils.color_int2float(c.getRed()); 325 325 } … … 331 331 * @see java.awt.Color#getGreen() 332 332 */ 333 public static float green(Color c) { 333 public static float green(Color c) { // NO_UCD (unused code) 334 334 return Utils.color_int2float(c.getGreen()); 335 335 } … … 341 341 * @see java.awt.Color#getBlue() 342 342 */ 343 public static float blue(Color c) { 343 public static float blue(Color c) { // NO_UCD (unused code) 344 344 return Utils.color_int2float(c.getBlue()); 345 345 } … … 351 351 * @see java.awt.Color#getAlpha() 352 352 */ 353 public static float alpha(Color c) { 353 public static float alpha(Color c) { // NO_UCD (unused code) 354 354 return Utils.color_int2float(c.getAlpha()); 355 355 } … … 362 362 */ 363 363 @NullableArguments 364 public static String concat(Object... args) { 364 public static String concat(Object... args) { // NO_UCD (unused code) 365 365 return Utils.join("", Arrays.asList(args)); 366 366 } … … 373 373 */ 374 374 @NullableArguments 375 public static String join(String... args) { 375 public static String join(String... args) { // NO_UCD (unused code) 376 376 return Utils.join(args[0], Arrays.asList(args).subList(1, args.length)); 377 377 } … … 384 384 * @see Utils#join 385 385 */ 386 public static String join_list(final String separator, final List<String> values) { 386 public static String join_list(final String separator, final List<String> values) { // NO_UCD (unused code) 387 387 return Utils.join(separator, values); 388 388 } … … 394 394 * @return the property value 395 395 */ 396 public static Object prop(final Environment env, String key) { 396 public static Object prop(final Environment env, String key) { // NO_UCD (unused code) 397 397 return prop(env, key, null); 398 398 } … … 415 415 * @return {@code true} if the property is set, {@code false} otherwise 416 416 */ 417 public static Boolean is_prop_set(final Environment env, String key) { 417 public static Boolean is_prop_set(final Environment env, String key) { // NO_UCD (unused code) 418 418 return is_prop_set(env, key, null); 419 419 } … … 436 436 * @return the value for given key 437 437 */ 438 public static String tag(final Environment env, String key) { 438 public static String tag(final Environment env, String key) { // NO_UCD (unused code) 439 439 return env.osm == null ? null : env.osm.get(key); 440 440 } … … 446 446 * @return first non-null value of the key {@code key} from the object's parent(s) 447 447 */ 448 public static String parent_tag(final Environment env, String key) { 448 public static String parent_tag(final Environment env, String key) { // NO_UCD (unused code) 449 449 if (env.parent == null) { 450 450 if (env.osm != null) { … … 470 470 * @return a list of non-null values of the key {@code key} from the object's parent(s) 471 471 */ 472 public static List<String> parent_tags(final Environment env, String key) { 472 public static List<String> parent_tags(final Environment env, String key) { // NO_UCD (unused code) 473 473 if (env.parent == null) { 474 474 if (env.osm != null) { … … 494 494 * @return the value of the key {@code key} from the object's child, or {@code null} if there is no child 495 495 */ 496 public static String child_tag(final Environment env, String key) { 496 public static String child_tag(final Environment env, String key) { // NO_UCD (unused code) 497 497 return env.child == null ? null : env.child.get(key); 498 498 } … … 504 504 * @return {@code true} if the object has a tag with the given key, {@code false} otherwise 505 505 */ 506 public static boolean has_tag_key(final Environment env, String key) { 506 public static boolean has_tag_key(final Environment env, String key) { // NO_UCD (unused code) 507 507 return env.osm.hasKey(key); 508 508 } … … 513 513 * @return the index as float. Starts at 1 514 514 */ 515 public static Float index(final Environment env) { 515 public static Float index(final Environment env) { // NO_UCD (unused code) 516 516 if (env.index == null) { 517 517 return null; … … 526 526 * @see Environment#getRole() 527 527 */ 528 public static String role(final Environment env) { 528 public static String role(final Environment env) { // NO_UCD (unused code) 529 529 return env.getRole(); 530 530 } … … 536 536 * @see Geometry#computeArea(OsmPrimitive) 537 537 */ 538 public static Float areasize(final Environment env) { 538 public static Float areasize(final Environment env) { // NO_UCD (unused code) 539 539 final Double area = Geometry.computeArea(env.osm); 540 540 return area == null ? null : area.floatValue(); … … 547 547 * @see Way#getLength() 548 548 */ 549 public static Float waylength(final Environment env) { 549 public static Float waylength(final Environment env) { // NO_UCD (unused code) 550 550 if (env.osm instanceof Way) { 551 551 return (float) ((Way) env.osm).getLength(); … … 560 560 * @return {@code true} if {@code !b} 561 561 */ 562 public static boolean not(boolean b) { 562 public static boolean not(boolean b) { // NO_UCD (unused code) 563 563 return !b; 564 564 } … … 570 570 * @return {@code true} if {@code a >= b} 571 571 */ 572 public static boolean greater_equal(float a, float b) { 572 public static boolean greater_equal(float a, float b) { // NO_UCD (unused code) 573 573 return a >= b; 574 574 } … … 580 580 * @return {@code true} if {@code a <= b} 581 581 */ 582 public static boolean less_equal(float a, float b) { 582 public static boolean less_equal(float a, float b) { // NO_UCD (unused code) 583 583 return a <= b; 584 584 } … … 590 590 * @return {@code true} if {@code a > b} 591 591 */ 592 public static boolean greater(float a, float b) { 592 public static boolean greater(float a, float b) { // NO_UCD (unused code) 593 593 return a > b; 594 594 } … … 600 600 * @return {@code true} if {@code a < b} 601 601 */ 602 public static boolean less(float a, float b) { 602 public static boolean less(float a, float b) { // NO_UCD (unused code) 603 603 return a < b; 604 604 } … … 610 610 * @see Math#toRadians(double) 611 611 */ 612 public static double degree_to_radians(double degree) { 612 public static double degree_to_radians(double degree) { // NO_UCD (unused code) 613 613 return Math.toRadians(degree); 614 614 } … … 623 623 * @see RotationAngle#parseCardinalRotation(String) 624 624 */ 625 public static Double cardinal_to_radians(String cardinal) { 625 public static Double cardinal_to_radians(String cardinal) { // NO_UCD (unused code) 626 626 try { 627 627 return RotationAngle.parseCardinalRotation(cardinal); … … 651 651 * @see Object#equals(Object) 652 652 */ 653 public static boolean not_equal(Object a, Object b) { 653 public static boolean not_equal(Object a, Object b) { // NO_UCD (unused code) 654 654 return !equal(a, b); 655 655 } … … 662 662 * @see SearchCompiler 663 663 */ 664 public static Boolean JOSM_search(final Environment env, String searchStr) { 664 public static Boolean JOSM_search(final Environment env, String searchStr) { // NO_UCD (unused code) 665 665 Match m; 666 666 try { … … 680 680 * @return value for key, or default value if not found 681 681 */ 682 public static String JOSM_pref(Environment env, String key, String def) { 682 public static String JOSM_pref(Environment env, String key, String def) { // NO_UCD (unused code) 683 683 return MapPaintStyles.getStyles().getPreferenceCached(key, def); 684 684 } … … 692 692 * @since 5699 693 693 */ 694 public static boolean regexp_test(String pattern, String target) { 694 public static boolean regexp_test(String pattern, String target) { // NO_UCD (unused code) 695 695 return Pattern.matches(pattern, target); 696 696 } … … 707 707 * @since 5699 708 708 */ 709 public static boolean regexp_test(String pattern, String target, String flags) { 709 public static boolean regexp_test(String pattern, String target, String flags) { // NO_UCD (unused code) 710 710 int f = 0; 711 711 if (flags.contains("i")) { … … 734 734 * @since 5701 735 735 */ 736 public static List<String> regexp_match(String pattern, String target, String flags) { 736 public static List<String> regexp_match(String pattern, String target, String flags) { // NO_UCD (unused code) 737 737 int f = 0; 738 738 if (flags.contains("i")) { … … 757 757 * @since 5701 758 758 */ 759 public static List<String> regexp_match(String pattern, String target) { 759 public static List<String> regexp_match(String pattern, String target) { // NO_UCD (unused code) 760 760 return Utils.getMatches(Pattern.compile(pattern).matcher(target)); 761 761 } … … 767 767 * @see OsmPrimitive#getUniqueId() 768 768 */ 769 public static long osm_id(final Environment env) { 769 public static long osm_id(final Environment env) { // NO_UCD (unused code) 770 770 return env.osm.getUniqueId(); 771 771 } … … 778 778 */ 779 779 @NullableArguments 780 public static String tr(String... args) { 780 public static String tr(String... args) { // NO_UCD (unused code) 781 781 final String text = args[0]; 782 782 System.arraycopy(args, 1, args, 0, args.length - 1); … … 791 791 * @see String#substring(int) 792 792 */ 793 public static String substring(String s, /* due to missing Cascade.convertTo for int*/ float begin) { 793 public static String substring(String s, /* due to missing Cascade.convertTo for int*/ float begin) { // NO_UCD (unused code) 794 794 return s == null ? null : s.substring((int) begin); 795 795 } … … 804 804 * @see String#substring(int, int) 805 805 */ 806 public static String substring(String s, float begin, float end) { 806 public static String substring(String s, float begin, float end) { // NO_UCD (unused code) 807 807 return s == null ? null : s.substring((int) begin, (int) end); 808 808 } … … 816 816 * @see String#replace(CharSequence, CharSequence) 817 817 */ 818 public static String replace(String s, String target, String replacement) { 818 public static String replace(String s, String target, String replacement) { // NO_UCD (unused code) 819 819 return s == null ? null : s.replace(target, replacement); 820 820 } … … 827 827 * @return the encoded string 828 828 */ 829 public static String URL_encode(String s) { 829 public static String URL_encode(String s) { // NO_UCD (unused code) 830 830 return s == null ? null : Utils.encodeUrl(s); 831 831 } … … 838 838 * @return the encoded string 839 839 */ 840 public static String XML_encode(String s) { 840 public static String XML_encode(String s) { // NO_UCD (unused code) 841 841 return s == null ? null : XmlWriter.encode(s); 842 842 } … … 847 847 * @return long value from 0 to 2^32-1 848 848 */ 849 public static long CRC32_checksum(String s) { 849 public static long CRC32_checksum(String s) { // NO_UCD (unused code) 850 850 CRC32 cs = new CRC32(); 851 851 cs.update(s.getBytes(StandardCharsets.UTF_8)); … … 903 903 */ 904 904 @NullableArguments 905 public static Object print(Object o) { 905 public static Object print(Object o) { // NO_UCD (unused code) 906 906 System.out.print(o == null ? "none" : o.toString()); 907 907 return o; … … 915 915 */ 916 916 @NullableArguments 917 public static Object println(Object o) { 917 public static Object println(Object o) { // NO_UCD (unused code) 918 918 System.out.println(o == null ? "none" : o.toString()); 919 919 return o; … … 925 925 * @return number of tags 926 926 */ 927 public static int number_of_tags(Environment env) { 927 public static int number_of_tags(Environment env) { // NO_UCD (unused code) 928 928 return env.osm.getNumKeys(); 929 929 } … … 935 935 * @return the value of the setting (calculated when the style is loaded) 936 936 */ 937 public static Object setting(Environment env, String key) { 937 public static Object setting(Environment env, String key) { // NO_UCD (unused code) 938 938 return env.source.settingValues.get(key); 939 939 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r9253 r9983 955 955 } 956 956 957 public Action getAction(String s) {958 Action e = actions.get(s);959 if (e == null) {960 e = regactions.get(s);961 }962 return e;963 }964 965 957 private void loadActions() { 966 958 rootActionsNode.removeAllChildren(); -
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r9847 r9983 12 12 import java.awt.event.ActionEvent; 13 13 import java.awt.event.KeyEvent; 14 import java.awt.event.KeyListener;15 14 import java.beans.PropertyChangeEvent; 16 15 import java.beans.PropertyChangeListener; … … 487 486 } 488 487 489 public void addOKAccelatorListener(KeyListener l) {490 addKeyListener(l);491 if (editor != null) {492 editor.getEditor().addKeyListener(l);493 }494 }495 496 488 /** 497 489 * Inject a tag cell editor in the tag table -
trunk/src/org/openstreetmap/josm/gui/widgets/ComboBoxHistory.java
r9854 r9983 17 17 18 18 private final int maxSize; 19 20 private final transient List<HistoryChangedListener> listeners = new ArrayList<>();21 19 22 20 /** … … 63 61 // set selected item to the one just added 64 62 setSelectedItem(o); 65 66 fireHistoryChanged();67 63 } 68 64 … … 116 112 return list; 117 113 } 118 119 public void addHistoryChangedListener(HistoryChangedListener l) {120 listeners.add(l);121 }122 123 public void removeHistoryChangedListener(HistoryChangedListener l) {124 listeners.remove(l);125 }126 127 private void fireHistoryChanged() {128 for (HistoryChangedListener l : listeners) {129 l.historyChanged(asStringList());130 }131 }132 114 } -
trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionExporter.java
r9455 r9983 29 29 * @param layer GeoImage layer to export 30 30 */ 31 public GeoImageSessionExporter(GeoImageLayer layer) { 31 public GeoImageSessionExporter(GeoImageLayer layer) { // NO_UCD (unused code) 32 32 super(layer); 33 33 } -
trunk/src/org/openstreetmap/josm/io/session/GpxTracksSessionExporter.java
r9471 r9983 21 21 * @param layer GPX layer to export 22 22 */ 23 public GpxTracksSessionExporter(GpxLayer layer) { 23 public GpxTracksSessionExporter(GpxLayer layer) { // NO_UCD (test only) 24 24 super(layer, "tracks", "0.1", "gpx"); 25 25 } -
trunk/src/org/openstreetmap/josm/io/session/ImagerySessionExporter.java
r9455 r9983 33 33 * @param layer imagery layer to export 34 34 */ 35 public ImagerySessionExporter(ImageryLayer layer) { 35 public ImagerySessionExporter(ImageryLayer layer) { // NO_UCD (unused code) 36 36 super(layer); 37 37 } … … 41 41 * @param layer TMS layer to export 42 42 */ 43 public ImagerySessionExporter(TMSLayer layer) { 43 public ImagerySessionExporter(TMSLayer layer) { // NO_UCD (unused code) 44 44 super(layer); 45 45 } … … 49 49 * @param layer WMS layer to export 50 50 */ 51 public ImagerySessionExporter(WMSLayer layer) { 51 public ImagerySessionExporter(WMSLayer layer) { // NO_UCD (unused code) 52 52 super(layer); 53 53 } … … 57 57 * @param layer WMTS layer to export 58 58 */ 59 public ImagerySessionExporter(WMTSLayer layer) { 59 public ImagerySessionExporter(WMTSLayer layer) { // NO_UCD (unused code) 60 60 super(layer); 61 61 } -
trunk/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java
r9455 r9983 37 37 * @param layer marker layer to export 38 38 */ 39 public MarkerSessionExporter(MarkerLayer layer) { 39 public MarkerSessionExporter(MarkerLayer layer) { // NO_UCD (unused code) 40 40 super(layer); 41 41 } -
trunk/src/org/openstreetmap/josm/io/session/NoteSessionExporter.java
r9746 r9983 18 18 * @param layer Note layer to export 19 19 */ 20 public NoteSessionExporter(NoteLayer layer) { 20 public NoteSessionExporter(NoteLayer layer) { // NO_UCD (unused code) 21 21 super(layer, "osm-notes", "0.1", "osn"); 22 22 } -
trunk/src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java
r9471 r9983 22 22 * @param layer Data layer to export 23 23 */ 24 public OsmDataSessionExporter(OsmDataLayer layer) { 24 public OsmDataSessionExporter(OsmDataLayer layer) { // NO_UCD (test only) 25 25 super(layer, "osm-data", "0.1", "osm"); 26 26 } -
trunk/src/org/openstreetmap/josm/plugins/PluginException.java
r8308 r9983 13 13 public class PluginException extends Exception { 14 14 public final transient PluginProxy plugin; 15 public final String name;16 15 17 16 public PluginException(PluginProxy plugin, String name, Throwable cause) { 18 17 super(tr("An error occurred in plugin {0}", name), cause); 19 18 this.plugin = plugin; 20 this.name = name;21 19 } 22 20 23 public PluginException(String name, Stringmessage) {21 public PluginException(String message) { 24 22 super(message); 25 23 this.plugin = null; 26 this.name = name;27 24 } 28 25 … … 30 27 super(tr("An error occurred in plugin {0}", name), cause); 31 28 this.plugin = null; 32 this.name = name;33 29 } 34 30 } -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r8943 r9983 111 111 public PluginInformation(File file, String name) throws PluginException { 112 112 if (!PluginHandler.isValidJar(file)) { 113 throw new PluginException( name,tr("Invalid jar file ''{0}''", file));113 throw new PluginException(tr("Invalid jar file ''{0}''", file)); 114 114 } 115 115 this.name = name; … … 121 121 Manifest manifest = jar.getManifest(); 122 122 if (manifest == null) 123 throw new PluginException( name,tr("The plugin file ''{0}'' does not include a Manifest.", file.toString()));123 throw new PluginException(tr("The plugin file ''{0}'' does not include a Manifest.", file.toString())); 124 124 scanManifest(manifest, false); 125 125 libraries.add(0, Utils.fileToURL(file)); -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r9599 r9983 95 95 private static volatile PluralMode pluralMode = PluralMode.MODE_NOTONE; /* english default */ 96 96 private static volatile String loadedCode = "en"; 97 /** store the original system locale for further use */98 public static final Locale SystemLocale = Locale.getDefault();99 97 100 98 /* Localization keys for file chooser (and color chooser). */ -
trunk/src/org/openstreetmap/josm/tools/Pair.java
r9542 r9983 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.tools; 3 import java.util.ArrayList;4 import java.util.List;5 3 import java.util.Objects; 6 4 … … 48 46 49 47 /** 50 * Converts a single-typed pair to a list.51 * @param <T> type of both elements52 * @param p pair53 * @return list containing a and b54 */55 public static <T> List<T> toList(Pair<T, T> p) {56 List<T> l = new ArrayList<>(2);57 l.add(p.a);58 l.add(p.b);59 return l;60 }61 62 /**63 48 * Sorts a single-typed pair so {@code a <= b}. 64 49 * @param <T> type of both elements -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r9799 r9983 239 239 public XmlObjectParser() { 240 240 parser = new Parser(); 241 }242 243 public XmlObjectParser(DefaultHandler handler) {244 parser = handler;245 241 } 246 242
Note:
See TracChangeset
for help on using the changeset viewer.