new GeoLine(obj, to)
建立線段
Name | Type | Description |
---|---|---|
obj |
GeoLine | PointLike | Object |
optional
欲複製的GeoLine;指定的From;帶有From,To的Object。 |
to |
PointLike |
optional
指定的To。 |
Example
var a = new GeoLine();//預設建構子
var b = new GeoLine(a);//使用欲複製的GeoLine建立GeoLine
var from = new GeoPoint();
var to = new GeoPoint();
var c = new GeoLine(from, to);//指定From,To並建立GeoLine
var d = new GeoLine({From: from, To: to});//使用帶有From,To的Object建立GeoLine
Extends
Members
-
readonlyBoundary
-
此幾何的範圍
Properties:
Name Type Description Boundary
GeoBoundary 範圍
-
readonlyCenter
-
中心點
Properties:
Name Type Description Center
GeoPoint 中心點
-
From
-
起始點
Properties:
Name Type Description From
GeoPoint 起始點
-
readonlyLength
-
長度
Properties:
Name Type Description Length
number 長度
-
PolarAngle
-
波拉角,即從起點往終點的向量,此向量的數學角度,單位為角度
Properties:
Name Type Description PolarAngle
number 波拉角
-
To
-
終點
Properties:
Name Type Description To
GeoPoint 終點
-
readonlytype
-
物件型態,值為GEO_TYPE.LINE
Properties:
Name Type Description type
GEO_TYPE 物件型態
Methods
-
BackExtend(distance)
common/geometry/GeoLine.js, line 651 -
線段往後退縮Distance距離。
Name Type Description distance
number 往後退縮的距離。
-
Classify(p){GEO_STATUS}
common/geometry/GeoLine.js, line 196 -
取得傳入點p與本身的相關位置。
Name Type Description p
GeoPoint 欲測試的資料點。
Returns:
Type Description GEO_STATUS 相關位置 -
Clone(){GeoLine}
common/geometry/GeoLine.js, line 117 -
產生一份新的自己。
Returns:
Type Description GeoLine 傳回複製的新的自己。 -
CopyFrom(obj){GeoLine}
common/geometry/GeoLine.js, line 125 -
複製。
Name Type Description obj
GeoLine 複製的資料源。
Returns:
Type Description GeoLine this -
Distance(obj){number}
common/geometry/GeoLine.js, line 547 -
計算自己與傳入幾何的距離。
Name Type Description obj
GeoPoint | GeoLine | GeoPolyline | GeoPolygon | GeoPolygonSet 要計算距離的幾何資料。
Returns:
Type Description number 傳回距離。 -
Flip()
common/geometry/GeoLine.js, line 441 -
將此線段的起點與終點對調。
-
ForwardExtend(distance)
common/geometry/GeoLine.js, line 640 -
線段往前延展Distance距離。
Name Type Description distance
number 往前延展的距離。
-
FromGeoJSON(src){boolean}
common/geometry/GeoLine.js, line 716 -
讀入GeoJSON數值。
Name Type Description src
GeoJSON.GeoJsonObject | string GeoJSON物件或字串 。
Returns:
Type Description boolean 回傳讀取是否成功。 -
GetNearPoint(p, ret){number}
common/geometry/GeoLine.js, line 570 -
取得在此線段中,離傳入的點p最近的點Ret。
Name Type Description p
GeoPoint 要計算的點。
ret
GeoPoint 此為out,要在外面先配置好,會傳回最近的點。
Returns:
Type Description number 傳回離最近的點的距離。 -
GetPoint(t){GeoPoint}
common/geometry/GeoLine.js, line 451 -
取得從起點往終點方向的某比例的點。
Name Type Description t
number 欲取出點的比例,此比例可為正或負,單位為線段的長度。
Returns:
Type Description GeoPoint 取出的點 -
Intersect(e, obj, includeZ){GEO_STATUS}
common/geometry/GeoLine.js, line 411 -
取得與傳入線段e的相關位置。
Name Type Default Description e
GeoLine 欲比較的線段。
obj
GeoPoint | Object 此為out參數,需先在外面配好變數,回傳時,若為GeoPoint,則為交點,否則Obj.t代表交點離起點的距離,單位為整個線段的比例,也就是0<=Obj.t<=1。
includeZ
boolean false 是否處理z值,預設值為false
Returns:
Type Description GEO_STATUS 相關位置。 -
IsIntersect(line, endPointIncluded, obj, includeZ){boolean}
common/geometry/GeoLine.js, line 498 -
判斷自己與傳入線段Line是否相交。
Name Type Default Description line
GeoLine 欲檢查的線段。
endPointIncluded
boolean 若只交道端點,是否算是相交。
obj
GeoPoint | Object 此為out參數,需先在外面配好變數,回傳時,若為GeoPoint,則為交點,否則Obj.t代表交點離起點的距離,單位為整個線段的比例,也就是0<=Obj.t<=1。
includeZ
boolean false 是否處理z值,預設值為false,只有在Obj類型為GeoPoint時有用。
Returns:
Type Description boolean 是否相交。 -
MakeBuffer(distance, polygonSet){boolean}
common/geometry/GeoLine.js, line 633 -
做出環域的PolygonSet。
Name Type Description distance
number 環域的距離。
polygonSet
GeoPolygonSet out參數,環域計算的答案。
Returns:
Type Description boolean 回傳是否成功。 -
Offset(p)
common/geometry/GeoLine.js, line 623 -
將線段位移p。
Name Type Description p
GeoPoint 欲位移的距離。
-
PtInsideLine(p){boolean}
common/geometry/GeoLine.js, line 616 -
判定點p是否位於線段中。
Name Type Description p
GeoPoint 欲判斷的點。
Returns:
Type Description boolean 傳回判斷的結果。 -
Rot()
common/geometry/GeoLine.js, line 426 -
將此線段以中心點為旋轉中心,逆時針,轉動90度。
-
SplitBy(line, buffer1, buffer2){number}
common/geometry/GeoLine.js, line 665 -
找出此線段和傳入線段Line的焦點。
Name Type Description line
GeoLine 要計算的線段。
buffer1
Array.<GeoPoint> 此為out參數,要在外面先配置好,傳回從自己的起點算,所經過的交點,因為是線段,所以最多只會有一個點。
buffer2
Array.<GeoPoint> 此為out參數,要在外面先配置好,傳回從傳入的Line起點算,所經過的交點,因為是線段,所以最多只會有一個點。
Returns:
Type Description number 傳回所有交點數量。 -
ToGeoJSON(toString, includeZ){GeoJSON.Polyline|string}
common/geometry/GeoLine.js, line 691 -
將幾何輸出成GeoJSON物件或字串。
Name Type Description toString
boolean 是否把物件轉成JSON字串。
includeZ
boolean 是否包含Z,標準GeoJSON不包含Z(可不給,預設false)。
Returns:
Type Description GeoJSON.Polyline | string 輸出轉換結果。