new GeoPolyline(polyline)
幾何物件:多點的線
| Name | Type | Description | 
|---|---|---|
polyline | 
            
            
            GeoPolyline | GeoLine | Array.<GeoPoint> | 
                
                    
                        optional
                    
                    
                        
                    
                
                 欲複製的GeoPolyline;欲轉換的GeoLine;GeoPoint陣列。  | 
        
Example
var a = new GeoPolyline();//預設建構子
var b = new GeoPolyline(a);//使用欲複製的GeoPolyline建立GeoPolyline
var c = new GeoPolyline(new GeoLine());//使用欲轉換的GeoLine建立GeoPolyline
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 d = new GeoPolyline([p1, p2, p3]);//使用GeoPoint陣列建立GeoPolyline
    
    
Members
- 
    
readonlyBoundary
 - 
    
    
此幾何的範圍
Properties:
Name Type Description BoundaryGeoBoundary 範圍
 - 
    
Buffer
 - 
    
    
放置點位的Buffer
Properties:
Name Type Description BufferArray.<GeoPoint> 點位陣列
 - 
    
readonlyCenter
 - 
    
    
此幾何的中心點
Properties:
Name Type Description CenterGeoPoint 中心點
 - 
    
length
 - 
    
    
內含點位的數量
Properties:
Name Type Description lengthNumber 點位的數量
 - 
    
readonlyLength
 - 
    
    
長度
Properties:
Name Type Description LengthNumber 長度
 - 
    
readonlytype
 - 
    
    
物件型態,值為GEO_TYPE.POLYLINE
Properties:
Name Type Description typeGEO_TYPE 物件型態
 
Methods
- 
    
Clone(){GeoPolyline}
common/Geometry.js, line 5084 - 
    
    
    
產生一份新的自己。
Returns:
Type Description GeoPolyline 傳回複製的新的自己。  - 
    
CopyFrom(Obj){GeoLine}
common/Geometry.js, line 5093 - 
    
    
    
複製。
Name Type Description ObjGeoLine | GeoPolyline | Array.<GeoPoint> 複製的資料源。
Returns:
Type Description GeoLine this。  - 
    
Distance(Obj){Number}
common/Geometry.js, line 5181 - 
    
    
    
計算自己與傳入幾何的距離。
Name Type Description ObjGeoPoint | GeoLine | GeoPolyline | GeoPolygon | GeoPolygonSet 要計算距離的幾何資料。
Returns:
Type Description Number 傳回距離。  - 
    
FromGeoJSON(src){Boolean}
common/Geometry.js, line 5741 - 
    
    
    
讀入GeoJSON數值。
Name Type Description srcobject | string GeoJSON物件或字串 。
Returns:
Type Description Boolean 回傳讀取是否成功。  - 
    
Get3DNearPointFromPoint(DestPoint){object}
common/Geometry.js, line 5841 - 
    
    
    
取得聚合線在線上與目標點最近的點(考慮z),在平面中直接使用即可,在球型要先將線從Map轉成WorldMap再計算,算完再轉回Map。
Name Type Description DestPointGeoPoint 目標點。
Returns:
Type Description object success:是否成功,pt1:來源聚合線上的最近點,distance:目標聚合線上的最近點。  - 
    
Get3DNearPointFromPolyline(DestPolyline){object}
common/Geometry.js, line 5767 - 
    
    
    
取得兩條聚合線在線上最近的兩點(考慮z),在平面中直接使用即可,在球型要先將線從Map轉成WorldMap再計算,算完再轉回Map。
Name Type Description DestPolylineGeoPolyline 目標聚合線。
Returns:
Type Description object success:是否成功,pt1:來源聚合線上的最近點,pt2:目標聚合線上的最近點。  - 
    
GetAt(index){GeoPoint}
common/Geometry.js, line 5113 - 
    
    
    
取第index個點。
Name Type Description indexNumber 索引。
Returns:
Type Description GeoPoint 第index個點  - 
    
GetNearPoint(p, Ret){Number}
common/Geometry.js, line 5205 - 
    
    
    
取得在此線段中,離傳入的點p最近的點Ret。
Name Type Description pGeoPoint 要計算的點。
RetGeoPoint 此為out,要在外面先配置好,會傳回最近的點。
Returns:
Type Description Number 傳回離最近的點的距離。  - 
    
GetPointByDistance1(Distance, p){Boolean}
common/Geometry.js, line 5490 - 
    
    
    
從起點開始,沿著Polyline走,找出沿著Polyline的距離Distance的點位。
Name Type Description DistanceNumber 想要的距離。
pGeoPoint 此為out參數,需再呼叫前先配置好,執行後,傳回找到的答案。
Returns:
Type Description Boolean 傳回是否有答案。  - 
    
GetPointByDistance2(Distance, p){Boolean}
common/Geometry.js, line 5522 - 
    
    
    
從起點開始,沿著Polyline走,找出某點離起點直線距離為Distance的點位。
Name Type Description DistanceNumber 想要的距離。
pGeoPoint 此為out參數,需再呼叫前先配置好,執行後,傳回找到的答案。
Returns:
Type Description Boolean 傳回是否有答案。  - 
    
InsertPoint(p){Boolean}
common/Geometry.js, line 5638 - 
    
    
    
若輸入的點p位於Polyline上,則將點p插於polyline中的適當位置。
Name Type Description pGeoPoint 要插入的點。
Returns:
Type Description Boolean 傳回是否成功。  - 
    
Intersect(Polyline, Buffer){Number}
common/Geometry.js, line 5231 - 
    
    
    
