Skip to content

m-gis核心库 v0.4.4


m-gis核心库 / Util

类: Util

定义于: utils/Util.ts:34

构造函数

构造函数

new Util(): Util

返回

Util

方法

altitudeToZoom()

static altitudeToZoom(altitude): number

定义于: utils/Util.ts:152

计算相机高度和地图层级之间的转换

参数

altitude

number

相机高度

返回

number

地图层级


calculateHash()

static calculateHash(text, type?): Promise<any>

定义于: utils/Util.ts:427

计算字符串的哈希值

参数

text

string

字符串

type?

"SHA-1" | "SHA-256" | "SHA-384" | "SHA-512"

哈希类型,默认SHA-256,可选SHA-1、SHA-256、SHA-384、SHA-512

返回

Promise<any>

哈希值


createGuid()

static createGuid(): string

定义于: utils/Util.ts:55

返回

string


getBounds()

static getBounds(positions?, expand?): object

定义于: utils/Util.ts:312

获取坐标串的边界坐标

参数

positions?

never[] = []

坐标串

expand?

number = 0

边界坐标放大

返回

object

边界坐标

east

east: number = maxLng

north

north: number = maxLat

south

south: number = minLat

west

west: number = minLng


getCenter()

static getCenter(positions): Position

定义于: utils/Util.ts:161

参数

positions

Position[]

返回

Position


getCesiumTdt()

static getCesiumTdt(cesiumTdtSrc): any

定义于: utils/Util.ts:282

获取天地图的三维服务

参数

cesiumTdtSrc

string

返回

any

返回CesiumTdt对象


getDistance()

static getDistance(positions): number

定义于: utils/Util.ts:182

参数

positions

Position[]

返回

number


getId()

static getId(prefix?): string

定义于: utils/Util.ts:125

生成自增id

参数

prefix?

string

自定义首字符

返回

string

自增id


getIPAddress()

static getIPAddress(): Promise<unknown>

定义于: utils/Util.ts:404

获取IP地址对应的地理位置

返回

Promise<unknown>

返回Promise对象


getRealPlanetRadius()

static getRealPlanetRadius(viewer?): number

定义于: utils/Util.ts:353

获取地球半径

参数

viewer?

Viewer

返回

number

地球半径


getValueByDistance()

static getValueByDistance(distance, translucencyByDistance): number

定义于: utils/Util.ts:213

参数

distance

number

translucencyByDistance

NearFarScalar

返回

number


hashToRange()

static hashToRange(hash, range): number

定义于: utils/Util.ts:440

参数

hash

string

range

number

返回

number


isBetween()

static isBetween(value, min, max): boolean

定义于: utils/Util.ts:340

参数

value

number

min

number

max

number

返回

boolean


isEmptyObject()

static isEmptyObject(e): boolean

定义于: utils/Util.ts:135

判断对象是否为空

参数

e

object

对象

返回

boolean

是否为空


isPointOnLineSegment()

static isPointOnLineSegment(A, B, C, tolerance?): boolean

定义于: utils/Util.ts:453

判断点C是否在A和B的连线上

参数

A

Cartesian3

B

Cartesian3

C

Cartesian3

tolerance?

number = 1e-6

返回

boolean


jsonp()

static jsonp(url): Promise<unknown>

定义于: utils/Util.ts:371

jsonp请求

参数

url

string

请求地址

返回

Promise<unknown>

返回Promise对象


loadJS()

static loadJS(src, callback): void

定义于: utils/Util.ts:261

异步加载一个js文件/js API

参数

src

string

js资源路径

callback

(script) => void

js资源加载完的回调函数

返回

void


merge()

static merge(dest, ...sources): any

定义于: utils/Util.ts:67

参数

dest

any

sources

...any

返回

any


merge2()

static merge2(dest, ...sources): any

定义于: utils/Util.ts:84

合并对象,自动去除回调函数式的属性值

参数

dest

any

目标对象

sources

...any

源对象

返回

any

合并后的对象


mergeModify()

static mergeModify(dest, ...sources): any

定义于: utils/Util.ts:107

合并对象,仅合并不一致的属性

参数

dest

any

目标对象

sources

...any

源对象

返回

any

合并后的对象


trim()

static trim(str): string

定义于: utils/Util.ts:142

参数

str

string

返回

string


updateCssTransform()

static updateCssTransform(transformStr, key, value): string

定义于: utils/Util.ts:232

参数

transformStr

string

key

string

value

string

返回

string


uuid()

static uuid(prefix?): string

定义于: utils/Util.ts:41

生成 uuid

参数

prefix?

string = 'D'

自定义首字符

返回

string

返回生成的 uuid 字符串

MGis 地理三维库