@openglobus/og 0.21.0 → 0.22.1
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/LICENSE.md +2 -2
- package/lib/@openglobus/js/Globe.d.ts +4 -0
- package/lib/@openglobus/js/Object3d.d.ts +7 -2
- package/lib/@openglobus/js/camera/Camera.d.ts +2 -0
- package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +58 -0
- package/lib/@openglobus/js/ellipsoid/Ellipsoid.d.ts +2 -1
- package/lib/@openglobus/js/ellipsoid/index.d.ts +4 -3
- package/lib/@openglobus/js/ellipsoid/mars.d.ts +6 -0
- package/lib/@openglobus/js/ellipsoid/moon.d.ts +6 -0
- package/lib/@openglobus/js/entity/Entity.d.ts +4 -2
- package/lib/@openglobus/js/entity/EntityCollection.d.ts +3 -2
- package/lib/@openglobus/js/entity/GeoObject.d.ts +6 -1
- package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +4 -0
- package/lib/@openglobus/js/entity/Label.d.ts +14 -0
- package/lib/@openglobus/js/entity/LabelHandler.d.ts +1 -1
- package/lib/@openglobus/js/index.d.ts +3 -3
- package/lib/@openglobus/js/layer/Vector.d.ts +12 -29
- package/lib/@openglobus/js/proj/equi.d.ts +9 -0
- package/lib/@openglobus/js/quadTree/{EPSG4326QuadTreeStrategy.d.ts → EPSG4326/EPSG4326QuadTreeStrategy.d.ts} +2 -2
- package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +5 -13
- package/lib/@openglobus/js/quadTree/EntityCollectionsTreeStrategy.d.ts +25 -0
- package/lib/@openglobus/js/quadTree/QuadTreeStrategy.d.ts +11 -0
- package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +18 -0
- package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +19 -0
- package/lib/@openglobus/js/quadTree/earth/EarthQuadTreeStrategy.d.ts +29 -0
- package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +17 -0
- package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionsTreeStrategy.d.ts +17 -0
- package/lib/@openglobus/js/quadTree/equi/EquiQuadTreeStrategy.d.ts +19 -0
- package/lib/@openglobus/js/quadTree/index.d.ts +6 -6
- package/lib/{js/quadTree → @openglobus/js/quadTree/wgs84}/Wgs84QuadTreeStrategy.d.ts +2 -2
- package/lib/@openglobus/js/renderer/Renderer.d.ts +2 -0
- package/lib/@openglobus/js/scene/Planet.d.ts +0 -27
- package/lib/@openglobus/js/segment/Segment.d.ts +0 -1
- package/lib/@openglobus/js/segment/SegmentLonLat.d.ts +0 -4
- package/lib/@openglobus/js/segment/{SegmentLonLatWgs84.d.ts → SegmentLonLatEqui.d.ts} +4 -1
- package/lib/@openglobus/js/terrain/RgbTerrain.d.ts +11 -0
- package/lib/@openglobus/og.esm.js +1 -1
- package/lib/@openglobus/og.esm.js.map +1 -1
- package/lib/@openglobus/og.umd.js +1 -1
- package/lib/@openglobus/og.umd.js.map +1 -1
- package/lib/@openglobus/res/fonts/Ephesis-Regular.json +4648 -0
- package/lib/@openglobus/res/fonts/Ephesis-Regular.ttf.cfg +1282 -0
- package/lib/@openglobus/res/fonts/Ephesis-Regular.ttf.png +0 -0
- package/lib/js/Globe.d.ts +4 -0
- package/lib/js/Globe.js +8 -4
- package/lib/js/Object3d.d.ts +7 -2
- package/lib/js/Object3d.js +46 -6
- package/lib/js/camera/Camera.d.ts +2 -0
- package/lib/js/camera/Camera.js +8 -0
- package/lib/js/control/elevationProfile/ElevationProfileScene.js +2 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +58 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +105 -0
- package/lib/js/ellipsoid/Ellipsoid.d.ts +2 -1
- package/lib/js/ellipsoid/Ellipsoid.js +17 -1
- package/lib/js/ellipsoid/index.d.ts +4 -3
- package/lib/js/ellipsoid/index.js +4 -3
- package/lib/js/ellipsoid/mars.d.ts +6 -0
- package/lib/js/ellipsoid/mars.js +6 -0
- package/lib/js/ellipsoid/moon.d.ts +6 -0
- package/lib/js/ellipsoid/moon.js +6 -0
- package/lib/js/entity/Entity.d.ts +4 -2
- package/lib/js/entity/Entity.js +4 -1
- package/lib/js/entity/EntityCollection.d.ts +3 -2
- package/lib/js/entity/EntityCollection.js +26 -2
- package/lib/js/entity/GeoObject.d.ts +6 -1
- package/lib/js/entity/GeoObject.js +9 -0
- package/lib/js/entity/GeoObjectHandler.d.ts +4 -0
- package/lib/js/entity/GeoObjectHandler.js +32 -1
- package/lib/js/entity/GeometryHandler.js +16 -14
- package/lib/js/entity/Label.d.ts +14 -0
- package/lib/js/entity/Label.js +24 -4
- package/lib/js/entity/LabelHandler.d.ts +1 -1
- package/lib/js/entity/LabelHandler.js +4 -4
- package/lib/js/entity/Polyline.js +1 -1
- package/lib/js/index.d.ts +3 -3
- package/lib/js/index.js +3 -3
- package/lib/js/layer/CanvasTiles.js +1 -11
- package/lib/js/layer/Layer.js +9 -28
- package/lib/js/layer/Vector.d.ts +12 -29
- package/lib/js/layer/Vector.js +45 -160
- package/lib/js/layer/XYZ.js +10 -10
- package/lib/js/proj/equi.d.ts +9 -0
- package/lib/js/proj/equi.js +9 -0
- package/lib/js/quadTree/{EPSG4326QuadTreeStrategy.d.ts → EPSG4326/EPSG4326QuadTreeStrategy.d.ts} +2 -2
- package/lib/js/quadTree/EPSG4326/EPSG4326QuadTreeStrategy.js +16 -0
- package/lib/js/quadTree/EntityCollectionNode.d.ts +5 -13
- package/lib/js/quadTree/EntityCollectionNode.js +18 -83
- package/lib/js/quadTree/EntityCollectionsTreeStrategy.d.ts +25 -0
- package/lib/js/quadTree/EntityCollectionsTreeStrategy.js +49 -0
- package/lib/js/quadTree/Node.js +6 -12
- package/lib/js/quadTree/QuadTreeStrategy.d.ts +11 -0
- package/lib/js/quadTree/QuadTreeStrategy.js +12 -0
- package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +18 -0
- package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.js +74 -0
- package/lib/js/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +19 -0
- package/lib/js/quadTree/earth/EarthEntityCollectionsTreeStrategy.js +103 -0
- package/lib/js/quadTree/earth/EarthQuadTreeStrategy.d.ts +29 -0
- package/lib/js/quadTree/{EarthQuadTreeStrategy.js → earth/EarthQuadTreeStrategy.js} +29 -6
- package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +17 -0
- package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.js +70 -0
- package/lib/js/quadTree/equi/EquiEntityCollectionsTreeStrategy.d.ts +17 -0
- package/lib/js/quadTree/equi/EquiEntityCollectionsTreeStrategy.js +75 -0
- package/lib/js/quadTree/equi/EquiQuadTreeStrategy.d.ts +19 -0
- package/lib/js/quadTree/equi/EquiQuadTreeStrategy.js +62 -0
- package/lib/js/quadTree/index.d.ts +6 -6
- package/lib/js/quadTree/index.js +6 -6
- package/lib/{@openglobus/js/quadTree → js/quadTree/wgs84}/Wgs84QuadTreeStrategy.d.ts +2 -2
- package/lib/js/quadTree/wgs84/Wgs84QuadTreeStrategy.js +15 -0
- package/lib/js/renderer/Renderer.d.ts +2 -0
- package/lib/js/renderer/Renderer.js +2 -2
- package/lib/js/scene/Planet.d.ts +0 -27
- package/lib/js/scene/Planet.js +2 -9
- package/lib/js/segment/Segment.d.ts +0 -1
- package/lib/js/segment/Segment.js +0 -3
- package/lib/js/segment/SegmentLonLat.d.ts +0 -4
- package/lib/js/segment/SegmentLonLat.js +0 -11
- package/lib/js/segment/{SegmentLonLatWgs84.d.ts → SegmentLonLatEqui.d.ts} +4 -1
- package/lib/js/segment/SegmentLonLatEqui.js +46 -0
- package/lib/js/shaders/geoObject.js +10 -5
- package/lib/js/shaders/polyline.js +8 -6
- package/lib/js/terrain/RgbTerrain.d.ts +11 -0
- package/lib/js/terrain/RgbTerrain.js +12 -1
- package/lib/js/utils/PlainSegmentWorker.js +3 -1
- package/lib/js/webgl/Handler.js +1 -1
- package/package.json +4 -4
- package/lib/@openglobus/js/quadTree/EarthQuadTreeStrategy.d.ts +0 -9
- package/lib/@openglobus/js/quadTree/MarsQuadTreeStrategy.d.ts +0 -11
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +0 -16
- package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +0 -9
- package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +0 -11
- package/lib/js/quadTree/MarsQuadTreeStrategy.js +0 -43
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +0 -15
- package/lib/js/segment/SegmentLonLatWgs84.js +0 -25
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { QueueArray } from "../QueueArray";
|
|
2
|
+
export class EntityCollectionsTreeStrategy {
|
|
3
|
+
constructor(layer, nodeCapacity) {
|
|
4
|
+
this._layer = layer;
|
|
5
|
+
this._nodeCapacity = nodeCapacity;
|
|
6
|
+
this._secondPASS = [];
|
|
7
|
+
this._counter = 0;
|
|
8
|
+
this._deferredEntitiesPendingQueue = new QueueArray();
|
|
9
|
+
this._renderingNodes = {};
|
|
10
|
+
}
|
|
11
|
+
insertEntity(entity, rightNow = false) {
|
|
12
|
+
}
|
|
13
|
+
setPickingEnabled(pickingEnabled) {
|
|
14
|
+
}
|
|
15
|
+
dispose() {
|
|
16
|
+
}
|
|
17
|
+
insertEntities(entitiesForTree) {
|
|
18
|
+
}
|
|
19
|
+
collectVisibleEntityCollections(outArr) {
|
|
20
|
+
}
|
|
21
|
+
_queueDeferredNode(node) {
|
|
22
|
+
if (this._layer.getVisibility()) {
|
|
23
|
+
node._inTheQueue = true;
|
|
24
|
+
if (this._counter >= 1) {
|
|
25
|
+
this._deferredEntitiesPendingQueue.push(node);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this._execDeferredNode(node);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
_execDeferredNode(node) {
|
|
33
|
+
this._counter++;
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
node.applyCollection();
|
|
36
|
+
this._counter--;
|
|
37
|
+
if (this._deferredEntitiesPendingQueue.length && this._counter < 1) {
|
|
38
|
+
while (this._deferredEntitiesPendingQueue.length) {
|
|
39
|
+
let n = this._deferredEntitiesPendingQueue.pop();
|
|
40
|
+
n._inTheQueue = false;
|
|
41
|
+
if (n.isVisible()) {
|
|
42
|
+
this._execDeferredNode(n);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
package/lib/js/quadTree/Node.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Extent } from "../Extent";
|
|
2
2
|
import { EPSG3857 } from "../proj/EPSG3857";
|
|
3
|
-
import { EPSG4326 } from "../proj/EPSG4326";
|
|
4
3
|
import { binaryInsert, getMatrixSubArray32, getMatrixSubArray64, getMatrixSubArrayBoundsExt } from "../utils/shared";
|
|
5
4
|
import { LonLat } from "../LonLat";
|
|
6
5
|
import { MAX, MIN } from "../math";
|
|
7
|
-
import { MAX_LAT } from "../mercator";
|
|
8
6
|
import { Vec2 } from "../math/Vec2";
|
|
9
7
|
import { Vec3 } from "../math/Vec3";
|
|
10
8
|
import { E, MAX_RENDERED_NODES, N, NE, NEIGHBOUR, NOTRENDERING, NW, OPPART, OPSIDE, PARTOFFSET, RENDERING, S, SE, SW, W, WALKTHROUGH } from "./quadTree";
|
|
@@ -161,10 +159,10 @@ class Node {
|
|
|
161
159
|
// Search a node which the camera is flying over.
|
|
162
160
|
if (!this.parentNode || this.parentNode._cameraInside) {
|
|
163
161
|
let inside;
|
|
164
|
-
if (Math.abs(cam._lonLat.lat) <= MAX_LAT && seg._projection.id === EPSG3857.id) {
|
|
162
|
+
if ( /*Math.abs(cam._lonLat.lat) <= MAX_LAT && */seg._projection.id === EPSG3857.id) {
|
|
165
163
|
inside = seg._extent.isInside(cam._lonLatMerc);
|
|
166
164
|
}
|
|
167
|
-
else if (seg._projection.id === EPSG4326.id) {
|
|
165
|
+
else /*if (seg._projection.id === EPSG4326.id)*/ {
|
|
168
166
|
inside = seg._extent.isInside(cam._lonLat);
|
|
169
167
|
}
|
|
170
168
|
if (inside) {
|
|
@@ -182,17 +180,14 @@ class Node {
|
|
|
182
180
|
}
|
|
183
181
|
}
|
|
184
182
|
else {
|
|
185
|
-
let
|
|
186
|
-
for (let i = 0; commonFrustumFlag && i < numFrustums; i++) {
|
|
183
|
+
for (let i = 0; i < numFrustums; i++) {
|
|
187
184
|
if (seg.terrainReady) {
|
|
188
185
|
if (frustums[i].containsBox(seg.bbox)) {
|
|
189
|
-
commonFrustumFlag >>= 1;
|
|
190
186
|
this.inFrustum |= 1 << i;
|
|
191
187
|
}
|
|
192
188
|
}
|
|
193
189
|
else {
|
|
194
190
|
if (frustums[i].containsSphere(seg.bsphere)) {
|
|
195
|
-
commonFrustumFlag >>= 1;
|
|
196
191
|
this.inFrustum |= 1 << i;
|
|
197
192
|
}
|
|
198
193
|
}
|
|
@@ -200,11 +195,11 @@ class Node {
|
|
|
200
195
|
}
|
|
201
196
|
if (this.inFrustum || this._cameraInside || seg.tileZoom < 3) {
|
|
202
197
|
let h = Math.abs(cam._lonLat.height);
|
|
203
|
-
let horizonDist = cam.eye.length2() -
|
|
198
|
+
let horizonDist = cam.eye.length2() - planet.ellipsoid.polarSizeSqr;
|
|
204
199
|
horizonDist = horizonDist < 106876472875.63281 * planet._heightFactor ? 106876472875.63281 * planet._heightFactor : horizonDist;
|
|
205
200
|
let altVis = seg.tileZoom < 2 || seg.tileZoom > 19 ||
|
|
206
201
|
/* Could be replaced with camera frustum always looking down check,
|
|
207
|
-
and not to go
|
|
202
|
+
and not to go through nodes from the opposite of the globe*/
|
|
208
203
|
(seg.tileZoom < 6 && !seg.terrainReady);
|
|
209
204
|
altVis = altVis ||
|
|
210
205
|
cam.eye.distance2(seg._sw) < horizonDist ||
|
|
@@ -212,8 +207,7 @@ class Node {
|
|
|
212
207
|
cam.eye.distance2(seg._ne) < horizonDist ||
|
|
213
208
|
cam.eye.distance2(seg._se) < horizonDist;
|
|
214
209
|
if ((this.inFrustum && (altVis || h > 10000.0)) || this._cameraInside) {
|
|
215
|
-
|
|
216
|
-
seg._collectVisibleNodes();
|
|
210
|
+
planet.quadTreeStrategy.collectVisibleNode(this);
|
|
217
211
|
}
|
|
218
212
|
if (seg.tileZoom < 2) {
|
|
219
213
|
this.traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Layer } from "../layer/Layer";
|
|
2
|
+
import { Vector } from "../layer/Vector";
|
|
2
3
|
import { Node } from "../quadTree/Node";
|
|
3
4
|
import { Planet } from "../scene/Planet";
|
|
4
5
|
import { Proj } from "../proj/Proj";
|
|
5
6
|
import { LonLat } from "../LonLat";
|
|
7
|
+
import { EntityCollectionsTreeStrategy } from "./EntityCollectionsTreeStrategy";
|
|
6
8
|
export declare class QuadTreeStrategy {
|
|
7
9
|
name: string;
|
|
8
10
|
projection: Proj;
|
|
@@ -13,16 +15,25 @@ export declare class QuadTreeStrategy {
|
|
|
13
15
|
* @type {Node[]}
|
|
14
16
|
*/
|
|
15
17
|
protected _quadTreeList: Node[];
|
|
18
|
+
/**
|
|
19
|
+
* Current visible mercator segments tree nodes array.
|
|
20
|
+
* @public
|
|
21
|
+
* @type {Node}
|
|
22
|
+
*/
|
|
23
|
+
_visibleNodes: Record<number, Node>;
|
|
16
24
|
constructor(planet: Planet, name?: string, proj?: Proj);
|
|
25
|
+
createEntitiCollectionsTreeStrategy(layer: Vector, nodeCapacity: number): EntityCollectionsTreeStrategy;
|
|
17
26
|
destroyBranches(): void;
|
|
18
27
|
clearLayerMaterial(layer: Layer): void;
|
|
19
28
|
get planet(): Planet;
|
|
20
29
|
init(): void;
|
|
21
30
|
preRender(): void;
|
|
22
31
|
preLoad(): void;
|
|
32
|
+
protected _clearVisibleNodes(): void;
|
|
23
33
|
collectRenderNodes(): void;
|
|
24
34
|
clear(): void;
|
|
25
35
|
get quadTreeList(): Node[];
|
|
26
36
|
getTileXY(lonLat: LonLat, zoom: number): [number, number, number, number];
|
|
27
37
|
getLonLatTileOffset(lonLat: LonLat, x: number, y: number, z: number, gridSize: number): [number, number];
|
|
38
|
+
collectVisibleNode(node: Node): void;
|
|
28
39
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { EPSG3857 } from "../proj/EPSG3857";
|
|
2
2
|
import { getTileCellExtent, getTileCellIndex, TILEGROUP_COMMON } from "../segment/Segment";
|
|
3
3
|
import { Extent } from "../Extent";
|
|
4
|
+
import { EntityCollectionsTreeStrategy } from "./EntityCollectionsTreeStrategy";
|
|
4
5
|
export class QuadTreeStrategy {
|
|
5
6
|
constructor(planet, name = "", proj = EPSG3857) {
|
|
6
7
|
this.name = name;
|
|
7
8
|
this.projection = proj;
|
|
8
9
|
this._planet = planet;
|
|
9
10
|
this._quadTreeList = [];
|
|
11
|
+
this._visibleNodes = {};
|
|
12
|
+
}
|
|
13
|
+
createEntitiCollectionsTreeStrategy(layer, nodeCapacity) {
|
|
14
|
+
return new EntityCollectionsTreeStrategy(layer, nodeCapacity);
|
|
10
15
|
}
|
|
11
16
|
destroyBranches() {
|
|
12
17
|
for (let i = 0, len = this._quadTreeList.length; i < len; i++) {
|
|
@@ -55,7 +60,11 @@ export class QuadTreeStrategy {
|
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
}
|
|
63
|
+
_clearVisibleNodes() {
|
|
64
|
+
this._visibleNodes = {};
|
|
65
|
+
}
|
|
58
66
|
collectRenderNodes() {
|
|
67
|
+
this._clearVisibleNodes();
|
|
59
68
|
for (let i = 0; i < this._quadTreeList.length; i++) {
|
|
60
69
|
this._quadTreeList[i].renderTree(this._planet.camera, 0, null);
|
|
61
70
|
}
|
|
@@ -83,4 +92,7 @@ export class QuadTreeStrategy {
|
|
|
83
92
|
let i = gridSize - Math.ceil((coords.lat - extent.southWest.lat) / sizeImgH) - 1, j = Math.floor((coords.lon - extent.southWest.lon) / sizeImgW);
|
|
84
93
|
return [i, j];
|
|
85
94
|
}
|
|
95
|
+
collectVisibleNode(node) {
|
|
96
|
+
this._visibleNodes[node.nodeId] = node;
|
|
97
|
+
}
|
|
86
98
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EarthEntityCollectionsTreeStrategy } from "./EarthEntityCollectionsTreeStrategy";
|
|
2
|
+
import { Extent } from "../../Extent";
|
|
3
|
+
import { Planet } from "../../scene/Planet";
|
|
4
|
+
import { LonLat } from "../../LonLat";
|
|
5
|
+
import { Entity } from "../../entity/Entity";
|
|
6
|
+
import { EntityCollection } from "../../entity/EntityCollection";
|
|
7
|
+
import { EntityCollectionNode, NodesDict } from "../EntityCollectionNode";
|
|
8
|
+
export declare class EarthEntityCollectionNodeLonLat extends EntityCollectionNode {
|
|
9
|
+
isNorth: boolean;
|
|
10
|
+
strategy: EarthEntityCollectionsTreeStrategy;
|
|
11
|
+
constructor(strategy: EarthEntityCollectionsTreeStrategy, partId: number, parent: EarthEntityCollectionNodeLonLat | null, extent: Extent, planet: Planet, zoom: number);
|
|
12
|
+
createChildrenNodes(): void;
|
|
13
|
+
protected _setExtentBounds(): void;
|
|
14
|
+
__setLonLat__(entity: Entity): LonLat;
|
|
15
|
+
isVisible(): boolean;
|
|
16
|
+
isInside(entity: Entity): boolean;
|
|
17
|
+
renderCollection(outArr: EntityCollection[], visibleNodes: NodesDict, renderingNode: number): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Extent } from "../../Extent";
|
|
2
|
+
import { LonLat } from "../../LonLat";
|
|
3
|
+
import { NE, NW, SE, SW } from "../quadTree";
|
|
4
|
+
import { EntityCollectionNode } from "../EntityCollectionNode";
|
|
5
|
+
export class EarthEntityCollectionNodeLonLat extends EntityCollectionNode {
|
|
6
|
+
constructor(strategy, partId, parent, extent, planet, zoom) {
|
|
7
|
+
super(strategy, partId, parent, extent, planet, zoom);
|
|
8
|
+
this.strategy = strategy;
|
|
9
|
+
this.isNorth = false;
|
|
10
|
+
}
|
|
11
|
+
createChildrenNodes() {
|
|
12
|
+
const s = this.strategy;
|
|
13
|
+
const ext = this.extent;
|
|
14
|
+
const size_x = ext.getWidth() * 0.5;
|
|
15
|
+
const size_y = ext.getHeight() * 0.5;
|
|
16
|
+
const ne = ext.northEast;
|
|
17
|
+
const sw = ext.southWest;
|
|
18
|
+
const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
|
|
19
|
+
const nd = this.childrenNodes;
|
|
20
|
+
const p = this.layer._planet;
|
|
21
|
+
const z = this.zoom + 1;
|
|
22
|
+
nd[NW] = new EarthEntityCollectionNodeLonLat(s, NW, this, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
|
|
23
|
+
nd[NE] = new EarthEntityCollectionNodeLonLat(s, NE, this, new Extent(c, new LonLat(ne.lon, ne.lat)), p, z);
|
|
24
|
+
nd[SW] = new EarthEntityCollectionNodeLonLat(s, SW, this, new Extent(new LonLat(sw.lon, sw.lat), c), p, z);
|
|
25
|
+
nd[SE] = new EarthEntityCollectionNodeLonLat(s, SE, this, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)), p, z);
|
|
26
|
+
}
|
|
27
|
+
_setExtentBounds() {
|
|
28
|
+
if (this.extent.northEast.lat > 0) {
|
|
29
|
+
this.isNorth = true;
|
|
30
|
+
}
|
|
31
|
+
this.bsphere.setFromExtent(this.layer._planet.ellipsoid, this.extent);
|
|
32
|
+
}
|
|
33
|
+
__setLonLat__(entity) {
|
|
34
|
+
if (entity._lonLat.isZero()) {
|
|
35
|
+
entity._lonLat = this.layer._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
|
|
36
|
+
}
|
|
37
|
+
return entity._lonLat;
|
|
38
|
+
}
|
|
39
|
+
isVisible() {
|
|
40
|
+
if (this.isNorth && this.strategy._renderingNodesNorth[this.nodeId]) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
else if (this.strategy._renderingNodesSouth[this.nodeId]) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
isInside(entity) {
|
|
49
|
+
return this.extent.isInside(entity._lonLat);
|
|
50
|
+
}
|
|
51
|
+
renderCollection(outArr, visibleNodes, renderingNode) {
|
|
52
|
+
if (this.isNorth) {
|
|
53
|
+
this.strategy._renderingNodesNorth[this.nodeId] = true;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.strategy._renderingNodesSouth[this.nodeId] = true;
|
|
57
|
+
}
|
|
58
|
+
if (this.deferredEntities.length && !this._inTheQueue) {
|
|
59
|
+
if (this.layer.async) {
|
|
60
|
+
this.strategy._queueDeferredNode(this);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.applyCollection();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const ec = this.entityCollection;
|
|
67
|
+
ec._fadingOpacity = this.layer._fadingOpacity;
|
|
68
|
+
ec.scaleByDistance = this.layer.scaleByDistance;
|
|
69
|
+
ec.pickingScale = this.layer.pickingScale;
|
|
70
|
+
if (!ec.isEmpty()) {
|
|
71
|
+
outArr.push(ec);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EntityCollectionNode } from "../EntityCollectionNode";
|
|
2
|
+
import { EarthEntityCollectionNodeLonLat } from "./EarthEntityCollectionNodeLonLat";
|
|
3
|
+
import { Vector } from "../../layer/Vector";
|
|
4
|
+
import { Entity } from "../../entity/Entity";
|
|
5
|
+
import { EntityCollection } from "../../entity/EntityCollection";
|
|
6
|
+
import { EntityCollectionsTreeStrategy } from "../EntityCollectionsTreeStrategy";
|
|
7
|
+
export declare class EarthEntityCollectionsTreeStrategy extends EntityCollectionsTreeStrategy {
|
|
8
|
+
protected _entityCollectionsTree: EntityCollectionNode;
|
|
9
|
+
protected _entityCollectionsTreeNorth: EarthEntityCollectionNodeLonLat;
|
|
10
|
+
protected _entityCollectionsTreeSouth: EarthEntityCollectionNodeLonLat;
|
|
11
|
+
_renderingNodesNorth: Record<number, boolean>;
|
|
12
|
+
_renderingNodesSouth: Record<number, boolean>;
|
|
13
|
+
constructor(layer: Vector, nodeCapacity: number);
|
|
14
|
+
insertEntity(entity: Entity, rightNow?: boolean): void;
|
|
15
|
+
setPickingEnabled(pickingEnabled: boolean): void;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
insertEntities(entitiesForTree: Entity[]): void;
|
|
18
|
+
collectVisibleEntityCollections(outArr: EntityCollection[]): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { EntityCollectionNode } from "../EntityCollectionNode";
|
|
2
|
+
import { EarthEntityCollectionNodeLonLat } from "./EarthEntityCollectionNodeLonLat";
|
|
3
|
+
import * as quadTree from "../quadTree";
|
|
4
|
+
import { Extent } from "../../Extent";
|
|
5
|
+
import * as mercator from "../../mercator";
|
|
6
|
+
import { EntityCollectionsTreeStrategy } from "../EntityCollectionsTreeStrategy";
|
|
7
|
+
export class EarthEntityCollectionsTreeStrategy extends EntityCollectionsTreeStrategy {
|
|
8
|
+
constructor(layer, nodeCapacity) {
|
|
9
|
+
super(layer, nodeCapacity);
|
|
10
|
+
let planet = layer._planet;
|
|
11
|
+
this._entityCollectionsTree = new EntityCollectionNode(this, quadTree.NW, null, Extent.createFromArray([-20037508.34, -20037508.34, 20037508.34, 20037508.34]), planet, 0);
|
|
12
|
+
this._entityCollectionsTreeNorth = new EarthEntityCollectionNodeLonLat(this, quadTree.NW, null, Extent.createFromArray([-180, mercator.MAX_LAT, 180, 90]), planet, 0);
|
|
13
|
+
this._entityCollectionsTreeSouth = new EarthEntityCollectionNodeLonLat(this, quadTree.NW, null, Extent.createFromArray([-180, -90, 180, mercator.MIN_LAT]), planet, 0);
|
|
14
|
+
this._renderingNodes = {};
|
|
15
|
+
this._renderingNodesNorth = {};
|
|
16
|
+
this._renderingNodesSouth = {};
|
|
17
|
+
}
|
|
18
|
+
insertEntity(entity, rightNow = false) {
|
|
19
|
+
if (entity._lonLat.lat > mercator.MAX_LAT) {
|
|
20
|
+
this._entityCollectionsTreeNorth.__setLonLat__(entity);
|
|
21
|
+
this._entityCollectionsTreeNorth.insertEntity(entity, rightNow);
|
|
22
|
+
}
|
|
23
|
+
else if (entity._lonLat.lat < mercator.MIN_LAT) {
|
|
24
|
+
this._entityCollectionsTreeSouth.__setLonLat__(entity);
|
|
25
|
+
this._entityCollectionsTreeSouth.insertEntity(entity, rightNow);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this._entityCollectionsTree.__setLonLat__(entity);
|
|
29
|
+
this._entityCollectionsTree.insertEntity(entity, rightNow);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
setPickingEnabled(pickingEnabled) {
|
|
33
|
+
this._entityCollectionsTree && this._entityCollectionsTree.traverseTree((node) => {
|
|
34
|
+
node.entityCollection.setPickingEnabled(pickingEnabled);
|
|
35
|
+
});
|
|
36
|
+
this._entityCollectionsTreeNorth && this._entityCollectionsTreeNorth.traverseTree((node) => {
|
|
37
|
+
node.entityCollection.setPickingEnabled(pickingEnabled);
|
|
38
|
+
});
|
|
39
|
+
this._entityCollectionsTreeSouth && this._entityCollectionsTreeSouth.traverseTree((node) => {
|
|
40
|
+
node.entityCollection.setPickingEnabled(pickingEnabled);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
dispose() {
|
|
44
|
+
//@ts-ignore
|
|
45
|
+
this._entityCollectionsTree = null;
|
|
46
|
+
//@ts-ignore
|
|
47
|
+
this._entityCollectionsTreeNorth = null;
|
|
48
|
+
//@ts-ignore
|
|
49
|
+
this._entityCollectionsTreeSouth = null;
|
|
50
|
+
this._renderingNodes = {};
|
|
51
|
+
this._renderingNodesNorth = {};
|
|
52
|
+
this._renderingNodesSouth = {};
|
|
53
|
+
}
|
|
54
|
+
insertEntities(entitiesForTree) {
|
|
55
|
+
let northEntities = [], southEntities = [], mercEntities = [];
|
|
56
|
+
for (let i = 0, len = entitiesForTree.length; i < len; i++) {
|
|
57
|
+
let entity = entitiesForTree[i];
|
|
58
|
+
// north tree
|
|
59
|
+
if (entity._lonLat.lat > mercator.MAX_LAT) {
|
|
60
|
+
northEntities.push(entity);
|
|
61
|
+
this._entityCollectionsTreeNorth.__setLonLat__(entity);
|
|
62
|
+
}
|
|
63
|
+
else if (entity._lonLat.lat < mercator.MIN_LAT) {
|
|
64
|
+
southEntities.push(entity);
|
|
65
|
+
this._entityCollectionsTreeSouth.__setLonLat__(entity);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
mercEntities.push(entity);
|
|
69
|
+
this._entityCollectionsTree.__setLonLat__(entity);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
this._entityCollectionsTree.buildTree(mercEntities);
|
|
73
|
+
this._entityCollectionsTreeNorth.buildTree(northEntities);
|
|
74
|
+
this._entityCollectionsTreeSouth.buildTree(southEntities);
|
|
75
|
+
}
|
|
76
|
+
collectVisibleEntityCollections(outArr) {
|
|
77
|
+
this._renderingNodes = {};
|
|
78
|
+
this._renderingNodesNorth = {};
|
|
79
|
+
this._renderingNodesSouth = {};
|
|
80
|
+
let pqs = this._layer._planet.quadTreeStrategy;
|
|
81
|
+
// Merc nodes
|
|
82
|
+
this._secondPASS = [];
|
|
83
|
+
this._entityCollectionsTree.collectRenderCollectionsPASS1(pqs._visibleNodes, outArr);
|
|
84
|
+
let i = this._secondPASS.length;
|
|
85
|
+
while (i--) {
|
|
86
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(pqs._visibleNodes, outArr, this._secondPASS[i].nodeId);
|
|
87
|
+
}
|
|
88
|
+
// North nodes
|
|
89
|
+
this._secondPASS = [];
|
|
90
|
+
this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(pqs._visibleNodesNorth, outArr);
|
|
91
|
+
i = this._secondPASS.length;
|
|
92
|
+
while (i--) {
|
|
93
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(pqs._visibleNodesNorth, outArr, this._secondPASS[i].nodeId);
|
|
94
|
+
}
|
|
95
|
+
// South nodes
|
|
96
|
+
this._secondPASS = [];
|
|
97
|
+
this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(pqs._visibleNodesSouth, outArr);
|
|
98
|
+
i = this._secondPASS.length;
|
|
99
|
+
while (i--) {
|
|
100
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(pqs._visibleNodesSouth, outArr, this._secondPASS[i].nodeId);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Node } from "../Node";
|
|
2
|
+
import { Planet } from "../../scene/Planet";
|
|
3
|
+
import { QuadTreeStrategy } from "../QuadTreeStrategy";
|
|
4
|
+
import { LonLat } from "../../LonLat";
|
|
5
|
+
import { Vector } from "../../layer/Vector";
|
|
6
|
+
import { EarthEntityCollectionsTreeStrategy } from "./EarthEntityCollectionsTreeStrategy";
|
|
7
|
+
export declare class EarthQuadTreeStrategy extends QuadTreeStrategy {
|
|
8
|
+
/**
|
|
9
|
+
* Current visible north pole nodes tree nodes array.
|
|
10
|
+
* @public
|
|
11
|
+
* @type {Node}
|
|
12
|
+
* @todo
|
|
13
|
+
*/
|
|
14
|
+
_visibleNodesNorth: Record<number, Node>;
|
|
15
|
+
/**
|
|
16
|
+
* Current visible south pole nodes tree nodes array.
|
|
17
|
+
* @public
|
|
18
|
+
* @type {Node}
|
|
19
|
+
* @todo
|
|
20
|
+
*/
|
|
21
|
+
_visibleNodesSouth: Record<number, Node>;
|
|
22
|
+
constructor(planet: Planet);
|
|
23
|
+
collectVisibleNode(node: Node): void;
|
|
24
|
+
protected _clearVisibleNodes(): void;
|
|
25
|
+
createEntitiCollectionsTreeStrategy(layer: Vector, nodeCapacity: number): EarthEntityCollectionsTreeStrategy;
|
|
26
|
+
init(): void;
|
|
27
|
+
getTileXY(lonLat: LonLat, zoom: number): [number, number, number, number];
|
|
28
|
+
getLonLatTileOffset(lonLat: LonLat, x: number, y: number, z: number, gridSize: number): [number, number];
|
|
29
|
+
}
|
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
import * as mercator from "
|
|
2
|
-
import { Extent } from "
|
|
3
|
-
import { Node } from "../
|
|
4
|
-
import { QuadTreeStrategy } from "
|
|
5
|
-
import { Segment, TILEGROUP_NORTH, TILEGROUP_SOUTH, getTileGroupByLat, getTileCellExtent, getTileCellIndex } from "
|
|
6
|
-
import { SegmentLonLat } from "
|
|
1
|
+
import * as mercator from "../../mercator";
|
|
2
|
+
import { Extent } from "../../Extent";
|
|
3
|
+
import { Node } from "../Node";
|
|
4
|
+
import { QuadTreeStrategy } from "../QuadTreeStrategy";
|
|
5
|
+
import { Segment, TILEGROUP_NORTH, TILEGROUP_SOUTH, getTileGroupByLat, getTileCellExtent, getTileCellIndex } from "../../segment/Segment";
|
|
6
|
+
import { SegmentLonLat } from "../../segment/SegmentLonLat";
|
|
7
|
+
import { EarthEntityCollectionsTreeStrategy } from "./EarthEntityCollectionsTreeStrategy";
|
|
7
8
|
export class EarthQuadTreeStrategy extends QuadTreeStrategy {
|
|
8
9
|
constructor(planet) {
|
|
9
10
|
super(planet, "Earth");
|
|
11
|
+
this._visibleNodesNorth = {};
|
|
12
|
+
this._visibleNodesSouth = {};
|
|
13
|
+
}
|
|
14
|
+
collectVisibleNode(node) {
|
|
15
|
+
let tg = node.segment._tileGroup;
|
|
16
|
+
if (tg === TILEGROUP_NORTH) {
|
|
17
|
+
this._visibleNodesNorth[node.nodeId] = node;
|
|
18
|
+
}
|
|
19
|
+
else if (tg === TILEGROUP_SOUTH) {
|
|
20
|
+
this._visibleNodesSouth[node.nodeId] = node;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
this._visibleNodes[node.nodeId] = node;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
_clearVisibleNodes() {
|
|
27
|
+
super._clearVisibleNodes();
|
|
28
|
+
this._visibleNodesNorth = {};
|
|
29
|
+
this._visibleNodesSouth = {};
|
|
30
|
+
}
|
|
31
|
+
createEntitiCollectionsTreeStrategy(layer, nodeCapacity) {
|
|
32
|
+
return new EarthEntityCollectionsTreeStrategy(layer, nodeCapacity);
|
|
10
33
|
}
|
|
11
34
|
init() {
|
|
12
35
|
this._quadTreeList = [
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Extent } from "../../Extent";
|
|
2
|
+
import { Planet } from "../../scene/Planet";
|
|
3
|
+
import { LonLat } from "../../LonLat";
|
|
4
|
+
import { Entity } from "../../entity/Entity";
|
|
5
|
+
import { EntityCollection } from "../../entity/EntityCollection";
|
|
6
|
+
import { EntityCollectionNode, NodesDict } from "../EntityCollectionNode";
|
|
7
|
+
import { EquiEntityCollectionsTreeStrategy } from "./EquiEntityCollectionsTreeStrategy";
|
|
8
|
+
export declare class EquiEntityCollectionNodeLonLat extends EntityCollectionNode {
|
|
9
|
+
strategy: EquiEntityCollectionsTreeStrategy;
|
|
10
|
+
constructor(strategy: EquiEntityCollectionsTreeStrategy, partId: number, parent: EquiEntityCollectionNodeLonLat | null, extent: Extent, planet: Planet, zoom: number);
|
|
11
|
+
createChildrenNodes(): void;
|
|
12
|
+
protected _setExtentBounds(): void;
|
|
13
|
+
__setLonLat__(entity: Entity): LonLat;
|
|
14
|
+
isVisible(): boolean;
|
|
15
|
+
isInside(entity: Entity): boolean;
|
|
16
|
+
renderCollection(outArr: EntityCollection[], visibleNodes: NodesDict, renderingNode: number): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Extent } from "../../Extent";
|
|
2
|
+
import { LonLat } from "../../LonLat";
|
|
3
|
+
import { NE, NW, SE, SW } from "../quadTree";
|
|
4
|
+
import { EntityCollectionNode } from "../EntityCollectionNode";
|
|
5
|
+
export class EquiEntityCollectionNodeLonLat extends EntityCollectionNode {
|
|
6
|
+
constructor(strategy, partId, parent, extent, planet, zoom) {
|
|
7
|
+
super(strategy, partId, parent, extent, planet, zoom);
|
|
8
|
+
this.strategy = strategy;
|
|
9
|
+
}
|
|
10
|
+
createChildrenNodes() {
|
|
11
|
+
const s = this.strategy;
|
|
12
|
+
const ext = this.extent;
|
|
13
|
+
const size_x = ext.getWidth() * 0.5;
|
|
14
|
+
const size_y = ext.getHeight() * 0.5;
|
|
15
|
+
const ne = ext.northEast;
|
|
16
|
+
const sw = ext.southWest;
|
|
17
|
+
const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
|
|
18
|
+
const nd = this.childrenNodes;
|
|
19
|
+
const p = this.layer._planet;
|
|
20
|
+
const z = this.zoom + 1;
|
|
21
|
+
nd[NW] = new EquiEntityCollectionNodeLonLat(s, NW, this, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
|
|
22
|
+
nd[NE] = new EquiEntityCollectionNodeLonLat(s, NE, this, new Extent(c, new LonLat(ne.lon, ne.lat)), p, z);
|
|
23
|
+
nd[SW] = new EquiEntityCollectionNodeLonLat(s, SW, this, new Extent(new LonLat(sw.lon, sw.lat), c), p, z);
|
|
24
|
+
nd[SE] = new EquiEntityCollectionNodeLonLat(s, SE, this, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)), p, z);
|
|
25
|
+
}
|
|
26
|
+
_setExtentBounds() {
|
|
27
|
+
this.bsphere.setFromExtent(this.layer._planet.ellipsoid, this.extent);
|
|
28
|
+
}
|
|
29
|
+
__setLonLat__(entity) {
|
|
30
|
+
if (entity._lonLat.isZero()) {
|
|
31
|
+
entity._lonLat = this.layer._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
|
|
32
|
+
}
|
|
33
|
+
return entity._lonLat;
|
|
34
|
+
}
|
|
35
|
+
isVisible() {
|
|
36
|
+
if (this.strategy._renderingNodesWest[this.nodeId]) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
else if (this.strategy._renderingNodesEast[this.nodeId]) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
isInside(entity) {
|
|
45
|
+
return this.extent.isInside(entity._lonLat);
|
|
46
|
+
}
|
|
47
|
+
renderCollection(outArr, visibleNodes, renderingNode) {
|
|
48
|
+
if (this.extent.southWest.lon < 0) {
|
|
49
|
+
this.strategy._renderingNodesWest[this.nodeId] = true;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.strategy._renderingNodesEast[this.nodeId] = true;
|
|
53
|
+
}
|
|
54
|
+
if (this.deferredEntities.length && !this._inTheQueue) {
|
|
55
|
+
if (this.layer.async) {
|
|
56
|
+
this.strategy._queueDeferredNode(this);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.applyCollection();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const ec = this.entityCollection;
|
|
63
|
+
ec._fadingOpacity = this.layer._fadingOpacity;
|
|
64
|
+
ec.scaleByDistance = this.layer.scaleByDistance;
|
|
65
|
+
ec.pickingScale = this.layer.pickingScale;
|
|
66
|
+
if (!ec.isEmpty()) {
|
|
67
|
+
outArr.push(ec);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Vector } from "../../layer/Vector";
|
|
2
|
+
import { Entity } from "../../entity/Entity";
|
|
3
|
+
import { EntityCollection } from "../../entity/EntityCollection";
|
|
4
|
+
import { EntityCollectionsTreeStrategy } from "../EntityCollectionsTreeStrategy";
|
|
5
|
+
import { EquiEntityCollectionNodeLonLat } from "./EquiEntityCollectionNodeLonLat";
|
|
6
|
+
export declare class EquiEntityCollectionsTreeStrategy extends EntityCollectionsTreeStrategy {
|
|
7
|
+
protected _entityCollectionsTreeWest: EquiEntityCollectionNodeLonLat;
|
|
8
|
+
protected _entityCollectionsTreeEast: EquiEntityCollectionNodeLonLat;
|
|
9
|
+
_renderingNodesWest: Record<number, boolean>;
|
|
10
|
+
_renderingNodesEast: Record<number, boolean>;
|
|
11
|
+
constructor(layer: Vector, nodeCapacity: number);
|
|
12
|
+
insertEntity(entity: Entity, rightNow?: boolean): void;
|
|
13
|
+
setPickingEnabled(pickingEnabled: boolean): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
insertEntities(entitiesForTree: Entity[]): void;
|
|
16
|
+
collectVisibleEntityCollections(outArr: EntityCollection[]): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as quadTree from "../quadTree";
|
|
2
|
+
import { Extent } from "../../Extent";
|
|
3
|
+
import { EntityCollectionsTreeStrategy } from "../EntityCollectionsTreeStrategy";
|
|
4
|
+
import { EquiEntityCollectionNodeLonLat } from "./EquiEntityCollectionNodeLonLat";
|
|
5
|
+
export class EquiEntityCollectionsTreeStrategy extends EntityCollectionsTreeStrategy {
|
|
6
|
+
constructor(layer, nodeCapacity) {
|
|
7
|
+
super(layer, nodeCapacity);
|
|
8
|
+
let planet = layer._planet;
|
|
9
|
+
this._entityCollectionsTreeWest = new EquiEntityCollectionNodeLonLat(this, quadTree.NW, null, Extent.createFromArray([-180, -90, 0, 90]), planet, 0);
|
|
10
|
+
this._entityCollectionsTreeEast = new EquiEntityCollectionNodeLonLat(this, quadTree.NW, null, Extent.createFromArray([0, -90, 180, 90]), planet, 0);
|
|
11
|
+
this._renderingNodesWest = {};
|
|
12
|
+
this._renderingNodesEast = {};
|
|
13
|
+
}
|
|
14
|
+
insertEntity(entity, rightNow = false) {
|
|
15
|
+
if (entity._lonLat.lon < 0) {
|
|
16
|
+
this._entityCollectionsTreeWest.__setLonLat__(entity);
|
|
17
|
+
this._entityCollectionsTreeWest.insertEntity(entity, rightNow);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this._entityCollectionsTreeEast.__setLonLat__(entity);
|
|
21
|
+
this._entityCollectionsTreeEast.insertEntity(entity, rightNow);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
setPickingEnabled(pickingEnabled) {
|
|
25
|
+
this._entityCollectionsTreeWest.traverseTree((node) => {
|
|
26
|
+
node.entityCollection.setPickingEnabled(pickingEnabled);
|
|
27
|
+
});
|
|
28
|
+
this._entityCollectionsTreeEast.traverseTree((node) => {
|
|
29
|
+
node.entityCollection.setPickingEnabled(pickingEnabled);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
dispose() {
|
|
33
|
+
//@ts-ignore
|
|
34
|
+
this._entityCollectionsTreeWest = null;
|
|
35
|
+
//@ts-ignore
|
|
36
|
+
this._entityCollectionsTreeEast = null;
|
|
37
|
+
this._renderingNodesWest = {};
|
|
38
|
+
this._renderingNodesEast = {};
|
|
39
|
+
}
|
|
40
|
+
insertEntities(entitiesForTree) {
|
|
41
|
+
let westEntities = [], eastEntities = [];
|
|
42
|
+
for (let i = 0, len = entitiesForTree.length; i < len; i++) {
|
|
43
|
+
let entity = entitiesForTree[i];
|
|
44
|
+
if (entity._lonLat.lon < 0) {
|
|
45
|
+
westEntities.push(entity);
|
|
46
|
+
this._entityCollectionsTreeWest.__setLonLat__(entity);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
eastEntities.push(entity);
|
|
50
|
+
this._entityCollectionsTreeEast.__setLonLat__(entity);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
this._entityCollectionsTreeWest.buildTree(westEntities);
|
|
54
|
+
this._entityCollectionsTreeEast.buildTree(eastEntities);
|
|
55
|
+
}
|
|
56
|
+
collectVisibleEntityCollections(outArr) {
|
|
57
|
+
this._renderingNodesWest = {};
|
|
58
|
+
this._renderingNodesEast = {};
|
|
59
|
+
let pqs = this._layer._planet.quadTreeStrategy;
|
|
60
|
+
// Wset
|
|
61
|
+
this._secondPASS = [];
|
|
62
|
+
this._entityCollectionsTreeWest.collectRenderCollectionsPASS1(pqs._visibleNodesWest, outArr);
|
|
63
|
+
let i = this._secondPASS.length;
|
|
64
|
+
while (i--) {
|
|
65
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(pqs._visibleNodesWest, outArr, this._secondPASS[i].nodeId);
|
|
66
|
+
}
|
|
67
|
+
// East
|
|
68
|
+
this._secondPASS = [];
|
|
69
|
+
this._entityCollectionsTreeEast.collectRenderCollectionsPASS1(pqs._visibleNodesEast, outArr);
|
|
70
|
+
i = this._secondPASS.length;
|
|
71
|
+
while (i--) {
|
|
72
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(pqs._visibleNodesEast, outArr, this._secondPASS[i].nodeId);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|