Class: GeoPolygon

GeoPolygon

new GeoPolygon(Obj)

common/Geometry.js, line 5772

幾何物件:多邊形,內部的點位順序需為順時針

Name Type Description
Obj GeoPolyline | GeoPolygon | GeoBoundary | Array.<GeoPoint> | undefined

複製的資料源。

Example

var a = new GeoPolygon(polygon);
var b = new GeoPolyline();

Members

readonlyBoundary

此幾何的範圍

Properties:
Name Type Description
Boundary GeoBoundary

範圍

BufferArray.<GeoPoint>

放置點位的Buffer

readonlyCenter

此幾何的中心點

Properties:
Name Type Description
Center GeoPoint

中心點

DistanceInBound

計算傳入的點到Polygon邊緣上的距離。

length

內含點位的數量

Properties:
Name Type Description
length Number

點位的數量

readonlytype

物件型態,值為GEO_TYPE.POLYGON

Properties:
Name Type Description
type GEO_TYPE

物件型態

Methods

ClipLine(s, result){Boolean}

common/Geometry.js, line 6306

將傳入的Line用此Polygon來切除,只剩在Polygon內的線。

Name Type Description
s GeoLine

欲處理的線段資料。

result GeoLine

此為out參數,須在執行前先配置好,執行後,此為處理後的答案。

Returns:
Type Description
Boolean 傳回值行是否成功。

ClipPolygon(s, result){Boolean}

common/Geometry.js, line 6351

將傳入的Polygon用此Polygon來切除,只剩在Polygon內的範圍。

Name Type Description
s GeoPolygon

欲處理的線段資料。

result GeoPolygon

此為out參數,須在執行前先配置好,執行後,此為處理後的答案。

Returns:
Type Description
Boolean 傳回值行是否成功。

Clone(){GeoPolygon}

common/Geometry.js, line 5989

產生一份新的自己。

Returns:
Type Description
GeoPolygon 傳回複製的新的自己。

CombinPolygon(Polygon, PolygonSet, CombinType){Boolean}

common/Geometry.js, line 6476

將自己與傳入的Polygon做合併運算。

Name Type Description
Polygon GeoPolygon

運算的Polygon資料。

PolygonSet GeoPolygonSet

此為out參數,需先在外面配好變數,合併後的結果。

CombinType GEO_CB_TYPE

運算類型。

Returns:
Type Description
Boolean 傳回運算是否成功。

ConvertToPolyline(){GeoPolyline}

common/Geometry.js, line 7248

將此Polygon轉為Polyline。

Returns:
Type Description
GeoPolyline 傳回轉換後的Polyline。

CopyFrom(Obj){GeoPolygon}

common/Geometry.js, line 5998

複製。

Name Type Description
Obj GeoLine | GeoPolyline | Array.<GeoPoint>

複製的資料源。

Returns:
Type Description
GeoPolygon this。

Distance(Obj){Number}

common/Geometry.js, line 7122

計算自己與傳入幾何的距離。

Name Type Description
Obj GeoPoint | GeoLine | GeoPolyline | GeoPolygon | GeoPolygonSet

要計算距離的幾何資料。

Returns:
Type Description
Number 傳回距離。

FromGeoJSON(src){Boolean}

common/Geometry.js, line 7277

讀入GeoJSON數值。

Name Type Description
src Object | String

GeoJSON物件或字串。

Returns:
Type Description
Boolean 回傳讀取是否成功。

GetArea(){Number}

common/Geometry.js, line 6114

計算此Polygon的面積。

Returns:
Type Description
Number 傳回計算的面積。

GetAt(index){GeoPoint}

common/Geometry.js, line 6067

取第index個點。

Name Type Description
index Number

索引。

Returns:
Type Description
GeoPoint 第index個點。

Include(Obj, bound){Boolean}

common/Geometry.js, line 7031

判斷傳入的幾何資料是否被自己包含。

Name Type Description
Obj GeoPoint | GeoLine | GeoPolyline | GeoPolygon | GeoPolygonSet

判斷的幾何資料。

bound Boolean

只用於Polygon與PolygonSet,指示相交於編上是否算包含。

Returns:
Type Description
Boolean 傳回是否相交。

IsConvex(){Boolean}

common/Geometry.js, line 6133

判定此Polygon是否為凸多邊形。

Returns:
Type Description
Boolean 傳回判斷結果。

IsGood(){Boolean}

common/Geometry.js, line 6185

判定此Polygon是否為好的Polygon(順序對,沒自己相交,有面積...)。

Returns:
Type Description
Boolean 傳回判斷結果。

IsIntersect(判斷的幾何資料。, slice){Boolean}

