Changeset 11674 in josm for trunk


Ignore:
Timestamp:
2017-03-05T00:23:56+01:00 (7 years ago)
Author:
michael2402
Message:

Add Javadoc to icon drawing functions. Fix AreaElement#equals/hashCode.

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r11671 r11674  
    949949     * @param member {@code} true to render it as a relation member, {@code false} otherwise
    950950     * @param theta the angle of rotation in radians
     951     * @since 11670
    951952     */
    952953    public void drawAreaIcon(OsmPrimitive primitive, MapImage img, boolean disabled, boolean selected, boolean member, double theta) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java

    r11670 r11674  
    6262    private final MapImage iconImage;
    6363
     64    /**
     65     * The rotation of the {@link #iconImageAngle}
     66     */
    6467    private final RotationAngle iconImageAngle;
    6568
     
    175178                Objects.equals(text, that.text) &&
    176179                Objects.equals(extent, that.extent) &&
    177                 Objects.equals(extentThreshold, that.extentThreshold);
     180                Objects.equals(extentThreshold, that.extentThreshold) &&
     181                Objects.equals(iconImage, that.iconImage) &&
     182                Objects.equals(iconImageAngle, that.iconImageAngle);
    178183    }
    179184
    180185    @Override
    181186    public int hashCode() {
    182         return Objects.hash(super.hashCode(), color, fillImage, text, extent, extentThreshold);
     187        return Objects.hash(super.hashCode(), color, fillImage, text, extent, extentThreshold, iconImage, iconImageAngle);
    183188    }
    184189
     
    186191    public String toString() {
    187192        return "AreaElemStyle{" + super.toString() + "color=" + Utils.toString(color) +
    188                 " fillImage=[" + fillImage + "]}";
     193                " fillImage=[" + fillImage + "] iconImage=[" + iconImage + "] iconImageAngle=[" + iconImageAngle + "]}";
    189194    }
    190195}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java

    r11670 r11674  
    3333 */
    3434public class NodeElement extends StyleElement {
     35    /**
     36     * The image that is used to display this node. May be <code>null</code>
     37     */
    3538    public final MapImage mapImage;
     39    /**
     40     * The angle that is used to rotate {@link #mapImage}. May be <code>null</code> to indicate no rotation.
     41     */
    3642    public final RotationAngle mapImageAngle;
    3743    /**
     
    6369    }
    6470
     71    /**
     72     * Creates a new node element for the given Environment
     73     * @param env The environment
     74     * @return The node element style or <code>null</code> if the node should not be painted.
     75     */
    6576    public static NodeElement create(Environment env) {
    6677        return create(env, 4f, false);
     
    90101     * @param env The environment
    91102     * @return The angle
     103     * @since 11670
    92104     */
    93105    public static RotationAngle createRotationAngle(Environment env) {
     
    115127    }
    116128
     129    /**
     130     * Create a map icon for the environment using the default keys.
     131     * @param env The environment to read the icon form
     132     * @return The icon or <code>null</code> if no icon is defined
     133     * @since 11670
     134     */
    117135    public static MapImage createIcon(final Environment env) {
    118136        return createIcon(env, ICON_KEYS);
    119137    }
    120138
     139    /**
     140     * Create a map icon for the environment.
     141     * @param env The environment to read the icon form
     142     * @param keys The keys, indexed by the ICON_..._IDX constants.
     143     * @return The icon or <code>null</code> if no icon is defined
     144     */
    121145    public static MapImage createIcon(final Environment env, final String ... keys) {
    122146        CheckParameterUtil.ensureParameterNotNull(env, "env");
     
    168192    }
    169193
     194    /**
     195     * Create a symbol for the environment
     196     * @param env The environment to read the icon form
     197     * @return The symbol.
     198     */
    170199    private static Symbol createSymbol(Environment env) {
    171200        Cascade c = env.mc.getCascade(env.layer);
     
    303332    }
    304333
     334    /**
     335     * Gets the selection box for this element.
     336     * @return The selection box as {@link BoxProvider} object.
     337     */
    305338    public BoxProvider getBoxProvider() {
    306339        if (mapImage != null)
Note: See TracChangeset for help on using the changeset viewer.