<< Click to Display Table of Contents >>

SuperGIS Server JavaScript API

 

new sg.geometry.MultiPolygon()

 

 

Description

建立一個多重多邊形幾何物件

 

Position

Geometry.js

 

 

Properties

 

Properties

Type

Description

extent

sg.geometry.Extent

幾何資料範圍

parts

Array.<sg.geometry.Geometry>

幾何資料陣列

type

String

幾何資料的類型

 

 

Methods

 

Methods

Type

Description

addPart(part)

sg.geometry.Geometry

加入幾何資料到集合裡

Name

Type

Description

part

sg.geometry.Geometry

幾何資料

getExtent()

Returns:

sg.geometry.Extent

取得幾何資料範圍

Returns:

Type

Description

sg.geometry.Extent

幾何範圍

update(updatePart)

sg.geometry.MultiPolygon

更新多重多邊形幾何物件資料

(更新後,舊資料會被新資料取代)

Name

Type

Description

updatepart

sg.geometry.MultiPolygon

多重多邊形幾何物件資料

toWkt()

Returns:

String

轉換成wkt字串

Returns:

Type

Description

String

wkt字串

Contains(geom)        

geom:sg.geometry.Geometry

Returns:Boolean

檢測幾何物件是否落在多重多邊幾何物件範圍之內

Name

Type

Description

part

sg.geometry.Geometry

幾何資料

Returns:

Type

Description

Boolean

True:落在多重多邊幾何物件範圍內
False:落在多重多邊幾何物件範圍外

getCentroid()        

Returns:

sg.geometry.Point

取得多重多邊幾何物件的重心

Returns:

Type

Description

sg.geometry.Point

重心點

getFirstPoint_        

Returns:

sg.geometry.Point

取得多重多邊幾何物件的第一個點位

Returns:

Type

Description

sg.geometry.Point

多重多邊幾何物件的第一個點位

Clone()

Returns:

sg.geometry.MultiPolygon

複製多重多邊幾何物件並回傳

Returns:

Type

Description

sg.geometry.MultiPolygon

多重多邊幾何物件

transform(a,b,c,d,e,f,g,h,i)

Number

透過轉換參數,對多重多邊幾何物件進行座標轉換

Name

Type

Description

a,b,c,d,e,f,g,h,i

Nmber

轉換矩陣元素,轉換矩陣M=[[a, b, c], [d, e, f], [g, h, i]]

forEachVertex(callback)        

function

透過callback方法,回傳多重多邊幾何物件的所有頂點資料

callback(context)

{

 //回傳內容,參考Polygon 的

 //forEachVertex(callback)

 //說明

}

 

 

Example

 

 

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

                         

var multipolygon = new sg.geometry.MultiPolygon;

 

var polygon1 = new sg.geometry.Polygon;

var ring1 = new sg.geometry.LinearRing;

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

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

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

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

polygon1.addRing(ring1);

polygon1.update();

 

var polygon2 = new sg.geometry.Polygon;

var ring2 = new sg.geometry.LinearRing;

ring2.path.push(new sg.geometry.Point(1778256, 5228329));

ring2.path.push(new sg.geometry.Point(2051868, 5263128));

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

ring2.path.push(new sg.geometry.Point(1991530, 5458390));

polygon2.addRing(ring2);

polygon2.update();

 

multipolygon.addPart(polygon1);

multipolygon.addPart(polygon2);

 

 

See live example

 

 


©2015 Supergeo Technologies Inc.