gis-common 4.2.4 → 4.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Color.d.ts +67 -0
- package/dist/core/HashMap.d.ts +14 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/gis-common.es.js +1423 -1127
- package/dist/gis-common.umd.js +1 -1
- package/dist/utils/BrowserUtil.d.ts +65 -16
- package/dist/utils/CommUtil.d.ts +1 -1
- package/dist/utils/CoordsUtil.d.ts +14 -6
- package/dist/utils/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/utils/ColorUtil.d.ts +0 -37
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
interface ColorRGBA {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
a?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 基本的颜色类,支持RGB颜色
|
|
9
|
+
*/
|
|
10
|
+
export default class Color {
|
|
11
|
+
private _r;
|
|
12
|
+
private _g;
|
|
13
|
+
private _b;
|
|
14
|
+
private _alpha;
|
|
15
|
+
constructor(r: number, g: number, b: number, a?: number);
|
|
16
|
+
private _validateColorChannel;
|
|
17
|
+
get rgba(): ColorRGBA;
|
|
18
|
+
get hex(): string;
|
|
19
|
+
setAlpha(a: number): Color;
|
|
20
|
+
setRgb(r: number, g: number, b: number): Color;
|
|
21
|
+
/**
|
|
22
|
+
* 从RGBA字符串创建Color对象
|
|
23
|
+
*
|
|
24
|
+
* @param rgbaValue RGBA颜色值字符串,格式为"rgba(r,g,b,a)"或"rgb(r,g,b)"
|
|
25
|
+
* @returns 返回Color对象
|
|
26
|
+
* @throws 如果rgbaValue不是有效的RGBA颜色值,则抛出错误
|
|
27
|
+
*/
|
|
28
|
+
static fromRgba(rgbaValue: string): Color;
|
|
29
|
+
/**
|
|
30
|
+
* 将十六进制颜色值转换为颜色对象
|
|
31
|
+
*
|
|
32
|
+
* @param hexValue 十六进制颜色值,可带或不带#前缀,支持3位和6位表示
|
|
33
|
+
* @returns 返回颜色对象
|
|
34
|
+
*/
|
|
35
|
+
static fromHex(hexValue: string, a?: number): Color;
|
|
36
|
+
/**
|
|
37
|
+
* 从 HSL 字符串创建颜色对象
|
|
38
|
+
*
|
|
39
|
+
* @param hsl HSL 字符串,格式为 hsl(h, s%, l%) 或 hsla(h, s%, l%, a)
|
|
40
|
+
* @returns 返回颜色对象,如果 hsl 字符串无效则返回 null
|
|
41
|
+
*/
|
|
42
|
+
static fromHsl(hslValue: string): Color;
|
|
43
|
+
/**
|
|
44
|
+
* 从字符串中创建颜色对象
|
|
45
|
+
*
|
|
46
|
+
* @param str 字符串类型的颜色值,支持rgba、hex、hsl格式
|
|
47
|
+
* @returns 返回创建的颜色对象
|
|
48
|
+
* @throws 当颜色值无效时,抛出错误
|
|
49
|
+
*/
|
|
50
|
+
static from(str: string): Color;
|
|
51
|
+
/**
|
|
52
|
+
* 将RGB颜色值转换为十六进制颜色值
|
|
53
|
+
*
|
|
54
|
+
* @param r 红色分量值,取值范围0-255
|
|
55
|
+
* @param g 绿色分量值,取值范围0-255
|
|
56
|
+
* @param b 蓝色分量值,取值范围0-255
|
|
57
|
+
* @param a 可选参数,透明度分量值,取值范围0-1
|
|
58
|
+
* @returns 十六进制颜色值,格式为#RRGGBB或#RRGGBBAA
|
|
59
|
+
*/
|
|
60
|
+
static rgb2hex(r: number, g: number, b: number, a?: number): string;
|
|
61
|
+
static isHex(a: string): boolean;
|
|
62
|
+
static isRgb(a: string): boolean;
|
|
63
|
+
static isHsl(a: string): boolean;
|
|
64
|
+
static isColor(a: string): boolean;
|
|
65
|
+
static random(): Color;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
package/dist/core/HashMap.d.ts
CHANGED
|
@@ -3,5 +3,18 @@ export default class HashMap<K, V> extends Map<K, V> {
|
|
|
3
3
|
_values(): V[];
|
|
4
4
|
_keys(): K[];
|
|
5
5
|
_entries(): [K, V][];
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* 从键值对数组创建一个HashMap对象
|
|
8
|
+
*
|
|
9
|
+
* @param array 键值对数组,默认为空数组
|
|
10
|
+
* @returns 返回一个新的HashMap对象
|
|
11
|
+
*/
|
|
12
|
+
static fromEntries<K extends string | number | symbol, V>(array?: Array<[K, V]>): HashMap<K, V>;
|
|
13
|
+
/**
|
|
14
|
+
* 从JSON字符串创建HashMap实例
|
|
15
|
+
*
|
|
16
|
+
* @param str JSON字符串
|
|
17
|
+
* @returns HashMap实例
|
|
18
|
+
*/
|
|
19
|
+
static fromJson<K extends string | number | symbol, V>(str: any): HashMap<K, V>;
|
|
7
20
|
}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as AudioPlayer } from './AudioPlayer';
|
|
2
2
|
export { default as Cookie } from './Cookie';
|
|
3
|
+
export { default as Color } from './Color';
|
|
3
4
|
export { default as CanvasDrawer } from './CanvasDrawer';
|
|
4
5
|
export { default as EventDispatcher } from './EventDispatcher';
|
|
5
6
|
export { default as HashMap } from './HashMap';
|