@openglobus/og 0.11.5 → 0.12.0
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/css/og.css +5 -2
- package/package.json +12 -14
- package/src/og/Clock.js +6 -10
- package/src/og/Events.js +5 -7
- package/src/og/Extent.js +73 -32
- package/src/og/Globe.js +25 -10
- package/src/og/ImageCanvas.js +18 -15
- package/src/og/LonLat.js +13 -10
- package/src/og/Popup.js +19 -17
- package/src/og/QueueArray.js +3 -4
- package/src/og/Rectangle.js +4 -6
- package/src/og/Stack.js +2 -4
- package/src/og/ajax.js +20 -14
- package/src/og/astro/earth.js +21 -15
- package/src/og/bv/Box.js +2 -3
- package/src/og/bv/Sphere.js +10 -7
- package/src/og/camera/Camera.js +70 -79
- package/src/og/camera/Frustum.js +19 -12
- package/src/og/camera/PlanetCamera.js +33 -34
- package/src/og/control/CompassButton.js +1 -2
- package/src/og/control/Control.js +7 -9
- package/src/og/control/DebugInfo.js +2 -3
- package/src/og/control/EarthNavigation.js +26 -17
- package/src/og/control/KeyboardNavigation.js +9 -9
- package/src/og/control/LayerSwitcher.js +21 -20
- package/src/og/control/Lighting.js +74 -64
- package/src/og/control/MouseNavigation.js +30 -29
- package/src/og/control/MouseWheelZoomControl.js +257 -0
- package/src/og/control/SegmentBoundVisualization.js +5 -6
- package/src/og/control/ShowFps.js +12 -7
- package/src/og/control/SimpleNavigation.js +5 -7
- package/src/og/control/Sun.js +24 -14
- package/src/og/control/ToggleWireframe.js +3 -3
- package/src/og/control/TouchNavigation.js +43 -32
- package/src/og/control/ZoomControl.js +40 -24
- package/src/og/control/index.js +2 -0
- package/src/og/control/visibleExtent/Segment.js +1862 -0
- package/src/og/control/visibleExtent/VisibleExtent.js +80 -0
- package/src/og/control/visibleExtent/drawnode.js +751 -0
- package/src/og/ellipsoid/Ellipsoid.js +149 -57
- package/src/og/ellipsoid/wgs84.js +3 -3
- package/src/og/entity/BaseBillboard.js +72 -30
- package/src/og/entity/Billboard.js +9 -5
- package/src/og/entity/BillboardHandler.js +315 -62
- package/src/og/entity/Entity.js +742 -704
- package/src/og/entity/EntityCollection.js +47 -24
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +895 -0
- package/src/og/entity/GeometryHandler.js +595 -123
- package/src/og/entity/Label.js +62 -30
- package/src/og/entity/LabelHandler.js +42 -243
- package/src/og/entity/LabelWorker.js +218 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +76 -28
- package/src/og/entity/PointCloudHandler.js +5 -5
- package/src/og/entity/Ray.js +49 -16
- package/src/og/entity/Strip.js +72 -43
- package/src/og/entity/StripHandler.js +23 -23
- package/src/og/layer/BaseGeoImage.js +50 -19
- package/src/og/layer/CanvasTiles.js +16 -17
- package/src/og/layer/GeoImage.js +8 -16
- package/src/og/layer/GeoTexture2d.js +2 -10
- package/src/og/layer/GeoVideo.js +2 -10
- package/src/og/layer/KML.js +55 -33
- package/src/og/layer/Layer.js +24 -33
- package/src/og/layer/Material.js +1 -1
- package/src/og/layer/Vector.js +94 -48
- package/src/og/layer/WMS.js +33 -18
- package/src/og/layer/XYZ.js +24 -26
- package/src/og/light/LightSource.js +19 -12
- package/src/og/math/Mat3.js +24 -12
- package/src/og/math/Mat4.js +603 -603
- package/src/og/math/Plane.js +19 -18
- package/src/og/math/Ray.js +17 -12
- package/src/og/math/Vec2.js +24 -14
- package/src/og/math/Vec3.js +78 -32
- package/src/og/math/coder.js +7 -7
- package/src/og/proj/EPSG3857.js +3 -3
- package/src/og/proj/EPSG4326.js +3 -3
- package/src/og/proj/Proj.js +2 -4
- package/src/og/quadTree/Node.js +50 -95
- package/src/og/quadTree/quadTree.js +1 -1
- package/src/og/renderer/Renderer.js +106 -126
- package/src/og/renderer/RendererEvents.js +45 -23
- package/src/og/scene/BaseNode.js +2 -3
- package/src/og/scene/Planet.js +139 -191
- package/src/og/scene/RenderNode.js +15 -8
- package/src/og/segment/Segment.js +93 -268
- package/src/og/segment/Slice.js +45 -0
- package/src/og/shaders/drawnode.js +174 -360
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/pointCloud.js +41 -41
- package/src/og/shaders/shape.js +12 -18
- package/src/og/shaders/skybox.js +36 -36
- package/src/og/shaders/toneMapping.js +1 -0
- package/src/og/shapes/BaseShape.js +108 -36
- package/src/og/shapes/Icosphere.js +25 -10
- package/src/og/shapes/Sphere.js +8 -11
- package/src/og/terrain/EmptyTerrain.js +3 -2
- package/src/og/terrain/GlobusTerrain.js +2 -0
- package/src/og/utils/FontAtlas.js +6 -2
- package/src/og/utils/GeoImageCreator.js +5 -1
- package/src/og/utils/Loader.js +1 -1
- package/src/og/utils/PlainSegmentWorker.js +0 -13
- package/src/og/utils/TextureAtlas.js +18 -20
- package/src/og/utils/VectorTileCreator.js +1 -3
- package/src/og/utils/shared.js +2 -2
- package/src/og/webgl/Handler.js +219 -162
- package/src/og/webgl/Multisample.js +44 -16
- package/src/og/webgl/Program.js +78 -33
- package/src/og/webgl/callbacks.js +3 -3
- package/types/Clock.d.ts +0 -94
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -77
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -82
- package/types/ImageCanvas.d.ts +0 -123
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -108
- package/types/Popup.d.ts +0 -42
- package/types/QueueArray.d.ts +0 -19
- package/types/Rectangle.d.ts +0 -80
- package/types/Stack.d.ts +0 -19
- package/types/ajax.d.ts +0 -24
- package/types/arial.d.ts +0 -48
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -7
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -30
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -312
- package/types/camera/Frustum.d.ts +0 -133
- package/types/camera/PlanetCamera.d.ts +0 -218
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/CompassButton.d.ts +0 -17
- package/types/control/Control.d.ts +0 -104
- package/types/control/DebugInfo.d.ts +0 -15
- package/types/control/EarthCoordinates.d.ts +0 -47
- package/types/control/EarthNavigation.d.ts +0 -42
- package/types/control/GeoImageDragControl.d.ts +0 -6
- package/types/control/KeyboardNavigation.d.ts +0 -21
- package/types/control/LayerSwitcher.d.ts +0 -21
- package/types/control/Lighting.d.ts +0 -16
- package/types/control/MouseNavigation.d.ts +0 -47
- package/types/control/ScaleControl.d.ts +0 -22
- package/types/control/ShowFps.d.ts +0 -11
- package/types/control/SimpleNavigation.d.ts +0 -25
- package/types/control/Sun.d.ts +0 -50
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -48
- package/types/control/ZoomControl.d.ts +0 -27
- package/types/control/index.d.ts +0 -17
- package/types/ellipsoid/Ellipsoid.d.ts +0 -146
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -6
- package/types/entity/BaseBillboard.d.ts +0 -208
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -78
- package/types/entity/Entity.d.ts +0 -333
- package/types/entity/EntityCollection.d.ts +0 -311
- package/types/entity/Geometry.d.ts +0 -74
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -189
- package/types/entity/LabelHandler.d.ts +0 -29
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -306
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -124
- package/types/entity/RayHandler.d.ts +0 -67
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/entity/Strip.d.ts +0 -119
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.core.d.ts +0 -65
- package/types/index.d.ts +0 -45
- package/types/index.webgl.d.ts +0 -7
- package/types/input/KeyboardHandler.d.ts +0 -10
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -34
- package/types/layer/BaseGeoImage.d.ts +0 -94
- package/types/layer/CanvasTiles.d.ts +0 -68
- package/types/layer/GeoImage.d.ts +0 -52
- package/types/layer/GeoTexture2d.d.ts +0 -8
- package/types/layer/GeoVideo.d.ts +0 -55
- package/types/layer/KML.d.ts +0 -63
- package/types/layer/Layer.d.ts +0 -326
- package/types/layer/Material.d.ts +0 -45
- package/types/layer/Vector.d.ts +0 -208
- package/types/layer/WMS.d.ts +0 -63
- package/types/layer/XYZ.d.ts +0 -120
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -178
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -65
- package/types/math/Mat4.d.ts +0 -176
- package/types/math/Plane.d.ts +0 -18
- package/types/math/Quat.d.ts +0 -379
- package/types/math/Ray.d.ts +0 -82
- package/types/math/Vec2.d.ts +0 -309
- package/types/math/Vec3.d.ts +0 -460
- package/types/math/Vec4.d.ts +0 -162
- package/types/math/coder.d.ts +0 -43
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -261
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -6
- package/types/proj/EPSG4326.d.ts +0 -6
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EntityCollectionNode.d.ts +0 -34
- package/types/quadTree/Node.d.ts +0 -61
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -298
- package/types/renderer/RendererEvents.d.ts +0 -233
- package/types/res/images.d.ts +0 -3
- package/types/scene/Axes.d.ts +0 -11
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -577
- package/types/scene/RenderNode.d.ts +0 -142
- package/types/scene/SkyBox.d.ts +0 -10
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -279
- package/types/segment/SegmentLonLat.d.ts +0 -16
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -7
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/shape.d.ts +0 -4
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shapes/BaseShape.d.ts +0 -250
- package/types/shapes/Sphere.d.ts +0 -41
- package/types/terrain/BilTerrain.d.ts +0 -7
- package/types/terrain/EmptyTerrain.d.ts +0 -72
- package/types/terrain/Geoid.d.ts +0 -26
- package/types/terrain/GlobusTerrain.d.ts +0 -116
- package/types/terrain/MapboxTerrain.d.ts +0 -7
- package/types/terrain/index.d.ts +0 -5
- package/types/utils/FontAtlas.d.ts +0 -14
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -25
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -10
- package/types/utils/TerrainWorker.d.ts +0 -9
- package/types/utils/TextureAtlas.d.ts +0 -111
- package/types/utils/VectorTileCreator.d.ts +0 -16
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/shared.d.ts +0 -231
- package/types/webgl/Framebuffer.d.ts +0 -135
- package/types/webgl/Handler.d.ts +0 -388
- package/types/webgl/Multisample.d.ts +0 -89
- package/types/webgl/Program.d.ts +0 -155
- package/types/webgl/ProgramController.d.ts +0 -89
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
package/src/og/entity/Entity.js
CHANGED
|
@@ -1,704 +1,742 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/entity/Entity
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
"use strict";
|
|
6
|
-
|
|
7
|
-
import * as mercator from "../mercator.js";
|
|
8
|
-
import * as utils from "../utils/shared.js";
|
|
9
|
-
import { Billboard } from "./Billboard.js";
|
|
10
|
-
import { Strip } from "./Strip.js";
|
|
11
|
-
import { Extent } from "../Extent.js";
|
|
12
|
-
import { Geometry } from "./Geometry.js";
|
|
13
|
-
import { Label } from "./Label.js";
|
|
14
|
-
import { LonLat } from "../LonLat.js";
|
|
15
|
-
import { Polyline } from "./Polyline.js";
|
|
16
|
-
import { Ray } from "./Ray.js";
|
|
17
|
-
import { PointCloud } from "./PointCloud.js";
|
|
18
|
-
import { Sphere } from "../shapes/Sphere.js";
|
|
19
|
-
import { Vec3 } from "../math/Vec3.js";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
27
|
-
* @param {
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {boolean} [options.
|
|
32
|
-
* @param {
|
|
33
|
-
* @param {*} [options.
|
|
34
|
-
* @param {*} [options.
|
|
35
|
-
* @param {*} [options.
|
|
36
|
-
* @param {*} [options.
|
|
37
|
-
* @param {*} [options.
|
|
38
|
-
* @param {*} [options.
|
|
39
|
-
* @param {*} [options.
|
|
40
|
-
* @param {*} [options.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
* @
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
* @
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
* @
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
* @
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
* @
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*
|
|
100
|
-
* @
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*
|
|
107
|
-
* @
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*
|
|
114
|
-
* @
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*
|
|
121
|
-
* @
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
*
|
|
128
|
-
* @
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
*
|
|
135
|
-
* @
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
*
|
|
142
|
-
* @
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
*
|
|
149
|
-
* @
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
*
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
*
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
*
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
*
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
*
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
*
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
*
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
*
|
|
263
|
-
* @
|
|
264
|
-
*/
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
*
|
|
272
|
-
* @public
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
this.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
this.
|
|
286
|
-
|
|
287
|
-
//
|
|
288
|
-
this.
|
|
289
|
-
|
|
290
|
-
//
|
|
291
|
-
this.
|
|
292
|
-
|
|
293
|
-
//
|
|
294
|
-
this.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
*
|
|
324
|
-
* @
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
*
|
|
454
|
-
* @public
|
|
455
|
-
* @
|
|
456
|
-
*/
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Sets entity
|
|
463
|
-
* @public
|
|
464
|
-
* @
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
return
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Sets entity
|
|
481
|
-
* @public
|
|
482
|
-
* @param {
|
|
483
|
-
* @returns {
|
|
484
|
-
*/
|
|
485
|
-
|
|
486
|
-
if (this.
|
|
487
|
-
this.
|
|
488
|
-
}
|
|
489
|
-
this.
|
|
490
|
-
this.
|
|
491
|
-
this.
|
|
492
|
-
this.
|
|
493
|
-
this._entityCollection && this._entityCollection.
|
|
494
|
-
return
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* Sets entity
|
|
499
|
-
* @public
|
|
500
|
-
* @param {
|
|
501
|
-
* @returns {
|
|
502
|
-
*/
|
|
503
|
-
|
|
504
|
-
if (this.
|
|
505
|
-
this.
|
|
506
|
-
}
|
|
507
|
-
this.
|
|
508
|
-
this.
|
|
509
|
-
this.
|
|
510
|
-
this.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
*
|
|
517
|
-
* @
|
|
518
|
-
* @
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
this.
|
|
526
|
-
this.
|
|
527
|
-
this.
|
|
528
|
-
this._entityCollection && this._entityCollection.
|
|
529
|
-
return
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Sets entity
|
|
534
|
-
* @public
|
|
535
|
-
* @param {
|
|
536
|
-
* @returns {Polyline} -
|
|
537
|
-
*/
|
|
538
|
-
|
|
539
|
-
if (this.
|
|
540
|
-
this.
|
|
541
|
-
}
|
|
542
|
-
this.
|
|
543
|
-
this.
|
|
544
|
-
this.
|
|
545
|
-
this.
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
*
|
|
552
|
-
* @
|
|
553
|
-
* @
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
this.
|
|
561
|
-
this.
|
|
562
|
-
this.
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
*
|
|
569
|
-
* @
|
|
570
|
-
* @
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
this.
|
|
578
|
-
this.
|
|
579
|
-
this.
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
*
|
|
586
|
-
* @
|
|
587
|
-
* @
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
this.
|
|
595
|
-
this.
|
|
596
|
-
this.
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module og/entity/Entity
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
import * as mercator from "../mercator.js";
|
|
8
|
+
import * as utils from "../utils/shared.js";
|
|
9
|
+
import { Billboard } from "./Billboard.js";
|
|
10
|
+
import { Strip } from "./Strip.js";
|
|
11
|
+
import { Extent } from "../Extent.js";
|
|
12
|
+
import { Geometry } from "./Geometry.js";
|
|
13
|
+
import { Label } from "./Label.js";
|
|
14
|
+
import { LonLat } from "../LonLat.js";
|
|
15
|
+
import { Polyline } from "./Polyline.js";
|
|
16
|
+
import { Ray } from "./Ray.js";
|
|
17
|
+
import { PointCloud } from "./PointCloud.js";
|
|
18
|
+
import { Sphere } from "../shapes/Sphere.js";
|
|
19
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
20
|
+
import { GeoObject } from "./GeoObject.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Entity instances aggregate multiple forms of visualization into a single high-level object.
|
|
24
|
+
* They can be created manually and added to entity collection.
|
|
25
|
+
*
|
|
26
|
+
* @class
|
|
27
|
+
* @param {Object} [options] - Entity options:
|
|
28
|
+
* @param {string} [options.name] - A human readable name to display to users. It does not have to be unique.
|
|
29
|
+
* @param {Vec3|Array.<number>} [options.cartesian] - Spatial entities like billboard, label, sphere etc. cartesian position.
|
|
30
|
+
* @param {LonLat} [options.lonlat] - Geodetic coordiantes for an entities like billboard, label, sphere etc.
|
|
31
|
+
* @param {boolean} [options.aground] - True for entities that have to be placed on the relief.
|
|
32
|
+
* @param {boolean} [options.visibility] - Entity visibility.
|
|
33
|
+
* @param {*} [options.billboard] - Billboard options(see {@link og.Billboard}).
|
|
34
|
+
* @param {*} [options.label] - Label options(see {@link og.Label}).
|
|
35
|
+
* @param {*} [options.sphere] - Sphere options(see {@link og.shape.Sphere}).
|
|
36
|
+
* @param {*} [options.box] - Sphere options(see {@link og.shape.Box}).
|
|
37
|
+
* @param {*} [options.polyline] - Polyline options(see {@link og.Polyline}).
|
|
38
|
+
* @param {*} [options.ray] - Ray options(see {@link og.Ray}).
|
|
39
|
+
* @param {*} [options.pointCloud] - Point cloud options(see {@link og.PointCloud}).
|
|
40
|
+
* @param {*} [options.geometry] - Geometry options (see {@link og.Geometry}), available for vector layer only.
|
|
41
|
+
* @param {*} [options.properties] - Entity custom properties.
|
|
42
|
+
*/
|
|
43
|
+
class Entity {
|
|
44
|
+
constructor(options) {
|
|
45
|
+
options = options || {};
|
|
46
|
+
|
|
47
|
+
options.properties = options.properties || {};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Unic identifier.
|
|
51
|
+
* @public
|
|
52
|
+
* @readonly
|
|
53
|
+
*/
|
|
54
|
+
this.id = Entity._staticCounter++;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Entity user defined properties.
|
|
58
|
+
* @public
|
|
59
|
+
* @type {Object}
|
|
60
|
+
*/
|
|
61
|
+
this.properties = options.properties || {};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Entity name.
|
|
65
|
+
* @public
|
|
66
|
+
* @type {string}
|
|
67
|
+
*/
|
|
68
|
+
this.properties.name = this.properties.name || options.name || "";
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Children entities.
|
|
72
|
+
* @public
|
|
73
|
+
* @type {Array.<Entity>}
|
|
74
|
+
*/
|
|
75
|
+
this.childrenNodes = [];
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Parent entity.
|
|
79
|
+
* @public
|
|
80
|
+
* @type {Entity}
|
|
81
|
+
*/
|
|
82
|
+
this.parent = null;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Entity cartesian position.
|
|
86
|
+
* @protected
|
|
87
|
+
* @type {Vec3}
|
|
88
|
+
*/
|
|
89
|
+
this._cartesian = utils.createVector3(options.cartesian);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Geodetic entity coordiantes.
|
|
93
|
+
* @protected
|
|
94
|
+
* @type {LonLat}
|
|
95
|
+
*/
|
|
96
|
+
this._lonlat = utils.createLonLat(options.lonlat);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* World Mercator entity coordinates.
|
|
100
|
+
* @protected
|
|
101
|
+
* @type {LonLat}
|
|
102
|
+
*/
|
|
103
|
+
this._lonlatMerc = null;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Entity visible terrain altitude.
|
|
107
|
+
* @protected
|
|
108
|
+
* @type {number}
|
|
109
|
+
*/
|
|
110
|
+
this._altitude = options.altitude || 0.0;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Visibility flag.
|
|
114
|
+
* @protected
|
|
115
|
+
* @type {boolean}
|
|
116
|
+
*/
|
|
117
|
+
this._visibility = options.visibility != undefined ? options.visibility : true;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Entity collection that this entity belongs to.
|
|
121
|
+
* @protected
|
|
122
|
+
* @type {EntityCollection}
|
|
123
|
+
*/
|
|
124
|
+
this._entityCollection = null;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Entity collection array store index.
|
|
128
|
+
* @protected
|
|
129
|
+
* @type {number}
|
|
130
|
+
*/
|
|
131
|
+
this._entityCollectionIndex = -1;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Assigned vector layer pointer.
|
|
135
|
+
* @protected
|
|
136
|
+
* @type {layer.Vector}
|
|
137
|
+
*/
|
|
138
|
+
this._layer = null;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Assigned vector layer entity array index.
|
|
142
|
+
* @protected
|
|
143
|
+
* @type {number}
|
|
144
|
+
*/
|
|
145
|
+
this._layerIndex = -1;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Picking color.
|
|
149
|
+
* @protected
|
|
150
|
+
* @type {Vec3}
|
|
151
|
+
*/
|
|
152
|
+
this._pickingColor = new Vec3(0, 0, 0);
|
|
153
|
+
|
|
154
|
+
this._featureConstructorArray = {
|
|
155
|
+
billboard: [Billboard, this.setBillboard],
|
|
156
|
+
label: [Label, this.setLabel],
|
|
157
|
+
sphere: [Sphere, this.setShape],
|
|
158
|
+
// box: [Box, this.setShape],
|
|
159
|
+
polyline: [Polyline, this.setPolyline],
|
|
160
|
+
pointCloud: [PointCloud, this.setPointCloud],
|
|
161
|
+
geometry: [Geometry, this.setGeometry],
|
|
162
|
+
geoObject: [GeoObject, this.setGeoObject],
|
|
163
|
+
strip: [Strip, this.setStrip],
|
|
164
|
+
ray: [Ray, this.setRay]
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Billboard entity.
|
|
169
|
+
* @public
|
|
170
|
+
* @type {Billboard}
|
|
171
|
+
*/
|
|
172
|
+
this.billboard = this._createOptionFeature("billboard", options.billboard);
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Text label entity.
|
|
176
|
+
* @public
|
|
177
|
+
* @type {Label}
|
|
178
|
+
*/
|
|
179
|
+
this.label = this._createOptionFeature("label", options.label);
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Shape entity.
|
|
183
|
+
* @public
|
|
184
|
+
* @type {shape.BaseShape}
|
|
185
|
+
*/
|
|
186
|
+
this.shape = this._createOptionFeature("sphere", options.sphere || options.box);
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Polyline entity.
|
|
190
|
+
* @public
|
|
191
|
+
* @type {Polyline}
|
|
192
|
+
*/
|
|
193
|
+
this.polyline = this._createOptionFeature("polyline", options.polyline);
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Ray entity.
|
|
197
|
+
* @public
|
|
198
|
+
* @type {ray}
|
|
199
|
+
*/
|
|
200
|
+
this.ray = this._createOptionFeature("ray", options.ray);
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* PointCloud entity.
|
|
204
|
+
* @public
|
|
205
|
+
* @type {PointCloud}
|
|
206
|
+
*/
|
|
207
|
+
this.pointCloud = this._createOptionFeature("pointCloud", options.pointCloud);
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Geometry entity(available for vector layer only).
|
|
211
|
+
* @public
|
|
212
|
+
* @type {Geometry}
|
|
213
|
+
*/
|
|
214
|
+
this.geometry = this._createOptionFeature("geometry", options.geometry);
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Geo object entity
|
|
218
|
+
* @public
|
|
219
|
+
* @type {og.Geometry}
|
|
220
|
+
*/
|
|
221
|
+
this.geoObject = this._createOptionFeature("geoObject", options.geoObject);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Strip entity.
|
|
225
|
+
* @public
|
|
226
|
+
* @type {Strip}
|
|
227
|
+
*/
|
|
228
|
+
this.strip = this._createOptionFeature("strip", options.strip);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
static get _staticCounter() {
|
|
232
|
+
if (!this._counter && this._counter !== 0) {
|
|
233
|
+
this._counter = 0;
|
|
234
|
+
}
|
|
235
|
+
return this._counter;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
static set _staticCounter(n) {
|
|
239
|
+
this._counter = n;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
get instanceName() {
|
|
243
|
+
return "Entity";
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
_createOptionFeature(featureName, options) {
|
|
247
|
+
if (options) {
|
|
248
|
+
let c = this._featureConstructorArray[featureName];
|
|
249
|
+
return c[1].call(this, new c[0](options));
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
getCollectionIndex() {
|
|
255
|
+
return this._entityCollectionIndex;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Adds current entity into the specified entity collection.
|
|
260
|
+
* @public
|
|
261
|
+
* @param {EntityCollection|Vector} collection - Specified entity collection or vector layer.
|
|
262
|
+
* @param {Boolean} [rightNow=false] - Entity insertion option for vector layer.
|
|
263
|
+
* @returns {Entity} - This object.
|
|
264
|
+
*/
|
|
265
|
+
addTo(collection, rightNow) {
|
|
266
|
+
collection.add(this, rightNow);
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Removes current entity from collection and layer.
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
remove() {
|
|
275
|
+
this._layer && this._layer.removeEntity(this);
|
|
276
|
+
this._entityCollection && this._entityCollection.removeEntity(this);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Sets the entity visibility.
|
|
281
|
+
* @public
|
|
282
|
+
* @param {boolean} visibility - Entity visibility.
|
|
283
|
+
*/
|
|
284
|
+
setVisibility(visibility) {
|
|
285
|
+
this._visibility = visibility;
|
|
286
|
+
|
|
287
|
+
// billboards
|
|
288
|
+
this.billboard && this.billboard.setVisibility(visibility);
|
|
289
|
+
|
|
290
|
+
// geoObject
|
|
291
|
+
this.geoObject && this.geoObject.setVisibility(visibility);
|
|
292
|
+
|
|
293
|
+
// labels
|
|
294
|
+
this.label && this.label.setVisibility(visibility);
|
|
295
|
+
|
|
296
|
+
// shape
|
|
297
|
+
this.shape && this.shape.setVisibility(visibility);
|
|
298
|
+
|
|
299
|
+
// polyline
|
|
300
|
+
this.polyline && this.polyline.setVisibility(visibility);
|
|
301
|
+
|
|
302
|
+
// ray
|
|
303
|
+
this.ray && this.ray.setVisibility(visibility);
|
|
304
|
+
|
|
305
|
+
// geometry
|
|
306
|
+
this.geometry && this.geometry.setVisibility(visibility);
|
|
307
|
+
|
|
308
|
+
for (let i = 0; i < this.childrenNodes.length; i++) {
|
|
309
|
+
this.childrenNodes[i].setVisibility(visibility);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Returns entity visibility.
|
|
315
|
+
* @public
|
|
316
|
+
* @returns {boolean} -
|
|
317
|
+
*/
|
|
318
|
+
getVisibility() {
|
|
319
|
+
return this._visibility;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Sets entity cartesian position.
|
|
324
|
+
* @public
|
|
325
|
+
* @param {Vec3} cartesian - Cartesian position in 3d space.
|
|
326
|
+
*/
|
|
327
|
+
setCartesian3v(cartesian) {
|
|
328
|
+
this.setCartesian(cartesian.x, cartesian.y, cartesian.z);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Sets entity cartesian position.
|
|
333
|
+
* @public
|
|
334
|
+
* @param {number} x - 3d space X - position.
|
|
335
|
+
* @param {number} y - 3d space Y - position.
|
|
336
|
+
* @param {number} z - 3d space Z - position.
|
|
337
|
+
*/
|
|
338
|
+
setCartesian(x, y, z) {
|
|
339
|
+
let p = this._cartesian;
|
|
340
|
+
|
|
341
|
+
p.x = x;
|
|
342
|
+
p.y = y;
|
|
343
|
+
p.z = z;
|
|
344
|
+
|
|
345
|
+
// billboards
|
|
346
|
+
this.billboard && this.billboard.setPosition3v(p);
|
|
347
|
+
|
|
348
|
+
// geoObject
|
|
349
|
+
this.geoObject && this.geoObject.setPosition3v(p);
|
|
350
|
+
|
|
351
|
+
// labels
|
|
352
|
+
this.label && this.label.setPosition3v(p);
|
|
353
|
+
|
|
354
|
+
// shape
|
|
355
|
+
this.shape && this.shape.setPosition3v(p);
|
|
356
|
+
|
|
357
|
+
for (let i = 0; i < this.childrenNodes.length; i++) {
|
|
358
|
+
this.childrenNodes[i].setCartesian(x, y, z);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
let ec = this._entityCollection;
|
|
362
|
+
|
|
363
|
+
if (ec && ec.renderNode && ec.renderNode.ellipsoid) {
|
|
364
|
+
this._lonlat = ec.renderNode.ellipsoid.cartesianToLonLat(p);
|
|
365
|
+
|
|
366
|
+
if (Math.abs(this._lonlat.lat) < mercator.MAX_LAT) {
|
|
367
|
+
this._lonlatMerc = this._lonlat.forwardMercator();
|
|
368
|
+
} else {
|
|
369
|
+
this._lonlatMerc = null;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
ec && ec.events.dispatch(ec.events.entitymove, this);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Sets entity cartesian position without event dispatching.
|
|
378
|
+
* @protected
|
|
379
|
+
* @param {Vec3} cartesian - Cartesian position in 3d space.
|
|
380
|
+
* @param {boolean} skipLonLat - skip geodetic calculation.
|
|
381
|
+
*/
|
|
382
|
+
_setCartesian3vSilent(cartesian, skipLonLat) {
|
|
383
|
+
let p = this._cartesian;
|
|
384
|
+
|
|
385
|
+
p.x = cartesian.x;
|
|
386
|
+
p.y = cartesian.y;
|
|
387
|
+
p.z = cartesian.z;
|
|
388
|
+
|
|
389
|
+
// billboards
|
|
390
|
+
this.billboard && this.billboard.setPosition3v(p);
|
|
391
|
+
|
|
392
|
+
// geoObject
|
|
393
|
+
this.geoObject && this.geoObject.setPosition3v(p);
|
|
394
|
+
|
|
395
|
+
// labels
|
|
396
|
+
this.label && this.label.setPosition3v(p);
|
|
397
|
+
|
|
398
|
+
// shape
|
|
399
|
+
this.shape && this.shape.setPosition3v(p);
|
|
400
|
+
|
|
401
|
+
for (let i = 0; i < this.childrenNodes.length; i++) {
|
|
402
|
+
this.childrenNodes[i].setCartesian(p.x, p.y, p.z);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
let ec = this._entityCollection;
|
|
406
|
+
|
|
407
|
+
if (!skipLonLat && ec && ec.renderNode && ec.renderNode.ellipsoid) {
|
|
408
|
+
this._lonlat = ec.renderNode.ellipsoid.cartesianToLonLat(p);
|
|
409
|
+
|
|
410
|
+
if (Math.abs(this._lonlat.lat) < mercator.MAX_LAT) {
|
|
411
|
+
this._lonlatMerc = this._lonlat.forwardMercator();
|
|
412
|
+
} else {
|
|
413
|
+
this._lonlatMerc = null;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Gets entity geodetic coordinates.
|
|
420
|
+
* @public
|
|
421
|
+
* @returns {LonLat} -
|
|
422
|
+
*/
|
|
423
|
+
getLonLat() {
|
|
424
|
+
return this._lonlat.clone();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Sets geodetic coordinates of the entity point object.
|
|
429
|
+
* @public
|
|
430
|
+
* @param {LonLat} lonlat - WGS84 coordinates.
|
|
431
|
+
*/
|
|
432
|
+
setLonLat(lonlat) {
|
|
433
|
+
let l = this._lonlat;
|
|
434
|
+
|
|
435
|
+
l.lon = lonlat.lon;
|
|
436
|
+
l.lat = lonlat.lat;
|
|
437
|
+
l.height = lonlat.height;
|
|
438
|
+
|
|
439
|
+
let ec = this._entityCollection;
|
|
440
|
+
if (ec && ec.renderNode && ec.renderNode.ellipsoid) {
|
|
441
|
+
if (Math.abs(lonlat.lat) < mercator.MAX_LAT) {
|
|
442
|
+
this._lonlatMerc = lonlat.forwardMercator();
|
|
443
|
+
} else {
|
|
444
|
+
this._lonlatMerc = null;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
ec.renderNode.ellipsoid.lonLatToCartesianRes(lonlat, this._cartesian);
|
|
448
|
+
this.setCartesian3v(this._cartesian);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Sets entity altitude over the planet.
|
|
454
|
+
* @public
|
|
455
|
+
* @param {number} altitude - Altitude.
|
|
456
|
+
*/
|
|
457
|
+
setAltitude(altitude) {
|
|
458
|
+
this._altitude = altitude;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Sets entity altitude over the planet.
|
|
463
|
+
* @public
|
|
464
|
+
* @return {number} Altitude.
|
|
465
|
+
*/
|
|
466
|
+
getAltitude() {
|
|
467
|
+
return this._altitude;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Returns carteain position.
|
|
472
|
+
* @public
|
|
473
|
+
* @returns {Vec3} -
|
|
474
|
+
*/
|
|
475
|
+
getCartesian() {
|
|
476
|
+
return this._cartesian.clone();
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Sets entity billboard.
|
|
481
|
+
* @public
|
|
482
|
+
* @param {Billboard} billboard - Billboard object.
|
|
483
|
+
* @returns {Billboard} -
|
|
484
|
+
*/
|
|
485
|
+
setBillboard(billboard) {
|
|
486
|
+
if (this.billboard) {
|
|
487
|
+
this.billboard.remove();
|
|
488
|
+
}
|
|
489
|
+
this.billboard = billboard;
|
|
490
|
+
this.billboard._entity = this;
|
|
491
|
+
this.billboard.setPosition3v(this._cartesian);
|
|
492
|
+
this.billboard.setVisibility(this._visibility);
|
|
493
|
+
this._entityCollection && this._entityCollection._billboardHandler.add(billboard);
|
|
494
|
+
return billboard;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Sets entity label.
|
|
499
|
+
* @public
|
|
500
|
+
* @param {Label} label - Text label.
|
|
501
|
+
* @returns {Label} -
|
|
502
|
+
*/
|
|
503
|
+
setLabel(label) {
|
|
504
|
+
if (this.label) {
|
|
505
|
+
this.label.remove();
|
|
506
|
+
}
|
|
507
|
+
this.label = label;
|
|
508
|
+
this.label._entity = this;
|
|
509
|
+
this.label.setPosition3v(this._cartesian);
|
|
510
|
+
this.label.setVisibility(this._visibility);
|
|
511
|
+
this._entityCollection && this._entityCollection._labelHandler.add(label);
|
|
512
|
+
return label;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Sets entity ray.
|
|
517
|
+
* @public
|
|
518
|
+
* @param {Ray} ray - Ray object.
|
|
519
|
+
* @returns {Ray} -
|
|
520
|
+
*/
|
|
521
|
+
setRay(ray) {
|
|
522
|
+
if (this.ray) {
|
|
523
|
+
this.ray.remove();
|
|
524
|
+
}
|
|
525
|
+
this.ray = ray;
|
|
526
|
+
this.ray._entity = this;
|
|
527
|
+
this.ray.setVisibility(this._visibility);
|
|
528
|
+
this._entityCollection && this._entityCollection._rayHandler.add(ray);
|
|
529
|
+
return ray;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Sets entity shape.
|
|
534
|
+
* @public
|
|
535
|
+
* @param {BaseShape} shape - Shape object.
|
|
536
|
+
* @returns {Polyline} -
|
|
537
|
+
*/
|
|
538
|
+
setShape(shape) {
|
|
539
|
+
if (this.shape) {
|
|
540
|
+
this.shape.remove();
|
|
541
|
+
}
|
|
542
|
+
this.shape = shape;
|
|
543
|
+
this.shape._entity = this;
|
|
544
|
+
this.shape.setPosition3v(this._cartesian);
|
|
545
|
+
this.shape.setVisibility(this._visibility);
|
|
546
|
+
this._entityCollection && this._entityCollection._shapeHandler.add(shape);
|
|
547
|
+
return shape;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Sets entity polyline.
|
|
552
|
+
* @public
|
|
553
|
+
* @param {Polyline} polyline - Polyline object.
|
|
554
|
+
* @returns {Polyline} -
|
|
555
|
+
*/
|
|
556
|
+
setPolyline(polyline) {
|
|
557
|
+
if (this.polyline) {
|
|
558
|
+
this.polyline.remove();
|
|
559
|
+
}
|
|
560
|
+
this.polyline = polyline;
|
|
561
|
+
this.polyline._entity = this;
|
|
562
|
+
this.polyline.setVisibility(this._visibility);
|
|
563
|
+
this._entityCollection && this._entityCollection._polylineHandler.add(polyline);
|
|
564
|
+
return polyline;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Sets entity pointCloud.
|
|
569
|
+
* @public
|
|
570
|
+
* @param {PointCloud} pointCloud - PointCloud object.
|
|
571
|
+
* @returns {PointCloud} -
|
|
572
|
+
*/
|
|
573
|
+
setPointCloud(pointCloud) {
|
|
574
|
+
if (this.pointCloud) {
|
|
575
|
+
this.pointCloud.remove();
|
|
576
|
+
}
|
|
577
|
+
this.pointCloud = pointCloud;
|
|
578
|
+
this.pointCloud._entity = this;
|
|
579
|
+
this.pointCloud.setVisibility(this._visibility);
|
|
580
|
+
this._entityCollection && this._entityCollection._pointCloudHandler.add(pointCloud);
|
|
581
|
+
return pointCloud;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Sets entity geometry.
|
|
586
|
+
* @public
|
|
587
|
+
* @param {Geometry} geometry - Geometry object.
|
|
588
|
+
* @returns {Geometry} -
|
|
589
|
+
*/
|
|
590
|
+
setGeometry(geometry) {
|
|
591
|
+
if (this.geometry) {
|
|
592
|
+
this.geometry.remove();
|
|
593
|
+
}
|
|
594
|
+
this.geometry = geometry;
|
|
595
|
+
this.geometry._entity = this;
|
|
596
|
+
this.geometry.setVisibility(this._visibility);
|
|
597
|
+
this._layer && this._layer.add(this);
|
|
598
|
+
return geometry;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Sets entity geoObject.
|
|
603
|
+
* @public
|
|
604
|
+
* @param {GeoObject} geoObject - GeoObject.
|
|
605
|
+
* @returns {GeoObject} -
|
|
606
|
+
*/
|
|
607
|
+
setGeoObject(geoObject) {
|
|
608
|
+
if (this.geoObject) {
|
|
609
|
+
this.geoObject.remove();
|
|
610
|
+
}
|
|
611
|
+
this.geoObject = geoObject;
|
|
612
|
+
this.geoObject._entity = this;
|
|
613
|
+
this.geoObject.setPosition3v(this._cartesian);
|
|
614
|
+
this.geoObject.setVisibility(this._visibility);
|
|
615
|
+
this._entityCollection && this._entityCollection._geoObjectHandler.add(geoObject);
|
|
616
|
+
return geoObject;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Sets entity strip.
|
|
621
|
+
* @public
|
|
622
|
+
* @param {Strip} strip - Strip object.
|
|
623
|
+
* @returns {Strip} -
|
|
624
|
+
*/
|
|
625
|
+
setStrip(strip) {
|
|
626
|
+
if (this.strip) {
|
|
627
|
+
this.strip.remove();
|
|
628
|
+
}
|
|
629
|
+
this.strip = strip;
|
|
630
|
+
this.strip._entity = this;
|
|
631
|
+
this.strip.setVisibility(this._visibility);
|
|
632
|
+
this._entityCollection && this._entityCollection._stripHandler.add(strip);
|
|
633
|
+
return strip;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
get layer() {
|
|
637
|
+
return this._layer;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
get rendererEvents() {
|
|
641
|
+
if (this._layer) {
|
|
642
|
+
return this._layer.events;
|
|
643
|
+
} else if (this._entityCollection) {
|
|
644
|
+
return this._entityCollection.events;
|
|
645
|
+
}
|
|
646
|
+
return null;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Append child entity.
|
|
651
|
+
* @public
|
|
652
|
+
* @param {Entity} entity - Child entity.
|
|
653
|
+
*/
|
|
654
|
+
appendChild(entity) {
|
|
655
|
+
entity._entityCollection = this._entityCollection;
|
|
656
|
+
entity._pickingColor = this._pickingColor;
|
|
657
|
+
entity.parent = this;
|
|
658
|
+
this.childrenNodes.push(entity);
|
|
659
|
+
this._entityCollection && this._entityCollection._addRecursively(entity);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Appends entity items(billboard, label etc.) picking color.
|
|
664
|
+
* @public
|
|
665
|
+
*/
|
|
666
|
+
setPickingColor() {
|
|
667
|
+
let c = this._pickingColor;
|
|
668
|
+
|
|
669
|
+
// billboard
|
|
670
|
+
this.billboard && this.billboard.setPickingColor3v(c);
|
|
671
|
+
|
|
672
|
+
// label
|
|
673
|
+
this.label && this.label.setPickingColor3v(c);
|
|
674
|
+
|
|
675
|
+
// shape
|
|
676
|
+
this.shape && this.shape.setPickingColor3v(c);
|
|
677
|
+
|
|
678
|
+
// polyline
|
|
679
|
+
this.polyline && this.polyline.setPickingColor3v(c);
|
|
680
|
+
|
|
681
|
+
// ray
|
|
682
|
+
this.ray && this.ray.setPickingColor3v(c);
|
|
683
|
+
|
|
684
|
+
// strip
|
|
685
|
+
this.strip && this.strip.setPickingColor3v(c);
|
|
686
|
+
|
|
687
|
+
// billboard
|
|
688
|
+
this.geoObject && this.geoObject.setPickingColor3v(c);
|
|
689
|
+
for (let i = 0; i < this.childrenNodes.length; i++) {
|
|
690
|
+
this.childrenNodes[i].setPickingColor();
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Return geodethic extent.
|
|
696
|
+
* @returns {Extent} -
|
|
697
|
+
*/
|
|
698
|
+
getExtent() {
|
|
699
|
+
let res;
|
|
700
|
+
let c = this._lonlat;
|
|
701
|
+
if (this.billboard || this.label) {
|
|
702
|
+
res = new Extent(new LonLat(c.lon, c.lat), new LonLat(c.lon, c.lat));
|
|
703
|
+
} else {
|
|
704
|
+
res = new Extent(new LonLat(180.0, 90.0), new LonLat(-180.0, -90.0));
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
let sw = res.southWest,
|
|
708
|
+
ne = res.northEast;
|
|
709
|
+
|
|
710
|
+
if (this.polyline) {
|
|
711
|
+
let e = this.polyline.getExtent();
|
|
712
|
+
if (e.southWest.lon < sw.lon) sw.lon = e.southWest.lon;
|
|
713
|
+
if (e.southWest.lat < sw.lat) sw.lat = e.southWest.lat;
|
|
714
|
+
if (e.northEast.lon > ne.lon) ne.lon = e.northEast.lon;
|
|
715
|
+
if (e.northEast.lat > ne.lat) ne.lat = e.northEast.lat;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
if (this.geometry) {
|
|
719
|
+
let e = this.geometry.getExtent();
|
|
720
|
+
if (e.southWest.lon < sw.lon) sw.lon = e.southWest.lon;
|
|
721
|
+
if (e.southWest.lat < sw.lat) sw.lat = e.southWest.lat;
|
|
722
|
+
if (e.northEast.lon > ne.lon) ne.lon = e.northEast.lon;
|
|
723
|
+
if (e.northEast.lat > ne.lat) ne.lat = e.northEast.lat;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
for (let i = 0; i < this.childrenNodes.length; i++) {
|
|
727
|
+
let e = this.childrenNodes[i].getExtent();
|
|
728
|
+
if (e.southWest.lon < sw.lon) sw.lon = e.southWest.lon;
|
|
729
|
+
if (e.southWest.lat < sw.lat) sw.lat = e.southWest.lat;
|
|
730
|
+
if (e.northEast.lon > ne.lon) ne.lon = e.northEast.lon;
|
|
731
|
+
if (e.northEast.lat > ne.lat) ne.lat = e.northEast.lat;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
return res;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
isEqual(entity) {
|
|
738
|
+
return this.id === entity.id;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
export { Entity };
|