# Class: GeoBounds

GeoBounds 地理范围.

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new GeoBounds(min?: GeoPoint, max?: GeoPoint): GeoBounds

# Parameters
Name Type
min? GeoPoint
max? GeoPoint

Returns: GeoBounds

# Properties

# max

max: GeoPoint


# min

min: GeoPoint

# Methods

# center

center(): GeoPoint

得到中心点

Returns: GeoPoint


# clone

clone(): GeoBounds

克隆

Returns: GeoBounds


# closestPoint

closestPoint(testPoint: GeoPoint, includeInterior?: boolean): GeoPoint

查找边界框上最近的点并返回该点.

# Parameters
Name Type Default value Description
testPoint GeoPoint - 点.
includeInterior boolean true 如果为true,则最近的点可以位于边界框内。如果为false,则最近的点只能位于边界框的外边缘上.

Returns: GeoPoint


# contains

contains(point: GeoPoint): boolean

查看点是否在包围盒中

# Parameters
Name Type
point GeoPoint

Returns: boolean


# height

height(): number

获取高度

Returns: number


# intersect

intersect(b: GeoBounds): null | GeoBounds

两包围盒求交集

# Parameters
Name Type
b GeoBounds

Returns: null | GeoBounds


# isContains

isContains(bound: GeoBounds): boolean

求一个包围盒是否包含另一个包围盒

# Parameters
Name Type
bound GeoBounds

Returns: boolean


# isIntersect

isIntersect(bound: GeoBounds): boolean

判断与另一个包围盒是否相交

# Parameters
Name Type
bound GeoBounds

Returns: boolean


# leftBottom

leftBottom(): GeoPoint

得到左下角

Returns: GeoPoint


# leftTop

leftTop(): GeoPoint

得到左上角

Returns: GeoPoint


# randomGeoJsonLineCollection

randomGeoJsonLineCollection(maxLineCount: number, maxPointCount: number, xRatio?: number, yRatio?: number, propertiesCb?: (index: number) => Object, minLineCount?: number, minPointCount?: number): GeoJsonGeomertry

生成一个随机geojson线集合

# Parameters
Name Type Default value Description
maxLineCount number - 最多线的数目
maxPointCount number - 每条线最多的点的数目
xRatio number 0.6 x轴范围比例 缺省 0.6
yRatio number 0.6 y轴范围比例 缺省 0.6
propertiesCb? (index: number) => Object - 属性回调函数
minLineCount? number - 最少线的数目(缺省为1)
minPointCount? number - 每条线最少的点的数目(缺省为2)

Returns: GeoJsonGeomertry


# randomGeoJsonPointCollection

randomGeoJsonPointCollection(count: number, xRatio?: number, yRatio?: number, propertiesCb?: (index: number) => Object): GeoJsonGeomertry

生成一个随机geojson点集合

# Parameters
Name Type Default value Description
count number - 点的数目
xRatio number 0.6 x轴范围比例 缺省 0.6
yRatio number 0.6 y轴范围比例 缺省 0.6
propertiesCb? (index: number) => Object - 属性回调函数

Returns: GeoJsonGeomertry


# randomGeoJsonPolygonCollection

randomGeoJsonPolygonCollection(maxPolygonCount: number, maxPointCount: number, xRatio?: number, yRatio?: number, propertiesCb?: (index: number) => Object, minPolygonCount?: number, minPointCount?: number): GeoJsonGeomertry

生成一个随机geojson多边形集合

# Parameters
Name Type Default value Description
maxPolygonCount number - 最多多边形的数目
maxPointCount number - 每条线最多的点的数目
xRatio number 0.6 x轴范围比例 缺省 0.6
yRatio number 0.6 y轴范围比例 缺省 0.6
propertiesCb? (index: number) => Object - 属性回调函数
minPolygonCount? number - 最少多边形的数目(缺省为1)
minPointCount? number - 每条线最少的点的数目(缺省为3)

Returns: GeoJsonGeomertry


# randomPoint

randomPoint(xRatio?: number, yRatio?: number): GeoPoint

生成一个随机点

# Parameters
Name Type Default value Description
xRatio number 0.6 x轴范围比例 缺省 0.6
yRatio number 0.6 y轴范围比例 缺省 0.6

Returns: GeoPoint


# randomPoints

randomPoints(minPointCount: number, maxPointCount: number, xRatio?: number, yRatio?: number): GeoPoint[]

生成一个随机点序列

