Ignore:
Timestamp:
2017-03-04T22:29:24+01:00 (7 years ago)
Author:
michael2402
Message:

See #10176: Make icon-image work for areas. Icon is displayed at center of lat/lon bounds.

File:
1 edited

Legend:

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

    r11553 r11670  
    7070        Cascade c = env.mc.getCascade(env.layer);
    7171
    72         MapImage mapImage = createIcon(env, ICON_KEYS);
     72        MapImage mapImage = createIcon(env);
    7373        Symbol symbol = null;
    7474        if (mapImage == null) {
    7575            symbol = createSymbol(env);
    7676        }
     77
     78        RotationAngle rotationAngle = createRotationAngle(env);
     79
     80        // optimization: if we neither have a symbol, nor a mapImage
     81        // we don't have to check for the remaining style properties and we don't
     82        // have to allocate a node element style.
     83        if (!allowDefault && symbol == null && mapImage == null) return null;
     84
     85        return new NodeElement(c, mapImage, symbol, defaultMajorZindex, rotationAngle);
     86    }
     87
     88    /**
     89     * Reads the icon-rotation property and creates a rotation angle from it.
     90     * @param env The environment
     91     * @return The angle
     92     */
     93    public static RotationAngle createRotationAngle(Environment env) {
     94        Cascade c = env.mc.getCascade(env.layer);
     95
    7796        RotationAngle rotationAngle = null;
    7897        final Float angle = c.get(ICON_ROTATION, null, Float.class, true);
     
    93112            }
    94113        }
    95 
    96         // optimization: if we neither have a symbol, nor a mapImage
    97         // we don't have to check for the remaining style properties and we don't
    98         // have to allocate a node element style.
    99         if (!allowDefault && symbol == null && mapImage == null) return null;
    100 
    101         return new NodeElement(c, mapImage, symbol, defaultMajorZindex, rotationAngle);
     114        return rotationAngle;
     115    }
     116
     117    public static MapImage createIcon(final Environment env) {
     118        return createIcon(env, ICON_KEYS);
    102119    }
    103120
Note: See TracChangeset for help on using the changeset viewer.