react-map4d-map 1.2.5 → 1.2.7

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.
@@ -0,0 +1,34 @@
1
+ import { Vector3 } from "./Vector3";
2
+ export declare class Color {
3
+ alpha: number;
4
+ private _buffer;
5
+ /**
6
+ * create a color
7
+ */
8
+ constructor(red?: number, green?: number, blue?: number, alpha?: number);
9
+ /**
10
+ * get the buffer
11
+ */
12
+ rgbBuffer(): Float32Array;
13
+ /**
14
+ * get the buffer
15
+ */
16
+ buffer(): Float32Array;
17
+ get red(): number;
18
+ get green(): number;
19
+ get blue(): number;
20
+ /**
21
+ * string style for canvas
22
+ * @return {string}
23
+ */
24
+ get rgba(): string;
25
+ /**
26
+ * create color from hex string
27
+ */
28
+ static fromHex(hexString?: string): Color;
29
+ static fromInt(colorCode?: number): Color;
30
+ static fromVec3(color: Vector3): Color;
31
+ static mix(a: Color, b: Color, factor: number): Color;
32
+ get code(): string;
33
+ static isValid(colorString: string): boolean;
34
+ }
@@ -0,0 +1,16 @@
1
+ import { Texture } from "./Texture";
2
+ export declare class FrameBuffer {
3
+ private gl;
4
+ private width;
5
+ private height;
6
+ frameBufferId: WebGLFramebuffer;
7
+ colorTexture: Texture;
8
+ depthBuffer: WebGLRenderbuffer;
9
+ private isReady;
10
+ constructor(gl: WebGLRenderingContext, width: number, height: number);
11
+ init(): boolean;
12
+ bind(): void;
13
+ unbind(): void;
14
+ drawDebug(): void;
15
+ destroy(): void;
16
+ }
@@ -0,0 +1,8 @@
1
+ import { Vector2 } from "./Vector2";
2
+ export declare class MathUtils {
3
+ static clamp(value: number, min: number, max: number): number;
4
+ static toRadians(angleDegrees: number): number;
5
+ static distance(p1: Vector2, p2: Vector2): number;
6
+ static findNextPowerOf2(n: number): number;
7
+ static findPreviousPowerOf2(n: number): number;
8
+ }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * the matrix class
3
+ */
4
+ import { Vector3 } from "./Vector3";
5
+ export declare class Matrix4 {
6
+ data: Float32Array;
7
+ /**
8
+ * create an eye 4x4 matrix
9
+ * @param data
10
+ */
11
+ constructor(data?: Float32Array);
12
+ setIdentity(x?: number, y?: number, z?: number): this;
13
+ copy(other: Matrix4): this;
14
+ /**
15
+ * get a translation matrix
16
+ * @param x
17
+ * @param y
18
+ * @param z
19
+ * @returns {Matrix4}
20
+ */
21
+ static translate(x: number, y: number, z?: number): Matrix4;
22
+ translate(x: number, y: number, z?: number): this;
23
+ get position(): Vector3;
24
+ /**
25
+ * get a rotation matrix around x-axis
26
+ * @param alpha
27
+ * @returns {Matrix4}
28
+ */
29
+ static rotateX(alpha: number): Matrix4;
30
+ setRotationX(alpha: number): this;
31
+ rotateX(alpha: number): this;
32
+ /**
33
+ * get a rotation matrix around y-axis
34
+ * @param alpha
35
+ * @returns {Matrix4}
36
+ */
37
+ static rotateY(alpha: number): Matrix4;
38
+ setRotationY(alpha: number): this;
39
+ rotateY(alpha: number): this;
40
+ /**
41
+ * get a rotation matrix around z-axis
42
+ * @param alpha
43
+ * @returns {Matrix4}
44
+ */
45
+ static rotateZ(alpha: number): Matrix4;
46
+ setRotationZ(alpha: number): this;
47
+ rotateZ(alpha: number): this;
48
+ /**
49
+ * get a scale matrix
50
+ * @param x
51
+ * @param y
52
+ * @param z
53
+ * @returns {Matrix4}
54
+ */
55
+ /**
56
+ * concatenate with other transformation matrix
57
+ * @param matrix
58
+ * @returns {Matrix4}
59
+ */
60
+ multiply(matrix: Matrix4): Matrix4;
61
+ /**
62
+ *
63
+ * @param left
64
+ * @param right
65
+ * @param bottom
66
+ * @param top
67
+ * @param near
68
+ * @param far
69
+ * @returns {Matrix4}
70
+ */
71
+ static ortho(left: number, right: number, bottom: number, top: number, near?: number, far?: number): Matrix4;
72
+ setOrtho(left: number, right: number, bottom: number, top: number, near?: number, far?: number): this;
73
+ /**
74
+ * create a perspective matrix
75
+ * @param fov
76
+ * @param aspect
77
+ * @param near
78
+ * @param far
79
+ * @returns {Matrix4}
80
+ */
81
+ static perspective(fov: number, aspect: number, near: number, far: number): Matrix4;
82
+ setPerspective(fov: number, aspect: number, near: number, far: number): void;
83
+ /**
84
+ *
85
+ * @param left
86
+ * @param right
87
+ * @param bottom
88
+ * @param top
89
+ * @param near
90
+ * @param far
91
+ * @returns {Matrix4}
92
+ */
93
+ static frustum(left: number, right: number, bottom: number, top: number, near?: number, far?: number): Matrix4;
94
+ setFrustum(left: number, right: number, bottom: number, top: number, near?: number, far?: number): void;
95
+ /**
96
+ * transform a vector
97
+ * @param vector
98
+ * @param w include transformation
99
+ */
100
+ transform(vector: Vector3, w?: number): Vector3;
101
+ /**
102
+ * get the matrix buffer
103
+ * @returns {number[]}
104
+ */
105
+ buffer(): Float32Array;
106
+ /**
107
+ * return look at matrix
108
+ * @param eye
109
+ * @param target
110
+ * @param scale
111
+ * @param up
112
+ * @returns {Matrix4}
113
+ */
114
+ inverse(): Matrix4;
115
+ }
@@ -0,0 +1,77 @@
1
+ import { AttributeInfo } from "./Shader";
2
+ import { ResourceReference } from "./ResourceReference";
3
+ import { Vector3 } from "./Vector3";
4
+ import { Point } from "../public/Point";
5
+ export declare class Model extends ResourceReference {
6
+ private gl;
7
+ /**
8
+ *
9
+ * @type {Array}
10
+ */
11
+ attributeInfos: AttributeInfo[];
12
+ /**
13
+ * the vertices buffer
14
+ */
15
+ arrayBuffer: WebGLBuffer;
16
+ /**
17
+ * the index buffer
18
+ */
19
+ indexBuffer: WebGLBuffer;
20
+ /**
21
+ * Number of vertices
22
+ */
23
+ numOfVertices: number;
24
+ highestModelPosition: Vector3;
25
+ private _points;
26
+ private _minX;
27
+ private _maxX;
28
+ private _minY;
29
+ private _maxY;
30
+ private _minZ;
31
+ private _maxZ;
32
+ /**
33
+ * create an model with
34
+ * @param gl
35
+ * @param type the item type
36
+ * @param data
37
+ * @param properties
38
+ * @param attributes
39
+ * @param indices the indices
40
+ */
41
+ constructor(gl: WebGLRenderingContext, data?: any[], properties?: string[], attributes?: string[], indices?: number[]);
42
+ init(data?: any, attributeInfos?: AttributeInfo[], indices?: number[]): void;
43
+ init3dObjectFormArrayBuffer(vertices?: ArrayBuffer): void;
44
+ init3dObject(data?: number[], indices?: number[]): void;
45
+ /**
46
+ * set indices
47
+ * @param indices
48
+ */
49
+ setIndices(indices: number[]): void;
50
+ bind(): void;
51
+ unbind(): void;
52
+ /**
53
+ * render this model
54
+ */
55
+ render(type: number): void;
56
+ renderPartial(type: number, first: number, count: number): void;
57
+ /**
58
+ * destroy the model to save memory
59
+ */
60
+ destroy(): void;
61
+ setHighestModelPosition(highestModelPosition: Vector3): void;
62
+ getHighestModelPosition(): Vector3;
63
+ get points(): Point[];
64
+ set points(value: Point[]);
65
+ get maxX(): number;
66
+ set maxX(value: number);
67
+ get maxY(): number;
68
+ set maxY(value: number);
69
+ get maxZ(): number;
70
+ set maxZ(value: number);
71
+ get minX(): number;
72
+ set minX(value: number);
73
+ get minY(): number;
74
+ set minY(value: number);
75
+ get minZ(): number;
76
+ set minZ(value: number);
77
+ }
@@ -0,0 +1,8 @@
1
+ export declare abstract class ResourceReference {
2
+ private _reference;
3
+ protected constructor();
4
+ protected abstract destroy(): void;
5
+ retain(): void;
6
+ release(): void;
7
+ get reference(): number;
8
+ }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * attribute information to store
3
+ * data for webgl attribute
4
+ */
5
+ export declare class AttributeInfo {
6
+ name: string;
7
+ size: number;
8
+ offset: number;
9
+ stride: number;
10
+ /**
11
+ * create an attribute information
12
+ * @param name
13
+ * @param size
14
+ * @param offset
15
+ * @param stride
16
+ */
17
+ constructor(name: string, size: number, offset?: number, stride?: number);
18
+ }
19
+ /**
20
+ * the shader class - for managing shader
21
+ */
22
+ export declare class Shader {
23
+ private gl;
24
+ /**
25
+ * the program to user
26
+ */
27
+ program: WebGLProgram;
28
+ fragmentShader: WebGLShader;
29
+ vertexShader: WebGLShader;
30
+ /**
31
+ * current texture unit
32
+ * @type {number}
33
+ */
34
+ textureUnit: number;
35
+ readonly mvpMatrixUniform: WebGLUniformLocation;
36
+ readonly timeUniform: WebGLUniformLocation;
37
+ readonly enableWaterUniform: WebGLUniformLocation;
38
+ readonly textureUniform: WebGLUniformLocation;
39
+ readonly waterDisplacementUniform: WebGLUniformLocation;
40
+ readonly waterColorUniform: WebGLUniformLocation;
41
+ readonly opacityUniform: WebGLUniformLocation;
42
+ readonly lightColorUniform: WebGLUniformLocation;
43
+ readonly lightPositionUniform: WebGLUniformLocation;
44
+ readonly fogStartUniform: WebGLUniformLocation;
45
+ readonly fogRangeUniform: WebGLUniformLocation;
46
+ readonly fogColorUniform: WebGLUniformLocation;
47
+ readonly shadowMvpMatrixUniform: WebGLUniformLocation;
48
+ readonly shadowMapUniform: WebGLUniformLocation;
49
+ readonly lineWidthUniform: WebGLUniformLocation;
50
+ readonly colorUniform: WebGLUniformLocation;
51
+ readonly textureScaleUniform: WebGLUniformLocation;
52
+ readonly useStrokePatternUniform: WebGLUniformLocation;
53
+ readonly useIconUniform: WebGLUniformLocation;
54
+ readonly radiusUniform: WebGLUniformLocation;
55
+ readonly strokeColorUniform: WebGLUniformLocation;
56
+ readonly outerRadiusUniform: WebGLUniformLocation;
57
+ readonly innerRadiusUniform: WebGLUniformLocation;
58
+ readonly modelMatrixUniform: WebGLUniformLocation;
59
+ readonly cameraDirectionUniform: WebGLUniformLocation;
60
+ readonly lowerLimitUniform: WebGLUniformLocation;
61
+ readonly upperLimitUniform: WebGLUniformLocation;
62
+ readonly skyColorUniform: WebGLUniformLocation;
63
+ readonly texsizeUniform: WebGLUniformLocation;
64
+ readonly pixelScaleUniform: WebGLUniformLocation;
65
+ readonly gammaScaleUniform: WebGLUniformLocation;
66
+ readonly isHaloUniform: WebGLUniformLocation;
67
+ readonly textSizeUniform: WebGLUniformLocation;
68
+ readonly useMaskTextureUniform: WebGLUniformLocation;
69
+ readonly spriteInfoUniform: WebGLUniformLocation;
70
+ readonly paddingUniform: WebGLUniformLocation;
71
+ /**
72
+ * dictionary that stores all attributes
73
+ * @type {{}}
74
+ */
75
+ attributes: {
76
+ [key: string]: number;
77
+ };
78
+ /**
79
+ * create a shader with sources
80
+ * @param gl
81
+ * @param vertexSource
82
+ * @param fragmentSource
83
+ */
84
+ constructor(gl: WebGLRenderingContext, vertexSource: string, fragmentSource: string);
85
+ /**
86
+ * load all attributes of this shader
87
+ */
88
+ loadAttributes(): void;
89
+ /**
90
+ * load a shader with source
91
+ * @param type type of the shader | either VERTEX_SHADER or FRAGMENT_SHADER
92
+ * @param source
93
+ * @returns {WebGLShader}
94
+ */
95
+ loadShader(type: number, source: string): WebGLShader;
96
+ /**
97
+ * Bind the shader to use
98
+ */
99
+ bind(): void;
100
+ /**
101
+ * Reset texture unit
102
+ */
103
+ resetTextureUnit(): void;
104
+ /**
105
+ * Set attributes
106
+ * @param attributeInfos
107
+ */
108
+ setAttributes(attributeInfos: AttributeInfo[]): void;
109
+ setTexture(location: WebGLUniformLocation, textureId: WebGLTexture): void;
110
+ /**
111
+ * disable all attributes
112
+ */
113
+ disableAttributes(): void;
114
+ /**
115
+ * destroy this shader to release memory
116
+ */
117
+ destroy(): void;
118
+ }
@@ -0,0 +1,42 @@
1
+ export declare class ShaderSource {
2
+ static lightEffect: string;
3
+ static waterFragment: string;
4
+ static basicVS: string;
5
+ static basicFS: string;
6
+ static rasterFogVS: string;
7
+ static rasterFogFS: string;
8
+ static polylineVS: string;
9
+ static polylineFS: string;
10
+ static fillVS: string;
11
+ static fillFS: string;
12
+ static geoJsonVS: string;
13
+ static geoJsonFS: string;
14
+ static circleVS: string;
15
+ static circleFS: string;
16
+ static markerVS: string;
17
+ static markerFS: string;
18
+ static buildingVS: string;
19
+ static buildingFS: string;
20
+ static buildingSelectionVS: string;
21
+ static buildingSelectionFS: string;
22
+ static debugSelectionVS: string;
23
+ static debugSelectionFS: string;
24
+ static skyVS: string;
25
+ static skyFS: string;
26
+ static shadowMappingVS: string;
27
+ static shadowMappingFS: string;
28
+ static shadowFS: string;
29
+ static raster3DWithShadowVS: string;
30
+ static raster3DWithShadowFS: string;
31
+ static rasterWithShadowVS: string;
32
+ static rasterWithShadowFS: string;
33
+ static buildingWithShadowVS: string;
34
+ static buildingWithShadowFS: string;
35
+ static buildingOutliningFS: string;
36
+ static textLabelVS: string;
37
+ static textLabelFS: string;
38
+ static tileDebugVS: string;
39
+ static tileDebugFS: string;
40
+ static collisionDebugVS: string;
41
+ static collisionDebugFS: string;
42
+ }
@@ -0,0 +1,51 @@
1
+ import { ResourceReference } from "./ResourceReference";
2
+ import { Color } from "./Color";
3
+ export declare class TextureFiltering {
4
+ min?: number;
5
+ mag?: number;
6
+ constructor(min: number, mag: number);
7
+ }
8
+ export declare class TextureWrapping {
9
+ wraps: number;
10
+ wrapt: number;
11
+ constructor(wraps: number, wrapt: number);
12
+ }
13
+ export declare class TextureOptions {
14
+ target: number;
15
+ internalFormat: number;
16
+ format: number;
17
+ type: number;
18
+ filtering: TextureFiltering;
19
+ wrapping: TextureWrapping;
20
+ constructor(target: number, internalFormat: number, format: number, type: number, filtering: TextureFiltering, wrapping: TextureWrapping);
21
+ }
22
+ /**
23
+ * class for managing texture 2d
24
+ */
25
+ export declare class Texture extends ResourceReference {
26
+ private gl;
27
+ /**
28
+ * the texture Id
29
+ */
30
+ textureId: WebGLTexture;
31
+ options: TextureOptions;
32
+ width: number;
33
+ height: number;
34
+ isLoaded: boolean;
35
+ constructor(gl: WebGLRenderingContext, options?: TextureOptions);
36
+ private initDefaultTextureOptions;
37
+ private init;
38
+ bind(): void;
39
+ unbind(): void;
40
+ loadColor(color: Color): void;
41
+ loadImageFromArrayBuffer(data: ArrayBuffer, width: number, height: number, flip?: boolean, onLoad?: Function): void;
42
+ loadImage(url: string, onLoad?: Function, flip?: boolean): void;
43
+ loadImageDataArray(data: Uint8Array, width: number, height: number, filterParam: number, onLoad?: Function): void;
44
+ /**
45
+ * destroy the map texture
46
+ */
47
+ destroy(): void;
48
+ applyFilter(isGenerateMipmap?: boolean): void;
49
+ initFrameBufferTexture(width: number, height: number): void;
50
+ isPowerOf2(value: any): boolean;
51
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * class vector 2
3
+ */
4
+ export declare class Vector2 {
5
+ x: number;
6
+ y: number;
7
+ /**
8
+ * create a vector 2 class
9
+ * @param x
10
+ * @param y
11
+ */
12
+ constructor(x?: number, y?: number);
13
+ clone(): Vector2;
14
+ /**
15
+ * get the length of the vector
16
+ * @returns {number}
17
+ */
18
+ get length(): number;
19
+ /**
20
+ * @return {number}
21
+ */
22
+ get lengthSq(): number;
23
+ /**
24
+ * normalize the vector
25
+ * @returns {Vector2}
26
+ */
27
+ normalize(): Vector2;
28
+ /**
29
+ * set value of the vector
30
+ * @param a
31
+ */
32
+ set(a: Vector2): void;
33
+ /**
34
+ * invert the vector direction
35
+ * @returns {Vector2}
36
+ */
37
+ invert(): Vector2;
38
+ /**
39
+ * rotate 90
40
+ * @returns {Vector2}
41
+ */
42
+ rotate90(): Vector2;
43
+ /**
44
+ * add to another vector
45
+ * @param a
46
+ * @returns {Vector2}
47
+ */
48
+ add(a: Vector2): Vector2;
49
+ /**
50
+ * subtract with another vector
51
+ * @param a
52
+ * @returns {Vector2}
53
+ */
54
+ subtract(a: Vector2): Vector2;
55
+ /**
56
+ * multiply by a number
57
+ * @param a
58
+ * @returns {Vector2}
59
+ */
60
+ multiply(a: number): Vector2;
61
+ /**
62
+ * rotate by an angle
63
+ * @param a
64
+ * @returns {Vector2}
65
+ */
66
+ rotateBy(a: number): Vector2;
67
+ rotateByRadian(a: number): Vector2;
68
+ /**
69
+ * multiply by a vector
70
+ * @param a
71
+ * @returns {Vector2}
72
+ */
73
+ cross(a: Vector2): number;
74
+ /**
75
+ * dot a vector
76
+ * @param a
77
+ * @returns {number}
78
+ */
79
+ dot(a: Vector2): number;
80
+ static perp(v1: number[], v2: number[]): Vector2;
81
+ static neg(v: Vector2): Vector2;
82
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * class vector 3
3
+ */
4
+ export declare class Vector3 {
5
+ x: number;
6
+ y: number;
7
+ z: number;
8
+ /**
9
+ * create a vector 3 class
10
+ * @param x
11
+ * @param y
12
+ * @param z
13
+ */
14
+ constructor(x?: number, y?: number, z?: number);
15
+ clone(): Vector3;
16
+ buffer(): Float32Array;
17
+ /**
18
+ * get the length of the vector
19
+ * @returns {number}
20
+ */
21
+ get length(): number;
22
+ /**
23
+ * @return {number}
24
+ */
25
+ get lengthSq(): number;
26
+ /**
27
+ * normalize the vector
28
+ * @returns {Vector3}
29
+ */
30
+ normalize(): Vector3;
31
+ /**
32
+ * set value of the vector
33
+ * @param a
34
+ */
35
+ set(a: Vector3): void;
36
+ /**
37
+ * invert the vector direction
38
+ * @returns {Vector3}
39
+ */
40
+ invert(): Vector3;
41
+ /**
42
+ * rotate 90
43
+ * @returns {Vector3}
44
+ */
45
+ rotate90(): Vector3;
46
+ /**
47
+ * add to another vector
48
+ * @param a
49
+ * @returns {Vector3}
50
+ */
51
+ add(a: Vector3): Vector3;
52
+ /**
53
+ * subtract with another vector
54
+ * @param a
55
+ * @returns {Vector3}
56
+ */
57
+ subtract(a: Vector3): Vector3;
58
+ /**
59
+ * multiply by a number
60
+ * @param a
61
+ * @returns {Vector3}
62
+ */
63
+ multiply(a: number): Vector3;
64
+ /**
65
+ * rotate by an angle
66
+ * @param a
67
+ * @returns {Vector3}
68
+ */
69
+ rotateBy(a: number): Vector3;
70
+ /**
71
+ * multiply by a vector
72
+ * @param a
73
+ * @returns {Vector3}
74
+ */
75
+ cross(a: Vector3): Vector3;
76
+ /**
77
+ * dot a vector
78
+ * @param a
79
+ * @returns {number}
80
+ */
81
+ dot(a: Vector3): number;
82
+ static perp(v1: number[], v2: number[]): Vector3;
83
+ static neg(v: Vector3): Vector3;
84
+ }
@@ -0,0 +1,2 @@
1
+ export declare class Vertex<A1> {
2
+ }
package/dist/index.d.ts CHANGED
@@ -13,4 +13,6 @@ import MFPOIOverlay from './components/MFPOIOverlay';
13
13
  import MFPolygon from './components/MFPolygon';
14
14
  import MFPolyline from './components/MFPolyline';
15
15
  import MFTileOverlay from './components/MFTileOverlay';
16
- export { MFBuilding, MFBuildingOverlay, MFCircle, MFDataLayer, MFDirectionsRenderer, MFGroundOverlay, MFImageOverlay, MFMap, MFMarker, MFMarkerCluster, MFPOI, MFPOIOverlay, MFPolygon, MFPolyline, MFTileOverlay };
16
+ import { CoordinateTransformer } from './ultils/CoordinateTransformer';
17
+ import { LatLng } from './models/LatLng';
18
+ export { MFBuilding, MFBuildingOverlay, MFCircle, MFDataLayer, MFDirectionsRenderer, MFGroundOverlay, MFImageOverlay, MFMap, MFMarker, MFMarkerCluster, MFPOI, MFPOIOverlay, MFPolygon, MFPolyline, MFTileOverlay, CoordinateTransformer, LatLng };