public override Filter MakeFilter(SpatialArgs args)
{
SpatialOperation op = args.Operation;
if (op == SpatialOperation.IsDisjointTo)
{
return new DisjointSpatialFilter(this, args, FieldName);
}
IShape shape = args.Shape;
int detailLevel = grid.GetLevelForDistance(args.ResolveDistErr(ctx, distErrPct));
if (pointsOnly || op == SpatialOperation.Intersects)
{
return new IntersectsPrefixTreeFilter(
shape, FieldName, grid, detailLevel, prefixGridScanLevel, !pointsOnly);
}
else if (op == SpatialOperation.IsWithin)
{
return new WithinPrefixTreeFilter(
shape, FieldName, grid, detailLevel, prefixGridScanLevel,
-1); //-1 flag is slower but ensures correct results
}
else if (op == SpatialOperation.Contains)
{
return new ContainsPrefixTreeFilter(shape, FieldName, grid, detailLevel,
multiOverlappingIndexedShapes);
}
throw new UnsupportedSpatialOperation(op);
}
}