Changeset 11760 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2017-03-21T15:45:26+01:00 (7 years ago)
Author:
michael2402
Message:

See #10176: Make area icon position setable by user.

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/StyleKeys.java

    r9341 r11760  
    2525    String ICON_ROTATION = "icon-rotation";
    2626    String ICON_WIDTH = "icon-width";
     27    /**
     28     * Position of icons on area.
     29     */
     30    String ICON_POSITION = "icon-position";
    2731    String LINECAP = "linecap";
    2832    String LINEJOIN = "linejoin";
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java

    r11748 r11760  
    99import org.openstreetmap.josm.gui.mappaint.Cascade;
    1010import org.openstreetmap.josm.gui.mappaint.Environment;
     11import org.openstreetmap.josm.gui.mappaint.Keyword;
    1112import org.openstreetmap.josm.gui.mappaint.styleelement.placement.PartiallyInsideAreaStrategy;
    1213import org.openstreetmap.josm.gui.mappaint.styleelement.placement.PositionForAreaStrategy;
     
    3233     * The position of the icon inside the area.
    3334     */
    34     private final PositionForAreaStrategy iconPosition = PartiallyInsideAreaStrategy.INSTANCE;
     35    private final PositionForAreaStrategy iconPosition;
    3536
    36     protected AreaIconElement(Cascade c, MapImage iconImage, RotationAngle iconImageAngle) {
     37    protected AreaIconElement(Cascade c, MapImage iconImage, RotationAngle iconImageAngle, PositionForAreaStrategy iconPosition) {
    3738        super(c, 4.8f);
    3839        this.iconImage = Objects.requireNonNull(iconImage, "iconImage");
    3940        this.iconImageAngle = Objects.requireNonNull(iconImageAngle, "iconImageAngle");
     41        this.iconPosition = Objects.requireNonNull(iconPosition, "iconPosition");
    4042    }
    4143
     
    5961        if (iconImage != null) {
    6062            RotationAngle rotationAngle = NodeElement.createRotationAngle(env);
     63            Keyword positionKeyword = c.get(AreaElement.ICON_POSITION, null, Keyword.class);
     64            PositionForAreaStrategy position = PositionForAreaStrategy.forKeyword(positionKeyword, PartiallyInsideAreaStrategy.INSTANCE);
    6165
    62             return new AreaIconElement(c, iconImage, rotationAngle);
     66            return new AreaIconElement(c, iconImage, rotationAngle, position);
    6367        } else {
    6468            return null;
Note: See TracChangeset for help on using the changeset viewer.