new GeoPolygon(boundary)
幾何物件:多邊形,內部的點位順序需為順時針
| Name | Type | Description | 
|---|---|---|
boundary | 
            
            
            GeoPolygon | GeoPolyline | GeoBoundary | Array.<GeoPoint> | 
                
                    
                        optional
                    
                    
                        
                    
                
                 欲複製的GeoPolygon;欲轉換的GeoPolyline;欲轉換的GeoBoundary;GeoPoint陣列。  | 
        
Example
var a = new GeoPolygon();//預設建構子
var b = new GeoPolygon(a);//使用欲複製的GeoPolygon建立GeoPolygon
var c = new GeoPolygon(new GeoPolyline());//使用欲轉換的GeoPolyline建立GeoPolygon
var d = new GeoPolygon(new GeoBoundary());//使用欲轉換的GeoBoundary建立GeoPolygon
var p1 = new GeoPoint({x: 0, y: 0});
var p2 = new GeoPoint({x: 0, y: 1});
var p3 = new GeoPoint({x: 1, y: 0});
var e = new GeoPolygon([p1, p2, p3]);//使用GeoPoint陣列建立GeoPolygon
    
    
Members
- 
    
readonlyBoundary
 - 
    
    
此幾何的範圍
Properties:
Name Type Description BoundaryGeoBoundary 範圍
 - 
    
BufferArray.<GeoPoint>
 - 
    
    
放置點位的Buffer
 - 
    
readonlyCenter
 - 
    
    
此幾何的中心點
Properties:
Name Type Description CenterGeoPoint 中心點
 - 
    
DistanceInBound
 - 
    
    
計算傳入的點到Polygon邊緣上的距離。
 - 
    
length
 - 
    
    
內含點位的數量
Properties:
Name Type Description lengthNumber 點位的數量
 - 
    
readonlytype
 - 
    
    
物件型態,值為GEO_TYPE.POLYGON
Properties:
Name Type Description typeGEO_TYPE 物件型態
 
Methods
- 
    
ClipLine(s, result){Boolean}
common/Geometry.js, line 6413 - 
    
    
    
將傳入的Line用此Polygon來切除,只剩在Polygon內的線。
Name Type Description sGeoLine 欲處理的線段資料。
resultGeoLine 此為out參數,須在執行前先配置好,執行後,此為處理後的答案。
Returns:
Type Description Boolean 傳回執行是否成功。  - 
    
ClipPolygon(s, result){Boolean}
common/Geometry.js, line 6458 - 
    
    
    
將傳入的Polygon用此Polygon來切除,只剩在Polygon內的範圍。
Name Type Description sGeoPolygon 欲處理的多邊形資料。
resultGeoPolygon 此為out參數,須在執行前先配置好,執行後,此為處理後的答案。
Returns:
Type Description Boolean 傳回執行是否成功。  - 
    
Clone(){GeoPolygon}
common/Geometry.js, line 6096 - 
    
    
    
產生一份新的自己。
Returns:
Type Description GeoPolygon 傳回複製的新的自己。  - 
    
CombinPolygon(Polygon, PolygonSet, CombinType){Boolean}
common/Geometry.js, line 6583 - 
    
    
    
將自己與傳入的Polygon做合併運算。
Name Type Description PolygonGeoPolygon 運算的Polygon資料。
PolygonSetGeoPolygonSet 此為out參數,需先在外面配好變數,合併後的結果。
CombinTypeGEO_CB_TYPE 運算類型。
Returns:
Type Description Boolean 傳回運算是否成功。  - 
    
ConvertToPolyline(){GeoPolyline}
common/Geometry.js, line 7343 - 
    
    
    
將此Polygon轉為Polyline。
Returns:
Type Description GeoPolyline 傳回轉換後的Polyline。  - 
    
CopyFrom(Obj){GeoPolygon}
common/Geometry.js, line 6105 - 
    
    
    
複製。
Name Type Description ObjGeoLine | GeoPolyline | Array.<GeoPoint> 複製的資料源。
Returns:
Type Description GeoPolygon this。  - 
    
Distance(Obj){Number}
common/Geometry.js, line 7226 - 
    
    
    
計算自己與傳入幾何的距離。
Name Type Description ObjGeoPoint | GeoLine | GeoPolyline | GeoPolygon | GeoPolygonSet 要計算距離的幾何資料。
Returns:
Type Description Number 傳回距離。  - 
    
FromGeoJSON(src){Boolean}
common/Geometry.js, line 7376 - 
    
    
    
讀入GeoJSON數值。
Name Type Description srcObject | String GeoJSON物件或字串。
Returns:
Type Description Boolean 回傳讀取是否成功。  - 
    
GetArea(){Number}
common/Geometry.js, line 6221 - 
    
    
    
計算此Polygon的面積。
Returns:
Type Description Number 傳回計算的面積。  - 
    
GetAt(index){GeoPoint}
common/Geometry.js, line 6174 - 
    
    
    
取第index個點。
Name Type Description indexNumber 索引。
Returns:
Type Description GeoPoint 第index個點。  - 
    
Include(Obj, bound){Boolean}
common/Geometry.js, line 7135 - 
    
    
    
判斷傳入的幾何資料是否被自己包含。
Name Type Description ObjGeoPoint | GeoLine | GeoPolyline | GeoPolygon | GeoPolygonSet 判斷的幾何資料。
boundBoolean 只用於Polygon與PolygonSet,指示相交於編上是否算包含。
Returns:
Type Description Boolean 傳回是否包含。  - 
    
