@soonspacejs/plugin-heat-map 2.11.13 → 2.11.15
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/README.md +4 -4
- package/dist/index.d.ts +71 -0
- package/dist/tools.d.ts +25 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# @soonspacejs/plugin-heat-map
|
|
2
|
-
|
|
3
|
-
> Haet-map plugin for SoonSpace.js
|
|
4
|
-
|
|
1
|
+
# @soonspacejs/plugin-heat-map
|
|
2
|
+
|
|
3
|
+
> Haet-map plugin for SoonSpace.js
|
|
4
|
+
|
|
5
5
|
Document: [http://www.xwbuilders.com:8800/plugin/heat-map.html](http://www.xwbuilders.com:8800/plugin/heat-map.html)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Box2, Matrix4, Vector3 } from 'three';
|
|
2
|
+
import SoonSpace, { IVector3, PlaneIVector2 } from 'soonspacejs';
|
|
3
|
+
import type { PluginObject } from 'soonspacejs/types/Library';
|
|
4
|
+
import HeatMap, { DataPoint } from 'heatmap-ts';
|
|
5
|
+
export interface SceneDataPoint extends Omit<DataPoint, 'y'> {
|
|
6
|
+
z: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ScenePolygonDataPoint extends DataPoint {
|
|
9
|
+
z: number;
|
|
10
|
+
}
|
|
11
|
+
export interface CanvasSize {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export interface CreateParam {
|
|
16
|
+
id: string;
|
|
17
|
+
name?: PluginObject['name'];
|
|
18
|
+
data: SceneDataPoint[];
|
|
19
|
+
yAxisHeight: number;
|
|
20
|
+
minPosition: PlaneIVector2;
|
|
21
|
+
maxPosition: PlaneIVector2;
|
|
22
|
+
min?: number;
|
|
23
|
+
max?: number;
|
|
24
|
+
radius?: number;
|
|
25
|
+
canvasScalar?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface CreatePolygonParam {
|
|
28
|
+
id: string;
|
|
29
|
+
name?: PluginObject['name'];
|
|
30
|
+
data: ScenePolygonDataPoint[];
|
|
31
|
+
points: IVector3[];
|
|
32
|
+
min?: number;
|
|
33
|
+
max?: number;
|
|
34
|
+
radius?: number;
|
|
35
|
+
}
|
|
36
|
+
interface StoreValue {
|
|
37
|
+
object: PluginObject;
|
|
38
|
+
canvas: HTMLCanvasElement;
|
|
39
|
+
param: CreateParam;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
projectionMatrix?: Matrix4;
|
|
43
|
+
polygonBox?: Box2;
|
|
44
|
+
}
|
|
45
|
+
interface StoreValuePolygon {
|
|
46
|
+
object: PluginObject;
|
|
47
|
+
canvas: HTMLCanvasElement;
|
|
48
|
+
param: CreatePolygonParam;
|
|
49
|
+
projectionMatrix: Matrix4;
|
|
50
|
+
polygonBox: Box2;
|
|
51
|
+
position: Vector3;
|
|
52
|
+
}
|
|
53
|
+
export default class HeatMapPlugin {
|
|
54
|
+
readonly ssp: SoonSpace;
|
|
55
|
+
hmInstance: HeatMap | null;
|
|
56
|
+
readonly store: Map<string | number, StoreValue | StoreValuePolygon>;
|
|
57
|
+
constructor(ssp: SoonSpace);
|
|
58
|
+
maxCanvasSize: number;
|
|
59
|
+
create(param: CreateParam): PluginObject;
|
|
60
|
+
createPolygon(param: CreatePolygonParam): PluginObject;
|
|
61
|
+
setData(id: CreateParam['id'], data: CreateParam['data']): PluginObject | void;
|
|
62
|
+
setDataPolygon(id: CreateParam['id'], data: CreatePolygonParam['data']): PluginObject | void;
|
|
63
|
+
getById(id: PluginObject['id']): PluginObject | null;
|
|
64
|
+
getByName(name: string): PluginObject[];
|
|
65
|
+
removeById(id: PluginObject['id']): boolean;
|
|
66
|
+
private createInitData;
|
|
67
|
+
private _formatCanvasSize;
|
|
68
|
+
private _formatData;
|
|
69
|
+
private _formatData_Polygon;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Matrix3, Vector3, Box2, Matrix4, ShapeGeometry } from 'three';
|
|
2
|
+
export declare function getPolygonGeometryInfo(points: Vector3[]): {
|
|
3
|
+
geometry: ShapeGeometry;
|
|
4
|
+
polygonBox: Box2;
|
|
5
|
+
modelMatrix: Matrix4;
|
|
6
|
+
planeMatrix: Matrix4;
|
|
7
|
+
projectionMatrix: Matrix4;
|
|
8
|
+
position: Vector3;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 创建平面投影矩阵
|
|
12
|
+
* @param points
|
|
13
|
+
*/
|
|
14
|
+
export declare function createPlaneMatrix(points: Vector3[]): Matrix3;
|
|
15
|
+
/**
|
|
16
|
+
* 创建 uv 变换矩阵
|
|
17
|
+
* @remarks
|
|
18
|
+
* 需要对热力图数据进行y值翻转
|
|
19
|
+
* @param points
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare function createUVMatrix(box: Box2): Matrix3;
|
|
23
|
+
/**
|
|
24
|
+
* 不需要对热力图数据进行y值翻转
|
|
25
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-heat-map",
|
|
3
3
|
"pluginName": "HeatMapPlugin",
|
|
4
|
-
"version": "2.11.
|
|
4
|
+
"version": "2.11.15",
|
|
5
5
|
"description": "Haet-map plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"heatmap-ts": "^0.0.4"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "428102fac08e80d838003505c5d52575335f2f90",
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"soonspacejs": "2.11.
|
|
21
|
+
"soonspacejs": "2.11.15"
|
|
22
22
|
}
|
|
23
23
|
}
|