Class: GeoPolyline

GeoPolyline

幾何物件:多點的線

new GeoPolyline(obj)

common/geometry/GeoPolyline.js, line 6

建立多點的線

Name Type Description
obj GeoPolyline | GeoLine | Array.<PointLike> 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

Extends

Members

readonlyBoundary

此幾何的範圍

Properties:
Name Type Description
Boundary GeoBoundary

範圍

BufferArray.<GeoPoint>

放置點位的Buffer

readonlyCenter

此幾何的中心點

Properties:
Name Type Description
Center GeoPoint

中心點

length

內含點位的數量

Properties:
Name Type Description
length number

點位的數量

readonlyLength

長度

Properties:
Name Type Description
Length number

長度

readonlytype

物件型態,值為GEO_TYPE.POLYLINE

Properties:
Name Type Description
type GEO_TYPE

物件型態

Methods

Clone(){GeoPolyline}

common/geometry/GeoPolyline.js, line 129

產生一份新的自己。

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

CopyFrom(obj){GeoLine}

common/geometry/GeoPolyline.js, line 137

複製。

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

複製的資料源。

Returns:
Type Description
GeoLine this。

Distance(obj){number}

common/geometry/GeoPolyline.js, line 218

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

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

要計算距離的幾何資料。

Returns:
Type Description
number 傳回距離。

FromGeoJSON(src){boolean}

common/geometry/GeoPolyline.js, line 756

讀入GeoJSON數值。

Name Type Description
src GeoJSON.Polyline | string

GeoJSON物件或字串 。

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

Get3DNearPointFromPoint(destPoint){object}

common/geometry/GeoPolyline.js, line 857

取得聚合線在線上與目標點最近的點(考慮z),在平面中直接使用即可,在球型要先將線從Map轉成WorldMap再計算,算完再轉回Map。

Name Type Description
destPoint GeoPoint

目標點。

Returns:
Type Description
object success:是否成功,pt1:來源聚合線上的最近點,distance:目標聚合線上的最近點。

Get3DNearPointFromPolyline(destPolyline){object}

common/geometry/GeoPolyline.js, line 782

取得兩條聚合線在線上最近的兩點(考慮z),在平面中直接使用即可,在球型要先將線從Map轉成WorldMap再計算,算完再轉回Map。

Name Type Description
destPolyline GeoPolyline

目標聚合線。

Returns:
Type Description
object success:是否成功,pt1:來源聚合線上的最近點,pt2:目標聚合線上的最近點。

GetAt(index){GeoPoint}

common/geometry/GeoPolyline.js, line 156

取第index個點。

Name Type Description
index number

索引。

Returns:
Type Description
GeoPoint 第index個點

GetNearPoint(p, ret){number}

common/geometry/GeoPolyline.js, line 241

取得在此線段中,離傳入的點p最近的點Ret。

Name Type Description
p GeoPoint

要計算的點。

ret GeoPoint

此為out,要在外面先配置好,會傳回最近的點。

Returns:
Type Description
number 傳回離最近的點的距離。

GetPointByDistance1(distance, p){boolean}

common/geometry/GeoPolyline.js, line 513

從起點開始,沿著Polyline走,找出沿著Polyline的距離Distance的點位。

Name Type Description
distance number

想要的距離。

p GeoPoint

此為out參數,需再呼叫前先配置好,執行後,傳回找到的答案。

Returns:
Type Description
boolean 傳回是否有答案。

GetPointByDistance2(distance, p){boolean}

common/geometry/GeoPolyline.js, line 544

從起點開始,沿著Polyline走,找出某點離起點直線距離為Distance的點位。

Name Type Description
distance number

想要的距離。

p GeoPoint

此為out參數,需再呼叫前先配置好,執行後,傳回找到的答案。

Returns:
Type Description
boolean 傳回是否有答案。

InsertPoint(p){boolean}

common/geometry/GeoPolyline.js, line 658

若輸入的點p位於Polyline上,則將點p插於polyline中的適當位置。

Name Type Description
p GeoPoint

要插入的點。

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

Intersect(polyline, buffer){number}

common/geometry/GeoPolyline.js, line 266

計算與傳入的Polyline的交點。

Name Type Description
polyline GeoPolyline

欲檢查的線段。

buffer Array.<GeoPoint>

此為out參數,需先在外面配好變數,回傳時,代表交點。

