@ SuppressWarnings ( { "cast" , "unchecked" } ) public static < O extends SpatialComparable > RangeQuery < O > getRangeQuery ( AbstractRStarTree < ? , ? , ? > tree , SpatialDistanceQuery < O > distanceQuery , Object ... hints ) { // Can we support this distance function - spatial distances only! SpatialPrimitiveDistanceFunction < ? super O > df = distanceQuery . getDistanceFunction ( ) ; if ( EuclideanDistanceFunction . STATIC . equals ( df ) ) { return ( RangeQuery < O > ) new EuclideanRStarTreeRangeQuery <> ( tree , ( Relation < NumberVector > ) distanceQuery . getRelation ( ) ) ; } return new RStarTreeRangeQuery <> ( tree , distanceQuery . getRelation ( ) , df ) ; }
Get an RTree range query using an optimized double implementation when possible .