<< Click to Display Table of Contents >>

 

new sg.geometry.LinearRing()

 

 

Description

create a linear ring.

 

Position

Geometry.js

 

 

Properties

 

Properties

Type

Description

extent

sg.geometry.Extent

Name

length

Number

pt

path

Array.<sg.geometry.Point>

Array of the path

type

String

Geometry type

 

 

Methods

 

Methods

Type

Description

addPoint(pt)

Returns: sg.geometry.Point

add vertexes

Name

Type

Description

pt

sg.geometry.Point

The vertexes of points

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

The geometry extent

getLength()

Returns: Number

return line length

Returns:

Type

Description

Nmber

The length

getMidPoint()

Returns: sg.geometry.Point

return the middle point of a line

Returns:

Type

Description

sg.geometry.Point

The middle point of a line.

setPath(path)

Returns: Array.<sg.geometry.Point>

set line path

Name

Type

Description

path

Array.<sg.geometry.Point>

An array of path

getCentroid()

Returns: sg.geometry.Point

return the centroid of a ring

Returns:

Type

Description

sg.geometry.Point

centroid of a ring

Clone()

Returns: sg.geometry.LineString

Copy the geomtery object

Returns:

Type

Description

sg.geometry.LineRing

ring geomtery object

forEachVertex(callback)

Returns: sg.geometry.Point

Get each verttex of a ring

 

callback(context)

{

 //Vertex

 Context.point;

 //Vertex index

 Context.pointIndex;

}

getFirstPoint_()

Returns: sg.geometry.point

Get the first vertex of a ring

Return:

Type

Description

sg.geometry.Point

first vertex of a ring

update()


update line attribute

 

 

Example

 

 

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

                         

var ring = new sg.geometry.LinearRing;

ring.path.push(new sg.geometry.Point(1528256, 5628329));

ring.path.push(new sg.geometry.Point(2001868, 5663128));

ring.path.push(new sg.geometry.Point(2174538, 5446056));

ring.path.push(new sg.geometry.Point(1841530, 5458390));

 

 

See live example

 


©2015 Supergeo Technologies Inc.