Class: GeoBoundary

GeoBoundary

代表世界座標的一個範圍,內部包含west,south,east,north 4個屬性

new GeoBoundary(obj, south, east, north)

common/geometry/GeoBoundary.js, line 6

建立範圍

Name Type Description
obj GeoBoundary | Number | Array.<Number> | Object optional

欲複製的GeoBoundary;指定的west;陣列大小為4的數字;帶有west,south,east,north的Object。

south number optional

指定的south。

east number optional

指定的east。

north number optional

指定的north。

Example

var a = new GeoBoundary();//預設建構子
var b = new GeoBoundary(a);//使用欲複製的GeoBoundary建立GeoBoundary
var c = new GeoBoundary(0, 0, 0, 0);//指定west,south,east,north並建立GeoBoundary
var d = new GeoBoundary([0, 0, 0, 0]);//使用陣列大小為4的數字建立GeoBoundary
var e = new GeoBoundary({west:0, south:0, east:0, north:0});//使用帶有west,south,east,north的Object建立GeoBoundary

Extends

Members

readonlyCenter

中心點

Properties:
Name Type Description
Center GeoPoint

中心點

eastnumber

東邊

readonlyHeight

高度

Properties:
Name Type Description
Height number

高度

readonlyIsEmpty

是否為空的,空的是指Width === 0 || Height = 0

Properties:
Name Type Description
IsEmpty boolean

是否為空的

northnumber

北邊

southnumber

南邊

readonlytype

物件型態,值為GEO_TYPE.RECT

Properties:
Name Type Description
type GEO_TYPE

物件型態

westnumber

西邊

readonlyWidth

寬度

Properties:
Name Type Description
Width number

寬度

Methods

staticGeoBoundary.IntersectRect(rect1, rect2){GeoBoundary|null}

common/geometry/GeoBoundary.js, line 163

計算Rect1與Rect2的交集。

Name Type Description
rect1 GeoBoundary

要計算的Rect。

rect2 GeoBoundary

要計算的Rect。

Returns:
Type Description
GeoBoundary | null 傳回兩Rect的交集,若沒交集,傳回null。

Clone(){GeoBoundary}

common/geometry/GeoBoundary.js, line 212

產生一份新的自己。

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

ContractionToInteger()

common/geometry/GeoBoundary.js, line 576

由於座標會有小數,本函式將往內縮,直至座標值為整數為止。

CopyFrom(Obj, south, east, north){GeoBoundary}

common/geometry/GeoBoundary.js, line 223

複製。

Name Type Description
Obj GeoBoundary | Number

為west,或本身就是一個GeoBoundary,或本身就是一個Array。

south number optional

若Obj參數為west使用,否則此參數無意義。

east number optional

若Obj參數為west使用,否則此參數無意義。

north number optional

若Obj參數為west使用,否則此參數無意義。

Returns:
Type Description
GeoBoundary 傳回this。

Deflate(deltaX, deltaY)

common/geometry/GeoBoundary.js, line 517

以中心點,向內縮。

Name Type Description
deltaX number

west與east都往內縮DeltaX。

deltaY number

south與north都往內縮DeltaY。

Expand(p)

common/geometry/GeoBoundary.js, line 279

使用一個點拓展Boundary。

Name Type Description
p GeoPoint | Geo3DPoint

輸入的點。

ExpandToInteger()

common/geometry/GeoBoundary.js, line 554

由於座標會有小數,本函式將往外擴張,直至座標值為整數為止。

ExpandXY(x, y)

common/geometry/GeoBoundary.js, line 290

使用一個點的xy值拓展Boundary。

Name Type Description
x number

輸入的點的x。

y number

輸入的點的y。

FromGeoJSON(src){boolean}

common/geometry/GeoBoundary.js, line 616

讀入GeoJSON數值。

Name Type Description
src GeoJSON.Boundary | string

GeoJSON物件或字串 。

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

Include(rect){boolean}

common/geometry/GeoBoundary.js, line 428

是否完全包含Rect。

Name Type Description
rect GeoBoundary

要被包含的Rect。

Returns:
Type Description
boolean 傳回是否完全包含Rect。

Inflate(deltaX, deltaY)

common/geometry/GeoBoundary.js, line 528

以中心點,向外擴張。

Name Type Description
deltaX number

west與east都向外擴張DeltaX。

deltaY number

south與north都向外擴張DeltaY。

IntersectRect(rect1, rect2){boolean}

common/geometry/GeoBoundary.js, line 330

有兩種用法
檢查自己是否和Rect1相交,用GeoBoundary.IntersectRect(Rect1);
檢查Rect1與Rect2是否相交,若相交,把相交的範圍設定給自己,用GeoBoundary.IntersectRect(Rect1,Rect2);。

Name Type Description
rect1 GeoBoundary

檢查的Rect。

rect2 GeoBoundary optional

檢查的Rect。

Returns:
Type Description
boolean 傳回檢查的結果。

IsEqual(boundary){boolean}

common/geometry/GeoBoundary.js, line 249

是否相等。

Name Type Description
boundary GeoBoundary

比較的Boundary。

Returns:
Type Description
boolean 傳回比較的結果。

IsNotEqual(boundary){boolean}

common/geometry/GeoBoundary.js, line 257

是否不相等。

Name Type Description
boundary GeoBoundary

比較的Boundary。

Returns:
Type Description
boolean 傳回比較的結果。

OffsetByXY(deltaX, deltaY)

common/geometry/GeoBoundary.js, line 539

整個GeoBoundary位移(DeltaX,DeltaY)。

Name Type Description
deltaX number

水平位移。

deltaY number

垂直位移。

PtInRect(p){boolean}

common/geometry/GeoBoundary.js, line 309

檢查p是否位於Rect範圍內

Name Type Description
p GeoPoint

檢查的值。

Returns:
Type Description
boolean 傳回檢查的結果。

PtXYInRect(p){boolean}

common/geometry/GeoBoundary.js, line 301

檢查p是否位於Rect範圍內

Name Type Description
p GeoPoint

檢查的值。

Returns:
Type Description
boolean 傳回檢查的結果。

Scale(scale)

common/geometry/GeoBoundary.js, line 504

以中心點,對Width與Height縮放scale。

Name Type Description
scale number

縮放的倍數。

SetNegativeInfinity()

common/geometry/GeoBoundary.js, line 269

將Boundary設為負無窮大(不合理的值)。

SetNULL()

common/geometry/GeoBoundary.js, line 263

將west,south,east,north都設為0。

ToArray(){Array.<Number>}

common/geometry/GeoBoundary.js, line 205

回傳陣列[W,S,E,N]。

Returns:
Type Description
Array.<Number> 陣列[W,S,E,N]。

ToGeoJSON(toString){GeoJSON.Boundary|string}

common/geometry/GeoBoundary.js, line 600

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

Name Type Description
toString boolean

是否把物件轉成JSON字串。

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

ToPolygon(){GeoPolygon}

common/geometry/GeoBoundary.js, line 634

轉換成多邊形(西北、東北、東南、西南)

Returns:
Type Description
GeoPolygon 多邊形

Union(rect)

common/geometry/GeoBoundary.js, line 467

計算聯集。

Name Type Description
rect GeoBoundary

聯集的對象。