Skip to content

Commit

Permalink
rel queries fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
clarisma committed Sep 9, 2024
1 parent 0cfed8d commit c6ca572
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 12 additions & 2 deletions src/main/java/com/geodesk/feature/query/NodeParentView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}

Expand All @@ -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);
}

Expand Down
6 changes: 1 addition & 5 deletions src/main/java/com/geodesk/feature/store/StoredNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -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);
}

Expand Down

0 comments on commit c6ca572

Please sign in to comment.