File Coverage

blib/lib/Algorithm/SpatialIndex/Strategy/2D.pm
Criterion Covered Total %
statement 19 25 76.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 6 9 66.6
pod 5 5 100.0
total 32 44 72.7


line stmt bran cond sub pod time code
1             package Algorithm::SpatialIndex::Strategy::2D;
2 7     7   7877 use 5.008001;
  7         26  
  7         276  
3 7     7   36 use strict;
  7         13  
  7         205  
4 7     7   81 use warnings;
  7         12  
  7         372  
5              
6 7     7   45 use parent 'Algorithm::SpatialIndex::Strategy';
  7         19  
  7         47  
7              
8 0     0 1 0 sub no_of_dimensions { 2 }
9 3     3 1 1318 sub no_of_subnodes { 4 }
10 0     0 1 0 sub coord_types { qw(double double double double) }
11 0     0 1 0 sub item_coord_types { qw(double double) }
12              
13             sub filter_items_in_rect {
14 2     2 1 15 my ($self, $xl, $yl, $xu, $yu, @nodes) = @_;
15 2         7 my $storage = $self->storage;
16 2 50       31 if ($storage->bucket_class->can('items_in_rect')) {
17 0         0 return map { @{ $storage->fetch_bucket($_->id)->items_in_rect($xl, $yl, $xu, $yu) } }
  0         0  
  0         0  
18             @nodes
19             }
20 104         251 return grep $_->[1] >= $xl && $_->[1] <= $xu &&
21             $_->[2] >= $yl && $_->[2] <= $yu,
22 2   33     19 map { @{ $storage->fetch_bucket($_->id)->items } }
  104         103  
23             @nodes;
24             }
25              
26             1;
27             __END__