計算與傳入的Polyline的交點。
Name Type Description PolylineGeoPolyline 欲檢查的線段。
BufferArray.<GeoPoint> 此為out參數,需先在外面配好變數,回傳時,代表交點。
Returns:
Type Description Number 交點的數量。  - 
    
Inverse()
common/Geometry.js, line 5625 - 
    
    
    
將點位逆向排序。
 - 
    
IsIntersect(Obj, slice){Boolean}
common/Geometry.js, line 5282 - 
    
    
    
判斷自己與傳入幾何是否相交。
Name Type Description ObjGeoPolyline | GeoPolygon | GeoPolygonSet 判斷的幾何資料。
sliceBoolean 指定若只交在節點上,算不算相交。
Returns:
Type Description Boolean 傳回是否相交。  - 
    
Join(Polyline){Boolean}
common/Geometry.js, line 5675 - 
    
    
    
傳入的Polyline若與本身可相連,則將Polyline連於自己。
Name Type Description PolylineGeoPolyline 要相連的Polyline。
Returns:
Type Description Boolean 傳回是否成功。  - 
    
MakeBuffer(Delta, PolygonSet, TwoSide){Boolean}
common/Geometry.js, line 5314 - 
    
    
    
做出環域的PolygonSet。
Name Type Default Description DeltaNumber 環域的距離。
PolygonSetGeoPolygonSet out參數,環域計算的答案。
TwoSideBoolean true optional 是否要兩邊
Returns:
Type Description Boolean 回傳是否成功。  - 
    
MidByDistance1(Distance1, Distance2){Boolean}
common/Geometry.js, line 5544 - 
    
    
    
將自己切成沿Polyline走,距離Distance1與Distance2之間的Sub Polyline。
Name Type Description Distance1Number 切割的起始距離。
Distance2Number 切割的結束距離。
Returns:
Type Description Boolean 傳回是否切割成功。  - 
    
MidByDistance2(Distance1, Distance2){Boolean}
common/Geometry.js, line 5586 - 
    
    
    
將自己切成沿Polyline走,離起點直線距離Distance1與Distance2之間的Sub Polyline。
Name Type Description Distance1Number 切割的起始距離。
Distance2Number 切割的結束距離。
Returns:
Type Description Boolean 傳回是否切割成功。  - 
    
Offset(p)
common/Geometry.js, line 5300 - 
    
    
    
位移p。
Name Type Description pGeoPoint 欲位移的距離。
 - 
    
RemoveAll()
common/Geometry.js, line 5666 - 
    
    
    
移除所有點位資料。
 - 
    
SetAt(index, Obj)
common/Geometry.js, line 5122 - 
    
    
    
設定第index個點。
Name Type Description indexNumber 索引。
ObjGeoPoint 要設定的值。
 - 
    
SimplifyByPointCount(Count, Delta, DontCutPolylines){Number}
common/Geometry.js, line 5347 - 
    
    
    
給定指定點數(希望簡約化後的點數),計算簡約化。
Name Type Description CountNumber 簡約化後希望的點數。
DeltaNumber 簡約化的誤差值。
DontCutPolylinesArray.<GeoPolyline> | undefined 簡約化過程中,要避免與這些Polyline相交。
Returns:
Type Description Number 傳回簡約化後,剩餘的點數。  - 
    
SimplifyByTolerance(MaxErr, DontCutPolylines){Number}
common/Geometry.js, line 5335 - 
    
    
    
給定誤差值,計算簡約化。
Name Type Description MaxErrNumber 簡約化的誤差值。
DontCutPolylinesArray.<GeoPolyline> | undefined 簡約化過程中,要避免與這些Polyline相交。
Returns:
Type Description Number 傳回簡約化後,剩餘的點數。  - 
    
SplitByLine(Line, Buffer){Number}
common/Geometry.js, line 5362 - 
    
    
    
被線段切割。
Name Type Description LineGeoLine 切割的線段。
BufferArray.<GeoPolyline> 此為out參數,需再呼叫前先配置好,執行完後,傳回切割的Polyline。
Returns:
Type Description Number 傳回切割的線數量。  - 
    
SplitByPolygon(Polygon, Inside, Outside){Number}
common/Geometry.js, line 5436 - 
    
    
    
被Polygon切割。
Name Type Description PolygonGeoPolygon 切割的Polygon。
InsideArray.<GeoPolyline> 此為out參數,需再呼叫前先配置好,執行完後,傳回被切後,在Polygon內的Polyline。
OutsideArray.<GeoPolyline> 此為out參數,需再呼叫前先配置好,執行完後,傳回被切後,在Polygon外的Polyline。
Returns:
Type Description Number 傳回被削下的所有Polyline的數量。  - 
    
SplitByPolyline(Line, Buffer){Number}
common/Geometry.js, line 5377 - 
    
    
    
被Polyline切割。
Name Type Description LineGeoPolyline 切割的Polyline。
BufferArray.<GeoPolyline> 此為out參數,需再呼叫前先配置好,執行完後,傳回切割的Polyline。
Returns:
Type Description Number 傳回切割的線數量。  - 
    
ToGeoJSON(toString, includeZ){object|string}
common/Geometry.js, line 5713 - 
    
    
    
將幾何輸出成GeoJSON物件或字串。
Name Type Description toStringBoolean 是否把物件轉成JSON字串。
includeZBoolean 是否包含Z,標準GeoJSON不包含Z(可不給,預設false)。
Returns:
Type Description object | string 輸出轉換結果。