@maptalks/3dtiles 0.11.0 → 0.11.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/dist/maptalks.3dtiles.js +171 -171
- package/package.json +1 -1
package/dist/maptalks.3dtiles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/3dtiles v0.11.
|
|
2
|
+
* @maptalks/3dtiles v0.11.1
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
4
|
* (c) 2016-2022 maptalks.com
|
|
5
5
|
*/
|
|
@@ -4073,8 +4073,8 @@
|
|
|
4073
4073
|
let r = new s.Coordinate(p(e[0]), p(e[1])), i = new s.Coordinate(p(e[2]), p(e[3]));
|
|
4074
4074
|
r = this.ye(r), i = this.ye(i);
|
|
4075
4075
|
const o = r.add(i).be(.5);
|
|
4076
|
-
r.
|
|
4077
|
-
const a = this.
|
|
4076
|
+
r._sub(o), i._sub(o);
|
|
4077
|
+
const a = this.pe(e[4], e[5]), c = a.x, h = a.y, u = [ r.x, r.y, h, i.x, r.y, h, i.x, i.y, h, r.x, i.y, h, r.x, r.y, c, i.x, r.y, c, i.x, i.y, c, r.x, i.y, c ], f = new n.reshader.Geometry({
|
|
4078
4078
|
aPosition: u
|
|
4079
4079
|
}, [ 0, 1, 1, 2, 2, 3, 3, 0, 0, 4, 1, 5, 2, 6, 3, 7, 4, 5, 5, 6, 6, 7, 7, 4 ], 0, {
|
|
4080
4080
|
primitive: "lines"
|
|
@@ -4108,7 +4108,7 @@
|
|
|
4108
4108
|
i.RGB ? u.HAS_RGB = 1 : i.RGBA ? u.HAS_RGBA = 1 : i.RGB565 && (u.HAS_RGB565 = 1),
|
|
4109
4109
|
(i.NORMAL || i.NORMAL_OCT16P) && (u.HAS_NORMAL = 1, i.NORMAL_OCT16P && (u.HAS_NORMAL_OCT16P = 1)),
|
|
4110
4110
|
t.featureTable.CONSTANT_RGBA && (t.featureTable.CONSTANT_RGBA = t.featureTable.CONSTANT_RGBA.map(t => t / 255));
|
|
4111
|
-
const {rtcCenter: f, rtcCoord: l} = t, d = this.
|
|
4111
|
+
const {rtcCenter: f, rtcCoord: l} = t, d = this.we(l), m = this._e(r, f, l);
|
|
4112
4112
|
n.mat4.multiply(m, m, d);
|
|
4113
4113
|
const y = this.Nt.options.services[a], b = new n.reshader.Mesh(h);
|
|
4114
4114
|
return b.properties.magic = "pnts", b.properties.id = e, b.properties.count = c,
|
|
@@ -4141,7 +4141,7 @@
|
|
|
4141
4141
|
mesh: t
|
|
4142
4142
|
}), t;
|
|
4143
4143
|
}
|
|
4144
|
-
const i = this.
|
|
4144
|
+
const i = this.ge(r.Te), {i3dm: o, featureTable: a, gltf: c, batchTable: h, batchTableBin: u, count: f} = t, l = a.INSTANCES_LENGTH, {rtcCenter: d, rtcCoord: m} = t, y = this.we(m), b = this._e(r, d, m), {POSITION: p, NORMAL_UP: w, NORMAL_RIGHT: _, SCALE: g, SCALE_NON_UNIFORM: T, INSTANCE_ROTATION: O} = o, v = {
|
|
4145
4145
|
"instance_vectorA": new Float32Array(4 * l),
|
|
4146
4146
|
"instance_vectorB": new Float32Array(4 * l),
|
|
4147
4147
|
"instance_vectorC": new Float32Array(4 * l)
|
|
@@ -4183,12 +4183,12 @@
|
|
|
4183
4183
|
let F = 0, D = !0;
|
|
4184
4184
|
const k = [];
|
|
4185
4185
|
return Dt(c, (t, s, o, a) => {
|
|
4186
|
-
let {geometry: c, material: d} = this.
|
|
4186
|
+
let {geometry: c, material: d} = this.Ae(t, s, o, a, r, !0, R);
|
|
4187
4187
|
d && !d.isReady() && (D = !1, F++);
|
|
4188
4188
|
const m = new n.reshader.InstancedMesh(L, l, c, d);
|
|
4189
4189
|
m.properties.magic = "i3dm", m.properties.id = e, m.properties.count = f, m.properties.batchTable = h,
|
|
4190
4190
|
m.properties.batchTableBin = u;
|
|
4191
|
-
const p = this.
|
|
4191
|
+
const p = this.Oe(t, c, d, r.te), w = n.mat4.identity([]);
|
|
4192
4192
|
if (t.matrices && t.matrices.length) for (let e = 0; e < t.matrices.length; e++) n.mat4.multiply(w, w, t.matrices[e]);
|
|
4193
4193
|
n.mat4.multiply(w, i, w), m.setPositionMatrix(w), n.mat4.multiply(y, b, y), m.setLocalTransform(y),
|
|
4194
4194
|
m.setDefines(p), m.properties.polygonOffset = {
|
|
@@ -4201,7 +4201,7 @@
|
|
|
4201
4201
|
})) : (this.Bt[e] = {
|
|
4202
4202
|
meshes: k,
|
|
4203
4203
|
count: F
|
|
4204
|
-
}, k.
|
|
4204
|
+
}, k.ve = s), k;
|
|
4205
4205
|
}
|
|
4206
4206
|
createB3DMMesh(t, e, r, i) {
|
|
4207
4207
|
if (this.Rt[e] || this.Bt[e]) {
|
|
@@ -4216,21 +4216,21 @@
|
|
|
4216
4216
|
const t = new s.Extent(r.maxExtent).convertTo(t => this._pointToPrj(t));
|
|
4217
4217
|
o = [ t.xmin, t.ymin, t.xmax, t.ymax ];
|
|
4218
4218
|
}
|
|
4219
|
-
const a = this.
|
|
4219
|
+
const a = this.ge(r.Te), c = t.gltf, {center: h, coord: u} = c.extensions.CESIUM_RTC, f = this.Nt.options.services[r.te].heightOffset || 0;
|
|
4220
4220
|
f && (u[2] += f);
|
|
4221
|
-
const l = this.
|
|
4221
|
+
const l = this.we(u, r.te), d = this.Nt.options.services[r.te].shader || "phong", m = [];
|
|
4222
4222
|
let y = 0, b = !0;
|
|
4223
4223
|
return Dt(c, (s, i, c, f) => {
|
|
4224
|
-
let {geometry: p, material: w} = this.
|
|
4224
|
+
let {geometry: p, material: w} = this.Ae(s, i, c, f, r, !1, d);
|
|
4225
4225
|
w && !w.isReady() && (b = !1, y++);
|
|
4226
4226
|
const _ = new n.reshader.Mesh(p, w);
|
|
4227
4227
|
_.properties.magic = "b3dm", _.properties.id = e, _.properties.batchTable = t.batchTable,
|
|
4228
4228
|
_.properties.batchTableBin = t.batchTableBin, _.properties.count = t.featureTable.BATCH_LENGTH;
|
|
4229
|
-
const g = this.
|
|
4229
|
+
const g = this.Oe(s, p, w, r.te);
|
|
4230
4230
|
_.setDefines(g), o && (g.USE_MAX_EXTENT = 1, _.setUniform("maxPrjExtent", o));
|
|
4231
4231
|
let T = n.mat4.identity([]);
|
|
4232
4232
|
if (s.matrices && s.matrices.length) for (let t = 0; t < s.matrices.length; t++) n.mat4.multiply(T, T, s.matrices[t]);
|
|
4233
|
-
const A = this.
|
|
4233
|
+
const A = this._e(r, h, u);
|
|
4234
4234
|
n.mat4.multiply(T, a, T), n.mat4.multiply(T, l, T), n.mat4.multiply(T, A, T), _.setLocalTransform(T),
|
|
4235
4235
|
m.push(_);
|
|
4236
4236
|
}), b ? (this.Rt[e] = m, i(null, {
|
|
@@ -4239,9 +4239,9 @@
|
|
|
4239
4239
|
})) : (this.Bt[e] = {
|
|
4240
4240
|
meshes: m,
|
|
4241
4241
|
count: y
|
|
4242
|
-
}, m.
|
|
4242
|
+
}, m.ve = i), m;
|
|
4243
4243
|
}
|
|
4244
|
-
|
|
4244
|
+
_e(t, e, r) {
|
|
4245
4245
|
const i = this.getMap(), o = this.Nt.options.services[t.te].heightOffset || 0, a = new s.Coordinate(r), c = i.distanceToPointAtRes(100, 0, i.getGLRes(), a).x / 100;
|
|
4246
4246
|
let h = t.matrix ? n.mat4.copy([], t.matrix) : n.mat4.identity([]);
|
|
4247
4247
|
if (e) {
|
|
@@ -4279,9 +4279,9 @@
|
|
|
4279
4279
|
}(fn, u);
|
|
4280
4280
|
let l = this.Nt.options.offset;
|
|
4281
4281
|
if (y(l)) {
|
|
4282
|
-
l = l(this.Nt.
|
|
4282
|
+
l = l(this.Nt.Me(t.id).center);
|
|
4283
4283
|
}
|
|
4284
|
-
return n.vec3.set(un, l[0], l[1], 0), n.vec3.
|
|
4284
|
+
return n.vec3.set(un, l[0], l[1], 0), n.vec3.sub(f, f, un), ve(u, f, u), u;
|
|
4285
4285
|
}
|
|
4286
4286
|
createCMPTMesh(t, e, r, s) {
|
|
4287
4287
|
if (this.kt[e]) {
|
|
@@ -4296,13 +4296,13 @@
|
|
|
4296
4296
|
for (let t = 0; t < i.length; t++) {
|
|
4297
4297
|
const {magic: n} = i[t], s = e + "." + t;
|
|
4298
4298
|
"b3dm" === n ? this.createB3DMMesh(i[t], s, r, (t, {mesh: e}) => {
|
|
4299
|
-
this.
|
|
4299
|
+
this.Se(a, e), o.push(e);
|
|
4300
4300
|
}) : "i3dm" === n ? this.createI3DMMesh(i[t], s, r, (t, {mesh: e}) => {
|
|
4301
4301
|
a = null, o.push(e);
|
|
4302
4302
|
}) : "pnts" === n ? this.createPntsMesh(i[t], s, r, (t, {mesh: e}) => {
|
|
4303
|
-
this.
|
|
4303
|
+
this.Se(a, e), o.push(e);
|
|
4304
4304
|
}) : "cmpt" === n && this.createCMPTMesh(i[t], s, r, (t, {mesh: e}) => {
|
|
4305
|
-
e.boundingBox || (a = null), this.
|
|
4305
|
+
e.boundingBox || (a = null), this.Se(a, e), o.push(e);
|
|
4306
4306
|
});
|
|
4307
4307
|
}
|
|
4308
4308
|
return a && (o.boundingBox = [ a.min, a.max ]), this.kt[e] = o, s(null, {
|
|
@@ -4310,23 +4310,23 @@
|
|
|
4310
4310
|
mesh: o
|
|
4311
4311
|
}), o;
|
|
4312
4312
|
}
|
|
4313
|
-
|
|
4313
|
+
Se(t, e) {
|
|
4314
4314
|
if (!t) return null;
|
|
4315
4315
|
if (e.boundingBox) t.combine(e.boundingBox); else for (let n = 0; n < e.length; n++) e[n] && t.combine(e[n].getBoundingBox());
|
|
4316
4316
|
}
|
|
4317
|
-
|
|
4317
|
+
Oe(t, e, n, r) {
|
|
4318
4318
|
return ("phong" === (this.Nt.options.services[r].shader || "phong") ? this.re : this.se).getGeometryDefines(e);
|
|
4319
4319
|
}
|
|
4320
|
-
|
|
4320
|
+
Ae(t, e, n, r, s, i, o) {
|
|
4321
4321
|
const a = r.url + "-" + e + "-" + n;
|
|
4322
4322
|
if (this.jt[a]) return this.jt[a].refCount++, this.jt[a];
|
|
4323
4323
|
let c, h;
|
|
4324
4324
|
const u = r.materials[t.material];
|
|
4325
4325
|
if (r.extensions && r.extensions.KHR_techniques_webgl && u.extensions && u.extensions.KHR_techniques_webgl) {
|
|
4326
|
-
const e = this.
|
|
4326
|
+
const e = this.xe(t, r, i);
|
|
4327
4327
|
c = e.material, h = e.geometry;
|
|
4328
|
-
} else h = this.
|
|
4329
|
-
c && !c.isReady() ? c.
|
|
4328
|
+
} else h = this.Ie(t, i, ln), c = this.Ne(t.material, r, o);
|
|
4329
|
+
c && !c.isReady() ? c.Pe = s.id : c || (c = this.Kt);
|
|
4330
4330
|
const f = {
|
|
4331
4331
|
refCount: 1,
|
|
4332
4332
|
geometry: h,
|
|
@@ -4334,14 +4334,14 @@
|
|
|
4334
4334
|
};
|
|
4335
4335
|
return h.properties.url = a, this.jt[a] = f, f;
|
|
4336
4336
|
}
|
|
4337
|
-
|
|
4337
|
+
xe(t, e, n) {
|
|
4338
4338
|
const {geometry: r, material: s} = this.Zt.createMesh(t, e, n);
|
|
4339
4339
|
return {
|
|
4340
4340
|
geometry: r,
|
|
4341
4341
|
material: s
|
|
4342
4342
|
};
|
|
4343
4343
|
}
|
|
4344
|
-
|
|
4344
|
+
Ie(t, e, r) {
|
|
4345
4345
|
const s = t.attributes, i = r.COLOR_0;
|
|
4346
4346
|
if (s[i] && s[i] instanceof Float32Array) {
|
|
4347
4347
|
const t = new Uint8Array(s[i].length);
|
|
@@ -4371,8 +4371,8 @@
|
|
|
4371
4371
|
excludeElementsInVAO: e
|
|
4372
4372
|
}), a;
|
|
4373
4373
|
}
|
|
4374
|
-
|
|
4375
|
-
const e = n.mat4.identity([]), r = this.getMap(), s = this.
|
|
4374
|
+
we(t) {
|
|
4375
|
+
const e = n.mat4.identity([]), r = this.getMap(), s = this.Ee();
|
|
4376
4376
|
hn.x = t[0], hn.y = t[1];
|
|
4377
4377
|
const i = r.distanceToPointAtRes(100, 100, r.getGLRes(), hn);
|
|
4378
4378
|
return n.vec3.set(s, i.x / 100 * 1.01, i.y / 100 * 1.01, i.y / 100), n.mat4.scale(e, e, s),
|
|
@@ -4506,7 +4506,7 @@
|
|
|
4506
4506
|
polygonOpacity: 1
|
|
4507
4507
|
}), s;
|
|
4508
4508
|
}
|
|
4509
|
-
|
|
4509
|
+
Ne(t, e, r) {
|
|
4510
4510
|
const s = e.materials[t];
|
|
4511
4511
|
if (!s || !s.baseColorTexture && !s.pbrMetallicRoughness) return null;
|
|
4512
4512
|
let i;
|
|
@@ -4553,7 +4553,7 @@
|
|
|
4553
4553
|
format: t.format ? $e(t.format) : "rgba",
|
|
4554
4554
|
flipY: !1
|
|
4555
4555
|
};
|
|
4556
|
-
if (e && e.baseColorTexture) r.url = this.
|
|
4556
|
+
if (e && e.baseColorTexture) r.url = this.Ce(t); else {
|
|
4557
4557
|
const e = t.image;
|
|
4558
4558
|
r.data = e.array, r.width = e.width, r.height = e.height;
|
|
4559
4559
|
}
|
|
@@ -4561,31 +4561,31 @@
|
|
|
4561
4561
|
return s && (s.magFilter && (r.mag = ze(s.magFilter)), s.minFilter && (r.min = Ve(s.minFilter)),
|
|
4562
4562
|
s.wrapS && (r.wrapS = Ge(s.wrapS)), s.wrapT && (r.wrapT = Ge(s.wrapT))), new n.reshader.Texture2D(r, this.$t);
|
|
4563
4563
|
}
|
|
4564
|
-
|
|
4564
|
+
Ce(t) {
|
|
4565
4565
|
const e = t.image, n = window.URL || window.webkitURL, r = new Blob([ e.array ], {
|
|
4566
4566
|
type: e.mimeType
|
|
4567
4567
|
});
|
|
4568
4568
|
return n.createObjectURL(r);
|
|
4569
4569
|
}
|
|
4570
4570
|
Jt({target: t}) {
|
|
4571
|
-
const e = t.
|
|
4571
|
+
const e = t.Pe, n = this.Bt[e];
|
|
4572
4572
|
if (n.count--, !n.count) {
|
|
4573
4573
|
const t = n.meshes;
|
|
4574
4574
|
this.Rt[e] = t, delete this.Bt[e];
|
|
4575
|
-
const r = t.
|
|
4576
|
-
delete t.
|
|
4575
|
+
const r = t.ve;
|
|
4576
|
+
delete t.ve, r(null, {
|
|
4577
4577
|
mesh: n.meshes,
|
|
4578
4578
|
id: e
|
|
4579
4579
|
});
|
|
4580
4580
|
}
|
|
4581
4581
|
}
|
|
4582
|
-
|
|
4582
|
+
Ee() {
|
|
4583
4583
|
return en;
|
|
4584
4584
|
}
|
|
4585
4585
|
ye(t) {
|
|
4586
4586
|
return this.Nt.ye(t);
|
|
4587
4587
|
}
|
|
4588
|
-
|
|
4588
|
+
pe(t, e) {
|
|
4589
4589
|
const n = this.getMap();
|
|
4590
4590
|
return n.getGLZoom ? n.distanceToPoint(t, e, n.getGLZoom()) : n.distanceToPointAtRes(t, e, n.getGLRes());
|
|
4591
4591
|
}
|
|
@@ -4597,7 +4597,7 @@
|
|
|
4597
4597
|
const e = this.getMap();
|
|
4598
4598
|
return e.getGLZoom ? e._prjToPoint(t, e.getGLZoom()) : e._prjToPointAtRes(t, e.getGLRes());
|
|
4599
4599
|
}
|
|
4600
|
-
|
|
4600
|
+
ge(t) {
|
|
4601
4601
|
return "Y" === t ? Ke : "X" === t ? Xe : nn;
|
|
4602
4602
|
}
|
|
4603
4603
|
}
|
|
@@ -4617,30 +4617,30 @@
|
|
|
4617
4617
|
if (n && !n.intersects(this.canvasExtent2D)) return void this.completeRender();
|
|
4618
4618
|
const {root: r, tiles: s} = this.layer.getTiles(), i = s ? Object.keys(s).length : 0;
|
|
4619
4619
|
if (!s || !i) return void this.completeRender();
|
|
4620
|
-
const {selectedTiles: o, leaves: a, requests: c} = this.
|
|
4621
|
-
this.
|
|
4620
|
+
const {selectedTiles: o, leaves: a, requests: c} = this.Ue(r, s);
|
|
4621
|
+
this.Be(o, a, e), this.Le(), c.length ? this.loadTiles(c) : this.completeRender();
|
|
4622
4622
|
}
|
|
4623
|
-
|
|
4623
|
+
Ue(t, e) {
|
|
4624
4624
|
let n = [];
|
|
4625
|
-
this.
|
|
4625
|
+
this.Re();
|
|
4626
4626
|
let r = 0;
|
|
4627
|
-
const s = this.
|
|
4627
|
+
const s = this.Fe(), i = {};
|
|
4628
4628
|
let o = !1, a = !1;
|
|
4629
4629
|
for (const t in e) {
|
|
4630
4630
|
const s = e[t], c = s.node;
|
|
4631
4631
|
if (i[c.id]) continue;
|
|
4632
4632
|
i[c.id] = 1;
|
|
4633
4633
|
let h = !1;
|
|
4634
|
-
const u = this.
|
|
4635
|
-
if (this.
|
|
4634
|
+
const u = this.De(c.id);
|
|
4635
|
+
if (this.ke(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
|
|
4636
4636
|
o = !0, s.selected = !0, s.data = u) : this.painter.has(c) || (h = a = !0, n.push(c)),
|
|
4637
4637
|
!h) continue;
|
|
4638
|
-
if (this.
|
|
4639
|
-
this.
|
|
4638
|
+
if (this.je(s)) o = !0; else {
|
|
4639
|
+
this.ze(s).length && (o = !0);
|
|
4640
4640
|
}
|
|
4641
4641
|
}
|
|
4642
4642
|
let c = [], h = {};
|
|
4643
|
-
if (o && ({selectedTiles: c, leaves: h} = this.
|
|
4643
|
+
if (o && ({selectedTiles: c, leaves: h} = this.Ve(t)), n.length > 1 && (n.sort(bn),
|
|
4644
4644
|
s)) {
|
|
4645
4645
|
const t = s - r;
|
|
4646
4646
|
n = t > 0 ? n.slice(0, t) : [];
|
|
@@ -4652,14 +4652,14 @@
|
|
|
4652
4652
|
leaves: h
|
|
4653
4653
|
};
|
|
4654
4654
|
}
|
|
4655
|
-
|
|
4655
|
+
Ve(t) {
|
|
4656
4656
|
const e = [], n = {};
|
|
4657
4657
|
let r;
|
|
4658
4658
|
const s = [ t ], i = [];
|
|
4659
4659
|
for (;s.length > 0 || i.length > 0; ) {
|
|
4660
4660
|
if (i.length > 0) {
|
|
4661
4661
|
const t = i[i.length - 1];
|
|
4662
|
-
if (t.
|
|
4662
|
+
if (t.Ge === s.length) {
|
|
4663
4663
|
i.pop(), t === r && (t.leave = !0, n[t.node.id] = 1), e.push(t);
|
|
4664
4664
|
continue;
|
|
4665
4665
|
}
|
|
@@ -4671,7 +4671,7 @@
|
|
|
4671
4671
|
t.leave = !0, n[t.node.id] = 1, e.push(t);
|
|
4672
4672
|
continue;
|
|
4673
4673
|
}
|
|
4674
|
-
i.push(t), t.
|
|
4674
|
+
i.push(t), t.Ge = s.length;
|
|
4675
4675
|
}
|
|
4676
4676
|
o.length > 1 && o.sort(yn);
|
|
4677
4677
|
for (let t = 0; t < o.length; t++) s.push(o[t]);
|
|
@@ -4681,7 +4681,7 @@
|
|
|
4681
4681
|
leaves: n
|
|
4682
4682
|
};
|
|
4683
4683
|
}
|
|
4684
|
-
|
|
4684
|
+
je(t) {
|
|
4685
4685
|
if (!t.parent) return null;
|
|
4686
4686
|
let e = t.parent;
|
|
4687
4687
|
for (;e && e.level >= 0; ) {
|
|
@@ -4692,27 +4692,27 @@
|
|
|
4692
4692
|
}
|
|
4693
4693
|
return null;
|
|
4694
4694
|
}
|
|
4695
|
-
|
|
4695
|
+
ze(t) {
|
|
4696
4696
|
const e = [];
|
|
4697
4697
|
if (!t.node.children || !t.node.children.length) return e;
|
|
4698
|
-
const n = t
|
|
4698
|
+
const n = t.He + 1, r = [ t.node ];
|
|
4699
4699
|
for (;r.length > 0; ) {
|
|
4700
4700
|
const s = r.pop().children;
|
|
4701
4701
|
for (let i = 0, o = s.length; i < o; i++) {
|
|
4702
|
-
if (!this.layer
|
|
4702
|
+
if (!this.layer.$e(s[i]) && s[i].children && s[i].children.length) {
|
|
4703
4703
|
r.push(s[i]);
|
|
4704
4704
|
continue;
|
|
4705
4705
|
}
|
|
4706
4706
|
const o = s[i].id;
|
|
4707
4707
|
if (this.tileCache.has(o)) {
|
|
4708
|
-
const n = this.layer.
|
|
4708
|
+
const n = this.layer.qe(s[i], t);
|
|
4709
4709
|
n.selected = !0, n.data = this.tileCache.get(o), t.children.push(n), e.push(n);
|
|
4710
|
-
} else s[i]
|
|
4710
|
+
} else s[i].He <= n && r.push(s[i]);
|
|
4711
4711
|
}
|
|
4712
4712
|
}
|
|
4713
4713
|
return e;
|
|
4714
4714
|
}
|
|
4715
|
-
|
|
4715
|
+
Be(t, e, n) {
|
|
4716
4716
|
this.tileCache.markAll(!1);
|
|
4717
4717
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
4718
4718
|
const n = t[e].data;
|
|
@@ -4746,7 +4746,7 @@
|
|
|
4746
4746
|
let e = t.content.url;
|
|
4747
4747
|
if (M(e)) {
|
|
4748
4748
|
const n = S(e);
|
|
4749
|
-
return void this.
|
|
4749
|
+
return void this.Je(e, n, t);
|
|
4750
4750
|
}
|
|
4751
4751
|
t && -1 === e.indexOf("http://") && -1 === e.indexOf("https://") && (e = t.baseUrl + e);
|
|
4752
4752
|
const n = this.layer.options.services[t.te];
|
|
@@ -4756,53 +4756,53 @@
|
|
|
4756
4756
|
let s = ft.getArrayBuffer(e + (r || ""), n.ajaxOptions);
|
|
4757
4757
|
const i = s.xhr;
|
|
4758
4758
|
s = s.then(n => {
|
|
4759
|
-
delete this.gt[e], n ? this.
|
|
4759
|
+
delete this.gt[e], n ? this.Je(e, n.data, t) : this.onTileError(null, t);
|
|
4760
4760
|
}).catch(n => {
|
|
4761
4761
|
delete this.gt[e], this.onTileError(n, t);
|
|
4762
4762
|
}), this.gt[e] = i;
|
|
4763
|
-
} else this.
|
|
4763
|
+
} else this.Je(e, null, t);
|
|
4764
4764
|
}
|
|
4765
|
-
|
|
4765
|
+
Je(t, e, n) {
|
|
4766
4766
|
this.workerConn.loadTile(this.layer.getId(), {
|
|
4767
4767
|
url: t,
|
|
4768
4768
|
arraybuffer: e,
|
|
4769
4769
|
rootIdx: n.te,
|
|
4770
|
-
upAxis: n.
|
|
4770
|
+
upAxis: n.Te,
|
|
4771
4771
|
transform: n.matrix
|
|
4772
4772
|
}, (e, r) => {
|
|
4773
4773
|
if (e) return void this.onTileError(e, n);
|
|
4774
4774
|
const {magic: s} = r;
|
|
4775
4775
|
"b3dm" === s ? this.painter.createB3DMMesh(r, n.id, n, (t, {mesh: e}) => {
|
|
4776
|
-
n.
|
|
4776
|
+
n.Ke = this.Xe(e), this.Ze(r, n, t, e);
|
|
4777
4777
|
}) : "pnts" === s ? this.painter.createPntsMesh(r, n.id, n, (t, {mesh: e}) => {
|
|
4778
|
-
n.
|
|
4778
|
+
n.Ke = this.Xe(e), this.Ze(r, n, t, e);
|
|
4779
4779
|
}) : "i3dm" === s ? this.painter.createI3DMMesh(r, n.id, n, (t, {mesh: e}) => {
|
|
4780
|
-
this.
|
|
4780
|
+
this.Ze(r, n, t, e);
|
|
4781
4781
|
}) : "cmpt" === s ? this.painter.createCMPTMesh(r, n.id, n, (t, {mesh: e}) => {
|
|
4782
|
-
e.boundingBox && (n.
|
|
4782
|
+
e.boundingBox && (n.Ke = e.boundingBox), this.Ze(r, n, t, e);
|
|
4783
4783
|
}) : this.onTilesetLoad(r, n, t);
|
|
4784
4784
|
});
|
|
4785
4785
|
}
|
|
4786
|
-
|
|
4786
|
+
Xe(t) {
|
|
4787
4787
|
if (1 === t.length) return t[0].getBoundingBox();
|
|
4788
4788
|
if (!n.reshader.BoundingBox) return null;
|
|
4789
4789
|
const e = new n.reshader.BoundingBox;
|
|
4790
4790
|
for (let n = 0; n < t.length; n++) t[n] && e.combine(t[n].getBoundingBox());
|
|
4791
4791
|
return [ e.min, e.max ];
|
|
4792
4792
|
}
|
|
4793
|
-
|
|
4793
|
+
Ze(t, e, n, r) {
|
|
4794
4794
|
if (n) this.onTileError(n, e); else {
|
|
4795
|
-
const n = this.
|
|
4795
|
+
const n = this.We(r);
|
|
4796
4796
|
e.memorySize = n, this.onTileLoad(t, e);
|
|
4797
4797
|
}
|
|
4798
4798
|
}
|
|
4799
|
-
|
|
4799
|
+
We(t) {
|
|
4800
4800
|
let e = 0;
|
|
4801
|
-
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.
|
|
4801
|
+
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.We(t[n])); else t && (e += t.getMemorySize());
|
|
4802
4802
|
return e;
|
|
4803
4803
|
}
|
|
4804
4804
|
onTileLoad(t, e) {
|
|
4805
|
-
this.layer && (delete this.tilesLoading[e.id], this.
|
|
4805
|
+
this.layer && (delete this.tilesLoading[e.id], this.Ye(e), this.setToRedraw(), this.layer.fire("tileload", {
|
|
4806
4806
|
node: e
|
|
4807
4807
|
}));
|
|
4808
4808
|
}
|
|
@@ -4813,15 +4813,15 @@
|
|
|
4813
4813
|
if (!this.layer) return;
|
|
4814
4814
|
const n = e.content.url;
|
|
4815
4815
|
console.warn("failed to load 3d tile: " + n), console.warn(t), delete this.tilesLoading[e.id],
|
|
4816
|
-
this.
|
|
4816
|
+
this.Ye(e), this.setToRedraw(), this.layer.fire("tileerror", {
|
|
4817
4817
|
node: e,
|
|
4818
4818
|
error: t
|
|
4819
4819
|
});
|
|
4820
4820
|
}
|
|
4821
|
-
|
|
4821
|
+
De(t) {
|
|
4822
4822
|
return this.tileCache.get(t);
|
|
4823
4823
|
}
|
|
4824
|
-
|
|
4824
|
+
Ye(t) {
|
|
4825
4825
|
const e = {
|
|
4826
4826
|
loadTime: s.Util.now(),
|
|
4827
4827
|
current: !0,
|
|
@@ -4838,7 +4838,7 @@
|
|
|
4838
4838
|
} else this.workerConn.abortTileLoading(this.layer.getId(), e);
|
|
4839
4839
|
delete this.gt[e];
|
|
4840
4840
|
}
|
|
4841
|
-
|
|
4841
|
+
Re() {
|
|
4842
4842
|
if (this.tilesLoading) for (const t in this.tilesLoading) this.tilesLoading[t].current = !1;
|
|
4843
4843
|
}
|
|
4844
4844
|
deleteTile(t) {
|
|
@@ -4853,7 +4853,7 @@
|
|
|
4853
4853
|
antialias: t.options.antialias
|
|
4854
4854
|
};
|
|
4855
4855
|
this.canvas.gl && this.canvas.gl.wrap ? (this.gl = this.canvas.gl.wrap(), this.regl = this.canvas.gl.regl) : (this.glOptions = e,
|
|
4856
|
-
this.gl = this.
|
|
4856
|
+
this.gl = this.Qe(this.canvas, e)), this.regl = this.regl || n.createREGL({
|
|
4857
4857
|
gl: this.gl,
|
|
4858
4858
|
attributes: e,
|
|
4859
4859
|
extensions: [ "OES_element_index_uint", "WEBGL_compressed_texture_s3tc" ],
|
|
@@ -4880,7 +4880,7 @@
|
|
|
4880
4880
|
super.onRemove();
|
|
4881
4881
|
}
|
|
4882
4882
|
clear() {
|
|
4883
|
-
this.
|
|
4883
|
+
this.Le(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
|
|
4884
4884
|
}
|
|
4885
4885
|
clearCanvas() {
|
|
4886
4886
|
this.regl && this.regl.clear({
|
|
@@ -4895,11 +4895,11 @@
|
|
|
4895
4895
|
getStencilValue() {
|
|
4896
4896
|
return 0;
|
|
4897
4897
|
}
|
|
4898
|
-
|
|
4899
|
-
this.
|
|
4898
|
+
Le(t) {
|
|
4899
|
+
this.tn || (this.tn = Date.now());
|
|
4900
4900
|
const e = Date.now();
|
|
4901
|
-
if (t || !(e - this.
|
|
4902
|
-
this.
|
|
4901
|
+
if (t || !(e - this.tn < this.layer.options.retireInterval)) {
|
|
4902
|
+
this.tn = e;
|
|
4903
4903
|
for (const e in this.tilesLoading) {
|
|
4904
4904
|
const n = this.tilesLoading[e];
|
|
4905
4905
|
!t && n.current || (this.abortTileLoading(n), this.painter.has(n) && this.painter.deleteTile(n),
|
|
@@ -4907,10 +4907,10 @@
|
|
|
4907
4907
|
}
|
|
4908
4908
|
}
|
|
4909
4909
|
}
|
|
4910
|
-
|
|
4910
|
+
Fe() {
|
|
4911
4911
|
return this.getMap().isInteracting() ? this.layer.options.loadingLimitOnInteracting : this.layer.options.loadingLimit;
|
|
4912
4912
|
}
|
|
4913
|
-
|
|
4913
|
+
Qe(t, e) {
|
|
4914
4914
|
const n = [ "webgl", "experimental-webgl" ];
|
|
4915
4915
|
let r = null;
|
|
4916
4916
|
for (let s = 0; s < n.length; ++s) {
|
|
@@ -4921,7 +4921,7 @@
|
|
|
4921
4921
|
}
|
|
4922
4922
|
return r;
|
|
4923
4923
|
}
|
|
4924
|
-
|
|
4924
|
+
ke(t) {
|
|
4925
4925
|
return !!this.tilesLoading[t];
|
|
4926
4926
|
}
|
|
4927
4927
|
getI3DMMeshes() {
|
|
@@ -4938,10 +4938,10 @@
|
|
|
4938
4938
|
}
|
|
4939
4939
|
}
|
|
4940
4940
|
function yn(t, e) {
|
|
4941
|
-
return 0 === t.node.ce && 0 === e.node.ce ? e.node.
|
|
4941
|
+
return 0 === t.node.ce && 0 === e.node.ce ? e.node.en - t.node.en : e.node.ce - t.node.ce;
|
|
4942
4942
|
}
|
|
4943
4943
|
function bn(t, e) {
|
|
4944
|
-
return 0 === t.ce && 0 === e.ce ? t.
|
|
4944
|
+
return 0 === t.ce && 0 === e.ce ? t.en - e.en : t.ce - e.ce;
|
|
4945
4945
|
}
|
|
4946
4946
|
function pn(t, e, n) {
|
|
4947
4947
|
return t[0] = e[n], t[1] = e[n + 3], t[2] = e[n + 6], t;
|
|
@@ -4963,11 +4963,11 @@
|
|
|
4963
4963
|
const vn = s.projection.EPSG3857, Mn = new s.Extent(0, 0, 0, 0), Sn = [], xn = [], In = new s.Coordinate(0, 0), Nn = n.mat4.identity([]);
|
|
4964
4964
|
class Pn extends s.Layer {
|
|
4965
4965
|
constructor(t, e) {
|
|
4966
|
-
super(t, e), this.
|
|
4966
|
+
super(t, e), this.nn(), this.gt = {}, this.rn = {};
|
|
4967
4967
|
}
|
|
4968
|
-
|
|
4968
|
+
nn() {
|
|
4969
4969
|
let t = this.options.services.map(t => t.url);
|
|
4970
|
-
this.
|
|
4970
|
+
this.sn = t.map((t, e) => function(t, e) {
|
|
4971
4971
|
t = w(t);
|
|
4972
4972
|
return {
|
|
4973
4973
|
baseUrl: t.substring(0, t.lastIndexOf("/")) + "/",
|
|
@@ -4977,25 +4977,25 @@
|
|
|
4977
4977
|
refine: "replace",
|
|
4978
4978
|
matrix: n.mat4.identity([]),
|
|
4979
4979
|
te: e,
|
|
4980
|
-
|
|
4980
|
+
He: 0
|
|
4981
4981
|
};
|
|
4982
4982
|
}(t, e)), this.fire("rootready", {
|
|
4983
|
-
roots: this.
|
|
4983
|
+
roots: this.sn.slice(0)
|
|
4984
4984
|
});
|
|
4985
4985
|
}
|
|
4986
4986
|
getExtent(t) {
|
|
4987
4987
|
if (!t && 0 !== t) {
|
|
4988
4988
|
const t = new s.Extent;
|
|
4989
|
-
for (let e = 0; e < this.
|
|
4990
|
-
const n = this.boundingVolumeToExtent(this.
|
|
4989
|
+
for (let e = 0; e < this.sn.length; e++) if (this.sn[e].boundingVolume) {
|
|
4990
|
+
const n = this.boundingVolumeToExtent(this.sn[e]);
|
|
4991
4991
|
t._combine(n);
|
|
4992
4992
|
}
|
|
4993
4993
|
return t;
|
|
4994
4994
|
}
|
|
4995
|
-
return this.
|
|
4995
|
+
return this.sn[t] && this.sn[t].boundingVolume ? this.boundingVolumeToExtent(this.sn[t]) : null;
|
|
4996
4996
|
}
|
|
4997
4997
|
boundingVolumeToExtent(t) {
|
|
4998
|
-
const e = t.boundingVolume.
|
|
4998
|
+
const e = t.boundingVolume.in ? Nn : t.matrix, r = this.getMap();
|
|
4999
4999
|
if (t.boundingVolume.region) {
|
|
5000
5000
|
const e = t.boundingVolume.region;
|
|
5001
5001
|
return new s.Extent(p(e[0]), p(e[1]), p(e[2]), p(e[3]));
|
|
@@ -5013,14 +5013,14 @@
|
|
|
5013
5013
|
return null;
|
|
5014
5014
|
}
|
|
5015
5015
|
getRootTiles() {
|
|
5016
|
-
return this.
|
|
5016
|
+
return this.sn;
|
|
5017
5017
|
}
|
|
5018
5018
|
getTiles() {
|
|
5019
|
-
return this.getRenderer().ready ? this.
|
|
5019
|
+
return this.getRenderer().ready ? this.an() : (this.cn(), {
|
|
5020
5020
|
tiles: null
|
|
5021
5021
|
});
|
|
5022
5022
|
}
|
|
5023
|
-
|
|
5023
|
+
an() {
|
|
5024
5024
|
const t = this.getMap(), e = t.cameraPosition;
|
|
5025
5025
|
let r, s;
|
|
5026
5026
|
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), In.set(e[0], e[1]),
|
|
@@ -5028,38 +5028,38 @@
|
|
|
5028
5028
|
const n = t.getGLRes();
|
|
5029
5029
|
s = t.pointAtResToDistance(e[2], 0, n), In.set(e[0], e[1]), r = t.pointAtResToCoord(In, n);
|
|
5030
5030
|
}
|
|
5031
|
-
this.
|
|
5032
|
-
this.
|
|
5031
|
+
this.hn = this.hn || [], n.vec3.set(this.hn, b(r.x), b(r.y), s), this.un = $t(this.un || [], this.hn[0], this.hn[1], this.hn[2]),
|
|
5032
|
+
this.ln = 2 * Math.tan(.5 * b(t.getFov())), this.dn = vn.project(r).toArray();
|
|
5033
5033
|
const i = t.projViewMatrix, o = {
|
|
5034
5034
|
children: [],
|
|
5035
5035
|
level: -1
|
|
5036
5036
|
};
|
|
5037
5037
|
let a = o;
|
|
5038
5038
|
const c = {};
|
|
5039
|
-
for (let t = 0; t < this.
|
|
5039
|
+
for (let t = 0; t < this.sn.length; t++) {
|
|
5040
5040
|
let e = 1 / 0;
|
|
5041
|
-
const n = [ this.
|
|
5041
|
+
const n = [ this.sn[t] ], r = this.mn(t);
|
|
5042
5042
|
for (;n.length > 0; ) {
|
|
5043
5043
|
const t = n.pop();
|
|
5044
|
-
for (this.
|
|
5045
|
-
const s = this.
|
|
5044
|
+
for (this.yn(t); a.level >= t.He; ) a = a.parent;
|
|
5045
|
+
const s = this.bn(t, r, i);
|
|
5046
5046
|
if (s < 1) {
|
|
5047
5047
|
let n = a;
|
|
5048
5048
|
for (;n && !n.content; ) n = n.parent;
|
|
5049
|
-
n && n.content && (t.
|
|
5049
|
+
n && n.content && (t.pn = n, this.wn(c, n));
|
|
5050
5050
|
if (!1 === this.options.services[t.te].alwaysShow) continue;
|
|
5051
|
-
if (!(0 === s && t
|
|
5052
|
-
t.content && (e = t
|
|
5051
|
+
if (!(0 === s && t.He <= e)) continue;
|
|
5052
|
+
t.content && (e = t.He);
|
|
5053
5053
|
}
|
|
5054
|
-
t.ce < 1 / 0 && this.
|
|
5055
|
-
const o = this.
|
|
5054
|
+
t.ce < 1 / 0 && this._n(t);
|
|
5055
|
+
const o = this.qe(t, a);
|
|
5056
5056
|
a.children.push(o);
|
|
5057
5057
|
const h = t.children, u = h && h.length, f = o.content;
|
|
5058
|
-
if (!u && f && this.
|
|
5059
|
-
f && "add" === t.refine && this.
|
|
5058
|
+
if (!u && f && this.wn(c, o), u) {
|
|
5059
|
+
f && "add" === t.refine && this.wn(c, o), a = o;
|
|
5060
5060
|
for (let e = 0, r = h.length; e < r; e++) {
|
|
5061
5061
|
if (!h[e].parent) {
|
|
5062
|
-
h[e].parent = t, h[e].
|
|
5062
|
+
h[e].parent = t, h[e].Te = t.Te, h[e].baseUrl = t.baseUrl;
|
|
5063
5063
|
const n = h[e].content && (h[e].content.url || h[e].content.uri);
|
|
5064
5064
|
n && (M(n) ? h[e].baseUrl = t.baseUrl : -1 === n.indexOf("http://") && -1 === n.indexOf("https://") ? h[e].content.url = t.baseUrl + n : h[e].baseUrl = n.substring(0, n.lastIndexOf("/") + 1));
|
|
5065
5065
|
}
|
|
@@ -5073,7 +5073,7 @@
|
|
|
5073
5073
|
tiles: c
|
|
5074
5074
|
};
|
|
5075
5075
|
}
|
|
5076
|
-
|
|
5076
|
+
wn(t, e) {
|
|
5077
5077
|
e.node.viewerRequestVolume && !function(t, e, n) {
|
|
5078
5078
|
if (n.region) {
|
|
5079
5079
|
const e = n.region;
|
|
@@ -5088,89 +5088,89 @@
|
|
|
5088
5088
|
* @maptalks/gl v0.64.0
|
|
5089
5089
|
* LICENSE : UNLICENSED
|
|
5090
5090
|
* (c) 2016-2022 maptalks.com
|
|
5091
|
-
*/ (this.
|
|
5091
|
+
*/ (this.hn, this.un, e.node.viewerRequestVolume) || (t[e.node.id] = e);
|
|
5092
5092
|
}
|
|
5093
|
-
|
|
5093
|
+
qe(t, e) {
|
|
5094
5094
|
return {
|
|
5095
5095
|
id: t.id,
|
|
5096
5096
|
node: t,
|
|
5097
5097
|
children: [],
|
|
5098
|
-
level: t
|
|
5098
|
+
level: t.He,
|
|
5099
5099
|
parent: e,
|
|
5100
|
-
content: this
|
|
5100
|
+
content: this.$e(t)
|
|
5101
5101
|
};
|
|
5102
5102
|
}
|
|
5103
|
-
|
|
5103
|
+
yn(t) {
|
|
5104
5104
|
void 0 === t.id && (t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]),
|
|
5105
|
-
t.
|
|
5106
|
-
t.te = t.parent.te, void 0 === t
|
|
5105
|
+
t.gn = this.Tn(t), t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix),
|
|
5106
|
+
t.te = t.parent.te, void 0 === t.He && (t.He = t.parent.He + 1), t.maxExtent = t.parent.maxExtent),
|
|
5107
5107
|
t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
|
|
5108
|
-
this.
|
|
5108
|
+
this.An(t));
|
|
5109
5109
|
}
|
|
5110
|
-
|
|
5110
|
+
An(t) {
|
|
5111
5111
|
const e = this.options.services[t.te].heightOffset || 0, r = this.options.offset, s = y(r) || r[0] || r[1];
|
|
5112
5112
|
if (!t.boundingVolume || !e && n.mat4.exactEquals(t.matrix, Nn) && !s) return;
|
|
5113
5113
|
const i = t.boundingVolume, {region: o, box: a, sphere: c} = i;
|
|
5114
5114
|
if (o) {
|
|
5115
|
-
const t = this.
|
|
5115
|
+
const t = this.On([ p(o[0]), p(o[1]) ]);
|
|
5116
5116
|
o[0] = b(t.x), o[1] = b(t.y);
|
|
5117
|
-
const n = this.
|
|
5117
|
+
const n = this.On([ p(o[2]), p(o[3]) ]);
|
|
5118
5118
|
o[2] = b(n.x), o[3] = b(n.y), o[4] += e, o[5] += e;
|
|
5119
5119
|
} else if (a || c) {
|
|
5120
|
-
const r = a || c, s = n.vec3.transformMat4(Sn, r, t.matrix), i = Wt(xn, s), o = this.
|
|
5120
|
+
const r = a || c, s = n.vec3.transformMat4(Sn, r, t.matrix), i = Wt(xn, s), o = this.On([ i[0], i[1] ]);
|
|
5121
5121
|
i[0] = o.x, i[1] = o.y, i[2] += e, $t(r, b(i[0]), b(i[1]), i[2]);
|
|
5122
5122
|
}
|
|
5123
|
-
i.
|
|
5123
|
+
i.in = !0;
|
|
5124
5124
|
}
|
|
5125
|
-
|
|
5125
|
+
Tn(t) {
|
|
5126
5126
|
return void 0 === t.geometricError || !t.boundingVolume;
|
|
5127
5127
|
}
|
|
5128
|
-
|
|
5128
|
+
$e(t) {
|
|
5129
5129
|
return t.content && t.content.url;
|
|
5130
5130
|
}
|
|
5131
|
-
|
|
5131
|
+
_n(t) {
|
|
5132
5132
|
let e = t.parent;
|
|
5133
|
-
for (;e && e.
|
|
5133
|
+
for (;e && e.gn && !(e.ce <= t.ce && e.en <= t.en); ) e.ce = t.ce, e.en = t.en,
|
|
5134
5134
|
e = t.parent;
|
|
5135
5135
|
}
|
|
5136
5136
|
onTilesetLoad(t, e, r) {
|
|
5137
5137
|
if (!t) return void console.warn("invalid tileset at : " + r);
|
|
5138
|
-
const s = (t.asset && t.asset.gltfUpAxis || e && e.
|
|
5139
|
-
if (t.root.baseUrl = r.substring(0, r.lastIndexOf("/") + 1), t.root.
|
|
5138
|
+
const s = (t.asset && t.asset.gltfUpAxis || e && e.Te || this.options.services[e.te].upAxis || "Y").toUpperCase();
|
|
5139
|
+
if (t.root.baseUrl = r.substring(0, r.lastIndexOf("/") + 1), t.root.Te = s, e) {
|
|
5140
5140
|
const r = e.boundingVolume;
|
|
5141
5141
|
m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
|
|
5142
5142
|
const s = t.root.transform;
|
|
5143
5143
|
s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
|
|
5144
|
-
this.
|
|
5145
|
-
t.root.content && (e.content = t.root.content)), e.
|
|
5144
|
+
this.An(e), e.children && e.children.length && (e.vn = e.content, delete e.content,
|
|
5145
|
+
t.root.content && (e.content = t.root.content)), e.gn = this.Tn(e);
|
|
5146
5146
|
const i = e.content && (e.content.url || e.content.uri);
|
|
5147
5147
|
i && e.content.uri && (e.content.url = e.content.uri, delete e.content.uri), i && !M(i) && -1 === i.indexOf("http://") && -1 === i.indexOf("https://") && (e.content.url = e.baseUrl + i);
|
|
5148
5148
|
}
|
|
5149
|
-
this.
|
|
5149
|
+
this.cn(), this.fire("loadtileset", {
|
|
5150
5150
|
tileset: t,
|
|
5151
5151
|
index: e.te,
|
|
5152
5152
|
url: r
|
|
5153
5153
|
});
|
|
5154
5154
|
}
|
|
5155
|
-
|
|
5156
|
-
if (t.ce = 1 / 0, 0 === t
|
|
5157
|
-
if (t.
|
|
5155
|
+
bn(t, e, n) {
|
|
5156
|
+
if (t.ce = 1 / 0, 0 === t.He || t.gn) return 1;
|
|
5157
|
+
if (t.Mn = 1 / 0, !this.Sn(t, e, n)) return -1;
|
|
5158
5158
|
if (0 === t.geometricError) return 1;
|
|
5159
5159
|
let r = this.options.services[t.te].maximumScreenSpaceError;
|
|
5160
5160
|
null == r && (r = 8);
|
|
5161
|
-
let s = this.
|
|
5162
|
-
return 0 === s && t.parent && (s = .5 * (t.parent.
|
|
5161
|
+
let s = this.xn(t);
|
|
5162
|
+
return 0 === s && t.parent && (s = .5 * (t.parent.Mn || 0)), s >= r ? 1 : 0;
|
|
5163
5163
|
}
|
|
5164
5164
|
ye(t) {
|
|
5165
5165
|
const e = this.getMap();
|
|
5166
5166
|
return e.getGLZoom ? e.coordToPoint(t, e.getGLZoom()) : e.coordToPointAtRes(t, e.getGLRes());
|
|
5167
5167
|
}
|
|
5168
|
-
|
|
5168
|
+
Sn(t, e, r) {
|
|
5169
5169
|
const o = this.getMap();
|
|
5170
5170
|
if (!o) return !1;
|
|
5171
|
-
if (t.
|
|
5171
|
+
if (t.Ke) return c(r, t.Ke);
|
|
5172
5172
|
const a = t.id;
|
|
5173
|
-
let f = this.
|
|
5173
|
+
let f = this.rn[a];
|
|
5174
5174
|
if (!t.boundingVolume) return !1;
|
|
5175
5175
|
if (!f && t.boundingVolume && !f) {
|
|
5176
5176
|
let e, r, i;
|
|
@@ -5179,18 +5179,18 @@
|
|
|
5179
5179
|
const n = t.boundingVolume.region;
|
|
5180
5180
|
e = new s.Extent(p(n[0]), p(n[1]), p(n[2]), p(n[3]));
|
|
5181
5181
|
const o = e.getCenter();
|
|
5182
|
-
e = e.convertTo(t => this.ye(t)), i = n[4], r = n[5], f = this.
|
|
5182
|
+
e = e.convertTo(t => this.ye(t)), i = n[4], r = n[5], f = this.rn[a] = [ [ e.xmin, e.ymin, i * c ], [ e.xmax, e.ymax, r * c ] ],
|
|
5183
5183
|
f.center = o;
|
|
5184
5184
|
} else if (t.boundingVolume.sphere) {
|
|
5185
5185
|
const e = t.boundingVolume.sphere, n = Wt([], e), r = this.ye(new s.Coordinate(n)).toArray();
|
|
5186
|
-
r.push(n[2] * c), f = this.
|
|
5186
|
+
r.push(n[2] * c), f = this.rn[a] = [ r, e[3] * c ], f.center = new s.Coordinate(n);
|
|
5187
5187
|
} else if (t.boundingVolume.box) {
|
|
5188
5188
|
const e = t.boundingVolume.box, r = Wt([], e), i = this.ye(new s.Coordinate(r)).toArray();
|
|
5189
5189
|
i.push(r[2] * c);
|
|
5190
5190
|
const o = e.slice(3);
|
|
5191
5191
|
n.mat4.exactEquals(t.matrix, Nn) || n.mat3.multiply(o, n.mat3.fromMat4([], t.matrix), o);
|
|
5192
5192
|
for (let t = 0; t < o.length; t++) o[t] *= c, e[3 + t] = o[t];
|
|
5193
|
-
f = this.
|
|
5193
|
+
f = this.rn[a] = [ ...i, ...o ], f.center = new s.Coordinate(r);
|
|
5194
5194
|
}
|
|
5195
5195
|
}
|
|
5196
5196
|
if (e) {
|
|
@@ -5218,62 +5218,62 @@
|
|
|
5218
5218
|
return !0;
|
|
5219
5219
|
}(r, f);
|
|
5220
5220
|
}
|
|
5221
|
-
|
|
5221
|
+
On(t) {
|
|
5222
5222
|
Array.isArray(t) && (t = new s.Coordinate(t));
|
|
5223
5223
|
let e = this.options.offset;
|
|
5224
5224
|
if (y(e) && (e = e(Array.isArray(t) ? new s.Coordinate(t) : t)), e[0] || e[1]) {
|
|
5225
5225
|
const n = this.getMap(), r = n.getGLRes(), s = n.coordToPointAtRes(t, r);
|
|
5226
|
-
return s.
|
|
5226
|
+
return s._sub(e), n.pointAtResToCoord(s, r);
|
|
5227
5227
|
}
|
|
5228
5228
|
return t;
|
|
5229
5229
|
}
|
|
5230
|
-
|
|
5230
|
+
mn(t) {
|
|
5231
5231
|
const e = this.options.services[t].maxExtent;
|
|
5232
5232
|
if (!e) return null;
|
|
5233
|
-
const n = this.
|
|
5233
|
+
const n = this.sn[t];
|
|
5234
5234
|
return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.ye(t))),
|
|
5235
5235
|
n.maxExtent;
|
|
5236
5236
|
}
|
|
5237
|
-
|
|
5238
|
-
const e = this.
|
|
5237
|
+
xn(t) {
|
|
5238
|
+
const e = this.ln, r = t.geometricError;
|
|
5239
5239
|
if (0 === r) return 0;
|
|
5240
5240
|
const s = this.getMap();
|
|
5241
5241
|
let i, o;
|
|
5242
5242
|
if (t.boundingVolume.region) {
|
|
5243
|
-
const e = this.
|
|
5243
|
+
const e = this.rn[t.id].center, r = (s.getGLZoom ? s.distanceToPoint(100, 0, s.getGLZoom(), e) : s.distanceToPointAtRes(100, 0, s.getGLRes(), e)).x / 100;
|
|
5244
5244
|
i = function(t, e, n, r) {
|
|
5245
5245
|
const s = t.boundingVolume.region;
|
|
5246
|
-
let i = t.
|
|
5247
|
-
i || (i = t.
|
|
5248
|
-
t.
|
|
5249
|
-
t.
|
|
5246
|
+
let i = t.In;
|
|
5247
|
+
i || (i = t.In = [ Ln(s[0], s[1]), Ln(s[0], s[3]), Ln(s[2], s[1]), Ln(s[2], s[3]), Ln(s[0], s[1]), Ln(s[0], s[3]), Ln(s[2], s[1]), Ln(s[2], s[3]) ],
|
|
5248
|
+
t.Nn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
|
|
5249
|
+
t.Pn = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
|
|
5250
5250
|
if (n[0] >= s[0] && n[0] <= s[2] && n[1] >= s[1] && n[1] <= s[3]) return n[2] <= s[5] ? 0 : n[2] - s[5];
|
|
5251
|
-
const o = (a = t.
|
|
5251
|
+
const o = (a = t.Nn, c = t.Pn, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
|
|
5252
5252
|
f = Math.max(a[1] - h[1], 0, h[1] - c[1]), Math.sqrt(u * u + f * f) / r);
|
|
5253
5253
|
var a, c, h, u, f;
|
|
5254
5254
|
let l = 0;
|
|
5255
5255
|
n[2] > s[5] && (l = n[2] - s[5]);
|
|
5256
5256
|
return Math.sqrt(o * o + l * l);
|
|
5257
|
-
}(t, this.
|
|
5257
|
+
}(t, this.dn, this.hn, r), o = function(t, e) {
|
|
5258
5258
|
const r = t.boundingVolume.region, s = $t(Un, r[0], r[1], r[4]), i = $t(Bn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
|
|
5259
5259
|
return n.vec3.dist(o, e);
|
|
5260
|
-
}(t, this.
|
|
5261
|
-
} else t.boundingVolume.sphere ? (i = En(t.boundingVolume, this.
|
|
5260
|
+
}(t, this.un);
|
|
5261
|
+
} else t.boundingVolume.sphere ? (i = En(t.boundingVolume, this.un), o = function(t, e) {
|
|
5262
5262
|
const r = t.boundingVolume.sphere;
|
|
5263
5263
|
return n.vec3.dist(r, e);
|
|
5264
|
-
}(t, this.
|
|
5264
|
+
}(t, this.un)) : t.boundingVolume.box && (i = Cn(t.boundingVolume, this.un), o = function(t, e) {
|
|
5265
5265
|
const r = t.boundingVolume.box;
|
|
5266
5266
|
return n.vec3.dist(r, e);
|
|
5267
|
-
}(t, this.
|
|
5267
|
+
}(t, this.un));
|
|
5268
5268
|
const a = Math.max(Math.abs(i), 1e-7), c = r * s.height / (a * e);
|
|
5269
|
-
return t.ce = i, t.
|
|
5269
|
+
return t.ce = i, t.en = o, t.Mn = c, c;
|
|
5270
5270
|
}
|
|
5271
|
-
|
|
5271
|
+
cn() {
|
|
5272
5272
|
const t = this.getRenderer();
|
|
5273
5273
|
t && t.setToRedraw();
|
|
5274
5274
|
}
|
|
5275
|
-
|
|
5276
|
-
return this.
|
|
5275
|
+
Me(t) {
|
|
5276
|
+
return this.rn[t];
|
|
5277
5277
|
}
|
|
5278
5278
|
}
|
|
5279
5279
|
function En(t, e) {
|
|
@@ -5903,5 +5903,5 @@
|
|
|
5903
5903
|
t.Geo3DTransform = re, Object.defineProperty(t, "t", {
|
|
5904
5904
|
value: !0
|
|
5905
5905
|
});
|
|
5906
|
-
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.11.
|
|
5906
|
+
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.11.1");
|
|
5907
5907
|
}));
|