Changeset 11731 in josm


Ignore:
Timestamp:
2017-03-13T20:29:33+01:00 (8 years ago)
Author:
michael2402
Message:

Clean icon drawing code style.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r11729 r11731  
    939939            double yRay = y.applyAsDouble(rayFrom);
    940940
    941             for(Way part : parts) {
     941            for (Way part : parts) {
    942942                // intersect against all way segments
    943943                for (int i = 0; i < part.getNodesCount() - 1; i++) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r11730 r11731  
    464464            Rectangle2D nb = fontMetrics.getStringBounds(name, g); // if slow, approximate by strlen()*maxcharbounds(font)
    465465
    466             Rectangle2D centeredNBounds = text.getLabelPositionSteategy().findLabelPlacement(area, nb);
     466            Rectangle2D centeredNBounds = text.getLabelPositionStrategy().findLabelPlacement(area, nb);
    467467            if (centeredNBounds != null) {
    468468                Font defaultFont = g.getFont();
     
    751751     * @since 11670
    752752     */
    753     public void drawAreaIcon(OsmPrimitive osm, MapImage img, boolean disabled, boolean selected, boolean member, double theta, PositionForAreaStrategy iconPosition) {
     753    public void drawAreaIcon(OsmPrimitive osm, MapImage img, boolean disabled, boolean selected, boolean member, double theta,
     754            PositionForAreaStrategy iconPosition) {
    754755        Rectangle2D.Double iconRect = new Rectangle2D.Double(-img.getWidth() / 2.0, -img.getHeight() / 2.0, img.getWidth(), img.getHeight());
    755756
     
    11121113     */
    11131114    public void drawText(OsmPrimitive osm, TextLabel text) {
    1114         PositionForAreaStrategy position = text.getLabelPositionSteategy();
     1115        PositionForAreaStrategy position = text.getLabelPositionStrategy();
    11151116        if (position.supportsGlyphVector()) {
    11161117            if (osm instanceof Way) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java

    r11730 r11731  
    1414 * This class defines how an icon is rendered onto the area.
    1515 * @author Michael Zangl
    16  * @since 11729
     16 * @since 11730
    1717 */
    1818public class AreaIconElement extends StyleElement {
     
    3232    private final PositionForAreaStrategy iconPosition = PositionForAreaStrategy.PARTIALY_INSIDE;
    3333
    34     private AreaIconElement(Cascade c, MapImage iconImage, RotationAngle iconImageAngle) {
     34    protected AreaIconElement(Cascade c, MapImage iconImage, RotationAngle iconImageAngle) {
    3535        super(c, 4.8f);
    3636        this.iconImage = Objects.requireNonNull(iconImage, "iconImage");
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/PositionForAreaStrategy.java

    r11724 r11731  
    3333     * @since 11722
    3434     */
    35     public static PositionForAreaStrategy forKeyword(Keyword keyword) {
     35    static PositionForAreaStrategy forKeyword(Keyword keyword) {
    3636        return forKeyword(keyword, LINE);
    3737    }
     
    4444     * @since 11722
    4545     */
    46     public static PositionForAreaStrategy forKeyword(Keyword keyword, PositionForAreaStrategy defaultStrategy) {
     46    static PositionForAreaStrategy forKeyword(Keyword keyword, PositionForAreaStrategy defaultStrategy) {
    4747        if (keyword == null) {
    4848            return defaultStrategy;
     
    6565     * @since 11722
    6666     */
    67     public static PositionForAreaStrategy LINE = new OnLineStrategy();
     67    PositionForAreaStrategy LINE = new OnLineStrategy();
    6868
    6969    /**
     
    7272     * @since 11722
    7373     */
    74     public static PositionForAreaStrategy INSIDE = new CompletelyInsideAreaStrategy();
     74    PositionForAreaStrategy INSIDE = new CompletelyInsideAreaStrategy();
    7575
    7676    /**
     
    7878     * @since 11722
    7979     */
    80     public static PositionForAreaStrategy PARTIALY_INSIDE = new PartialyInsideAreaStrategy();
     80    PositionForAreaStrategy PARTIALY_INSIDE = new PartialyInsideAreaStrategy();
    8181
    8282    /**
     
    9696            return true;
    9797        }
    98     };
     98    }
    9999
    100100    /**
     
    148148            // |  8  3  7  |
    149149            // +-----------+
    150             Rectangle[] candidates = new Rectangle[] { new Rectangle(x2, y1, nbw, nbh), new Rectangle(x3, y2, nbw, nbh),
    151                     new Rectangle(x2, y3, nbw, nbh), new Rectangle(x1, y2, nbw, nbh), new Rectangle(x1, y1, nbw, nbh),
    152                     new Rectangle(x3, y1, nbw, nbh), new Rectangle(x3, y3, nbw, nbh), new Rectangle(x1, y3, nbw, nbh) };
     150            Rectangle[] candidates = new Rectangle[] {
     151                    new Rectangle(x2, y1, nbw, nbh),
     152                    new Rectangle(x3, y2, nbw, nbh),
     153                    new Rectangle(x2, y3, nbw, nbh),
     154                    new Rectangle(x1, y2, nbw, nbh),
     155                    new Rectangle(x1, y1, nbw, nbh),
     156                    new Rectangle(x3, y1, nbw, nbh),
     157                    new Rectangle(x3, y3, nbw, nbh),
     158                    new Rectangle(x1, y3, nbw, nbh)
     159            };
    153160            // Dumb algorithm to find a better placement. We could surely find a smarter one but it should
    154161            // solve most of building issues with only few calculations (8 at most)
     
    176183     * @since 11722
    177184     */
    178     public class PartialyInsideAreaStrategy extends CompletelyInsideAreaStrategy {
     185    class PartialyInsideAreaStrategy extends CompletelyInsideAreaStrategy {
    179186        @Override
    180187        public Rectangle2D findLabelPlacement(Shape area, Rectangle2D nb) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java

    r11722 r11731  
    5959     * The position strategy for this text label.
    6060     */
    61     private final PositionForAreaStrategy labelPositionSteategy;
     61    private final PositionForAreaStrategy labelPositionStrategy;
    6262
    6363    /**
     
    9090     * @param haloRadius halo radius
    9191     * @param haloColor halo color
    92      * @param labelPositionSteategy The position in the area.
    93      */
    94     protected TextLabel(LabelCompositionStrategy strategy, Font font, int xOffset, int yOffset, Color color, Float haloRadius, Color haloColor, PositionForAreaStrategy labelPositionSteategy) {
     92     * @param labelPositionStrategy The position in the area.
     93     */
     94    protected TextLabel(LabelCompositionStrategy strategy, Font font, int xOffset, int yOffset, Color color, Float haloRadius,
     95            Color haloColor, PositionForAreaStrategy labelPositionStrategy) {
    9596        this.labelCompositionStrategy = strategy;
    9697        this.font = Objects.requireNonNull(font, "font");
     
    100101        this.haloRadius = haloRadius;
    101102        this.haloColor = haloColor;
    102         this.labelPositionSteategy = Objects.requireNonNull(labelPositionSteategy, "labelPositionSteategy");
     103        this.labelPositionStrategy = Objects.requireNonNull(labelPositionStrategy, "labelPositionStrategy");
    103104    }
    104105
     
    116117        this.haloColor = other.haloColor;
    117118        this.haloRadius = other.haloRadius;
    118         this.labelPositionSteategy = other.labelPositionSteategy;
     119        this.labelPositionStrategy = other.labelPositionStrategy;
    119120    }
    120121
     
    123124     *
    124125     * @param other the other element.
    125      * @param labelPositionSteategy the position
    126      */
    127     private TextLabel(TextLabel other, PositionForAreaStrategy labelPositionSteategy) {
     126     * @param labelPositionStrategy the position
     127     */
     128    private TextLabel(TextLabel other, PositionForAreaStrategy labelPositionStrategy) {
    128129        this.labelCompositionStrategy = other.labelCompositionStrategy;
    129130        this.font = other.font;
     
    133134        this.haloColor = other.haloColor;
    134135        this.haloRadius = other.haloRadius;
    135         this.labelPositionSteategy = labelPositionSteategy;
     136        this.labelPositionStrategy = labelPositionStrategy;
    136137    }
    137138
     
    242243     * @since 11722
    243244     */
    244     public PositionForAreaStrategy getLabelPositionSteategy() {
    245         return labelPositionSteategy;
    246     }
    247 
    248     public TextLabel withPosition(PositionForAreaStrategy labelPositionSteategy) {
    249         return new TextLabel(this, labelPositionSteategy);
     245    public PositionForAreaStrategy getLabelPositionStrategy() {
     246        return labelPositionStrategy;
     247    }
     248
     249    public TextLabel withPosition(PositionForAreaStrategy labelPositionStrategy) {
     250        return new TextLabel(this, labelPositionStrategy);
    250251    }
    251252
  • trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java

    r11726 r11731  
    2222     * The rotation along a way.
    2323     */
    24     static final class WayDirectionRotationAngle implements RotationAngle {
     24    final class WayDirectionRotationAngle implements RotationAngle {
    2525        @Override
    2626        public double getRotationAngle(OsmPrimitive p) {
     
    7171     * A static rotation
    7272     */
    73     static final class StaticRotationAngle implements RotationAngle {
     73    final class StaticRotationAngle implements RotationAngle {
    7474        private final double angle;
    7575
     
    121121     * @since 11726
    122122     */
    123     static RotationAngle NO_ROTATION = new StaticRotationAngle(0);
     123    RotationAngle NO_ROTATION = new StaticRotationAngle(0);
    124124
    125125    /**
Note: See TracChangeset for help on using the changeset viewer.