hj-gis-sdk 1.0.0 → 1.0.2

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.
Files changed (194) hide show
  1. package/README.md +50 -59
  2. package/dev-dist/animation.esm.js +152 -0
  3. package/dev-dist/animation.esm.js.map +1 -0
  4. package/dev-dist/animation.js +154 -0
  5. package/dev-dist/animation.js.map +1 -0
  6. package/dev-dist/building.esm.js +85 -0
  7. package/dev-dist/building.esm.js.map +1 -0
  8. package/dev-dist/building.js +87 -0
  9. package/dev-dist/building.js.map +1 -0
  10. package/dev-dist/common.esm.js +16159 -0
  11. package/dev-dist/common.esm.js.map +1 -0
  12. package/dev-dist/common.js +16163 -0
  13. package/dev-dist/common.js.map +1 -0
  14. package/dev-dist/fence.esm.js +100 -0
  15. package/dev-dist/fence.esm.js.map +1 -0
  16. package/dev-dist/fence.js +102 -0
  17. package/dev-dist/fence.js.map +1 -0
  18. package/dev-dist/ghost.esm.js +53 -0
  19. package/dev-dist/ghost.esm.js.map +1 -0
  20. package/dev-dist/ghost.js +55 -0
  21. package/dev-dist/ghost.js.map +1 -0
  22. package/dev-dist/heatmap.esm.js +103 -0
  23. package/dev-dist/heatmap.esm.js.map +1 -0
  24. package/dev-dist/heatmap.js +105 -0
  25. package/dev-dist/heatmap.js.map +1 -0
  26. package/dev-dist/index.esm.js +21 -0
  27. package/dev-dist/index.esm.js.map +1 -0
  28. package/dev-dist/index.esm2.js +4272 -0
  29. package/dev-dist/index.esm2.js.map +1 -0
  30. package/dev-dist/index.js +26 -0
  31. package/dev-dist/index.js.map +1 -0
  32. package/dev-dist/index2.js +4280 -0
  33. package/dev-dist/index2.js.map +1 -0
  34. package/dev-dist/keyframe.esm.js +95 -0
  35. package/dev-dist/keyframe.esm.js.map +1 -0
  36. package/dev-dist/keyframe.js +97 -0
  37. package/dev-dist/keyframe.js.map +1 -0
  38. package/dev-dist/measurement.esm.js +57 -0
  39. package/dev-dist/measurement.esm.js.map +1 -0
  40. package/dev-dist/measurement.js +59 -0
  41. package/dev-dist/measurement.js.map +1 -0
  42. package/dev-dist/scatter.esm.js +85 -0
  43. package/dev-dist/scatter.esm.js.map +1 -0
  44. package/dev-dist/scatter.js +87 -0
  45. package/dev-dist/scatter.js.map +1 -0
  46. package/dev-dist/src.esm.js +289 -0
  47. package/dev-dist/src.esm.js.map +1 -0
  48. package/dev-dist/src.js +291 -0
  49. package/dev-dist/src.js.map +1 -0
  50. package/dev-dist/types/hj-gis-sdk/addons/animation/animate-clip.d.ts +39 -0
  51. package/dev-dist/types/hj-gis-sdk/addons/animation/animate-clip.d.ts.map +1 -0
  52. package/dev-dist/types/hj-gis-sdk/addons/animation/animation-action.d.ts +31 -0
  53. package/dev-dist/types/hj-gis-sdk/addons/animation/animation-action.d.ts.map +1 -0
  54. package/dev-dist/types/hj-gis-sdk/addons/animation/animation-mixer.d.ts +18 -0
  55. package/dev-dist/types/hj-gis-sdk/addons/animation/animation-mixer.d.ts.map +1 -0
  56. package/dev-dist/types/hj-gis-sdk/addons/animation/index.d.ts +5 -0
  57. package/dev-dist/types/hj-gis-sdk/addons/animation/index.d.ts.map +1 -0
  58. package/dev-dist/types/hj-gis-sdk/addons/camera.d.ts +59 -0
  59. package/dev-dist/types/hj-gis-sdk/addons/camera.d.ts.map +1 -0
  60. package/dev-dist/types/hj-gis-sdk/addons/clock.d.ts +40 -0
  61. package/dev-dist/types/hj-gis-sdk/addons/clock.d.ts.map +1 -0
  62. package/dev-dist/types/hj-gis-sdk/addons/commander/context.d.ts +24 -0
  63. package/dev-dist/types/hj-gis-sdk/addons/commander/context.d.ts.map +1 -0
  64. package/dev-dist/types/hj-gis-sdk/addons/commander/dispatcher.d.ts +43 -0
  65. package/dev-dist/types/hj-gis-sdk/addons/commander/dispatcher.d.ts.map +1 -0
  66. package/dev-dist/types/hj-gis-sdk/addons/commander/excutor/base.d.ts +22 -0
  67. package/dev-dist/types/hj-gis-sdk/addons/commander/excutor/base.d.ts.map +1 -0
  68. package/dev-dist/types/hj-gis-sdk/addons/loader/index.d.ts +6 -0
  69. package/dev-dist/types/hj-gis-sdk/addons/loader/index.d.ts.map +1 -0
  70. package/dev-dist/types/hj-gis-sdk/addons/loader/loader.d.ts +4 -0
  71. package/dev-dist/types/hj-gis-sdk/addons/loader/loader.d.ts.map +1 -0
  72. package/dev-dist/types/hj-gis-sdk/addons/node/base.d.ts +63 -0
  73. package/dev-dist/types/hj-gis-sdk/addons/node/base.d.ts.map +1 -0
  74. package/dev-dist/types/hj-gis-sdk/addons/node/ue-node.d.ts +82 -0
  75. package/dev-dist/types/hj-gis-sdk/addons/node/ue-node.d.ts.map +1 -0
  76. package/dev-dist/types/hj-gis-sdk/addons/proxy.d.ts +83 -0
  77. package/dev-dist/types/hj-gis-sdk/addons/proxy.d.ts.map +1 -0
  78. package/dev-dist/types/hj-gis-sdk/addons/tools/base.d.ts +7 -0
  79. package/dev-dist/types/hj-gis-sdk/addons/tools/base.d.ts.map +1 -0
  80. package/dev-dist/types/hj-gis-sdk/addons/tools/building.d.ts +36 -0
  81. package/dev-dist/types/hj-gis-sdk/addons/tools/building.d.ts.map +1 -0
  82. package/dev-dist/types/hj-gis-sdk/addons/tools/daytime.d.ts +7 -0
  83. package/dev-dist/types/hj-gis-sdk/addons/tools/daytime.d.ts.map +1 -0
  84. package/dev-dist/types/hj-gis-sdk/addons/tools/fence.d.ts +61 -0
  85. package/dev-dist/types/hj-gis-sdk/addons/tools/fence.d.ts.map +1 -0
  86. package/dev-dist/types/hj-gis-sdk/addons/tools/ghost.d.ts +14 -0
  87. package/dev-dist/types/hj-gis-sdk/addons/tools/ghost.d.ts.map +1 -0
  88. package/dev-dist/types/hj-gis-sdk/addons/tools/heat-map.d.ts +65 -0
  89. package/dev-dist/types/hj-gis-sdk/addons/tools/heat-map.d.ts.map +1 -0
  90. package/dev-dist/types/hj-gis-sdk/addons/tools/index.d.ts +26 -0
  91. package/dev-dist/types/hj-gis-sdk/addons/tools/index.d.ts.map +1 -0
  92. package/dev-dist/types/hj-gis-sdk/addons/tools/match-view.d.ts +7 -0
  93. package/dev-dist/types/hj-gis-sdk/addons/tools/match-view.d.ts.map +1 -0
  94. package/dev-dist/types/hj-gis-sdk/addons/tools/measurement.d.ts +13 -0
  95. package/dev-dist/types/hj-gis-sdk/addons/tools/measurement.d.ts.map +1 -0
  96. package/dev-dist/types/hj-gis-sdk/addons/tools/pick-cast.d.ts +26 -0
  97. package/dev-dist/types/hj-gis-sdk/addons/tools/pick-cast.d.ts.map +1 -0
  98. package/dev-dist/types/hj-gis-sdk/addons/tools/scatter.d.ts +57 -0
  99. package/dev-dist/types/hj-gis-sdk/addons/tools/scatter.d.ts.map +1 -0
  100. package/dev-dist/types/hj-gis-sdk/addons/tools/weather.d.ts +31 -0
  101. package/dev-dist/types/hj-gis-sdk/addons/tools/weather.d.ts.map +1 -0
  102. package/dev-dist/types/hj-gis-sdk/addons/transform.d.ts +91 -0
  103. package/dev-dist/types/hj-gis-sdk/addons/transform.d.ts.map +1 -0
  104. package/dev-dist/types/hj-gis-sdk/addons/world.d.ts +76 -0
  105. package/dev-dist/types/hj-gis-sdk/addons/world.d.ts.map +1 -0
  106. package/dev-dist/types/hj-gis-sdk/core/ue-rpc.d.ts +54 -0
  107. package/dev-dist/types/hj-gis-sdk/core/ue-rpc.d.ts.map +1 -0
  108. package/dev-dist/types/hj-gis-sdk/index.d.ts +27 -0
  109. package/dev-dist/types/hj-gis-sdk/index.d.ts.map +1 -0
  110. package/dev-dist/types/hj-gis-sdk/utils.d.ts +16 -0
  111. package/dev-dist/types/hj-gis-sdk/utils.d.ts.map +1 -0
  112. package/dev-dist/types/src/animation.d.ts +2 -0
  113. package/dev-dist/types/src/animation.d.ts.map +1 -0
  114. package/dev-dist/types/src/building.d.ts +2 -0
  115. package/dev-dist/types/src/building.d.ts.map +1 -0
  116. package/dev-dist/types/src/common.d.ts +5 -0
  117. package/dev-dist/types/src/common.d.ts.map +1 -0
  118. package/dev-dist/types/src/fence.d.ts +2 -0
  119. package/dev-dist/types/src/fence.d.ts.map +1 -0
  120. package/dev-dist/types/src/ghost.d.ts +2 -0
  121. package/dev-dist/types/src/ghost.d.ts.map +1 -0
  122. package/dev-dist/types/src/heatmap.d.ts +2 -0
  123. package/dev-dist/types/src/heatmap.d.ts.map +1 -0
  124. package/dev-dist/types/src/index.d.ts +2 -0
  125. package/dev-dist/types/src/index.d.ts.map +1 -0
  126. package/dev-dist/types/src/keyframe.d.ts +2 -0
  127. package/dev-dist/types/src/keyframe.d.ts.map +1 -0
  128. package/dev-dist/types/src/measurement.d.ts +2 -0
  129. package/dev-dist/types/src/measurement.d.ts.map +1 -0
  130. package/dev-dist/types/src/scatter.d.ts +2 -0
  131. package/dev-dist/types/src/scatter.d.ts.map +1 -0
  132. package/dev-dist/types/src/weather.d.ts +2 -0
  133. package/dev-dist/types/src/weather.d.ts.map +1 -0
  134. package/dev-dist/weather.esm.js +68 -0
  135. package/dev-dist/weather.esm.js.map +1 -0
  136. package/dev-dist/weather.js +70 -0
  137. package/dev-dist/weather.js.map +1 -0
  138. package/dist/sdk.esm.js +19 -6
  139. package/dist/sdk.esm.js.map +1 -1
  140. package/dist/sdk.js +19 -6
  141. package/dist/sdk.js.map +1 -1
  142. package/dist/sdk.umd.js +1 -1
  143. package/dist/sdk.umd.js.map +1 -1
  144. package/dist/types/hj-gis-sdk/addons/tools/scatter.d.ts.map +1 -1
  145. package/dist/types/src/common.d.ts.map +1 -1
  146. package/hj-gis-sdk/addons/animation/animate-clip.ts +93 -0
  147. package/hj-gis-sdk/addons/animation/animation-action.ts +93 -0
  148. package/hj-gis-sdk/addons/animation/animation-mixer.ts +51 -0
  149. package/hj-gis-sdk/addons/animation/index.ts +17 -0
  150. package/hj-gis-sdk/addons/camera.ts +173 -0
  151. package/hj-gis-sdk/addons/clock.ts +85 -0
  152. package/hj-gis-sdk/addons/commander/context.ts +70 -0
  153. package/hj-gis-sdk/addons/commander/dispatcher.ts +68 -0
  154. package/hj-gis-sdk/addons/commander/excutor/base.ts +26 -0
  155. package/hj-gis-sdk/addons/loader/index.ts +7 -0
  156. package/hj-gis-sdk/addons/loader/loader.ts +3 -0
  157. package/hj-gis-sdk/addons/node/base.ts +131 -0
  158. package/hj-gis-sdk/addons/node/ue-node.ts +147 -0
  159. package/hj-gis-sdk/addons/proxy.ts +200 -0
  160. package/hj-gis-sdk/addons/tools/base.ts +11 -0
  161. package/hj-gis-sdk/addons/tools/building.ts +84 -0
  162. package/hj-gis-sdk/addons/tools/daytime.ts +14 -0
  163. package/hj-gis-sdk/addons/tools/fence.ts +105 -0
  164. package/hj-gis-sdk/addons/tools/ghost.ts +31 -0
  165. package/hj-gis-sdk/addons/tools/heat-map.ts +95 -0
  166. package/hj-gis-sdk/addons/tools/index.ts +25 -0
  167. package/hj-gis-sdk/addons/tools/match-view.ts +35 -0
  168. package/hj-gis-sdk/addons/tools/measurement.ts +25 -0
  169. package/hj-gis-sdk/addons/tools/pick-cast.ts +67 -0
  170. package/hj-gis-sdk/addons/tools/scatter.ts +230 -0
  171. package/hj-gis-sdk/addons/tools/weather.ts +40 -0
  172. package/hj-gis-sdk/addons/transform.ts +126 -0
  173. package/hj-gis-sdk/addons/world.ts +173 -0
  174. package/hj-gis-sdk/core/ue-rpc.ts +234 -0
  175. package/hj-gis-sdk/index.ts +26 -0
  176. package/hj-gis-sdk/utils.ts +52 -0
  177. package/index.html +48 -0
  178. package/package-lock.json +7368 -0
  179. package/package.json +17 -4
  180. package/rollup.config.dev.js +107 -0
  181. package/rollup.config.js +52 -0
  182. package/src/animation.ts +175 -0
  183. package/src/building.ts +114 -0
  184. package/src/common.ts +47 -0
  185. package/src/fence.ts +131 -0
  186. package/src/ghost.ts +70 -0
  187. package/src/heatmap.ts +125 -0
  188. package/src/index.ts +350 -0
  189. package/src/keyframe.ts +113 -0
  190. package/src/measurement.ts +80 -0
  191. package/src/scatter.ts +105 -0
  192. package/src/weather.ts +86 -0
  193. package/tsconfig.json +30 -0
  194. package/yarn.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ASb"}
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAOA,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW;;;GA+B1E"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAQA,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW;;;GAsC1E"}
@@ -0,0 +1,93 @@
1
+ import { Transform } from '../transform'
2
+ import AnimationAction from './animation-action'
3
+
4
+ export type AnimateParam = {
5
+ Handle: string
6
+ Rate?: number
7
+ Loop?: boolean
8
+ }
9
+
10
+ export interface AnimateClip {
11
+ _clipCall(): ClipCall
12
+ }
13
+
14
+ export interface ClipCall {
15
+ clip: AnimateClip
16
+ _play(action: AnimationAction, params: AnimateParam): void
17
+ _pause(action: AnimationAction, params: AnimateParam): void
18
+ _resume(action: AnimationAction, params: AnimateParam): void
19
+ }
20
+
21
+ export class PresetAnimateClip implements AnimateClip {
22
+ animateName: string
23
+ constructor(animateName: string) {
24
+ this.animateName = animateName
25
+ }
26
+ _clipCall(): ClipCall {
27
+ return new PresetAnimateClipCall(this)
28
+ }
29
+ }
30
+
31
+ class PresetAnimateClipCall implements ClipCall {
32
+ clip: PresetAnimateClip
33
+ constructor(clip: PresetAnimateClip) {
34
+ this.clip = clip
35
+ }
36
+
37
+ _play(action: AnimationAction, params: AnimateParam) {
38
+ action.mixer?.rpc.callModule('Animation', 'Play', {
39
+ ...params,
40
+ Animation: this.clip.animateName
41
+ })
42
+ }
43
+ _pause(action: AnimationAction, params: AnimateParam) {
44
+ action.mixer?.rpc.callModule('Animation', 'Pause', {
45
+ handle: params.Handle
46
+ })
47
+ }
48
+ _resume(action: AnimationAction, params: AnimateParam) {
49
+ action.mixer?.rpc.callModule('Animation', 'Resume', {
50
+ handle: params.Handle
51
+ })
52
+ }
53
+ }
54
+
55
+ export class KeyFrameAnimateClip implements AnimateClip {
56
+ startTransform?: Transform
57
+ endTransform?: Transform
58
+ constructor(params: {
59
+ startTransform?: Transform
60
+ endTransform?: Transform
61
+ }) {
62
+ this.startTransform = params.startTransform
63
+ this.endTransform = params.endTransform
64
+ }
65
+ _clipCall() {
66
+ return new KeyFrameAnimateClipCall(this)
67
+ }
68
+ }
69
+
70
+ class KeyFrameAnimateClipCall implements ClipCall {
71
+ clip: KeyFrameAnimateClip
72
+ constructor(clip: KeyFrameAnimateClip) {
73
+ this.clip = clip
74
+ }
75
+ _play(action: AnimationAction, params: AnimateParam) {
76
+ action.mixer?.rpc.callModule('Animation', 'MoveBetweenTransforms', {
77
+ Handle: action.handle,
78
+ StartTransform: this.clip.startTransform?.toRPCJSON(),
79
+ EndTransform: this.clip.endTransform?.toRPCJSON(),
80
+ Duration: action.duration
81
+ })
82
+ }
83
+ _pause(action: AnimationAction, params: AnimateParam) {
84
+ action.mixer?.rpc.callModule('Animation', 'PauseMoveBetweenTransforms', {
85
+ Handle: action.handle
86
+ })
87
+ }
88
+ _resume(action: AnimationAction, params: AnimateParam) {
89
+ action.mixer?.rpc.callModule('Animation', 'ResumeMoveBetweenTransforms', {
90
+ Handle: action.handle
91
+ })
92
+ }
93
+ }
@@ -0,0 +1,93 @@
1
+ import type { AnimateClip } from './animate-clip'
2
+ import AnimationMixer from './animation-mixer'
3
+
4
+ enum Status {
5
+ Playing = 'playing',
6
+ Paused = 'paused',
7
+ Stopped = 'stopped'
8
+ }
9
+
10
+ enum PlaybackType {
11
+ Loop = 'loop',
12
+ Once = 'once'
13
+ }
14
+
15
+ export default class AnimationAction {
16
+ private _status: Status
17
+ private _handle: string
18
+ type: PlaybackType | string
19
+ rate: number
20
+ clip: AnimateClip
21
+ mixer?: AnimationMixer
22
+ private _duration?: number
23
+ playDuration: number
24
+
25
+ constructor(handle: string, clip: AnimateClip, mixer?: AnimationMixer) {
26
+ this._status = Status.Stopped
27
+ this._handle = handle
28
+ this.type = PlaybackType.Once
29
+ this.rate = 1
30
+ this.clip = clip
31
+ this.playDuration = 0
32
+ this.mixer = mixer
33
+ }
34
+
35
+ get duration(): number | undefined {
36
+ return this._duration
37
+ }
38
+
39
+ set duration(duration: number) {
40
+ this._duration = duration
41
+ }
42
+
43
+ get handle() {
44
+ return this._handle
45
+ }
46
+
47
+ get status() {
48
+ return this._status
49
+ }
50
+ async play() {
51
+ if (this._status == Status.Paused) {
52
+ let clipCall = this.clip._clipCall()
53
+ return clipCall._resume(this, {
54
+ Handle: this._handle
55
+ })
56
+ }
57
+ let obj = {
58
+ Handle: this._handle,
59
+ Rate: this.rate,
60
+ Loop: this.type == PlaybackType.Loop
61
+ }
62
+ let clipCall = this.clip._clipCall()
63
+ this.playDuration = 0
64
+ this._status = Status.Playing
65
+
66
+ let result = clipCall._play(this, obj)
67
+
68
+ return
69
+ }
70
+ pause() {
71
+ let obj = {
72
+ Handle: this._handle,
73
+ Rate: this.rate,
74
+ Loop: this.type == PlaybackType.Loop
75
+ }
76
+ let clipCall = this.clip._clipCall()
77
+ this._status = Status.Paused
78
+ return clipCall._pause(this, obj)
79
+ }
80
+ update(delta: number) {
81
+ if (this.status != Status.Playing) {
82
+ return
83
+ }
84
+ this.playDuration += delta
85
+ if (
86
+ this.type === PlaybackType.Once &&
87
+ this.duration &&
88
+ this.playDuration >= this.duration!
89
+ ) {
90
+ this._status = Status.Stopped
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,51 @@
1
+ import UERPCNode from '../node/ue-node'
2
+ import UERPC from '../../core/ue-rpc'
3
+ import AnimationAction from './animation-action'
4
+ import { Clock } from '../clock'
5
+ import { AnimateClip } from './animate-clip'
6
+ export default class AnimationMixer {
7
+ private _rpc: UERPC
8
+ private _duration: number
9
+ private _clock?: Clock
10
+ private _actions: AnimationAction[] = []
11
+ constructor(rpc: UERPC) {
12
+ this._rpc = rpc
13
+ this._duration = 0
14
+ this._actions = []
15
+ this.init()
16
+ }
17
+
18
+ get rpc() {
19
+ return this._rpc
20
+ }
21
+
22
+ init() {
23
+ this._clock = new Clock()
24
+ this._clock.start()
25
+ setTimeout(() => {
26
+ this._duration += this._clock!.getDelta()
27
+ this.updateAction()
28
+ }, 1000 / 60)
29
+ }
30
+
31
+ get duration() {
32
+ return this._duration
33
+ }
34
+
35
+ updateAction() {
36
+ this._actions.forEach((action) => {
37
+ action.update(this._duration)
38
+ })
39
+ }
40
+
41
+ clipAction(clip: AnimateClip, node: UERPCNode) {
42
+ return new AnimationAction(node.key!, clip, this)
43
+ }
44
+ removeAction(action: AnimationAction) {
45
+ // this._actions = this._actions.filter((item) => item !== action)
46
+ let index = this._actions.findIndex((item) => item === action)
47
+ if (index > -1) {
48
+ this._actions.splice(index, 1)
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,17 @@
1
+ import {
2
+ AnimateClip,
3
+ ClipCall,
4
+ PresetAnimateClip,
5
+ KeyFrameAnimateClip
6
+ } from './animate-clip'
7
+ import AnimationMixer from './animation-mixer'
8
+ import AnimationAction from './animation-action'
9
+
10
+ export {
11
+ AnimationMixer,
12
+ AnimationAction,
13
+ AnimateClip,
14
+ PresetAnimateClip,
15
+ KeyFrameAnimateClip,
16
+ ClipCall
17
+ }
@@ -0,0 +1,173 @@
1
+ /**
2
+ * 相机模块,提供相机相关的类和功能
3
+ * 该模块定义了相机基类和透视相机类,用于在3D场景中管理相机的属性和变换
4
+ */
5
+ import UERPC from '../core/ue-rpc'
6
+ import UERPCNode from './node/ue-node'
7
+ import { Collector, createDeepProxy } from './proxy'
8
+ import { Transform } from './transform'
9
+ import World from './world'
10
+
11
+ /**
12
+ * 相机基类,继承自UERPCNode
13
+ * 定义了相机的基本结构,所有具体相机类型的父类
14
+ */
15
+ export class Camera extends UERPCNode {
16
+ /**
17
+ * 相机基类构造函数
18
+ * @param rpc UERPC实例,用于与远程服务通信
19
+ * @param type 相机类型
20
+ */
21
+ constructor(rpc: UERPC, type: string) {
22
+ super(rpc, type)
23
+ }
24
+ }
25
+
26
+ /**
27
+ * 透视相机类,用于表示3D场景中的透视相机
28
+ * 实现了透视相机的属性和变换管理
29
+ */
30
+ export class PerspectiveCamera extends Camera {
31
+ /** 所属世界实例,用于关联相机与场景 */
32
+ world?: World
33
+ // /** 视场角,单位为度,控制相机的视野范围 */
34
+ // _fov: number
35
+ // /** 焦距,单位为毫米,影响相机的缩放效果 */
36
+ // _focalLength: number
37
+ // /** 光圈,影响相机的景深效果 */
38
+ // _aperture: number
39
+ // /** 焦距离,单位为世界单位,定义焦点所在的距离 */
40
+ // _focusDistance: number
41
+ /** 相机变换,包含位置、旋转和缩放信息 */
42
+ _transform: Transform
43
+ /** 变换收集器,用于收集相机变换的变化并触发更新 */
44
+ protected _collector: Collector
45
+ /** 远程更新标志,用于标记相机属性是否需要同步到远程 */
46
+ protected _remoteUpdateFlag: boolean
47
+
48
+ /**
49
+ * 构造函数
50
+ * @param rpc UERPC实例,用于与远程服务通信
51
+ */
52
+ constructor(rpc: UERPC) {
53
+ super(rpc, 'camera')
54
+ // // 初始化相机默认属性
55
+ // this._fov = 75
56
+ // this._focalLength = 50
57
+ // this._aperture = 35
58
+ // this._focusDistance = 100
59
+ // 创建默认变换
60
+ this._transform = Transform.default()
61
+ // 初始化变换收集器
62
+ this._collector = new Collector(this._triggerRemoteUpdate.bind(this))
63
+ // 初始化远程更新标志
64
+ this._remoteUpdateFlag = false
65
+ }
66
+
67
+ // /**
68
+ // * 获取焦距值
69
+ // * @returns {number} 焦距值,单位为毫米
70
+ // */
71
+ // get focalLength() {
72
+ // return this._focalLength
73
+ // }
74
+
75
+ // /**
76
+ // * 设置焦距值
77
+ // * @param focalLength 新的焦距值,单位为毫米
78
+ // */
79
+ // set focalLength(focalLength: number) {
80
+ // this._focalLength = focalLength
81
+ // this._triggerRemoteUpdate()
82
+ // }
83
+
84
+ // /**
85
+ // * 获取光圈值
86
+ // * @returns {number} 光圈值
87
+ // */
88
+ // get aperture() {
89
+ // return this._aperture
90
+ // }
91
+
92
+ // /**
93
+ // * 设置光圈值
94
+ // * @param aperture 新的光圈值
95
+ // */
96
+ // set aperture(aperture: number) {
97
+ // this._aperture = aperture
98
+ // this._triggerRemoteUpdate()
99
+ // }
100
+
101
+ // /**
102
+ // * 获取视场角
103
+ // * @returns {number} 视场角,单位为度
104
+ // */
105
+ // get fov() {
106
+ // return this._fov
107
+ // }
108
+
109
+ // /**
110
+ // * 设置视场角
111
+ // * @param fov 新的视场角,单位为度
112
+ // */
113
+ // set fov(fov: number) {
114
+ // this._fov = fov
115
+ // this._triggerRemoteUpdate()
116
+ // }
117
+
118
+ // /**
119
+ // * 获取焦距离
120
+ // * @returns {number} 焦距离,单位为世界单位
121
+ // */
122
+ // get focusDistance() {
123
+ // return this._focusDistance
124
+ // }
125
+
126
+ // 同步远程相机参数到本地
127
+ async forceSyncRemoteToLocal() {
128
+ let response = await this._rpc.getCameraTransform()
129
+ console.log(response)
130
+ if (response.Transform) {
131
+ let transform = Transform.fromRPCObject(response.Transform)
132
+ this._transform = transform
133
+ }
134
+ }
135
+
136
+ // /**
137
+ // * 设置焦距离
138
+ // * @param focusDistance 新的焦距离,单位为世界单位
139
+ // */
140
+ // set focusDistance(focusDistance: number) {
141
+ // this._focusDistance = focusDistance
142
+ // this._triggerRemoteUpdate()
143
+ // }
144
+
145
+ /**
146
+ * 获取相机变换的代理对象
147
+ * 通过深度代理实现对变换属性的监听,当变换属性变化时自动触发远程更新
148
+ * @returns {Transform} 相机变换的代理对象
149
+ */
150
+ get transform() {
151
+ return createDeepProxy(this._transform, {}, this._collector)
152
+ }
153
+
154
+ /**
155
+ * 触发远程更新
156
+ * 该方法在相机属性或变换变化时被调用,用于标记相机需要同步到远程
157
+ */
158
+ protected _triggerRemoteUpdate() {
159
+ this._remoteUpdateFlag = true
160
+ this._remoteUpdate()
161
+ }
162
+
163
+ /**
164
+ * 远程更新处理方法
165
+ * 用于将相机的属性和变换同步到远程服务器
166
+ * TODO: 实现具体的远程同步逻辑
167
+ */
168
+ protected _remoteUpdate() {
169
+ // TODO: 实现相机属性和变换的远程同步逻辑
170
+ this._rpc.setCameraTransform(this._transform.toRPCJSON())
171
+ this._remoteUpdateFlag = true
172
+ }
173
+ }
@@ -0,0 +1,85 @@
1
+ // 创建一个 Clock , 计算每次的时间差 , 同时保存开始的时间
2
+ export class Clock {
3
+ private startTime: number;
4
+ private previousTime: number;
5
+ private elapsedTime: number;
6
+ private isRunning: boolean;
7
+
8
+ constructor() {
9
+ this.startTime = 0;
10
+ this.previousTime = 0;
11
+ this.elapsedTime = 0;
12
+ this.isRunning = false;
13
+ }
14
+
15
+ /**
16
+ * 开始计时
17
+ */
18
+ start(): void {
19
+ this.startTime = performance.now();
20
+ this.previousTime = this.startTime;
21
+ this.elapsedTime = 0;
22
+ this.isRunning = true;
23
+ }
24
+
25
+ /**
26
+ * 停止计时
27
+ */
28
+ stop(): void {
29
+ this.getDelta(); // 更新 elapsedTime
30
+ this.isRunning = false;
31
+ }
32
+
33
+ /**
34
+ * 获取自上次调用 getDelta() 以来经过的时间(时间差)
35
+ * @returns 时间差(毫秒)
36
+ */
37
+ getDelta(): number {
38
+ let currentTime = performance.now();
39
+ let delta = 0;
40
+
41
+ if (this.isRunning) {
42
+ delta = currentTime - this.previousTime;
43
+ this.elapsedTime += delta;
44
+ this.previousTime = currentTime;
45
+ }
46
+
47
+ return delta;
48
+ }
49
+
50
+ /**
51
+ * 获取自开始计时以来经过的总时间
52
+ * @returns 经过的总时间(毫秒)
53
+ */
54
+ getElapsedTime(): number {
55
+ if (this.isRunning) {
56
+ this.getDelta(); // 更新 elapsedTime
57
+ }
58
+ return this.elapsedTime;
59
+ }
60
+
61
+ /**
62
+ * 获取开始时间
63
+ * @returns 开始时间(毫秒)
64
+ */
65
+ getStartTime(): number {
66
+ return this.startTime;
67
+ }
68
+
69
+ /**
70
+ * 检查是否正在运行
71
+ * @returns 是否正在运行
72
+ */
73
+ isRunningState(): boolean {
74
+ return this.isRunning;
75
+ }
76
+
77
+ /**
78
+ * 重置计时器
79
+ */
80
+ reset(): void {
81
+ this.startTime = performance.now();
82
+ this.previousTime = this.startTime;
83
+ this.elapsedTime = 0;
84
+ }
85
+ }
@@ -0,0 +1,70 @@
1
+ import mitt, { Emitter } from 'mitt'
2
+
3
+ interface Viewport {
4
+ width: number
5
+ height: number
6
+ }
7
+
8
+ export class Context {
9
+ private hover: any = null
10
+ private click: any = null
11
+ private viewport: Viewport = { width: 0, height: 0 }
12
+ private emitter: Emitter<any>
13
+ private clickLastZone: string | null = null
14
+
15
+ constructor() {
16
+ this.emitter = mitt<any>()
17
+ }
18
+
19
+ on<T extends keyof any>(event: T, handler: (data: any[T]) => void): void {
20
+ this.emitter.on(event, handler)
21
+ }
22
+
23
+ off<T extends keyof any>(event: T, handler: (data: any[T]) => void): void {
24
+ this.emitter.off(event, handler)
25
+ }
26
+
27
+ emit<T extends keyof any>(event: T, data: any[T]): void {
28
+ this.emitter.emit(event, data)
29
+ }
30
+
31
+ getHover(): any {
32
+ return this.hover
33
+ }
34
+
35
+ getClick(): any {
36
+ return this.click
37
+ }
38
+
39
+ getViewport(): Viewport {
40
+ return { ...this.viewport }
41
+ }
42
+
43
+ setHover(hover: any): void {
44
+ this.hover = hover
45
+ this.emit('hover', hover)
46
+ }
47
+
48
+ setClick(click: any): void {
49
+ this.click = click
50
+ this.emit('click', click)
51
+ }
52
+
53
+ setClickLastZone(str: string): void {
54
+ this.clickLastZone = str
55
+ }
56
+
57
+ setViewport(viewport: Viewport): void {
58
+ const isChanged =
59
+ viewport.width !== this.viewport.width ||
60
+ viewport.height !== this.viewport.height
61
+
62
+ this.viewport = { ...viewport }
63
+
64
+ if (isChanged) {
65
+ this.emit('viewport', this.viewport)
66
+ }
67
+ }
68
+ }
69
+
70
+ export default Context
@@ -0,0 +1,68 @@
1
+ import IGISExecutor, { Message } from './excutor/base'
2
+ import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5'
3
+ /**
4
+ * 定义命令类型枚举
5
+ */
6
+ export type CommandType =
7
+ | 'POIClicked'
8
+ | 'POICollapsed'
9
+ | 'POIExpanded'
10
+ | 'POIHoverBegin'
11
+ | 'POIHoverEnd'
12
+
13
+ /**
14
+ * 屏幕位置接口
15
+ */
16
+ export interface ScreenPosition {
17
+ relativeX: number
18
+ relativeY: number
19
+ x: number
20
+ y: number
21
+ viewportWidth: number
22
+ viewportHeight: number
23
+ }
24
+
25
+ /**
26
+ * 地理位置接口
27
+ */
28
+ export interface GeoLocation {
29
+ latitude: number
30
+ longitude: number
31
+ }
32
+
33
+ /**
34
+ * GIS 事件的分发器
35
+ * 1. 事件的注册
36
+ * 2. 事件的分发
37
+ */
38
+ export default class Dispatcher {
39
+ private excutors: IGISExecutor[] = []
40
+
41
+ /**
42
+ * 注册执行器
43
+ * @param excutor 单个执行器或执行器数组
44
+ */
45
+ register(excutor: IGISExecutor | IGISExecutor[]): void {
46
+ if (Array.isArray(excutor)) {
47
+ this.excutors.push(...excutor)
48
+ } else {
49
+ this.excutors.push(excutor)
50
+ }
51
+ }
52
+
53
+ /**
54
+ * 分发消息到匹配的执行器
55
+ * @param rawMessage 原始JSON消息字符串
56
+ * @returns 无返回值
57
+ */
58
+ dispatch(rawMessage: string): void {
59
+ const message: Message = JSON.parse(rawMessage)
60
+ Logger.Info(`dispatcher message: ${rawMessage}`)
61
+ for (const excutor of this.excutors) {
62
+ const matched = excutor.match(message)
63
+ if (matched) {
64
+ excutor.execute(message)
65
+ }
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,26 @@
1
+ import Context from '../context'
2
+ export type Message = any
3
+ /**
4
+ * GIS 事件执行器 Interface
5
+ * 1. 判断事件是否属于这个执行器
6
+ * 2. 执行事件
7
+ */
8
+ export default abstract class IGISExecutor {
9
+ protected context: Context
10
+
11
+ constructor(context: Context) {
12
+ this.context = context
13
+ }
14
+
15
+ /**
16
+ * 判断事件是否属于这个执行器
17
+ * @param message 消息对象
18
+ */
19
+ abstract match(message: Message): boolean
20
+
21
+ /**
22
+ * 执行事件
23
+ * @param message 消息对象
24
+ */
25
+ abstract execute(message: Message): void
26
+ }
@@ -0,0 +1,7 @@
1
+ import { Loader } from './loader'
2
+ import Node from '../node/base'
3
+ export class URLLoader implements Loader<Node> {
4
+ async loader(url: string): Promise<Node> {
5
+ throw new Error('Method not implemented.')
6
+ }
7
+ }