@openglobus/og 0.13.3 → 0.13.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/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Events.js +188 -188
- package/src/og/Globe.js +1 -0
- package/src/og/control/KeyboardNavigation.js +48 -2
- package/src/og/control/TouchNavigation.js +340 -319
- package/src/og/control/ZoomControl.js +1 -1
- package/src/og/ellipsoid/Ellipsoid.js +1 -1
- package/src/og/entity/Billboard.js +165 -165
- package/src/og/entity/BillboardHandler.js +1 -1
- package/src/og/entity/GeoObject.js +4 -0
- package/src/og/entity/GeoObjectHandler.js +22 -33
- package/src/og/entity/Geometry.js +319 -319
- package/src/og/entity/Label.js +348 -346
- package/src/og/entity/LabelHandler.js +44 -37
- package/src/og/input/input.js +7 -1
- package/src/og/layer/KML.js +181 -12
- package/src/og/layer/Layer.js +4 -2
- package/src/og/renderer/RendererEvents.js +1065 -1051
- package/src/og/scene/Planet.js +45 -27
- package/src/og/shaders/billboard.js +8 -0
- package/src/og/shaders/label.js +56 -13
- package/src/og/terrain/EmptyTerrain.js +159 -146
- package/src/og/terrain/Geoid.js +246 -241
- package/src/og/terrain/GlobusTerrain.js +17 -18
- package/src/og/terrain/MapboxTerrain.js +292 -294
- package/src/og/utils/FontAtlas.js +25 -15
- package/src/og/utils/PlainSegmentWorker.js +38 -26
- package/src/og/utils/TextureAtlas.js +291 -280
- package/types/control/KeyboardNavigation.d.ts +3 -0
- package/types/entity/GeoObject.d.ts +1 -0
- package/types/entity/Label.d.ts +1 -0
- package/types/entity/LabelHandler.d.ts +1 -1
- package/types/input/input.d.ts +6 -0
- package/types/layer/KML.d.ts +26 -1
- package/types/renderer/RendererEvents.d.ts +2 -0
- package/types/scene/Planet.d.ts +5 -0
- package/types/terrain/EmptyTerrain.d.ts +3 -1
- package/types/terrain/Geoid.d.ts +1 -10
- package/types/terrain/GlobusTerrain.d.ts +0 -1
- package/types/terrain/MapboxTerrain.d.ts +1 -1
- package/types/utils/TextureAtlas.d.ts +2 -0
|
@@ -24,6 +24,9 @@ const OUTLINECOLOR_BUFFER = 10;
|
|
|
24
24
|
|
|
25
25
|
window.LABEL_DEPTH_OFFSET = -0;
|
|
26
26
|
|
|
27
|
+
const EMPTY = -1.0;
|
|
28
|
+
const RTL = 1.0;
|
|
29
|
+
|
|
27
30
|
/*
|
|
28
31
|
* og.LabelHandler
|
|
29
32
|
*
|
|
@@ -201,6 +204,8 @@ class LabelHandler extends BillboardHandler {
|
|
|
201
204
|
var gl = h.gl,
|
|
202
205
|
ec = this._entityCollection;
|
|
203
206
|
|
|
207
|
+
gl.disable(gl.CULL_FACE);
|
|
208
|
+
|
|
204
209
|
gl.uniform1iv(shu.fontTextureArr, r.fontAtlas.samplerArr);
|
|
205
210
|
gl.uniform4fv(shu.sdfParamsArr, r.fontAtlas.sdfParamsArr);
|
|
206
211
|
gl.uniformMatrix4fv(shu.viewMatrix, false, r.activeCamera._viewMatrix._m);
|
|
@@ -264,6 +269,8 @@ class LabelHandler extends BillboardHandler {
|
|
|
264
269
|
gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
|
|
265
270
|
|
|
266
271
|
gl.depthFunc(gl.LESS);
|
|
272
|
+
|
|
273
|
+
gl.enable(gl.CULL_FACE);
|
|
267
274
|
}
|
|
268
275
|
|
|
269
276
|
_pickingPASS() {
|
|
@@ -359,7 +366,10 @@ class LabelHandler extends BillboardHandler {
|
|
|
359
366
|
label._isReady = false;
|
|
360
367
|
}
|
|
361
368
|
|
|
362
|
-
setText(index, text, fontIndex, align) {
|
|
369
|
+
setText(index, text, fontIndex, align, isRTL = false) {
|
|
370
|
+
|
|
371
|
+
text = text.normalize('NFKC');
|
|
372
|
+
|
|
363
373
|
var fa = this._renderer.fontAtlas.atlasesArr[fontIndex];
|
|
364
374
|
|
|
365
375
|
if (!fa) return;
|
|
@@ -370,15 +380,19 @@ class LabelHandler extends BillboardHandler {
|
|
|
370
380
|
|
|
371
381
|
let c = 0;
|
|
372
382
|
|
|
373
|
-
let n = fa.nodes[text[c]];
|
|
374
|
-
let offset = 0.0;
|
|
375
383
|
let len = Math.min(this._maxLetters, text.length);
|
|
384
|
+
let _rtl_ = 0.0;
|
|
385
|
+
if (isRTL) {
|
|
386
|
+
_rtl_ = RTL;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
let offset = 0.0;
|
|
376
390
|
let kern = fa.kernings;
|
|
377
391
|
|
|
378
392
|
for (c = 0; c < len; c++) {
|
|
379
393
|
let j = i + c * 24;
|
|
380
394
|
let char = text[c];
|
|
381
|
-
n = fa.
|
|
395
|
+
let n = fa.get(char.charCodeAt()) || fa.get(" ".charCodeAt());
|
|
382
396
|
let tc = n.texCoords;
|
|
383
397
|
|
|
384
398
|
let m = n.metrics;
|
|
@@ -386,32 +400,32 @@ class LabelHandler extends BillboardHandler {
|
|
|
386
400
|
a[j] = tc[0];
|
|
387
401
|
a[j + 1] = tc[1];
|
|
388
402
|
a[j + 2] = offset;
|
|
389
|
-
a[j + 3] =
|
|
403
|
+
a[j + 3] = _rtl_;
|
|
390
404
|
|
|
391
405
|
a[j + 4] = tc[2];
|
|
392
406
|
a[j + 5] = tc[3];
|
|
393
407
|
a[j + 6] = offset;
|
|
394
|
-
a[j + 7] =
|
|
408
|
+
a[j + 7] = _rtl_;
|
|
395
409
|
|
|
396
410
|
a[j + 8] = tc[4];
|
|
397
411
|
a[j + 9] = tc[5];
|
|
398
412
|
a[j + 10] = offset;
|
|
399
|
-
a[j + 11] =
|
|
413
|
+
a[j + 11] = _rtl_;
|
|
400
414
|
|
|
401
415
|
a[j + 12] = tc[6];
|
|
402
416
|
a[j + 13] = tc[7];
|
|
403
417
|
a[j + 14] = offset;
|
|
404
|
-
a[j + 15] =
|
|
418
|
+
a[j + 15] = _rtl_;
|
|
405
419
|
|
|
406
420
|
a[j + 16] = tc[8];
|
|
407
421
|
a[j + 17] = tc[9];
|
|
408
422
|
a[j + 18] = offset;
|
|
409
|
-
a[j + 19] =
|
|
423
|
+
a[j + 19] = _rtl_;
|
|
410
424
|
|
|
411
425
|
a[j + 20] = tc[10];
|
|
412
426
|
a[j + 21] = tc[11];
|
|
413
427
|
a[j + 22] = offset;
|
|
414
|
-
a[j + 23] =
|
|
428
|
+
a[j + 23] = _rtl_;
|
|
415
429
|
|
|
416
430
|
//
|
|
417
431
|
// Gliph
|
|
@@ -446,9 +460,9 @@ class LabelHandler extends BillboardHandler {
|
|
|
446
460
|
g[j + 22] = m.nXOffset;
|
|
447
461
|
g[j + 23] = m.nYOffset;
|
|
448
462
|
|
|
449
|
-
let k = kern[char];
|
|
450
|
-
if (k) {
|
|
451
|
-
k = k[text[c + 1]];
|
|
463
|
+
let k = kern[char.charCodeAt()];
|
|
464
|
+
if (k && text[c + 1]) {
|
|
465
|
+
k = k[text[c + 1].charCodeAt()];
|
|
452
466
|
if (k) {
|
|
453
467
|
offset += m.nAdvance + k;
|
|
454
468
|
} else {
|
|
@@ -464,33 +478,23 @@ class LabelHandler extends BillboardHandler {
|
|
|
464
478
|
offset *= -0.5;
|
|
465
479
|
for (c = 0; c < len; c++) {
|
|
466
480
|
let j = i + c * 24;
|
|
467
|
-
a[j +
|
|
468
|
-
a[j +
|
|
469
|
-
a[j +
|
|
470
|
-
a[j +
|
|
471
|
-
a[j +
|
|
472
|
-
a[j +
|
|
473
|
-
}
|
|
474
|
-
} else if (align === ALIGN.LEFT) {
|
|
475
|
-
for (c = 0; c < len; c++) {
|
|
476
|
-
let j = i + c * 24;
|
|
477
|
-
a[j + 3] = 0;
|
|
478
|
-
a[j + 7] = 0;
|
|
479
|
-
a[j + 11] = 0;
|
|
480
|
-
a[j + 15] = 0;
|
|
481
|
-
a[j + 19] = 0;
|
|
482
|
-
a[j + 23] = 0;
|
|
481
|
+
a[j + 2] += offset;
|
|
482
|
+
a[j + 6] += offset;
|
|
483
|
+
a[j + 10] += offset;
|
|
484
|
+
a[j + 14] += offset;
|
|
485
|
+
a[j + 18] += offset;
|
|
486
|
+
a[j + 22] += offset;
|
|
483
487
|
}
|
|
484
488
|
}
|
|
485
489
|
|
|
486
490
|
for (; c < this._maxLetters; c++) {
|
|
487
491
|
let j = i + c * 24;
|
|
488
|
-
a[j +
|
|
489
|
-
a[j +
|
|
490
|
-
a[j +
|
|
491
|
-
a[j +
|
|
492
|
-
a[j +
|
|
493
|
-
a[j +
|
|
492
|
+
a[j + 3] = EMPTY;
|
|
493
|
+
a[j + 7] = EMPTY;
|
|
494
|
+
a[j + 11] = EMPTY;
|
|
495
|
+
a[j + 15] = EMPTY;
|
|
496
|
+
a[j + 19] = EMPTY;
|
|
497
|
+
a[j + 23] = EMPTY;
|
|
494
498
|
}
|
|
495
499
|
|
|
496
500
|
this._changedBuffers[TEXCOORD_BUFFER] = true;
|
|
@@ -793,19 +797,22 @@ class LabelHandler extends BillboardHandler {
|
|
|
793
797
|
|
|
794
798
|
for (var q = 0; q < this._maxLetters; q++) {
|
|
795
799
|
var j = i + q * 12;
|
|
800
|
+
|
|
796
801
|
a[j] = vertexArr[0];
|
|
797
802
|
a[j + 1] = vertexArr[1];
|
|
798
|
-
a[j + 2] = vertexArr[2];
|
|
799
803
|
|
|
804
|
+
a[j + 2] = vertexArr[2];
|
|
800
805
|
a[j + 3] = vertexArr[3];
|
|
806
|
+
|
|
801
807
|
a[j + 4] = vertexArr[4];
|
|
802
808
|
a[j + 5] = vertexArr[5];
|
|
803
809
|
|
|
804
810
|
a[j + 6] = vertexArr[6];
|
|
805
811
|
a[j + 7] = vertexArr[7];
|
|
806
|
-
a[j + 8] = vertexArr[8];
|
|
807
812
|
|
|
813
|
+
a[j + 8] = vertexArr[8];
|
|
808
814
|
a[j + 9] = vertexArr[9];
|
|
815
|
+
|
|
809
816
|
a[j + 10] = vertexArr[10];
|
|
810
817
|
a[j + 11] = vertexArr[11];
|
|
811
818
|
}
|
package/src/og/input/input.js
CHANGED
|
@@ -9,11 +9,14 @@ export const input = {
|
|
|
9
9
|
KEY_ALT: 18,
|
|
10
10
|
KEY_SHIFT: 16,
|
|
11
11
|
KEY_SPACE: 32,
|
|
12
|
+
KEY_PGUP: 33,
|
|
13
|
+
KEY_PGDN: 34,
|
|
12
14
|
KEY_LEFT: 37,
|
|
13
15
|
KEY_UP: 38,
|
|
14
16
|
KEY_RIGHT: 39,
|
|
15
17
|
KEY_DOWN: 40,
|
|
16
18
|
KEY_PRINTSCREEN: 44,
|
|
19
|
+
KEY_EQUALS: 61,
|
|
17
20
|
KEY_A: 65,
|
|
18
21
|
KEY_C: 67,
|
|
19
22
|
KEY_D: 68,
|
|
@@ -23,6 +26,7 @@ export const input = {
|
|
|
23
26
|
KEY_I: 73,
|
|
24
27
|
KEY_K: 75,
|
|
25
28
|
KEY_L: 76,
|
|
29
|
+
KEY_N: 78,
|
|
26
30
|
KEY_O: 79,
|
|
27
31
|
KEY_P: 80,
|
|
28
32
|
KEY_Q: 81,
|
|
@@ -32,9 +36,11 @@ export const input = {
|
|
|
32
36
|
KEY_W: 87,
|
|
33
37
|
KEY_X: 88,
|
|
34
38
|
KEY_Z: 90,
|
|
39
|
+
KEY_PLUS: 107,
|
|
35
40
|
KEY_F1: 112,
|
|
41
|
+
KEY_MINUS: 173,
|
|
36
42
|
KEY_APOSTROPHE: 192,
|
|
37
43
|
MB_LEFT: 0,
|
|
38
44
|
MB_RIGHT: 2,
|
|
39
45
|
MB_MIDDLE: 1
|
|
40
|
-
};
|
|
46
|
+
};
|
package/src/og/layer/KML.js
CHANGED
|
@@ -42,17 +42,179 @@ export class KML extends Vector {
|
|
|
42
42
|
_extractCoordonatesFromKml(xmlDoc) {
|
|
43
43
|
const raw = Array.from(xmlDoc.getElementsByTagName("coordinates"));
|
|
44
44
|
const rawText = raw.map(item => item.textContent.trim());
|
|
45
|
-
const coordinates = rawText.map(item =>
|
|
45
|
+
const coordinates = rawText.map(item =>
|
|
46
46
|
item
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
.replace(/\n/g, " ")
|
|
48
|
+
.replace(/\t/g, " ")
|
|
49
|
+
.replace(/ +/g, " ")
|
|
50
|
+
.split(" ")
|
|
51
|
+
.map((co) => co.split(",").map(parseFloat))
|
|
52
52
|
);
|
|
53
53
|
return coordinates;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
_AGBRtoRGBA(agbr) {
|
|
60
|
+
if (!agbr || agbr.length != 8) return
|
|
61
|
+
|
|
62
|
+
const a = parseInt(agbr.slice(0, 2), 16) / 255;
|
|
63
|
+
const b = parseInt(agbr.slice(2, 4), 16);
|
|
64
|
+
const g = parseInt(agbr.slice(4, 6), 16);
|
|
65
|
+
const r = parseInt(agbr.slice(6, 8), 16);
|
|
66
|
+
|
|
67
|
+
return `rgba(${r},${g},${b},${a})`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @private
|
|
72
|
+
returns array of longitude, latitude, altitude (altitude optional)
|
|
73
|
+
*/
|
|
74
|
+
_parseKMLcoordinates(coords) {
|
|
75
|
+
const coordinates = coords.innerHTML.trim()
|
|
76
|
+
.replace(/\n/g, ' ')
|
|
77
|
+
.replace(/\t/g, ' ')
|
|
78
|
+
.replace(/ +/g, ' ')
|
|
79
|
+
.split(" ")
|
|
80
|
+
.map((co) => co.split(",").map(parseFloat))
|
|
81
|
+
|
|
82
|
+
return coordinates;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
_kmlPlacemarkToEntity(placemark, extent) {
|
|
89
|
+
if (!placemark) return;
|
|
90
|
+
|
|
91
|
+
const nameTags = Array.from(placemark.getElementsByTagName("name"))
|
|
92
|
+
const name = nameTags && nameTags[0]?.innerHTML?.trim() || '';
|
|
93
|
+
|
|
94
|
+
const { iconHeading, iconURL, iconColor, lineWidth, lineColor } = this._extractStyle(placemark);
|
|
95
|
+
|
|
96
|
+
// TODO handle MultiGeometry
|
|
97
|
+
|
|
98
|
+
const lonLats = [];
|
|
99
|
+
for (const coord of placemark.getElementsByTagName("coordinates")) {
|
|
100
|
+
const coordinates = this._parseKMLcoordinates(coord) || [[0, 0, 0]]
|
|
101
|
+
|
|
102
|
+
for (const lonlatalt of coordinates) {
|
|
103
|
+
const [lon, lat, alt] = lonlatalt
|
|
104
|
+
|
|
105
|
+
lonLats.push(new LonLat(lon, lat, alt));
|
|
106
|
+
|
|
107
|
+
if (lon < extent.southWest.lon) extent.southWest.lon = lon;
|
|
108
|
+
if (lat < extent.southWest.lat) extent.southWest.lat = lat;
|
|
109
|
+
if (lon > extent.northEast.lon) extent.northEast.lon = lon;
|
|
110
|
+
if (lat > extent.northEast.lat) extent.northEast.lat = lat;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (lonLats.length === 1) {
|
|
115
|
+
const hdgrad = iconHeading * 0.01745329; // radians
|
|
116
|
+
|
|
117
|
+
return new Entity({
|
|
118
|
+
name,
|
|
119
|
+
lonlat: lonLats[0],
|
|
120
|
+
billboard: {
|
|
121
|
+
src: iconURL,
|
|
122
|
+
size: [24, 24],
|
|
123
|
+
color: iconColor,
|
|
124
|
+
rotation: hdgrad
|
|
125
|
+
},
|
|
126
|
+
properties: {
|
|
127
|
+
color: iconColor,
|
|
128
|
+
heading: iconHeading
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
} else {
|
|
133
|
+
return new Entity({
|
|
134
|
+
polyline: {
|
|
135
|
+
pathLonLat: [lonLats],
|
|
136
|
+
thickness: lineWidth,
|
|
137
|
+
color: lineColor,
|
|
138
|
+
isClosed: false
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
_extractStyle(placemark) {
|
|
145
|
+
let iconColor;
|
|
146
|
+
let iconHeading;
|
|
147
|
+
let iconURL;
|
|
148
|
+
let lineColor;
|
|
149
|
+
let lineWidth;
|
|
150
|
+
|
|
151
|
+
const style = placemark.getElementsByTagName("Style")[0];
|
|
152
|
+
if (style) {
|
|
153
|
+
let iconstyle = style.getElementsByTagName("IconStyle")[0];
|
|
154
|
+
if (iconstyle) {
|
|
155
|
+
let color = iconstyle.getElementsByTagName("color")[0];
|
|
156
|
+
if (color)
|
|
157
|
+
iconColor = this._AGBRtoRGBA(color.innerHTML.trim());
|
|
158
|
+
|
|
159
|
+
let heading = iconstyle.getElementsByTagName("heading")[0];
|
|
160
|
+
if (heading) {
|
|
161
|
+
const hdg = parseFloat(heading.innerHTML.trim());
|
|
162
|
+
if (hdg >= 0 && hdg <= 360)
|
|
163
|
+
iconHeading = hdg % 360;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
let icon = iconstyle.getElementsByTagName("Icon")[0];
|
|
167
|
+
if (icon) {
|
|
168
|
+
let href = icon.getElementsByTagName("href")[0];
|
|
169
|
+
if (href) {
|
|
170
|
+
iconURL = href.innerHTML.trim();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
let linestyle = style.getElementsByTagName("LineStyle")[0];
|
|
176
|
+
if (linestyle) {
|
|
177
|
+
let color = linestyle.getElementsByTagName("color")[0];
|
|
178
|
+
if (color)
|
|
179
|
+
lineColor = this._AGBRtoRGBA(color.innerHTML.trim());
|
|
180
|
+
let width = linestyle.getElementsByTagName("width")[0];
|
|
181
|
+
if (width !== undefined)
|
|
182
|
+
lineWidth = parseFloat(width.innerHTML.trim());
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!iconColor) iconColor = "#FFFFFF"
|
|
187
|
+
if (!iconHeading) iconHeading = 0
|
|
188
|
+
if (!iconURL) iconURL = "https://openglobus.org/examples/billboards/carrot.png"
|
|
189
|
+
|
|
190
|
+
if (!lineColor) lineColor = "#FFFFFF"
|
|
191
|
+
if (!lineWidth) lineWidth = 1
|
|
192
|
+
|
|
193
|
+
return { iconHeading, iconURL, iconColor, lineWidth, lineColor };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
_parseKML(xml, extent, entities = undefined) {
|
|
197
|
+
if (!entities)
|
|
198
|
+
entities = [];
|
|
199
|
+
|
|
200
|
+
if (xml.documentElement.nodeName !== "kml")
|
|
201
|
+
return entities;
|
|
202
|
+
|
|
203
|
+
for (const placemark of xml.getElementsByTagName("Placemark")) {
|
|
204
|
+
const entity = this._kmlPlacemarkToEntity(placemark, extent);
|
|
205
|
+
if (entity) entities.push(entity);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return entities;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
_convertKMLintoEntities(xml) {
|
|
212
|
+
const extent = new Extent(new LonLat(180.0, 90.0), new LonLat(-180.0, -90.0));
|
|
213
|
+
const entities = this._parseKML(xml, extent);
|
|
214
|
+
|
|
215
|
+
return { entities, extent }
|
|
216
|
+
}
|
|
217
|
+
|
|
56
218
|
/**
|
|
57
219
|
* Creates billboards or polylines from array of lonlat.
|
|
58
220
|
* @public
|
|
@@ -129,6 +291,7 @@ export class KML extends Vector {
|
|
|
129
291
|
* @returns {Promise<{entities: Entity[], extent: Extent}>}
|
|
130
292
|
*/
|
|
131
293
|
async addKmlFromFiles(kmls, color = null, billboard = null) {
|
|
294
|
+
if (!Array.isArray(kmls)) return null
|
|
132
295
|
const kmlObjs = await Promise.all(kmls.map(this._getXmlContent));
|
|
133
296
|
const coordonates = kmlObjs.map(this._extractCoordonatesFromKml);
|
|
134
297
|
const { entities, extent } = this._convertCoordonatesIntoEntities(
|
|
@@ -179,14 +342,20 @@ export class KML extends Vector {
|
|
|
179
342
|
*/
|
|
180
343
|
async addKmlFromUrl(url, color = null, billboard = null) {
|
|
181
344
|
const kml = await this._getKmlFromUrl(url);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
345
|
+
/*
|
|
346
|
+
const coordonates = this._extractCoordonatesFromKml(kml);
|
|
347
|
+
const { entities, extent } = this._convertCoordonatesIntoEntities(
|
|
348
|
+
[coordonates],
|
|
349
|
+
color || this._color,
|
|
350
|
+
billboard || this._billboard
|
|
351
|
+
);
|
|
352
|
+
*/
|
|
353
|
+
const { entities, extent } = this._convertKMLintoEntities(kml);
|
|
354
|
+
|
|
188
355
|
this._extent = this._expandExtents(this._extent, extent);
|
|
356
|
+
|
|
189
357
|
entities.forEach(this.add.bind(this));
|
|
358
|
+
|
|
190
359
|
return { entities, extent };
|
|
191
360
|
}
|
|
192
361
|
}
|
package/src/og/layer/Layer.js
CHANGED
|
@@ -413,8 +413,10 @@ class Layer {
|
|
|
413
413
|
* @param {string} html - HTML code that represents layer attribution, it could be just a text.
|
|
414
414
|
*/
|
|
415
415
|
setAttribution(html) {
|
|
416
|
-
this._attribution
|
|
417
|
-
|
|
416
|
+
if (this._attribution !== html) {
|
|
417
|
+
this._attribution = html;
|
|
418
|
+
this._planet && this._planet.updateAttributionsList();
|
|
419
|
+
}
|
|
418
420
|
}
|
|
419
421
|
|
|
420
422
|
/**
|