# Parameters
Name Type Default value Description
minPointCount number - 最少的点数
maxPointCount number - 最多的点数
xRatio number 0.6 x轴范围比例 缺省 0.6
yRatio number 0.6 y轴范围比例 缺省 0.6

Returns: GeoPoint[]


# rightBottom

rightBottom(): GeoPoint

得到右下角

Returns: GeoPoint


# rightTop

rightTop(): GeoPoint

得到右上角

Returns: GeoPoint


# scale

scale(ratio: number, origin?: null | GeoPoint): GeoBounds

按照比例扩大/缩小出一个新的 GeoBounds。

# Parameters
Name Type Description
ratio number 比例
origin? null | GeoPoint 扩大时的基准点,默认为当前 bounds 的中心点

Returns: GeoBounds


# scaleXY

scaleXY(ratioX: number, ratioY: number, origin?: null | GeoPoint): GeoBounds

按照XY比例扩大/缩小出一个新的 GeoBounds。

# Parameters
Name Type Description
ratioX number X比例
ratioY number Y比例
origin? null | GeoPoint 扩大时的基准点,默认为当前 bounds 的中心点

Returns: GeoBounds


# set

set(min: GeoPoint, max: GeoPoint): void

设置包围盒范围

# Parameters
Name Type Description
min GeoPoint 最小值
max GeoPoint 最大值

Returns: void


# square

square(isLatlng?: boolean, isMinValue?: boolean): GeoBounds

变成正方形,使宽高相等

return{geobounds}

# Parameters
Name Type Description
isLatlng? boolean 是否是经纬度
isMinValue? boolean 是否取宽高的最小值或最大值,默认最大值

Returns: GeoBounds


# toArray

toArray(): number[]

返回数组

Returns: number[]

The coordinates represented as a array of the format [minx, miny, maxx, maxy]'.


# toPointArray

toPointArray(): [number, number][]

返回点数组,包括四个顶点

Returns: [number, number][]

The coordinates represented as a array of the format [[minx,maxy], [maxx,maxy], [maxx,miny], [minx,miny]]'.


# toString

toString(fixed?: number): string

返回字符串.

# Parameters
Name Type Default value
fixed number 6

Returns: string

The coordinates represented as a string of the format minx, miny, maxx, maxy'.


# translate

translate(dx: number, dy: number): void

位移包围盒

# Parameters
Name Type
dx number
dy number

Returns: void


# union

union(bound: GeoBounds): GeoBounds

求多个包围盒的并集

# Parameters
Name Type
bound GeoBounds

Returns: GeoBounds


# update

update(vertices: GeoPoint[]): void

更新包围盒

# Parameters
Name Type
vertices GeoPoint[]

Returns: void


# updateByBounds

updateByBounds(bounds: GeoBounds | GeoBounds[]): void

根据子包围盒更新包围盒

# Parameters
Name Type
bounds GeoBounds | GeoBounds[]

Returns: void


# width

width(): number

获取宽度

Returns: number


# fromArray

Static fromArray(input: [number, number, number, number]): GeoBounds

根据数组创建 GeoBounds.

Example:

const b = GeoBounds.fromArray([left, bottom, right, top]);
1
# Parameters
Name Type
input [number, number, number, number]

Returns: GeoBounds


# fromCenterWH

Static fromCenterWH(center: GeoPointLike, width: number, height?: number): GeoBounds

根据中心点和长,宽生成bounds

# Parameters
Name Type Description
center GeoPointLike 中心点
width number
height? number 高,不输入时与宽一样

Returns: GeoBounds


# fromDataExtent

Static fromDataExtent(input: GeoPoint | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection | [number, number] | [number, number, number] | { x: number ; y: number ; z?: number } | { lat: number ; lng: number } | { lat: number ; lon: number } | GeoPointLike[]): GeoBounds

根据数据范围来生成bounds

# Parameters
Name Type
input GeoPoint | Feature<Geometry | GeometryCollection, Properties> | FeatureCollection<Geometry | GeometryCollection, Properties> | Geometry | GeometryCollection | [number, number] | [number, number, number] | { x: number ; y: number ; z?: number } | { lat: number ; lng: number } | { lat: number ; lon: number } | GeoPointLike[]

Returns: GeoBounds


# fromString

Static fromString(input: string): GeoBounds

根据数组创建 GeoBounds.

Example:

const b = GeoBounds.fromString("[1,2,3,4]");
1
# Parameters
Name Type
input string

Returns: GeoBounds

vjmap / Exports / GeoPoint