<< Click to Display Table of Contents >>

 

new sg.geometry.MultiLineString()

 

 

Description

create a multi-line string.

 

Position

Geometry.js

 

 

Properties

 

Properties

Type

Description

extent

sg.geometry.Extent

Geometry extent

parts

Array.<sg.geometry.Geometry>

Array of geometries

type

String

Geometry type

 

 

Methods

 

Methods

Type

Description

addPart(part)

sg.geometry.Geometry

add geometries to the collection

Name

Type

Description

part

sg.geometry.Geometry

geometries

toWkt()

Returns:

String

return WKT string

Returns:

Type

Description

String

WKT string

getExtent()

Returns:

sg.geometry.Extent

return geometry extent

Returns:

Type

Description

sg.geometry.Extent

geometry extent

update()

sg.geometry.MultiLineString

update line attribute

(After update, the old data would be replaced by the new data.)

Name

Type

Description

updatepart

sg.geometry.MultiLineString

line attribute

getFirstPoint_()

Returns:

sg.geometry.Point

Get the first vertex of a multi-line.

Returns:

Type

Description

sg.geometry.Point

first vertex of a multi-line.

getCentroid()        

Returns:

sg.geometry.Point

return the centroid of a multi-line

Returns:

Type

Description

sg.geometry.Point

centroid of a multi-line

Clone()        

Returns:

sg.geometry.MultiLineString

Copy the multi-line geomtery object

Returns:

Type

Description

sg.geometry.MultiLineString

multi-line geomtery object

forEachVertex(callback)

function

Get each verttex of a multi-line geomtery object

 

callback(context)

{

 //Vertex

 Context.point;

 //Vertex index

 Context.pointIndex;

}

 

 

 

Example

 

 

<script type="text/javascript" src="scripts/Geometry.js"></script>

 

var multiline = new sg.geometry.MultiLineString;

var line1 = new sg.geometry.LineString;        

line1.path.push(new sg.geometry.Point(1628256, 5128329));

line1.path.push(new sg.geometry.Point(2101868, 5163128));

line1.update();

 

var line2 = new sg.geometry.LineString;

line2.path.push(new sg.geometry.Point(2274538, 5546056));

line2.path.push(new sg.geometry.Point(1941530, 5558390));

line2.update();

 

multiline.addPart(line1);

multiline.addPart(line2);

 

 

See live example


©2015 Supergeo Technologies Inc.