NAME

Geo::Geos::Noding::NodedSegmentString - Represents a list of contiguous line segments, and supports noding the segments.

SYNOPSIS

use Geo::Geos::Algorithm::LineIntersector;
use Geo::Geos::Coordinate;
use Geo::Geos::Noding::NodedSegmentString;
use Geo::Geos::PrecisionModel;

my $c1 = Geo::Geos::Coordinate->new(1,2);
my $c2 = Geo::Geos::Coordinate->new(5,2);
my $c3 = Geo::Geos::Coordinate->new(7,1);
my $c4 = Geo::Geos::Coordinate->new(9,1.5);

my $seq = [$c1, $c2, $c3];
my $ss = Geo::Geos::Noding::NodedSegmentString->new($seq);   # => isa 'Geo::Geos::Noding::NodedSegmentString'
Geo::Geos::Noding::NodedSegmentString->new($seq);            # => isa 'Geo::Geos::Noding::SegmentString'

$ss->isClosed;          # => ''
$ss->size;              # => 3

$ss->getCoordinate(0);              # => Geo::Geos::Coordinate->new(1,2)
my $c = $ss->getCoordinates->[0];   # => Geo::Geos::Coordinate->new(1,2)

$ss->toString;              # => like qr/\QLINESTRING(1 2, 5 2, 7 1)\E/
$ss->getSegmentOctant(0);   # => 0

$ss->addIntersectionNode($c4, 2);   # => isa 'Geo::Geos::Noding::SegmentNode'

my $ss2 = Geo::Geos::Noding::NodedSegmentString->new([$c1, $c2, $c3]);
my $segmentIndex = 1;
my $c6 = Geo::Geos::Coordinate->new(11,2);
$ss2->addIntersection($c6, $segmentIndex);
$ss2->toString;                              # => like qr/Nodes: 1/

my $pm = Geo::Geos::PrecisionModel->new;
my $li1 = Geo::Geos::Algorithm::LineIntersector->new($pm);
my $geomIndex = 1;
my $intIndex = 1;
$ss2->addIntersection($li1, $segmentIndex, $geomIndex, $intIndex);
$ss2->toString;                              # => like qr/Nodes: 2/

my $c_1 = Geo::Geos::Coordinate->new(10,1);
my $c_2 = Geo::Geos::Coordinate->new(12,1);
my $c_3 = Geo::Geos::Coordinate->new(11,0);
my $c_4 = Geo::Geos::Coordinate->new(11,2);

my $li2 = Geo::Geos::Algorithm::LineIntersector->new($pm);
$li2->computeIntersection($c_1, $c_2, $c_3, $c_4);
$ss2->addIntersections($li2, 1, 4);
$ss2->toString;                              # => like qr/Nodes: 3/

SEE ALSO (C++ classes docs)

GEOS C++ Library

geos::noding::NodedSegmentString

SEE ALSO

Geo::Geos

Geo::Geos::Algorithm::LineIntersector

Geo::Geos::Noding::SegmentString

Geo::Geos::Noding::SegmentNode

AUTHOR

Ivan Baidakou <i.baydakov@crazypanda.ru>, Crazy Panda, CP Decision LTD

LICENSE

You may distribute this code under the same terms as Perl itself.