IsConvex(){Boolean}
common/Geometry.js, line 6240 - 
    
    
    
判定此Polygon是否為凸多邊形。
Returns:
Type Description Boolean 傳回判斷結果。  - 
    
IsGood(){Boolean}
common/Geometry.js, line 6292 - 
    
    
    
判定此Polygon是否為好的Polygon(順序對,沒自己相交,有面積...)。
Returns:
Type Description Boolean 傳回判斷結果。  - 
    
IsIntersect(Obj, slice){Boolean}
common/Geometry.js, line 6560 - 
    
    
    
判斷自己與傳入幾何是否相交。
Name Type Description ObjGeoPolyline | GeoPolygon | GeoPolygonSet 判斷的幾何資料。
sliceBoolean 指定若只交在節點上,算不算相交。
Returns:
Type Description Boolean 傳回是否相交。  - 
    
MakeBuffer(Distance, PolygonSet){Boolean}
common/Geometry.js, line 7287 - 
    
    
    
做出環域的PolygonSet。
Name Type Description DistanceNumber 環域的距離。
PolygonSetGeoPolygonSet out參數,環域計算的答案。
Returns:
Type Description Boolean 回傳是否成功。  - 
    
Offset(p)
common/Geometry.js, line 7274 - 
    
    
    
位移p。
Name Type Description pGeoPoint 欲位移的距離。
 - 
    
PtInPolygon(p, Obj){Boolean}
common/Geometry.js, line 6193 - 
    
    
    
檢查傳入的點p是否位於此Polygon內。
Name Type Description pGeoPoint 欲檢查的點。
ObjObject 此為out參數,需在執行前先配置好,執行後,Obj.InBound=true|false代表是否位於邊緣上。
Returns:
Type Description Boolean 傳回是否位於Polygon內。  - 
    
RemoveAll()
common/Geometry.js, line 6131 - 
    
    
    
移除所有的點位資料。
 - 
    
SetAt(index, Obj)
common/Geometry.js, line 6183 - 
    
    
    
設定第index個點。
Name Type Description indexNumber 索引。
ObjGeoPoint 要設定的值。
 - 
    
SetGeoData(Buffer){Boolean}
common/Geometry.js, line 6140 - 
    
    
    
設定幾何資料,會檢查順逆時針,將其調整成正確的順序,若已知順序,可直接將點位資料Copy進Buffer變數,以增進效能。
Name Type Description BufferArray.<GeoPoint> 要Copy的點位資料。
Returns:
Type Description Boolean 是否Copy成功。  - 
    
SimplifyByPointCount(Count){Number}
common/Geometry.js, line 7333 - 
    
    
    
給定指定點數(希望簡約化後的點數),計算簡約化。
Name Type Description CountNumber 簡約化後希望的點數。
Returns:
Type Description Number 傳回簡約化後,剩餘的點數。  - 
    
SimplifyByTolerance(MaxErr, Polylines){Number}
common/Geometry.js, line 7305 - 
    
    
    
給定誤差值,計算簡約化
Name Type Description MaxErrNumber 簡約化的誤差值。
PolylinesArray.<GeoPolyline> | undefined 簡約化過程中,要避免與這些Polyline相交。
Returns:
Type Description Number 傳回簡約化後,剩餘的點數。  - 
    
SplitByLine(Line, RightAnswer, LeftAnswer){Boolean}
common/Geometry.js, line 6609 - 
    
    
    
將自己用傳入的Line來切成右與左兩部分的Polygon。
Name Type Description LineGeoLine 切割的Line。
RightAnswerArray.<GeoPolygon> 此為out參數,需在執行前先配置好,執行後,傳回右邊的Polygon。
LeftAnswerArray.<GeoPolygon> 此為out參數,需在執行前先配置好,執行後,傳回左邊的Polygon。
Returns:
Type Description Boolean 傳回運算是否成功  - 
    
SplitByPolygon(Polygon, Inside, Outside){Boolean}
common/Geometry.js, line 7002 - 
    
    
    
將自己用傳入的Polygon來切成內部與外部兩部分的PolygonSet。
Name Type Description PolygonGeoPolygon 切割的Polygon。
InsideArray.<GeoPolygonSet> 此為out參數,需在執行前先配置好,執行後,傳回內部的PolygonSet。
OutsideArray.<GeoPolygonSet> 此為out參數,需在執行前先配置好,執行後,傳回外部的PolygonSet。
Returns:
Type Description Boolean 傳回運算是否成功。  - 
    
SplitByPolyline(Line, RightAnswer, LeftAnswer){Boolean}
common/Geometry.js, line 6833 - 
    
    
    
將自己用傳入的Polyline來切成右與左兩部分的Polygon。
Name Type Description LineGeoPolyline 切割的Line。
RightAnswerArray.<GeoPolygon> 此為out參數,需在執行前先配置好,執行後,傳回右邊的Polygon。
LeftAnswerArray.<GeoPolygon> 此為out參數,需在執行前先配置好,執行後,傳回左邊的Polygon。
Returns:
Type Description Boolean 傳回運算是否成功。  - 
    
ToGeoBuffer(){Float64Array}
common/Geometry.js, line 7393 - 
    
    
    
輸出成緩衝區物件。
Returns:
Type Description Float64Array 回傳多邊形點位陣列。  - 
    
ToGeoJSON(toString){Object|String}
common/Geometry.js, line 7357 - 
    
    
    
將幾何輸出成GeoJSON物件或字串。
Name Type Description toStringBoolean 是否把物件轉成JSON字串。
Returns:
Type Description Object | String 輸出轉換結果。