Many changes and fixes to remove leaks and return objects by reference

This commit is contained in:
Alessandro Ranellucci 2013-09-03 19:26:58 +02:00
parent 275422fac7
commit a49dc603cc
27 changed files with 67 additions and 46 deletions

View file

@ -32,7 +32,7 @@ sub simplify {
my $tolerance = shift || 10;
my $simplified = Boost::Geometry::Utils::linestring_simplify($self->pp, $tolerance);
return (ref $self)->new(@$simplified);
return __PACKAGE__->new(@$simplified);
}
sub length {
@ -66,7 +66,7 @@ sub clip_with_expolygon {
my ($expolygon) = @_;
my $result = Boost::Geometry::Utils::polygon_multi_linestring_intersection($expolygon->pp, [$self->pp]);
return map { (ref $self)->new(@$_) } @$result;
return map { __PACKAGE__->new(@$_) } @$result;
}
sub bounding_box {
@ -128,7 +128,7 @@ sub clip_start {
$distance = 0;
}
return (ref $self)->new($points);
return __PACKAGE__->new($points);
}
# this method returns a collection of points picked on the polygon contour