Ignore:
Timestamp:
2014-01-05T12:03:37+01:00 (10 years ago)
Author:
simon04
Message:

Replace NodesDuplicatingWayTags test by a corresponding MapCSS test

File:
1 edited

Legend:

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

    r6611 r6629  
    99
    1010import org.openstreetmap.josm.data.osm.Node;
    11 import org.openstreetmap.josm.data.osm.OsmUtils;
    1211import org.openstreetmap.josm.data.osm.Relation;
    1312import org.openstreetmap.josm.data.osm.Tag;
     
    1514import org.openstreetmap.josm.gui.mappaint.Cascade;
    1615import org.openstreetmap.josm.gui.mappaint.Environment;
     16import org.openstreetmap.josm.tools.CheckParameterUtil;
    1717import org.openstreetmap.josm.tools.Predicates;
    1818import org.openstreetmap.josm.tools.Utils;
     
    5858
    5959    public static Condition createPseudoClassCondition(String id, boolean not, Context context) {
    60         return new PseudoClassCondition(id, not);
     60        return new PseudoClassCondition(id, not, context);
    6161    }
    6262
     
    305305        public final boolean not;
    306306
    307         public PseudoClassCondition(String id, boolean not) {
     307        public PseudoClassCondition(String id, boolean not, Context context) {
    308308            this.id = id;
    309309            this.not = not;
     310            CheckParameterUtil.ensureThat(!"sameTags".equals(id) || Context.LINK.equals(context), "sameTags only supported in LINK context");
    310311        }
    311312
     
    322323                    return true;
    323324                return false;
    324             } else if (equal(id, "modified"))
     325            } else if (equal(id, "modified")) {
    325326                return e.osm.isModified() || e.osm.isNewOrUndeleted();
    326             else if (equal(id, "new"))
     327            } else if (equal(id, "new")) {
    327328                return e.osm.isNew();
    328             else if (equal(id, "connection") && (e.osm instanceof Node))
     329            } else if (equal(id, "connection") && (e.osm instanceof Node)) {
    329330                return ((Node) e.osm).isConnectionNode();
    330             else if (equal(id, "tagged"))
     331            } else if (equal(id, "tagged")) {
    331332                return e.osm.isTagged();
     333            } else if ("sameTags".equals(id)) {
     334                return e.osm.hasSameInterestingTags(Utils.firstNonNull(e.child, e.parent));
     335            }
    332336            return true;
    333337        }
Note: See TracChangeset for help on using the changeset viewer.