common/Geometry.js, line 6453

判斷自己與傳入幾何是否相交。

Name Type Description
判斷的幾何資料。 GeoPolyline | GeoPolygon | GeoPolygonSet
slice Boolean

指定若只交在節點上,算不算相交。

Returns:
Type Description
Boolean 傳回是否相交。

MakeBuffer(Distance, PolygonSet){Boolean}

common/Geometry.js, line 7183

做出環域的PolygonSet。

Name Type Description
Distance Number

環域的距離。

PolygonSet GeoPolygonSet

out參數,環域計算的答案。

Returns:
Type Description
Boolean 回傳是否成功。

Offset(p)

common/Geometry.js, line 7170

位移p。

Name Type Description
p GeoPoint

欲位移的距離。

PtInPolygon(p, Obj){Boolean}

common/Geometry.js, line 6086

檢查傳入的點p是否位於此Polygon內。

Name Type Description
p GeoPoint

欲檢查的點。

Obj Object

此為out參數,需在執行前先配置好,執行後,Obj.InBound=true|false代表是否位於邊緣上。

Returns:
Type Description
Boolean 傳回是否位於Polygon內。

RemoveAll()

common/Geometry.js, line 6024

移除所有的點位資料。

SetAt(index, Obj)

common/Geometry.js, line 6076

設定第index個點。

Name Type Description
index Number

索引。

Obj GeoPoint

要設定的值。

SetGeoData(Buffer){Boolean}

common/Geometry.js, line 6033

設定幾何資料,會檢查順逆時針,將其調整成正確的順序,若已知順序,可直接將點位資料Copy進Buffer變數,以增進效能。

Name Type Description
Buffer Array.<GeoPoint>

要Copy的點位資料。

Returns:
Type Description
Boolean 是否Copy成功。

SimplifyByPointCount(Count){Number}

common/Geometry.js, line 7229

給定指定點數(希望簡約化後的點數),計算簡約化。

Name Type Description
Count Number

簡約化後希望的點數。

Returns:
Type Description
Number 傳回簡約化後,剩餘的點數。

SimplifyByTolerance(MaxErr, Polylines){Number}

common/Geometry.js, line 7201

給定誤差值,計算簡約化

Name Type Description
MaxErr Number

簡約化的誤差值。

Polylines Array.<GeoPolyline> | undefined

簡約化過程中,要避免與這些Polyline相交。

Returns:
Type Description
Number 傳回簡約化後,剩餘的點數。

SplitByLine(Line, RightAnswer, LeftAnswer){Boolean}

common/Geometry.js, line 6503

將自己用傳入的Line來切成右與左兩部分的Polygon。

Name Type Description
Line GeoLine

切割的Line。

RightAnswer Array.<GeoPolygon>

此為out參數,需在執行前先配置好,執行後,傳回右邊的Polygon。

LeftAnswer Array.<GeoPolygon>

此為out參數,需在執行前先配置好,執行後,傳回左邊的Polygon。

Returns:
Type Description
Boolean 傳回運算是否成功

SplitByPolygon(Polygon, Inside, Outside){Boolean}

common/Geometry.js, line 6898

將自己用傳入的Polygon來切成內部與外部兩部分的PolygonSet。

Name Type Description
Polygon GeoPolygon

切割的Polygon。

Inside Array.<GeoPolygonSet>

此為out參數,需在執行前先配置好,執行後,傳回內部的PolygonSet。

Outside Array.<GeoPolygonSet>

此為out參數,需在執行前先配置好,執行後,傳回外部的PolygonSet。

Returns:
Type Description
Boolean 傳回運算是否成功。

SplitByPolyline(Line, RightAnswer, LeftAnswer){Boolean}

common/Geometry.js, line 6728

將自己用傳入的Polyline來切成右與左兩部分的Polygon。

Name Type Description
Line GeoPolyline

切割的Line。

RightAnswer Array.<GeoPolygon>

此為out參數,需在執行前先配置好,執行後,傳回右邊的Polygon。

LeftAnswer Array.<GeoPolygon>

此為out參數,需在執行前先配置好,執行後,傳回左邊的Polygon。

Returns:
Type Description
Boolean 傳回運算是否成功。

ToGeoBuffer(){Float64Array}

common/Geometry.js, line 7294

輸出成緩衝區物件。

Returns:
Type Description
Float64Array 回傳多邊形點位陣列。

ToGeoJSON(toString){Object|String}

common/Geometry.js, line 7262

將幾何輸出成GeoJSON物件或字串。

Name Type Description
toString Boolean

是否把物件轉成JSON字串。

Returns:
Type Description
Object | String 輸出轉換結果。