Ignore:
Timestamp:
2012-06-09T20:03:41+02:00 (12 years ago)
Author:
bastiK
Message:

doc improvements

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/GBC.java

    r3894 r5275  
    9898    /**
    9999     * Specifies how to distribute extra horizontal space.
    100      * @param weidhtx   Weight in horizontal direction
     100     * @param weightx   Weight in horizontal direction
    101101     * @param weighty   Weight in vertical direction
    102102     * @return This constraint for chaining.
     
    114114     * @param y If higher than 0, this will be a vertical glue with y as minimum
    115115     *      vertical strut.
     116     * @return the glue component
    116117     */
    117118    public static Component glue(int x, int y) {
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r5266 r5275  
    3232
    3333    /**
    34      * Will find all intersection and add nodes there for list of given ways. Handles self-intersections too.
    35      * And make commands to add the intersection points to ways.
    36      * @param List<Way> - a list of ways to test
    37      * @return ArrayList<Node> List of new nodes
     34     * 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     *
    3838     * 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
    3946     */
    4047    public static Set<Node> addIntersections(List<Way> ways, boolean test, List<Command> cmds) {
     
    472479
    473480    /**
    474      * returns area of a closed way in square meters
     481     * Returns area of a closed way in square meters.
    475482     * (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.
    476491     */
    477492    public static double closedWayArea(Way way) {
     
    532547     * If the area is negative the way is ordered in a clockwise direction.
    533548     *
     549     * See http://paulbourke.net/geometry/polyarea/
     550     *
    534551     * @param w the way to be checked.
    535552     * @return true if and only if way is oriented clockwise.
    536553     * @throws IllegalArgumentException if way is not closed (see {@link Way#isClosed}).
    537      * @see http://paulbourke.net/geometry/polyarea/
    538554     */
    539555    public static boolean isClockwise(Way w) {
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r5056 r5275  
    115115
    116116    /**
    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',
    119119     *                  both extensions are tried.
    120120     */
     
    137137
    138138    /**
    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.)
    140142     */
    141143    public ImageProvider setId(String id) {
     
    145147
    146148    /**
    147      * A zip file where the image is located.
     149     * Specify a zip file where the image is located.
     150     *
     151     * (optional)
    148152     */
    149153    public ImageProvider setArchive(File archive) {
     
    153157
    154158    /**
    155      * The dimensions of the image.
     159     * Set the dimensions of the image.
    156160     *
    157161     * If not specified, the original size of the image is used.
     
    166170
    167171    /**
    168      * see setSize
     172     * @see #setSize
    169173     */
    170174    public ImageProvider setWidth(int width) {
     
    174178
    175179    /**
    176      * see setSize
     180     * @see #setSize
    177181     */
    178182    public ImageProvider setHeight(int height) {
     
    182186
    183187    /**
    184      * The maximum size of the image.
     188     * Limit the maximum size of the image.
    185189     *
    186190     * It will shrink the image if necessary, but keep the aspect ratio.
     
    196200
    197201    /**
    198      * see setMaxSize
     202     * @see #setMaxSize
    199203     */
    200204    public ImageProvider setMaxWidth(int maxWidth) {
     
    204208
    205209    /**
    206      * see setMaxSize
     210     * @see #setMaxSize
    207211     */
    208212    public ImageProvider setMaxHeight(int maxHeight) {
     
    212216
    213217    /**
    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
    217225     */
    218226    public ImageProvider setOptional(boolean optional) {
     
    241249    /**
    242250     * Execute the image request.
     251     * @return the requested image or null if the request failed
    243252     */
    244253    public ImageIcon get() {
     
    267276     * asynchronously.
    268277     *
    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}).
    274282     */
    275283    public void getInBackground(final ImageCallback callback) {
     
    290298
    291299    /**
    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)
    297304     * @return The requested Image.
     305     * @throws RuntimeException if the image cannot be located
    298306     */
    299307    public static ImageIcon get(String subdir, String name) {
     
    301309    }
    302310
     311    /**
     312     * @see #get(java.lang.String, java.lang.String)
     313     */
    303314    public static ImageIcon get(String name) {
    304315        return new ImageProvider(name).get();
    305316    }
    306317
     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     */
    307330    public static ImageIcon getIfAvailable(String name) {
    308331        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();
    313332    }
    314333
     
    691710        ImageIcon img = get("cursor", name);
    692711        if (overlay != null) {
    693             img = overlay(img, "cursor/modifier/" + overlay, OverlayPosition.SOUTHEAST);
     712            img = overlay(img, ImageProvider.get("cursor/modifier/" + overlay), OverlayPosition.SOUTHEAST);
    694713        }
    695714        Cursor c = Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(),
     
    698717    }
    699718
    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)
    701731     * @return an icon that represent the overlay of the two given icons. The second icon is layed
    702732     * on the first relative to the given position.
    703733     */
    704     public static ImageIcon overlay(Icon ground, String overlayImage, OverlayPosition pos) {
    705         return overlay(ground, ImageProvider.get(overlayImage), pos);
    706     }
    707 
    708734    public static ImageIcon overlay(Icon ground, Icon overlay, OverlayPosition pos) {
    709735        GraphicsConfiguration conf = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
     
    739765    }
    740766
    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 */
    745768    final static double DEGREE_90 = 90.0 * Math.PI / 180.0;
    746769
     
    750773     * @param c The component to get properties useful for painting, e.g. the foreground or
    751774     * background color.
    752      * @param icon the image to be rotated.
     775     * @param img the image to be rotated.
    753776     * @param rotatedAngle the rotated angle, in degree, clockwise. It could be any double but we
    754777     * will mod it with 360 before using it.
     
    811834     * @return the icon
    812835     */
    813     public static ImageIcon get(OsmPrimitiveType type) throws IllegalArgumentException {
     836    public static ImageIcon get(OsmPrimitiveType type) {
    814837        CheckParameterUtil.ensureParameterNotNull(type, "type");
    815838        return get("data", type.getAPIName());
  • trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java

    r5266 r5275  
    22package org.openstreetmap.josm.tools;
    33
     4import static org.openstreetmap.josm.tools.I18n.tr;
     5
    46import java.util.Locale;
    5 import static org.openstreetmap.josm.tools.I18n.tr;
    67
    78public class LanguageInfo {
     
    8182     * In most cases JOSM and Java uses the same codes, but for some exceptions this is needed.
    8283     *
    83      * @param code the locale code.
     84     * @param localeName the locale code.
    8485     * @return the resulting locale
    8586     */
  • trunk/src/org/openstreetmap/josm/tools/WikiReader.java

    r5061 r5275  
    3333     * pathes etc..
    3434     *
    35      * @return
    3635     * @throws IOException Throws, if the page could not be loaded.
    3736     */
Note: See TracChangeset for help on using the changeset viewer.