Algorithm-SpatialIndex
view release on metacpan or search on metacpan
examples/bench.pl view on Meta::CPAN
use strict;
use warnings;
use lib 'lib';
use Algorithm::SpatialIndex;
use Algorithm::QuadTree;
use Benchmark qw(cmpthese timethese);
# ordered or random or concentrated_random
#my $item_mode = 'ordered';
#my $item_mode = 'random';
my $item_mode = 'concentrated_random';
my $use_dbi = 0;
examples/profile.pl view on Meta::CPAN
use strict;
use warnings;
use lib 'lib';
use Algorithm::SpatialIndex;
my $what = lc(shift(@ARGV)||'poll');
my $bucks = 50;
my $scale = 2;
my @limits = qw(-10 -10 10 10);
my $use_dbi = 1;
if ($use_dbi) {
eval "use DBI; use DBD::SQLite;";
t/02pluggable.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 13;
use Algorithm::SpatialIndex;
my $tlibpath;
BEGIN {
$tlibpath = -d "t" ? "t/lib" : "lib";
}
use lib $tlibpath;
my $index = Algorithm::SpatialIndex->new(
strategy => 'Test',
storage => 'Memory',
);
isa_ok($index, 'Algorithm::SpatialIndex');
SCOPE: {
no warnings 'once';
t/20storage-memory.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 9;
use Algorithm::SpatialIndex;
my $tlibpath;
BEGIN {
$tlibpath = -d "t" ? "t/lib" : "lib";
}
use lib $tlibpath;
my $index = Algorithm::SpatialIndex->new(
strategy => 'Test',
storage => 'Memory',
);
isa_ok($index, 'Algorithm::SpatialIndex');
my $storage = $index->storage;
isa_ok($storage, 'Algorithm::SpatialIndex::Storage::Memory');
t/21storage-dbi.t view on Meta::CPAN
use warnings;
use Test::More;
use Algorithm::SpatialIndex;
my $do_unlink = !$ENV{PERL_ASI_TESTING_PRESERVE};
my $tlibpath;
BEGIN {
$tlibpath = -d "t" ? "t/lib" : "lib";
}
use lib $tlibpath;
if (not eval {require DBI; require DBD::SQLite; 1;}) {
plan skip_all => 'These tests require DBI and DBD::SQLite';
}
plan tests => 26;
my $dbfile = '21storage-dbi.test.sqlite';
unlink $dbfile if -f $dbfile;
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "");
t/30strategy-quadtree.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 70;
use Algorithm::SpatialIndex;
my $tlibpath;
BEGIN {
$tlibpath = -d "t" ? "t/lib" : "lib";
}
use lib $tlibpath;
use Algorithm::SpatialIndex::QTreeTest;
Algorithm::SpatialIndex::QTreeTest->run('Memory');
t/31strategy-quadtree-dbi.t view on Meta::CPAN
use warnings;
use Test::More;
use Algorithm::SpatialIndex;
my $do_unlink = !$ENV{PERL_ASI_TESTING_PRESERVE};
my $tlibpath;
BEGIN {
$tlibpath = -d "t" ? "t/lib" : "lib";
}
use lib $tlibpath;
if (not eval {require DBI; require DBD::SQLite; 1;}) {
plan skip_all => 'These tests require DBI and DBD::SQLite';
}
plan tests => 71;
my $dbfile = '31strategy-quadtree-dbi.test.sqlite';
unlink $dbfile if -f $dbfile;
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "");
t/40strategy-octtree.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 90;
use Algorithm::SpatialIndex;
my $tlibpath;
BEGIN {
$tlibpath = -d "t" ? "t/lib" : "lib";
}
use lib $tlibpath;
use Algorithm::SpatialIndex::OTreeTest;
Algorithm::SpatialIndex::OTreeTest->run('Memory');
t/41strategy-octtree-dbi.t view on Meta::CPAN
use warnings;
use Test::More;
use Algorithm::SpatialIndex;
my $do_unlink = !$ENV{PERL_ASI_TESTING_PRESERVE};
my $tlibpath;
BEGIN {
$tlibpath = -d "t" ? "t/lib" : "lib";
}
use lib $tlibpath;
if (not eval {require DBI; require DBD::SQLite; 1;}) {
plan skip_all => 'These tests require DBI and DBD::SQLite';
}
plan tests => 91;
my $dbfile = '31strategy-octtree-dbi.test.sqlite';
unlink $dbfile if -f $dbfile;
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "");
t/60max_depth.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 2;
use Algorithm::SpatialIndex;
my $tlibpath;
BEGIN {
$tlibpath = -d "t" ? "t/lib" : "lib";
}
use lib $tlibpath;
my @limits = qw(0 0 1 1);
my $index = Algorithm::SpatialIndex->new(
strategy => 'QuadTree',
storage => 'Memory',
limit_x_low => $limits[0],
limit_y_low => $limits[1],
limit_x_up => $limits[2],
limit_y_up => $limits[3],
bucket_size => 2,
( run in 0.290 second using v1.01-cache-2.11-cpan-87723dcf8b7 )