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


Ignore:
Timestamp:
2021-04-11T12:35:15+02:00 (4 years ago)
Author:
simon04
Message:

see #20739 - Extract Environment.getCascade

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

Legend:

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

    r15998 r17744  
    314314
    315315    /**
     316     * Gets the current cascade for the current layer of this environment
     317     * @return The cascade
     318     */
     319    public Cascade getCascade() {
     320        return getCascade(null);
     321    }
     322
     323    /**
    316324     * Gets the current cascade for a given layer
    317325     * @param layer The layer to use, <code>null</code> to use the layer of the {@link Environment}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java

    r17642 r17744  
    690690        @Override
    691691        public boolean applies(Environment env) {
    692             Cascade cascade = env.getCascade(env.layer);
     692            Cascade cascade = env.getCascade();
    693693            return cascade != null && (not ^ cascade.containsKey(id));
    694694        }
     
    866866        static boolean selected(Environment e) { // NO_UCD (unused code)
    867867            if (e.mc != null) {
    868                 e.mc.getCascade(e.layer).setDefaultSelectedHandling(false);
     868                e.getCascade().setDefaultSelectedHandling(false);
    869869            }
    870870            return e.osm.isSelected();
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java

    r16252 r17744  
    7777     */
    7878    public static AreaElement create(final Environment env) {
    79         final Cascade c = env.mc.getCascade(env.layer);
     79        final Cascade c = env.getCascade();
    8080        MapImage fillImage = null;
    8181        Color color;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java

    r16488 r17744  
    5757     */
    5858    public static AreaIconElement create(final Environment env) {
    59         final Cascade c = env.mc.getCascade(env.layer);
     59         final Cascade c = env.getCascade();
    6060        MapImage iconImage = NodeElement.createIcon(env);
    6161        if (iconImage != null) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.java

    r14193 r17744  
    216216        if (text.labelCompositionStrategy.compose(env.osm) == null) return null;
    217217
    218         Cascade c = env.mc.getCascade(env.layer);
     218        Cascade c = env.getCascade();
    219219
    220220        HorizontalTextAlignment hAlign;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.java

    r17519 r17744  
    312312
    313313    private static LineElement createImpl(Environment env, LineType type) {
    314         Cascade c = env.mc.getCascade(env.layer);
    315         Cascade cDef = env.mc.getCascade("default");
     314        Cascade c = env.getCascade();
     315        Cascade cDef = env.getCascade("default");
    316316        Float width = computeWidth(type, c, cDef);
    317317        if (width == null)
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java

    r16253 r17744  
    7676        if (!allowDefault && symbol == null && mapImage == null) return null;
    7777
    78         Cascade c = env.mc.getCascade(env.layer);
     78        Cascade c = env.getCascade();
    7979        RotationAngle rotationAngle = createRotationAngle(env);
    8080        return new NodeElement(c, mapImage, symbol, defaultMajorZindex, rotationAngle);
     
    102102
    103103    private static RotationAngle createRotationAngle(Environment env, String key) {
    104         Cascade c = env.mc.getCascade(env.layer);
     104        Cascade c = env.getCascade();
    105105
    106106        RotationAngle rotationAngle = RotationAngle.NO_ROTATION;
     
    145145        CheckParameterUtil.ensureParameterNotNull(keys, "keys");
    146146
    147         Cascade c = env.mc.getCascade(env.layer);
     147        Cascade c = env.getCascade();
    148148
    149149        final IconReference iconRef = c.get(keys[ICON_IMAGE_IDX], null, IconReference.class, true);
     
    151151            return null;
    152152
    153         Cascade cDef = env.mc.getCascade("default");
     153        Cascade cDef = env.getCascade("default");
    154154
    155155        Float widthOnDefault = cDef.get(keys[ICON_WIDTH_IDX], null, Float.class);
     
    196196     */
    197197    private static Symbol createSymbol(Environment env) {
    198         Cascade c = env.mc.getCascade(env.layer);
     198        Cascade c = env.getCascade();
    199199
    200200        Keyword shapeKW = c.get("symbol-shape", null, Keyword.class);
     
    206206        }
    207207
    208         Cascade cDef = env.mc.getCascade("default");
     208        Cascade cDef = env.getCascade("default");
    209209        Float sizeOnDefault = cDef.get("symbol-size", null, Float.class);
    210210        if (sizeOnDefault != null && sizeOnDefault <= 0) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/RepeatImageElement.java

    r16700 r17744  
    109109        if (pattern == null)
    110110            return null;
    111         Cascade c = env.mc.getCascade(env.layer);
     111        Cascade c = env.getCascade();
    112112        float offset = c.get(REPEAT_IMAGE_OFFSET, 0f, Float.class);
    113113        float spacing = c.get(REPEAT_IMAGE_SPACING, 0f, Float.class);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextElement.java

    r13662 r17744  
    5757        if (text == null)
    5858            return null;
    59         final Cascade c = env.mc.getCascade(env.layer);
     59        final Cascade c = env.getCascade();
    6060
    6161        Keyword positionKeyword = c.get(AreaElement.TEXT_POSITION, null, Keyword.class);
     
    7474     */
    7575    public static TextElement createForContent(Environment env) {
    76         final Cascade c = env.mc.getCascade(env.layer);
     76        final Cascade c = env.getCascade();
    7777        Keyword positionKeyword = c.get(AreaElement.TEXT_POSITION, null, Keyword.class);
    7878        if (positionKeyword != null) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java

    r16253 r17744  
    138138    public static TextLabel create(Environment env, Color defaultTextColor, boolean defaultAnnotate) {
    139139        CheckParameterUtil.ensureParameterNotNull(defaultTextColor);
    140         Cascade c = env.mc.getCascade(env.layer);
     140        Cascade c = env.getCascade();
    141141
    142142        LabelCompositionStrategy strategy = buildLabelCompositionStrategy(c, defaultAnnotate);
Note: See TracChangeset for help on using the changeset viewer.