Changeset 5275 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2012-06-09T20:03:41+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/GBC.java
r3894 r5275 98 98 /** 99 99 * Specifies how to distribute extra horizontal space. 100 * @param wei dhtx Weight in horizontal direction100 * @param weightx Weight in horizontal direction 101 101 * @param weighty Weight in vertical direction 102 102 * @return This constraint for chaining. … … 114 114 * @param y If higher than 0, this will be a vertical glue with y as minimum 115 115 * vertical strut. 116 * @return the glue component 116 117 */ 117 118 public static Component glue(int x, int y) { -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r5266 r5275 32 32 33 33 /** 34 * Will find all intersection and add nodes there for list of given ways. Handles self-intersections too.35 * And make commands to add theintersectionpoints to ways.36 * @param List<Way> - a list of ways to test37 * @return ArrayList<Node> List of new nodes34 * Will find all intersection and add nodes there for list of given ways. 35 * Handles self-intersections too. 36 * And makes commands to add the intersection points to ways. 37 * 38 38 * Prerequisite: no two nodes have the same coordinates. 39 * 40 * @param ways a list of ways to test 41 * @param test if false, do not build list of Commands, just return nodes 42 * @param cmds list of commands, typically empty when handed to this method. 43 * Will be filled with commands that add intersection nodes to 44 * the ways. 45 * @return list of new nodes 39 46 */ 40 47 public static Set<Node> addIntersections(List<Way> ways, boolean test, List<Command> cmds) { … … 472 479 473 480 /** 474 * returns area of a closed way in square meters481 * Returns area of a closed way in square meters. 475 482 * (approximate(?), but should be OK for small areas) 483 * 484 * Relies on the current projection: Works correctly, when 485 * one unit in projected coordinates corresponds to one meter. 486 * This is true for most projections, but not for WGS84 and 487 * Mercator (EPSG:3857). 488 * 489 * @param way Way to measure, should be closed (first node is the same as last node) 490 * @return area of the closed way. 476 491 */ 477 492 public static double closedWayArea(Way way) { … … 532 547 * If the area is negative the way is ordered in a clockwise direction. 533 548 * 549 * See http://paulbourke.net/geometry/polyarea/ 550 * 534 551 * @param w the way to be checked. 535 552 * @return true if and only if way is oriented clockwise. 536 553 * @throws IllegalArgumentException if way is not closed (see {@link Way#isClosed}). 537 * @see http://paulbourke.net/geometry/polyarea/538 554 */ 539 555 public static boolean isClockwise(Way w) { -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r5056 r5275 115 115 116 116 /** 117 * @param subdir Subdirectory the image lies in.118 * @param name The name of the image. If it does not end with '.png' or '.svg',117 * @param subdir subdirectory the image lies in 118 * @param name the name of the image. If it does not end with '.png' or '.svg', 119 119 * both extensions are tried. 120 120 */ … … 137 137 138 138 /** 139 * An id used for caching. Id is not used for cache if name starts with http://. (URL is unique anyway.) 139 * Set an id used for caching. 140 * If name starts with <tt>http://</tt> Id is not used for the cache. 141 * (A URL is unique anyway.) 140 142 */ 141 143 public ImageProvider setId(String id) { … … 145 147 146 148 /** 147 * A zip file where the image is located. 149 * Specify a zip file where the image is located. 150 * 151 * (optional) 148 152 */ 149 153 public ImageProvider setArchive(File archive) { … … 153 157 154 158 /** 155 * The dimensions of the image.159 * Set the dimensions of the image. 156 160 * 157 161 * If not specified, the original size of the image is used. … … 166 170 167 171 /** 168 * seesetSize172 * @see #setSize 169 173 */ 170 174 public ImageProvider setWidth(int width) { … … 174 178 175 179 /** 176 * seesetSize180 * @see #setSize 177 181 */ 178 182 public ImageProvider setHeight(int height) { … … 182 186 183 187 /** 184 * The maximum size of the image.188 * Limit the maximum size of the image. 185 189 * 186 190 * It will shrink the image if necessary, but keep the aspect ratio. … … 196 200 197 201 /** 198 * seesetMaxSize202 * @see #setMaxSize 199 203 */ 200 204 public ImageProvider setMaxWidth(int maxWidth) { … … 204 208 205 209 /** 206 * seesetMaxSize210 * @see #setMaxSize 207 211 */ 208 212 public ImageProvider setMaxHeight(int maxHeight) { … … 212 216 213 217 /** 214 * The image URL comes from user data and the image may be missing. 215 * 216 * Set true, if JOSM should *not* throw a RuntimeException in case the image cannot be located. 218 * Decide, if an exception should be thrown, when the image cannot be located. 219 * 220 * Set to true, when the image URL comes from user data and the image may be missing. 221 * 222 * @param optional true, if JOSM should <b>not</b> throw a RuntimeException 223 * in case the image cannot be located. 224 * @return the current object, for convenience 217 225 */ 218 226 public ImageProvider setOptional(boolean optional) { … … 241 249 /** 242 250 * Execute the image request. 251 * @return the requested image or null if the request failed 243 252 */ 244 253 public ImageIcon get() { … … 267 276 * asynchronously. 268 277 * 269 * @param callback is called, when the image is ready. This can happen 270 * before the call to getInBackground returns or it may be invoked some 271 * time (seconds) later. 272 * If no image is available, a null value is returned to callback (just 273 * like ImageProvider.get). 278 * @param callback a callback. It is called, when the image is ready. 279 * This can happen before the call to this method returns or it may be 280 * invoked some time (seconds) later. If no image is available, a null 281 * value is returned to callback (just like {@link #get}). 274 282 */ 275 283 public void getInBackground(final ImageCallback callback) { … … 290 298 291 299 /** 292 * Return an image from the specified location. Throws a RuntimeException if 293 * the image cannot be located. 294 * 295 * @param subdir The position of the directory, e.g. 'layer' 296 * @param name The icons name (with or without '.png' or '.svg' extension) 300 * Load an image with a given file name. 301 * 302 * @param subdir subdirectory the image lies in 303 * @param name The icon name (base name with or without '.png' or '.svg' extension) 297 304 * @return The requested Image. 305 * @throws RuntimeException if the image cannot be located 298 306 */ 299 307 public static ImageIcon get(String subdir, String name) { … … 301 309 } 302 310 311 /** 312 * @see #get(java.lang.String, java.lang.String) 313 */ 303 314 public static ImageIcon get(String name) { 304 315 return new ImageProvider(name).get(); 305 316 } 306 317 318 /** 319 * Load an image with a given file name, but do not throw an exception 320 * when the image cannot be found. 321 * @see #get(java.lang.String, java.lang.String) 322 */ 323 public static ImageIcon getIfAvailable(String subdir, String name) { 324 return new ImageProvider(subdir, name).setOptional(true).get(); 325 } 326 327 /** 328 * @see #getIfAvailable(java.lang.String, java.lang.String) 329 */ 307 330 public static ImageIcon getIfAvailable(String name) { 308 331 return new ImageProvider(name).setOptional(true).get(); 309 }310 311 public static ImageIcon getIfAvailable(String subdir, String name) {312 return new ImageProvider(subdir, name).setOptional(true).get();313 332 } 314 333 … … 691 710 ImageIcon img = get("cursor", name); 692 711 if (overlay != null) { 693 img = overlay(img, "cursor/modifier/" + overlay, OverlayPosition.SOUTHEAST); 712 img = overlay(img, ImageProvider.get("cursor/modifier/" + overlay), OverlayPosition.SOUTHEAST); 694 713 } 695 714 Cursor c = Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(), … … 698 717 } 699 718 700 /** 719 @Deprecated 720 public static ImageIcon overlay(Icon ground, String overlayImage, OverlayPosition pos) { 721 return overlay(ground, ImageProvider.get(overlayImage), pos); 722 } 723 724 /** 725 * Decorate one icon with an overlay icon. 726 * 727 * @param ground the base image 728 * @param overlay the overlay image (can be smaller than the base image) 729 * @param pos position of the overlay image inside the base image (positioned 730 * in one of the corners) 701 731 * @return an icon that represent the overlay of the two given icons. The second icon is layed 702 732 * on the first relative to the given position. 703 733 */ 704 public static ImageIcon overlay(Icon ground, String overlayImage, OverlayPosition pos) {705 return overlay(ground, ImageProvider.get(overlayImage), pos);706 }707 708 734 public static ImageIcon overlay(Icon ground, Icon overlay, OverlayPosition pos) { 709 735 GraphicsConfiguration conf = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() … … 739 765 } 740 766 741 /* 742 * from: http://www.jidesoft.com/blog/2008/02/29/rotate-an-icon-in-java/ License: 743 * "feel free to use" 744 */ 767 /** 90 degrees in radians units */ 745 768 final static double DEGREE_90 = 90.0 * Math.PI / 180.0; 746 769 … … 750 773 * @param c The component to get properties useful for painting, e.g. the foreground or 751 774 * background color. 752 * @param i conthe image to be rotated.775 * @param img the image to be rotated. 753 776 * @param rotatedAngle the rotated angle, in degree, clockwise. It could be any double but we 754 777 * will mod it with 360 before using it. … … 811 834 * @return the icon 812 835 */ 813 public static ImageIcon get(OsmPrimitiveType type) throws IllegalArgumentException{836 public static ImageIcon get(OsmPrimitiveType type) { 814 837 CheckParameterUtil.ensureParameterNotNull(type, "type"); 815 838 return get("data", type.getAPIName()); -
trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
r5266 r5275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 4 6 import java.util.Locale; 5 import static org.openstreetmap.josm.tools.I18n.tr;6 7 7 8 public class LanguageInfo { … … 81 82 * In most cases JOSM and Java uses the same codes, but for some exceptions this is needed. 82 83 * 83 * @param code the locale code.84 * @param localeName the locale code. 84 85 * @return the resulting locale 85 86 */ -
trunk/src/org/openstreetmap/josm/tools/WikiReader.java
r5061 r5275 33 33 * pathes etc.. 34 34 * 35 * @return36 35 * @throws IOException Throws, if the page could not be loaded. 37 36 */
Note:
See TracChangeset
for help on using the changeset viewer.