Modify

Opened 4 years ago

Last modified 17 months ago

#14290 new defect

Parent selector is selecting both child and parent

Reported by: naoliv Owned by: team
Priority: normal Milestone:
Component: Core validator Version:
Keywords: mapcss parent child selector Cc: Klumbumbus

Description

Use the example from https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#Parentselector

node[traffic_calming] < way[highway] {
        throwWarning: tr("match");
}

with the attached example and see how it's matching/selecting 2 objects (the way (parent) and the node (child))

The description says that In contrast to the child selector, the parent object will be "selected"

Shouldn't only the way be selected here? ie, we should see a warning about one object only (the way)

JOSM:

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2017-01-25 02:17:36 +0100 (Wed, 25 Jan 2017)
Build-Date:2017-01-25 02:33:55
Revision:11490
Relative:URL: ^/trunk

Identification: JOSM/1.5 (11490 en) Linux Debian GNU/Linux 9.0 (stretch)
Memory Usage: 314 MB / 10206 MB (52 MB allocated, but free)
Java version: 1.8.0_111-8u111-b14-3-b14, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1600x900, :0.1 1280x1024
Maximum Screen Size: 1600x1024
Java package: openjdk-8-jre:amd64-8u111-b14-3
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-13
VM arguments: [-Dawt.useSystemAAFontSettings=on]
Program arguments: [--language=en]
Dataset consistency test: No problems found

Attachments (1)

example.osm (611 bytes) - added by naoliv 4 years ago.

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by naoliv

Attachment: example.osm added

comment:1 Changed 4 years ago by Klumbumbus

Cc: Klumbumbus added

comment:2 Changed 3 years ago by naoliv

I did a test with this and now it's selecting only the parent:

  • src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    diff --git a/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java b/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
    index b2ceaecc5..bfcf60eea 100644
    a b public interface Selector { 
    410410                        INode n = wayNodes.get(i);
    411411                        if (left.matches(e.withPrimitive(n))
    412412                            && link.matches(e.withChildAndIndexAndLinkContext(n, i, wayNodes.size()))) {
    413                             e.child = n;
     413                            e.child = null;
    414414                            e.index = i;
    415415                            e.count = wayNodes.size();
    416416                            return true;

comment:3 Changed 17 months ago by Don-vip

Keywords: mapcss parent child selector added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to naoliv
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.