Returns:
Type Description
number 交點的數量。

Inverse()

common/geometry/GeoPolyline.js, line 646

將點位逆向排序。

IsIntersect(obj, slice){boolean}

common/geometry/GeoPolyline.js, line 313

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

Name Type Description
obj GeoPolyline | GeoPolygon | GeoPolygonSet

判斷的幾何資料。

slice boolean optional

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

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

Join(polyline){boolean}

common/geometry/GeoPolyline.js, line 693

傳入的Polyline若與本身可相連,則將Polyline連於自己。

Name Type Description
polyline GeoPolyline

要相連的Polyline。

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

MakeBuffer(distance, polygonSet, twoSide){boolean}

common/geometry/GeoPolyline.js, line 343

做出環域的PolygonSet。

Name Type Default Description
distance number

環域的距離。

polygonSet GeoPolygonSet

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

twoSide boolean true optional

是否要兩邊

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

MidByDistance1(distance1, distance2){boolean}

common/geometry/GeoPolyline.js, line 565

將自己切成沿Polyline走,距離Distance1與Distance2之間的Sub Polyline。

Name Type Description
distance1 number

切割的起始距離。

distance2 number

切割的結束距離。

Returns:
Type Description
boolean 傳回是否切割成功。

MidByDistance2(distance1, distance2){boolean}

common/geometry/GeoPolyline.js, line 607

將自己切成沿Polyline走,離起點直線距離Distance1與Distance2之間的Sub Polyline。

Name Type Description
distance1 number

切割的起始距離。

distance2 number

切割的結束距離。

Returns:
Type Description
boolean 傳回是否切割成功。

Offset(p)

common/geometry/GeoPolyline.js, line 330

位移p。

Name Type Description
p GeoPoint

欲位移的距離。

RemoveAll()

common/geometry/GeoPolyline.js, line 685

移除所有點位資料。

SetAt(index, obj)

common/geometry/GeoPolyline.js, line 164

設定第index個點。

Name Type Description
index number

索引。

obj GeoPoint

要設定的值。

SimplifyByPointCount(count, delta, dontCutPolylines){number}

common/geometry/GeoPolyline.js, line 374

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

Name Type Default Description
count number

簡約化後希望的點數。

delta number

簡約化的誤差值。

dontCutPolylines Array.<GeoPolyline> | undefined null

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

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

SimplifyByTolerance(maxErr, dontCutPolylines){number}

common/geometry/GeoPolyline.js, line 363

給定誤差值,計算簡約化。

Name Type Default Description
maxErr number

簡約化的誤差值。

dontCutPolylines Array.<GeoPolyline> | undefined null

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

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

SplitByLine(line, buffer){number}

common/geometry/GeoPolyline.js, line 388

被線段切割。

Name Type Description
line GeoLine

切割的線段。

buffer Array.<GeoPolyline>

此為out參數,需再呼叫前先配置好,執行完後,傳回切割的Polyline。

Returns:
Type Description
number 傳回切割的線數量。

SplitByPolygon(polygon, inside, outside){number}

common/geometry/GeoPolyline.js, line 460

被Polygon切割。

Name Type Description
polygon GeoPolygon

切割的Polygon。

inside Array.<GeoPolyline>

此為out參數,需再呼叫前先配置好,執行完後,傳回被切後,在Polygon內的Polyline。

outside Array.<GeoPolyline>

此為out參數,需再呼叫前先配置好,執行完後,傳回被切後,在Polygon外的Polyline。

Returns:
Type Description
number 傳回被削下的所有Polyline的數量。

SplitByPolyline(line, retBuffer){number}

common/geometry/GeoPolyline.js, line 402

被Polyline切割。

Name Type Description
line GeoPolyline

切割的Polyline。

retBuffer Array.<GeoPolyline>

此為out參數,需再呼叫前先配置好,執行完後,傳回切割的Polyline。

Returns:
Type Description
number 傳回切割的線數量。

ToGeoJSON(toString, includeZ){GeoJSON.Polyline|string}

common/geometry/GeoPolyline.js, line 730

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

Name Type Description
toString boolean

是否把物件轉成JSON字串。

includeZ boolean

是否包含Z,標準GeoJSON不包含Z(可不給,預設false)。

Returns:
Type Description
GeoJSON.Polyline | string 輸出轉換結果。