@openglobus/og 0.11.1 → 0.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +18 -20
- package/src/og/Clock.js +11 -11
- package/src/og/Deferred.js +1 -1
- package/src/og/Events.js +9 -7
- package/src/og/Extent.js +117 -72
- package/src/og/Globe.js +35 -22
- package/src/og/ImageCanvas.js +24 -18
- package/src/og/Lock.js +2 -2
- package/src/og/LonLat.js +40 -37
- package/src/og/Popup.js +21 -15
- package/src/og/QueueArray.js +7 -3
- package/src/og/Rectangle.js +11 -6
- package/src/og/Stack.js +8 -5
- package/src/og/ajax.js +21 -33
- package/src/og/astro/astro.js +5 -5
- package/src/og/astro/earth.js +23 -17
- package/src/og/astro/jd.js +44 -39
- package/src/og/astro/orbit.js +20 -18
- package/src/og/astro/rotation.js +17 -8
- package/src/og/bv/Box.js +7 -3
- package/src/og/bv/Sphere.js +17 -9
- package/src/og/camera/Camera.js +137 -86
- package/src/og/camera/Frustum.js +30 -19
- package/src/og/camera/PlanetCamera.js +30 -26
- package/src/og/control/CompassButton.js +8 -2
- package/src/og/control/Control.js +13 -11
- package/src/og/control/DebugInfo.js +4 -1
- package/src/og/control/EarthCoordinates.js +62 -41
- package/src/og/control/EarthNavigation.js +20 -22
- package/src/og/control/GeoImageDragControl.js +1 -1
- package/src/og/control/KeyboardNavigation.js +12 -12
- package/src/og/control/LayerSwitcher.js +24 -23
- package/src/og/control/Lighting.js +1 -1
- package/src/og/control/MouseNavigation.js +1 -1
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/SegmentBoundVisualization.js +8 -9
- package/src/og/control/ShowFps.js +15 -10
- package/src/og/control/SimpleNavigation.js +8 -10
- package/src/og/control/Sun.js +25 -15
- package/src/og/control/ToggleWireframe.js +5 -5
- package/src/og/control/TouchNavigation.js +58 -45
- package/src/og/control/ZoomControl.js +41 -25
- package/src/og/control/index.js +4 -0
- package/src/og/ellipsoid/Ellipsoid.js +181 -85
- package/src/og/ellipsoid/wgs84.js +4 -4
- package/src/og/entity/BaseBillboard.js +97 -44
- package/src/og/entity/Billboard.js +15 -11
- package/src/og/entity/BillboardHandler.js +314 -64
- package/src/og/entity/Entity.js +106 -74
- package/src/og/entity/EntityCollection.js +72 -49
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/Geometry.js +29 -26
- package/src/og/entity/GeometryHandler.js +598 -126
- package/src/og/entity/Label.js +74 -40
- package/src/og/entity/LabelHandler.js +47 -246
- package/src/og/entity/LabelWorker.js +213 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +81 -33
- package/src/og/entity/PointCloudHandler.js +9 -9
- package/src/og/entity/Polyline.js +39 -39
- package/src/og/entity/Ray.js +61 -28
- package/src/og/entity/ShapeHandler.js +1 -1
- package/src/og/entity/Strip.js +77 -48
- package/src/og/entity/StripHandler.js +27 -27
- package/src/og/entity/index.js +8 -16
- package/src/og/input/KeyboardHandler.js +107 -104
- package/src/og/input/MouseHandler.js +81 -78
- package/src/og/input/TouchHandler.js +55 -51
- package/src/og/layer/BaseGeoImage.js +61 -30
- package/src/og/layer/CanvasTiles.js +26 -24
- package/src/og/layer/GeoImage.js +10 -10
- package/src/og/layer/GeoTexture2d.js +1 -1
- package/src/og/layer/GeoVideo.js +3 -3
- package/src/og/layer/KML.js +66 -40
- package/src/og/layer/Layer.js +27 -17
- package/src/og/layer/Material.js +93 -61
- package/src/og/layer/Vector.js +118 -72
- package/src/og/layer/WMS.js +36 -19
- package/src/og/layer/XYZ.js +55 -48
- package/src/og/light/LightSource.js +47 -40
- package/src/og/math/Line2.js +24 -24
- package/src/og/math/Line3.js +103 -102
- package/src/og/math/Mat3.js +134 -121
- package/src/og/math/Mat4.js +603 -459
- package/src/og/math/Plane.js +21 -20
- package/src/og/math/Quat.js +980 -927
- package/src/og/math/Ray.js +195 -187
- package/src/og/math/Vec2.js +127 -117
- package/src/og/math/Vec3.js +206 -176
- package/src/og/math/Vec4.js +49 -53
- package/src/og/math/coder.js +18 -18
- package/src/og/math.js +12 -12
- package/src/og/mercator.js +11 -11
- package/src/og/proj/EPSG3857.js +4 -4
- package/src/og/proj/EPSG4326.js +4 -4
- package/src/og/proj/Proj.js +31 -31
- package/src/og/quadTree/EntityCollectionNode.js +310 -300
- package/src/og/quadTree/Node.js +1008 -993
- package/src/og/renderer/Renderer.js +768 -747
- package/src/og/renderer/RendererEvents.js +9 -6
- package/src/og/scene/Axes.js +1 -1
- package/src/og/scene/BaseNode.js +8 -9
- package/src/og/scene/Planet.js +115 -87
- package/src/og/scene/RenderNode.js +29 -22
- package/src/og/scene/SkyBox.js +1 -1
- package/src/og/segment/Segment.js +1886 -1878
- package/src/og/segment/SegmentLonLat.js +298 -268
- package/src/og/segment/segmentHelper.js +11 -11
- package/src/og/shaders/bloom.js +1 -1
- package/src/og/shaders/blur.js +2 -2
- package/src/og/shaders/depth.js +1 -1
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/label.js +1 -1
- package/src/og/shaders/lumFilter.js +1 -1
- package/src/og/shaders/pointCloud.js +42 -42
- package/src/og/shaders/screenFrame.js +1 -1
- package/src/og/shaders/shape.js +15 -21
- package/src/og/shaders/skybox.js +37 -37
- package/src/og/shaders/toneMapping.js +1 -1
- package/src/og/shapes/BaseShape.js +129 -57
- package/src/og/shapes/Icosphere.js +30 -15
- package/src/og/shapes/Sphere.js +13 -16
- package/src/og/terrain/BilTerrain.js +2 -1
- package/src/og/terrain/EmptyTerrain.js +2 -2
- package/src/og/terrain/Geoid.js +2 -2
- package/src/og/terrain/GlobusTerrain.js +10 -10
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/GeoImageCreator.js +9 -9
- package/src/og/utils/Loader.js +6 -6
- package/src/og/utils/NormalMapCreator.js +13 -13
- package/src/og/utils/TerrainWorker.js +1 -1
- package/src/og/utils/TextureAtlas.js +20 -22
- package/src/og/utils/VectorTileCreator.js +5 -5
- package/src/og/utils/earcut.js +1 -1
- package/src/og/utils/shared.js +15 -15
- package/src/og/webgl/Framebuffer.js +101 -53
- package/src/og/webgl/Handler.js +125 -85
- package/src/og/webgl/Multisample.js +55 -27
- package/src/og/webgl/Program.js +80 -35
- package/src/og/webgl/ProgramController.js +27 -23
- package/src/og/webgl/callbacks.js +8 -8
- package/types/Clock.d.ts +6 -2
- package/types/Deferred.d.ts +1 -1
- package/types/Events.d.ts +8 -4
- package/types/Extent.d.ts +37 -33
- package/types/Globe.d.ts +15 -13
- package/types/ImageCanvas.d.ts +5 -3
- package/types/LonLat.d.ts +24 -24
- package/types/Popup.d.ts +4 -0
- package/types/QueueArray.d.ts +6 -2
- package/types/Rectangle.d.ts +10 -4
- package/types/Stack.d.ts +4 -0
- package/types/ajax.d.ts +1 -1
- package/types/astro/earth.d.ts +3 -2
- package/types/bv/Box.d.ts +10 -5
- package/types/bv/Sphere.d.ts +13 -7
- package/types/camera/Camera.d.ts +90 -81
- package/types/camera/Frustum.d.ts +26 -22
- package/types/camera/PlanetCamera.d.ts +49 -53
- package/types/control/CompassButton.d.ts +4 -4
- package/types/control/Control.d.ts +7 -4
- package/types/control/DebugInfo.d.ts +3 -4
- package/types/control/EarthCoordinates.d.ts +6 -6
- package/types/control/EarthNavigation.d.ts +42 -0
- package/types/control/KeyboardNavigation.d.ts +3 -4
- package/types/control/LayerSwitcher.d.ts +3 -5
- package/types/control/Lighting.d.ts +3 -3
- package/types/control/MouseNavigation.d.ts +47 -0
- package/types/control/ScaleControl.d.ts +3 -3
- package/types/control/ShowFps.d.ts +3 -4
- package/types/control/SimpleNavigation.d.ts +3 -6
- package/types/control/Sun.d.ts +8 -10
- package/types/control/ToggleWireframe.d.ts +3 -3
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +3 -4
- package/types/control/index.d.ts +3 -1
- package/types/ellipsoid/Ellipsoid.d.ts +47 -43
- package/types/ellipsoid/wgs84.d.ts +3 -2
- package/types/entity/BaseBillboard.d.ts +41 -34
- package/types/entity/Billboard.d.ts +7 -7
- package/types/entity/BillboardHandler.d.ts +4 -0
- package/types/entity/Entity.d.ts +101 -83
- package/types/entity/EntityCollection.d.ts +57 -43
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +77 -0
- package/types/entity/Geometry.d.ts +9 -7
- package/types/entity/GeometryHandler.d.ts +2 -2
- package/types/entity/Label.d.ts +24 -29
- package/types/entity/LabelHandler.d.ts +9 -2
- package/types/entity/LabelWorker.d.ts +9 -0
- package/types/entity/PointCloud.d.ts +8 -8
- package/types/entity/PointCloudHandler.d.ts +3 -3
- package/types/entity/Polyline.d.ts +58 -55
- package/types/entity/Ray.d.ts +19 -18
- package/types/entity/Strip.d.ts +8 -7
- package/types/entity/StripHandler.d.ts +3 -3
- package/types/entity/index.d.ts +7 -7
- package/types/input/KeyboardHandler.d.ts +10 -0
- package/types/input/MouseHandler.d.ts +5 -0
- package/types/input/TouchHandler.d.ts +5 -0
- package/types/layer/BaseGeoImage.d.ts +23 -35
- package/types/layer/CanvasTiles.d.ts +15 -22
- package/types/layer/GeoImage.d.ts +5 -18
- package/types/layer/GeoVideo.d.ts +5 -30
- package/types/layer/KML.d.ts +20 -15
- package/types/layer/Layer.d.ts +326 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +4 -7
- package/types/layer/XYZ.d.ts +19 -25
- package/types/light/LightSource.d.ts +54 -53
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +30 -18
- package/types/math/Mat4.d.ts +71 -52
- package/types/math/Plane.d.ts +5 -4
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +102 -101
- package/types/math/Vec3.d.ts +143 -142
- package/types/math/Vec4.d.ts +40 -39
- package/types/math/coder.d.ts +12 -11
- package/types/math.d.ts +8 -8
- package/types/mercator.d.ts +3 -3
- package/types/proj/EPSG3857.d.ts +3 -2
- package/types/proj/EPSG4326.d.ts +3 -2
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +61 -0
- package/types/renderer/Renderer.d.ts +300 -0
- package/types/renderer/RendererEvents.d.ts +10 -7
- package/types/scene/BaseNode.d.ts +9 -9
- package/types/scene/Planet.d.ts +131 -126
- package/types/scene/RenderNode.d.ts +22 -23
- package/types/segment/Segment.d.ts +279 -0
- package/types/segment/SegmentLonLat.d.ts +16 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shapes/BaseShape.d.ts +43 -40
- package/types/shapes/Sphere.d.ts +7 -7
- package/types/terrain/BilTerrain.d.ts +0 -1
- package/types/terrain/EmptyTerrain.d.ts +4 -4
- package/types/terrain/GlobusTerrain.d.ts +17 -54
- package/types/terrain/MapboxTerrain.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +3 -2
- package/types/utils/TextureAtlas.d.ts +8 -8
- package/types/utils/shared.d.ts +25 -24
- package/types/webgl/Framebuffer.d.ts +5 -5
- package/types/webgl/Handler.d.ts +68 -43
- package/types/webgl/Multisample.d.ts +5 -5
- package/types/webgl/Program.d.ts +8 -2
- package/types/webgl/ProgramController.d.ts +18 -13
- package/src/og/inherits.js +0 -8
- package/src/og/utils/polylabel.js +0 -176
- package/types/inherits.d.ts +0 -4
package/src/og/layer/Vector.js
CHANGED
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
* @module og/layer/Vector
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import * as math from
|
|
8
|
-
import * as mercator from
|
|
9
|
-
import * as quadTree from
|
|
10
|
-
import { Entity } from
|
|
11
|
-
import { EntityCollection } from
|
|
12
|
-
import { Extent } from
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import {
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
import * as math from "../math.js";
|
|
8
|
+
import * as mercator from "../mercator.js";
|
|
9
|
+
import * as quadTree from "../quadTree/quadTree.js";
|
|
10
|
+
import { Entity } from "../entity/Entity.js";
|
|
11
|
+
import { EntityCollection } from "../entity/EntityCollection.js";
|
|
12
|
+
import { Extent } from "../Extent.js";
|
|
13
|
+
import {
|
|
14
|
+
EntityCollectionNode,
|
|
15
|
+
EntityCollectionNodeWGS84
|
|
16
|
+
} from "../quadTree/EntityCollectionNode.js";
|
|
17
|
+
import { GeometryHandler } from "../entity/GeometryHandler.js";
|
|
18
|
+
import { Layer } from "./Layer.js";
|
|
19
|
+
import { QueueArray } from "../QueueArray.js";
|
|
20
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Creates entity instance array.
|
|
@@ -32,13 +35,13 @@ function _entitiesConstructor(entities) {
|
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
return res;
|
|
35
|
-
}
|
|
38
|
+
}
|
|
36
39
|
|
|
37
40
|
/**
|
|
38
41
|
* Vector layer represents alternative entities store. Used for geospatial data rendering like
|
|
39
42
|
* points, lines, polygons, geometry objects etc.
|
|
40
43
|
* @class
|
|
41
|
-
* @extends {
|
|
44
|
+
* @extends {Layer}
|
|
42
45
|
* @param {string} [name="noname"] - Layer name.
|
|
43
46
|
* @param {Object} [options] - Layer options:
|
|
44
47
|
* @param {number} [options.minZoom=0] - Minimal visible zoom. 0 is default
|
|
@@ -47,8 +50,8 @@ function _entitiesConstructor(entities) {
|
|
|
47
50
|
* @param {string} [options.zIndex=0] - Layer Z-order index. 0 is default.
|
|
48
51
|
* @param {boolean} [options.visibility=true] - Layer visibility. True is default.
|
|
49
52
|
* @param {boolean} [options.isBaseLayer=false] - Layer base layer. False is default.
|
|
50
|
-
* @param {Array.<
|
|
51
|
-
* @param {Array.<number
|
|
53
|
+
* @param {Array.<Entity>} [options.entities] - Entities array.
|
|
54
|
+
* @param {Array.<number>} [options.scaleByDistance] - Scale by distance parameters. (exactly 3 entries)
|
|
52
55
|
* First index - near distance to the entity, after entity becomes full scale.
|
|
53
56
|
* Second index - far distance to the entity, when entity becomes zero scale.
|
|
54
57
|
* Third index - far distance to the entity, when entity becomes invisible.
|
|
@@ -68,13 +71,11 @@ function _entitiesConstructor(entities) {
|
|
|
68
71
|
* @fires og.layer.Vector#visibilitychange
|
|
69
72
|
*/
|
|
70
73
|
class Vector extends Layer {
|
|
71
|
-
|
|
72
74
|
/**
|
|
73
|
-
* @param {string} name
|
|
75
|
+
* @param {string} name
|
|
74
76
|
* @param {*} [options]
|
|
75
77
|
*/
|
|
76
78
|
constructor(name, options = {}) {
|
|
77
|
-
|
|
78
79
|
super(name, options);
|
|
79
80
|
|
|
80
81
|
this.events.registerNames(EVENT_NAMES);
|
|
@@ -88,7 +89,7 @@ class Vector extends Layer {
|
|
|
88
89
|
* Second index - far distance to the entity, when entity becomes zero scale.
|
|
89
90
|
* Third index - far distance to the entity, when entity becomes invisible.
|
|
90
91
|
* @public
|
|
91
|
-
* @type {Array.<number
|
|
92
|
+
* @type {Array.<number>} - (exactly 3 entries)
|
|
92
93
|
*/
|
|
93
94
|
this.scaleByDistance = options.scaleByDistance || [math.MAX32, math.MAX32, math.MAX32];
|
|
94
95
|
|
|
@@ -160,14 +161,16 @@ class Vector extends Layer {
|
|
|
160
161
|
* @public
|
|
161
162
|
* @type {Number}
|
|
162
163
|
*/
|
|
163
|
-
this.polygonOffsetFactor =
|
|
164
|
+
this.polygonOffsetFactor =
|
|
165
|
+
options.polygonOffsetFactor != undefined ? options.polygonOffsetFactor : 0.0;
|
|
164
166
|
|
|
165
167
|
/**
|
|
166
168
|
* Specifies the scale Units for gl.polygonOffset function to calculate depth values, 0.0 is default.
|
|
167
169
|
* @public
|
|
168
170
|
* @type {Number}
|
|
169
171
|
*/
|
|
170
|
-
this.polygonOffsetUnits =
|
|
172
|
+
this.polygonOffsetUnits =
|
|
173
|
+
options.polygonOffsetUnits != undefined ? options.polygonOffsetUnits : -637000.0;
|
|
171
174
|
|
|
172
175
|
this.pickingEnabled = this._pickingEnabled;
|
|
173
176
|
}
|
|
@@ -183,8 +186,8 @@ class Vector extends Layer {
|
|
|
183
186
|
/**
|
|
184
187
|
* Adds layer to the planet.
|
|
185
188
|
* @public
|
|
186
|
-
* @param {
|
|
187
|
-
* @returns {
|
|
189
|
+
* @param {Planet} planet - Planet scene object.
|
|
190
|
+
* @returns {layer.Vector} -
|
|
188
191
|
*/
|
|
189
192
|
addTo(planet) {
|
|
190
193
|
if (!this._planet) {
|
|
@@ -200,7 +203,7 @@ class Vector extends Layer {
|
|
|
200
203
|
/**
|
|
201
204
|
* Returns stored entities.
|
|
202
205
|
* @public
|
|
203
|
-
* @returns {Array.<
|
|
206
|
+
* @returns {Array.<Entity>} -
|
|
204
207
|
*/
|
|
205
208
|
getEntities() {
|
|
206
209
|
return [].concat(this._entities);
|
|
@@ -237,9 +240,9 @@ class Vector extends Layer {
|
|
|
237
240
|
/**
|
|
238
241
|
* Adds entity to the layer.
|
|
239
242
|
* @public
|
|
240
|
-
* @param {
|
|
243
|
+
* @param {Entity} entity - Entity.
|
|
241
244
|
* @param {boolean} [rightNow] - Entity insertion option. False is deafult.
|
|
242
|
-
* @returns {
|
|
245
|
+
* @returns {layer.Vector} - Returns this layer.
|
|
243
246
|
*/
|
|
244
247
|
add(entity, rightNow) {
|
|
245
248
|
if (!(entity._layer || entity._entityCollection)) {
|
|
@@ -255,10 +258,10 @@ class Vector extends Layer {
|
|
|
255
258
|
/**
|
|
256
259
|
* Adds entity to the layer in the index position.
|
|
257
260
|
* @public
|
|
258
|
-
* @param {
|
|
261
|
+
* @param {Entity} entity - Entity.
|
|
259
262
|
* @param {Number} index - Index position.
|
|
260
263
|
* @param {boolean} [rightNow] - Entity insertion option. False is deafult.
|
|
261
|
-
* @returns {
|
|
264
|
+
* @returns {layer.Vector} - Returns this layer.
|
|
262
265
|
*/
|
|
263
266
|
insert(entity, index, rightNow) {
|
|
264
267
|
if (!(entity._layer || entity._entityCollection)) {
|
|
@@ -277,7 +280,6 @@ class Vector extends Layer {
|
|
|
277
280
|
}
|
|
278
281
|
|
|
279
282
|
_proceedEntity(entity, rightNow) {
|
|
280
|
-
|
|
281
283
|
let temp = this._hasImageryTiles;
|
|
282
284
|
|
|
283
285
|
//
|
|
@@ -302,9 +304,10 @@ class Vector extends Layer {
|
|
|
302
304
|
|
|
303
305
|
if (entity.billboard || entity.label) {
|
|
304
306
|
if (this._planet) {
|
|
305
|
-
|
|
306
307
|
if (entity._cartesian.isZero() && !entity._lonlat.isZero()) {
|
|
307
|
-
entity._setCartesian3vSilent(
|
|
308
|
+
entity._setCartesian3vSilent(
|
|
309
|
+
this._planet.ellipsoid.lonLatToCartesian(entity._lonlat)
|
|
310
|
+
);
|
|
308
311
|
} else {
|
|
309
312
|
entity._lonlat = this._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
|
|
310
313
|
}
|
|
@@ -334,9 +337,9 @@ class Vector extends Layer {
|
|
|
334
337
|
/**
|
|
335
338
|
* Adds entity array to the layer.
|
|
336
339
|
* @public
|
|
337
|
-
* @param {Array.<
|
|
340
|
+
* @param {Array.<Entity>} entities - Entities array.
|
|
338
341
|
* @param {boolean} [rightNow] - Entity insertion option. False is deafult.
|
|
339
|
-
* @returns {
|
|
342
|
+
* @returns {layer.Vector} - Returns this layer.
|
|
340
343
|
*/
|
|
341
344
|
addEntities(entities, rightNow) {
|
|
342
345
|
var i = entities.length;
|
|
@@ -350,8 +353,8 @@ class Vector extends Layer {
|
|
|
350
353
|
* Remove entity from layer.
|
|
351
354
|
* TODO: memory leaks.
|
|
352
355
|
* @public
|
|
353
|
-
* @param {
|
|
354
|
-
* @returns {
|
|
356
|
+
* @param {Entity} entity - Entity to remove.
|
|
357
|
+
* @returns {layer.Vector} - Returns this layer.
|
|
355
358
|
*/
|
|
356
359
|
removeEntity(entity) {
|
|
357
360
|
if (entity._layer && this.isEqual(entity._layer)) {
|
|
@@ -367,15 +370,17 @@ class Vector extends Layer {
|
|
|
367
370
|
node.count--;
|
|
368
371
|
node = node.parentNode;
|
|
369
372
|
}
|
|
370
|
-
if (
|
|
371
|
-
entity._nodePtr
|
|
373
|
+
if (
|
|
374
|
+
entity._nodePtr &&
|
|
375
|
+
entity._nodePtr.count === 0 &&
|
|
376
|
+
entity._nodePtr.deferredEntities.length === 0
|
|
377
|
+
) {
|
|
372
378
|
entity._nodePtr.entityCollection = null;
|
|
373
379
|
//
|
|
374
380
|
// ...
|
|
375
381
|
//
|
|
376
382
|
}
|
|
377
|
-
} else if (entity._nodePtr &&
|
|
378
|
-
entity._nodePtr.deferredEntities.length) {
|
|
383
|
+
} else if (entity._nodePtr && entity._nodePtr.deferredEntities.length) {
|
|
379
384
|
var defEntities = entity._nodePtr.deferredEntities;
|
|
380
385
|
var j = defEntities.length;
|
|
381
386
|
while (j--) {
|
|
@@ -447,8 +452,8 @@ class Vector extends Layer {
|
|
|
447
452
|
/**
|
|
448
453
|
* Removes entities from layer.
|
|
449
454
|
* @public
|
|
450
|
-
* @param {Array.<
|
|
451
|
-
* @returns {
|
|
455
|
+
* @param {Array.<Entity>} entities - Entity array.
|
|
456
|
+
* @returns {layer.Vector} - Returns this layer.
|
|
452
457
|
*/
|
|
453
458
|
removeEntities(entities) {
|
|
454
459
|
var i = entities.length;
|
|
@@ -464,7 +469,7 @@ class Vector extends Layer {
|
|
|
464
469
|
* @param {number} near - Full scale entity distance.
|
|
465
470
|
* @param {number} far - Zerol scale entity distance.
|
|
466
471
|
* @param {number} [farInvisible] - Entity visibility distance.
|
|
467
|
-
* @returns {
|
|
472
|
+
* @returns {layer.Vector} -
|
|
468
473
|
*/
|
|
469
474
|
setScaleByDistance(near, far, farInvisible) {
|
|
470
475
|
this.scaleByDistance[0] = near;
|
|
@@ -478,7 +483,6 @@ class Vector extends Layer {
|
|
|
478
483
|
* @public
|
|
479
484
|
*/
|
|
480
485
|
clear() {
|
|
481
|
-
|
|
482
486
|
let temp = new Array(this._entities.length);
|
|
483
487
|
|
|
484
488
|
for (let i = 0; i < temp.length; i++) {
|
|
@@ -517,11 +521,10 @@ class Vector extends Layer {
|
|
|
517
521
|
/**
|
|
518
522
|
* Removes current entities from layer and adds new entities.
|
|
519
523
|
* @public
|
|
520
|
-
* @param {Array.<
|
|
521
|
-
* @returns {
|
|
524
|
+
* @param {Array.<Entity>} entities - New entity array.
|
|
525
|
+
* @returns {layer.Vector} - Returns layer instance.
|
|
522
526
|
*/
|
|
523
527
|
setEntities(entities) {
|
|
524
|
-
|
|
525
528
|
let temp = new Array(entities.length);
|
|
526
529
|
for (let i = 0, len = entities.length; i < len; i++) {
|
|
527
530
|
temp[i] = entities[i];
|
|
@@ -573,12 +576,33 @@ class Vector extends Layer {
|
|
|
573
576
|
|
|
574
577
|
_createEntityCollectionsTree(entitiesForTree) {
|
|
575
578
|
if (this._planet) {
|
|
576
|
-
this._entityCollectionsTree = new EntityCollectionNode(
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
Extent.createFromArray([-
|
|
579
|
+
this._entityCollectionsTree = new EntityCollectionNode(
|
|
580
|
+
this,
|
|
581
|
+
quadTree.NW,
|
|
582
|
+
null,
|
|
583
|
+
0,
|
|
584
|
+
Extent.createFromArray([-20037508.34, -20037508.34, 20037508.34, 20037508.34]),
|
|
585
|
+
this._planet,
|
|
586
|
+
0
|
|
587
|
+
);
|
|
588
|
+
this._entityCollectionsTreeNorth = new EntityCollectionNodeWGS84(
|
|
589
|
+
this,
|
|
590
|
+
quadTree.NW,
|
|
591
|
+
null,
|
|
592
|
+
0,
|
|
593
|
+
Extent.createFromArray([-180, mercator.MAX_LAT, 180, 90]),
|
|
594
|
+
this._planet,
|
|
595
|
+
0
|
|
596
|
+
);
|
|
597
|
+
this._entityCollectionsTreeSouth = new EntityCollectionNodeWGS84(
|
|
598
|
+
this,
|
|
599
|
+
quadTree.NW,
|
|
600
|
+
null,
|
|
601
|
+
0,
|
|
602
|
+
Extent.createFromArray([-180, -90, 180, mercator.MIN_LAT]),
|
|
603
|
+
this._planet,
|
|
604
|
+
0
|
|
605
|
+
);
|
|
582
606
|
|
|
583
607
|
for (let i = 0, len = entitiesForTree.length; i < len; i++) {
|
|
584
608
|
let entity = entitiesForTree[i];
|
|
@@ -682,7 +706,6 @@ class Vector extends Layer {
|
|
|
682
706
|
}
|
|
683
707
|
|
|
684
708
|
_collectStripCollectionPASS(outArr) {
|
|
685
|
-
|
|
686
709
|
var ec = this._stripEntityCollection;
|
|
687
710
|
|
|
688
711
|
ec._fadingOpacity = this._fadingOpacity;
|
|
@@ -699,7 +722,6 @@ class Vector extends Layer {
|
|
|
699
722
|
}
|
|
700
723
|
|
|
701
724
|
_collectPolylineCollectionPASS(outArr) {
|
|
702
|
-
|
|
703
725
|
var ec = this._polylineEntityCollection;
|
|
704
726
|
|
|
705
727
|
ec._fadingOpacity = this._fadingOpacity;
|
|
@@ -737,7 +759,12 @@ class Vector extends Layer {
|
|
|
737
759
|
if (seg._extent.isInside(ll)) {
|
|
738
760
|
let cart = p._path3v[c_j][c_j_h];
|
|
739
761
|
seg.getTerrainPoint(cart, ll, res);
|
|
740
|
-
p.setPoint3v(
|
|
762
|
+
p.setPoint3v(
|
|
763
|
+
res.addA(res.normal().scale((rtg && p.altitude) || 0.0)),
|
|
764
|
+
c_j_h,
|
|
765
|
+
c_j,
|
|
766
|
+
true
|
|
767
|
+
);
|
|
741
768
|
break;
|
|
742
769
|
}
|
|
743
770
|
}
|
|
@@ -751,9 +778,10 @@ class Vector extends Layer {
|
|
|
751
778
|
collectVisibleCollections(outArr) {
|
|
752
779
|
var p = this._planet;
|
|
753
780
|
|
|
754
|
-
if (
|
|
755
|
-
(this.
|
|
756
|
-
|
|
781
|
+
if (
|
|
782
|
+
(this._fading && this._fadingOpacity > 0.0) ||
|
|
783
|
+
(this.minZoom <= this._planet.maxCurrZoom && this.maxZoom >= p.maxCurrZoom)
|
|
784
|
+
) {
|
|
757
785
|
this._renderingNodes = {};
|
|
758
786
|
this._renderingNodesNorth = {};
|
|
759
787
|
this._renderingNodesSouth = {};
|
|
@@ -768,23 +796,41 @@ class Vector extends Layer {
|
|
|
768
796
|
this._entityCollectionsTree.collectRenderCollectionsPASS1(p._visibleNodes, outArr);
|
|
769
797
|
var i = this._secondPASS.length;
|
|
770
798
|
while (i--) {
|
|
771
|
-
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
799
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
800
|
+
p._visibleNodes,
|
|
801
|
+
outArr,
|
|
802
|
+
this._secondPASS[i].nodeId
|
|
803
|
+
);
|
|
772
804
|
}
|
|
773
805
|
|
|
774
806
|
// North nodes
|
|
775
807
|
this._secondPASS = [];
|
|
776
|
-
this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(
|
|
808
|
+
this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(
|
|
809
|
+
p._visibleNodesNorth,
|
|
810
|
+
outArr
|
|
811
|
+
);
|
|
777
812
|
i = this._secondPASS.length;
|
|
778
813
|
while (i--) {
|
|
779
|
-
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
814
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
815
|
+
p._visibleNodesNorth,
|
|
816
|
+
outArr,
|
|
817
|
+
this._secondPASS[i].nodeId
|
|
818
|
+
);
|
|
780
819
|
}
|
|
781
820
|
|
|
782
821
|
// South nodes
|
|
783
822
|
this._secondPASS = [];
|
|
784
|
-
this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(
|
|
823
|
+
this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(
|
|
824
|
+
p._visibleNodesSouth,
|
|
825
|
+
outArr
|
|
826
|
+
);
|
|
785
827
|
i = this._secondPASS.length;
|
|
786
828
|
while (i--) {
|
|
787
|
-
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
829
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
830
|
+
p._visibleNodesSouth,
|
|
831
|
+
outArr,
|
|
832
|
+
this._secondPASS[i].nodeId
|
|
833
|
+
);
|
|
788
834
|
}
|
|
789
835
|
}
|
|
790
836
|
}
|
|
@@ -823,14 +869,15 @@ class Vector extends Layer {
|
|
|
823
869
|
* Start to load tile material.
|
|
824
870
|
* @public
|
|
825
871
|
* @virtual
|
|
826
|
-
* @param {
|
|
872
|
+
* @param {Segment.Material} material - Current material.
|
|
827
873
|
*/
|
|
828
874
|
loadMaterial(material) {
|
|
829
|
-
|
|
830
875
|
var seg = material.segment;
|
|
831
876
|
|
|
832
877
|
if (this._isBaseLayer) {
|
|
833
|
-
material.texture = seg._isNorth
|
|
878
|
+
material.texture = seg._isNorth
|
|
879
|
+
? seg.planet.solidTextureOne
|
|
880
|
+
: seg.planet.solidTextureTwo;
|
|
834
881
|
} else {
|
|
835
882
|
material.texture = seg.planet.transparentTexture;
|
|
836
883
|
}
|
|
@@ -845,7 +892,7 @@ class Vector extends Layer {
|
|
|
845
892
|
/**
|
|
846
893
|
* Abort exact material loading.
|
|
847
894
|
* @public
|
|
848
|
-
* @param {
|
|
895
|
+
* @param {Material} material - Segment material.
|
|
849
896
|
*/
|
|
850
897
|
abortMaterialLoading(material) {
|
|
851
898
|
material.isLoading = false;
|
|
@@ -856,7 +903,6 @@ class Vector extends Layer {
|
|
|
856
903
|
if (material.isReady) {
|
|
857
904
|
return [0, 0, 1, 1];
|
|
858
905
|
} else {
|
|
859
|
-
|
|
860
906
|
!material.isLoading && this.loadMaterial(material);
|
|
861
907
|
|
|
862
908
|
var segment = material.segment;
|
|
@@ -933,7 +979,7 @@ class Vector extends Layer {
|
|
|
933
979
|
this._geometryHandler.update();
|
|
934
980
|
this.events.dispatch(this.events.draw, this);
|
|
935
981
|
}
|
|
936
|
-
}
|
|
982
|
+
}
|
|
937
983
|
|
|
938
984
|
const EVENT_NAMES = [
|
|
939
985
|
/**
|
|
@@ -961,4 +1007,4 @@ const EVENT_NAMES = [
|
|
|
961
1007
|
"entityremove"
|
|
962
1008
|
];
|
|
963
1009
|
|
|
964
|
-
export { Vector };
|
|
1010
|
+
export { Vector };
|
package/src/og/layer/WMS.js
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
* @module og/layer/WMS
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as mercator from
|
|
8
|
-
import { Extent } from
|
|
9
|
-
import { LonLat } from
|
|
10
|
-
import { XYZ } from
|
|
7
|
+
import * as mercator from "../mercator.js";
|
|
8
|
+
import { Extent } from "../Extent.js";
|
|
9
|
+
import { LonLat } from "../LonLat.js";
|
|
10
|
+
import { XYZ } from "./XYZ.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Used to display WMS services as tile layers on the globe.
|
|
14
14
|
* @class
|
|
15
|
-
* @extends {
|
|
15
|
+
* @extends {XYZ}
|
|
16
16
|
* //TODO: WMS version, format, and custom srs cpecification.
|
|
17
17
|
* @param {string} name - Layer name.
|
|
18
18
|
* @param {Object} options - Options:
|
|
19
19
|
* @param {number} [options.opacity=1.0] - Layer opacity.
|
|
20
|
-
* @param {Array.<number
|
|
20
|
+
* @param {Array.<number>} [options.transparentColor=[-1,-1,-1]] - RGB color that defines transparent color.
|
|
21
21
|
* @param {number} [options.minZoom=0] - Minimal visibility zoom level.
|
|
22
22
|
* @param {number} [options.maxZoom=0] - Maximal visibility zoom level.
|
|
23
23
|
* @param {string} [options.attribution] - Layer attribution that displayed in the attribution area on the screen.
|
|
@@ -29,20 +29,20 @@ import { XYZ } from './XYZ.js';
|
|
|
29
29
|
* @param {string} options.layers - WMS layers string.
|
|
30
30
|
* @param {string} [options.version="1.1.1"] - WMS version.
|
|
31
31
|
* @example:
|
|
32
|
-
* new og.layer.WMS("USA States", {
|
|
32
|
+
* new og.layer.WMS("USA States", {
|
|
33
33
|
* isBaseLayer: false,
|
|
34
|
-
* url: "http://openglobus.org/geoserver/",
|
|
35
|
-
* layers: "topp:states",
|
|
36
|
-
* opacity: 0.5,
|
|
37
|
-
* zIndex: 50,
|
|
38
|
-
* attribution: 'USA states - geoserver WMS example',
|
|
34
|
+
* url: "http://openglobus.org/geoserver/",
|
|
35
|
+
* layers: "topp:states",
|
|
36
|
+
* opacity: 0.5,
|
|
37
|
+
* zIndex: 50,
|
|
38
|
+
* attribution: 'USA states - geoserver WMS example',
|
|
39
39
|
* transparentColor: [1.0, 1.0, 1.0],
|
|
40
40
|
* version: "1.1.1",
|
|
41
41
|
* visibility: false }
|
|
42
42
|
* );
|
|
43
43
|
*
|
|
44
44
|
* @fires og.layer.XYZ#load
|
|
45
|
-
* @fires og.layer.XYZ#loadend
|
|
45
|
+
* @fires og.layer.XYZ#loadend
|
|
46
46
|
*/
|
|
47
47
|
class WMS extends XYZ {
|
|
48
48
|
constructor(name, options) {
|
|
@@ -87,17 +87,34 @@ class WMS extends XYZ {
|
|
|
87
87
|
srs,
|
|
88
88
|
bbox,
|
|
89
89
|
width = 256,
|
|
90
|
-
height = 256
|
|
90
|
+
height = 256
|
|
91
|
+
) {
|
|
91
92
|
return `${url}/wms?LAYERS=${layers}&FORMAT=${format}&SERVICE=WMS&VERSION=${version}&REQUEST=${request}
|
|
92
93
|
&SRS=${srs}&BBOX=${bbox}&WIDTH=${width}&HEIGHT=${height}`;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
static get_bbox_v1_1_1(extent) {
|
|
96
|
-
return
|
|
97
|
+
return (
|
|
98
|
+
extent.getWest() +
|
|
99
|
+
"," +
|
|
100
|
+
extent.getSouth() +
|
|
101
|
+
"," +
|
|
102
|
+
extent.getEast() +
|
|
103
|
+
"," +
|
|
104
|
+
extent.getNorth()
|
|
105
|
+
);
|
|
97
106
|
}
|
|
98
107
|
|
|
99
108
|
static get_bbox_v1_3_0(extent) {
|
|
100
|
-
return
|
|
109
|
+
return (
|
|
110
|
+
extent.getSouth() +
|
|
111
|
+
"," +
|
|
112
|
+
extent.getWest() +
|
|
113
|
+
"," +
|
|
114
|
+
extent.getNorth() +
|
|
115
|
+
"," +
|
|
116
|
+
extent.getEast()
|
|
117
|
+
);
|
|
101
118
|
}
|
|
102
119
|
|
|
103
120
|
_checkSegment(segment) {
|
|
@@ -154,6 +171,6 @@ class WMS extends XYZ {
|
|
|
154
171
|
em.southWest.lon = -ENLARGE_MERCATOR_LON;
|
|
155
172
|
}
|
|
156
173
|
}
|
|
157
|
-
}
|
|
174
|
+
}
|
|
158
175
|
|
|
159
|
-
export { WMS };
|
|
176
|
+
export { WMS };
|