From c6ca5726eb2798c9e8c9d78cacc9462332cc8650 Mon Sep 17 00:00:00 2001 From: clarisma <56932851+clarisma@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:17:37 +0200 Subject: [PATCH] rel queries fixed --- .../com/geodesk/feature/query/NodeParentView.java | 14 ++++++++++++-- .../java/com/geodesk/feature/store/StoredNode.java | 6 +----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/geodesk/feature/query/NodeParentView.java b/src/main/java/com/geodesk/feature/query/NodeParentView.java index c021b8b..f82c8d6 100644 --- a/src/main/java/com/geodesk/feature/query/NodeParentView.java +++ b/src/main/java/com/geodesk/feature/query/NodeParentView.java @@ -13,6 +13,7 @@ import com.geodesk.feature.filter.AndFilter; import com.geodesk.feature.match.Matcher; import com.geodesk.feature.match.TypeBits; +import com.geodesk.feature.store.FeatureFlags; import com.geodesk.feature.store.FeatureStore; import com.geodesk.feature.store.StoredNode; @@ -31,7 +32,11 @@ public NodeParentView(FeatureStore store, ByteBuffer buf, StoredNode node, int pRelations, int types, Matcher matcher, Filter filter) { super(store, buf, pRelations, types, matcher, filter); + /* assert((types & TypeBits.WAYS) != 0 && (types & TypeBits.RELATIONS) != 0); + assert((node.flags() & FeatureFlags.WAYNODE_FLAG) != 0 && + node.belongsToRelation()); + */ this.node = node; } @@ -40,16 +45,21 @@ public NodeParentView(FeatureStore store, ByteBuffer buf, if((types & TypeBits.RELATIONS) == 0) { // view has been restricted to ways only - assert((types & TypeBits.WAYS) != 0); + // assert((types & TypeBits.WAYS) != 0); return node.parentWays(types, matcher, filter); } else if ((types & TypeBits.WAYS) == 0) { // view has been restricted to relations only - assert((types & TypeBits.RELATIONS) != 0); + // assert((types & TypeBits.RELATIONS) != 0); + // assert(node.belongsToRelation()); return new ParentRelationView(store, buf, ptr, types, matcher, filter); } + /* assert((types & TypeBits.WAYS) != 0 && (types & TypeBits.RELATIONS) != 0); + assert((node.flags() & FeatureFlags.WAYNODE_FLAG) != 0 && + node.belongsToRelation()); + */ return new NodeParentView(store, buf, node, ptr, types, matcher, filter); } diff --git a/src/main/java/com/geodesk/feature/store/StoredNode.java b/src/main/java/com/geodesk/feature/store/StoredNode.java index 50ee370..a675422 100644 --- a/src/main/java/com/geodesk/feature/store/StoredNode.java +++ b/src/main/java/com/geodesk/feature/store/StoredNode.java @@ -121,7 +121,7 @@ public Features parents(int types, Matcher matcher, Filter filter) if (flags == FeatureFlags.RELATION_MEMBER_FLAG) { return new ParentRelationView(store, buf, getRelationTablePtr(), - types, matcher, filter); + types & TypeBits.RELATIONS, matcher, filter); } if (flags == (FeatureFlags.WAYNODE_FLAG | FeatureFlags.RELATION_MEMBER_FLAG)) { @@ -133,10 +133,6 @@ public Features parents(int types, Matcher matcher, Filter filter) @Override public Features parents() { - if(id() == 3465728159L) - { - System.out.print("!!!"); - } return parents(TypeBits.RELATIONS | TypeBits.WAYS, Matcher.ALL, null); }