Ignore:
Timestamp:
2014-01-03T17:14:36+01:00 (12 years ago)
Author:
simon04
Message:

see #9516 - Replace BuildingInBuilding by a corresponding MapCSS test

File:
1 edited

Legend:

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

    r6609 r6611  
    160160            @Override
    161161            public void visit(Node n) {
    162                 if (e.parent == null && right.matches(e.withPrimitive(n))) {
     162                if (e.child == null && left.matches(e.withPrimitive(n))) {
    163163                    if (e.osm instanceof Way && Geometry.nodeInsidePolygon(n, ((Way) e.osm).getNodes())
    164164                            || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isNodeInsideMultiPolygon(n, (Relation) e.osm, null)) {
    165                         e.parent = n;
     165                        e.child = n;
    166166                    }
    167167                }
     
    170170            @Override
    171171            public void visit(Way w) {
    172                 if (e.parent == null && right.matches(e.withPrimitive(w))) {
     172                if (e.child == null && left.matches(e.withPrimitive(w))) {
    173173                    if (e.osm instanceof Way && Geometry.PolygonIntersection.FIRST_INSIDE_SECOND.equals(Geometry.polygonIntersection(w.getNodes(), ((Way) e.osm).getNodes()))
    174174                            || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isPolygonInsideMultiPolygon(w.getNodes(), (Relation) e.osm, null)) {
    175                         e.parent = w;
     175                        e.child = w;
    176176                    }
    177177                }
     
    184184            public void visit(Collection<? extends OsmPrimitive> primitives) {
    185185                for (OsmPrimitive p : primitives) {
    186                     if (e.parent != null) {
     186                    if (e.child != null) {
    187187                        // abort if first match has been found
    188188                        break;
     
    206206                    return false;
    207207                }
    208                 e.child = e.osm;
     208                e.parent = e.osm;
    209209
    210210                final ContainsFinder containsFinder = new ContainsFinder(e);
     
    221221                }
    222222
    223                 return e.parent != null;
     223                return e.child != null;
    224224
    225225            } else if (ChildOrParentSelectorType.CHILD.equals(type)) {
     
    374374
    375375        public boolean matchesBase(OsmPrimitiveType type) {
    376             if (OsmPrimitiveType.NODE.equals(type)) {
    377                 return base.equals("node") || base.equals("*");
     376            if (base.equals("*")) {
     377                return true;
     378            } else if (OsmPrimitiveType.NODE.equals(type)) {
     379                return base.equals("node");
    378380            } else if (OsmPrimitiveType.WAY.equals(type)) {
    379                 return base.equals("way") || base.equals("area") || base.equals("*");
     381                return base.equals("way") || base.equals("area");
    380382            } else if (OsmPrimitiveType.RELATION.equals(type)) {
    381383                return base.equals("area") || base.equals("relation") || base.equals("canvas");
Note: See TracChangeset for help on using the changeset viewer.