@pirireis/webglobeplugins 0.3.1 → 0.3.2
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/bearing-line/plugin.js +41 -10
- package/package.json +1 -1
- package/partialrings/program.js +3 -1
- package/programs/line-on-globe/circle.js +0 -1
- package/programs/line-on-globe/naive.js +0 -1
- package/programs/totems/canvas-webglobe-info.js +136 -0
- package/programs/totems/gpu-selection-uniform-block.js +132 -0
- package/programs/two-d/pixel-circle.js +0 -0
- package/programs/two-d/pixel-padding.js +0 -0
- package/write-text/context-text.js +10 -1
package/bearing-line/plugin.js
CHANGED
|
@@ -22,11 +22,15 @@ export const RINGPARTIAL_DRAW_MODE = Object.freeze({
|
|
|
22
22
|
export default class Plugin {
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
constructor(id, { opacity = 1, textContextInjectionMap = new Map() } = {}) {
|
|
25
|
+
constructor(id, { opacity = 1, textContextInjectionMap = new Map(), drawVRM = true, drawBearingLine = true, drawAngleRing = true, drawText = true } = {}) {
|
|
26
26
|
this.id = id;
|
|
27
27
|
this._opacity = opacity;
|
|
28
28
|
this.bufferOrchestrator = new BufferOrchestrator({ capacity: 10 });
|
|
29
29
|
this._textContextInjectionMap = textContextInjectionMap;
|
|
30
|
+
this.drawVRM = drawVRM;
|
|
31
|
+
this.drawBearingLine = drawBearingLine;
|
|
32
|
+
this.drawAngleRing = drawAngleRing;
|
|
33
|
+
this.drawText = drawText;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
|
|
@@ -38,14 +42,18 @@ export default class Plugin {
|
|
|
38
42
|
this._insertTexts(item);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
|
|
44
48
|
setOpacity(opacity) {
|
|
45
49
|
this._opacity = opacity;
|
|
50
|
+
this._textContextInjectionMap.forEach(({ writer }) => writer.setOpacity(opacity));
|
|
46
51
|
this.globe.DrawRender();
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
49
57
|
init(globe, gl) {
|
|
50
58
|
this.gl = gl;
|
|
51
59
|
this.globe = globe;
|
|
@@ -142,18 +150,41 @@ export default class Plugin {
|
|
|
142
150
|
const { gl } = this;
|
|
143
151
|
this.lineProgram.draw(this.lineVao, this.bufferOrchestrator.length, this._opacity);
|
|
144
152
|
gl.disable(gl.DEPTH_TEST);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.
|
|
153
|
+
if (this.drawAngleRing) {
|
|
154
|
+
this.ringProgram.draw(this.bufferOrchestrator.length, this.ringVao, 360, this._opacity * 0.8, RINGPARTIAL_DRAW_MODE.TRIANGLE_FAN);
|
|
155
|
+
this.ringProgram.draw(this.bufferOrchestrator.length, this.ringVao, 360, this._opacity, RINGPARTIAL_DRAW_MODE.LINE_STRIP);
|
|
156
|
+
}
|
|
157
|
+
if (this.drawBearingLine) {
|
|
158
|
+
this.angledLineProgram.draw(this.angledLineVao, this.bufferOrchestrator.length, this._opacity * 0.8);
|
|
159
|
+
}
|
|
160
|
+
if (this.drawVRM) {
|
|
161
|
+
this.circleProgram.draw(this.circleVao, this.bufferOrchestrator.length, this._opacity);
|
|
162
|
+
}
|
|
163
|
+
if (this.drawText) {
|
|
164
|
+
this._textContextInjectionMap.forEach((e) => { e.writer.draw(); });
|
|
165
|
+
}
|
|
150
166
|
gl.enable(gl.DEPTH_TEST);
|
|
151
167
|
}
|
|
152
168
|
|
|
153
169
|
|
|
154
170
|
/**
|
|
171
|
+
* @typedef {{key, long, lat, endLong, endLat, bearingAngle, radius, rgba:[4numbers], rgbaMode, bigRadius, dashRatio, dashOpacity, circleDashAngle}} item
|
|
172
|
+
* @property {string} key
|
|
173
|
+
* @property {number} long
|
|
174
|
+
* @property {number} lat
|
|
175
|
+
* @property {number} endLong
|
|
176
|
+
* @property {number} endLat
|
|
177
|
+
* @property {number} bearingAngle 0-360
|
|
178
|
+
* @property {number} radius angle ring radius
|
|
179
|
+
* @property {Array<4numbers>} rgba [r,g,b,a]
|
|
180
|
+
* @property {number} rgbaMode 0 constant, 1 fading, 2 hides angle ring
|
|
181
|
+
* @property {number} bigRadius undefined means it will be calculated from long, lat, endLong, endLat
|
|
182
|
+
* @property {number} dashRatio 0-1
|
|
183
|
+
* @property {number} dashOpacity 0-1
|
|
184
|
+
* @property {number} circleDashAngle 0-360
|
|
155
185
|
*
|
|
156
|
-
* @param {Array<
|
|
186
|
+
* @param {Array<item>} items
|
|
187
|
+
* @param {Array<string>} injectionsSubSetIDs | textContextInjectionMap keys to be used for writing text.
|
|
157
188
|
*/
|
|
158
189
|
|
|
159
190
|
insertBulk(items, injectionsSubSetIDs = []) {
|
|
@@ -186,7 +217,8 @@ export default class Plugin {
|
|
|
186
217
|
|
|
187
218
|
/**
|
|
188
219
|
*
|
|
189
|
-
* @param {Array<{key, long, lat, endLong, endLat,
|
|
220
|
+
* @param {Array<{key, long, lat, endLong, endLat, bearingAngle}>} items
|
|
221
|
+
* @param {Array<string>} injectionSubSetIDs | textContextInjectionMap keys to be used for writing text.
|
|
190
222
|
*/
|
|
191
223
|
updateCoordinatesBulk(items, injectionSubSetIDs = []) { //TODO
|
|
192
224
|
const injectionsSubSet = injectionSubSetIDs.map((id) => this._textContextInjectionMap.get(id));
|
|
@@ -212,7 +244,6 @@ export default class Plugin {
|
|
|
212
244
|
const dashRatio = item.dashRatio !== undefined ? item.dashRatio : 1.0;
|
|
213
245
|
const dashOpacity = item.dashOpacity !== undefined ? item.dashOpacity : 0.9;
|
|
214
246
|
const circleDashRatio = item.circleDashAngle !== undefined ? (item.circleDashAngle / 360) : 1.0;
|
|
215
|
-
console.log("cicleDashRati", circleDashRatio);
|
|
216
247
|
const bigRadius = item.bigRadius !== undefined ? item.bigRadius : this.globe.Math.GetDist3D(item.long, item.lat, item.endLong, item.endLat);
|
|
217
248
|
const radius = item.radius !== undefined ? item.radius : bigRadius * 0.2;
|
|
218
249
|
const startAngle = calculateStartAngle(long, lat, endLong, endLat);
|
package/package.json
CHANGED
package/partialrings/program.js
CHANGED
|
@@ -83,7 +83,9 @@ void main() {
|
|
|
83
83
|
} else {
|
|
84
84
|
v_color = vec4( color.rgb , color.a * alpha );
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
if ( color_mode == 0.0 && draw_mode == 1 ) {
|
|
87
|
+
v_color.a /= 2.0;
|
|
88
|
+
}
|
|
87
89
|
float angle;
|
|
88
90
|
if ( tail_angle > 0.0 ) {
|
|
89
91
|
angle = tail_angle * (-phase + 1.0) + start_angle;
|
|
@@ -121,7 +121,6 @@ class Logic {
|
|
|
121
121
|
|
|
122
122
|
this.cameraBindingPoint = 0;
|
|
123
123
|
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
124
|
-
console.log("Logic constructor", this.cameraBlockTotem);
|
|
125
124
|
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
126
125
|
gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
|
|
127
126
|
}
|
|
@@ -226,7 +226,6 @@ class BufferManager extends BufferOffsetManger {
|
|
|
226
226
|
const { gl, buffer, globe } = this;
|
|
227
227
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
228
228
|
for (let { key, long, lat, endLong, endLat, rgba, dashRatio = 1 } of items) {
|
|
229
|
-
console.log(key, dashRatio, "dashRatio");
|
|
230
229
|
const payload = new Float32Array([
|
|
231
230
|
long,
|
|
232
231
|
lat,
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { globeProgramCache } from "../programcache";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const WebglobeInfoUniformBlockString = `
|
|
5
|
+
layout(std140) uniform WebglobeInfo {
|
|
6
|
+
vec2 canvas_resolution;
|
|
7
|
+
vec2 mouse_radian_long_lat;
|
|
8
|
+
vec2 mouse_pixel_xy;
|
|
9
|
+
float north_angle;
|
|
10
|
+
float world_tilt;
|
|
11
|
+
float earth_distance;
|
|
12
|
+
};
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export default class
|
|
18
|
+
|
|
19
|
+
CameraUniformBlockTotem {
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
constructor() {
|
|
23
|
+
this.id = "CameraUniformBlockTotem"
|
|
24
|
+
this.description = `Sets a uniform block and provides buffer for it. The following is the glsl uniform block:` + CameraUniformBlockString;
|
|
25
|
+
this.gl = null;
|
|
26
|
+
this.globe = null;
|
|
27
|
+
this.ubo = null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
init(globe, gl) {
|
|
32
|
+
this.gl = gl;
|
|
33
|
+
this.globe = globe;
|
|
34
|
+
this.ubo = this._createUBO();
|
|
35
|
+
this.traslateFloat32 = new Float32Array(3);
|
|
36
|
+
this.mapWHFloat32 = new Float32Array(2);
|
|
37
|
+
this.setGeometry();
|
|
38
|
+
this.resize();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
_createUBO() {
|
|
43
|
+
const { gl } = this;
|
|
44
|
+
const ubo = gl.createBuffer();
|
|
45
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
46
|
+
gl.bufferData(gl.UNIFORM_BUFFER, 164, gl.STREAM_DRAW);
|
|
47
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, ubo);
|
|
48
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
49
|
+
return ubo;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
resize() {
|
|
54
|
+
const { gl, globe, ubo } = this;
|
|
55
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
56
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 152, new Float32Array([globe.api_ScrW(), globe.api_ScrH()]));
|
|
57
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
setGeometry() {
|
|
62
|
+
const { gl, globe, ubo } = this;
|
|
63
|
+
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
64
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
65
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 140, new Float32Array([is3D]));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
draw3D(projection, modelView, translate) {
|
|
69
|
+
|
|
70
|
+
const { gl, traslateFloat32, ubo, mapWHFloat32, globe } = this;
|
|
71
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
72
|
+
{ // view, projection, translate
|
|
73
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, modelView);
|
|
74
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 64, projection);
|
|
75
|
+
traslateFloat32.set([translate.x, translate.y, translate.z], 0);
|
|
76
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 128, traslateFloat32);
|
|
77
|
+
}
|
|
78
|
+
{
|
|
79
|
+
// zoom level
|
|
80
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 160, new Float32Array([globe.api_GetCurrentLODWithDecimal()]));
|
|
81
|
+
}
|
|
82
|
+
{ // mapWH
|
|
83
|
+
if (globe.api_GetCurrentGeometry() === 1) {
|
|
84
|
+
const { width, height } = globe.api_GetCurrentWorldWH();
|
|
85
|
+
mapWHFloat32.set([width, height]);
|
|
86
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 144, mapWHFloat32);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
getUBO() {
|
|
94
|
+
return this.ubo;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
bind(bindingPoint) {
|
|
99
|
+
const { gl, ubo } = this;
|
|
100
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, ubo);
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
unbind(bindingPoint) {
|
|
105
|
+
const { gl } = this;
|
|
106
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, null);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
free() {
|
|
111
|
+
const { gl, ubo } = this;
|
|
112
|
+
gl.deleteBuffer(ubo);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
readBuffer() {
|
|
116
|
+
const result = new Float32Array(41);
|
|
117
|
+
this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, this.ubo);
|
|
118
|
+
this.gl.getBufferSubData(this.gl.UNIFORM_BUFFER, 0, result);
|
|
119
|
+
this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, null);
|
|
120
|
+
return {
|
|
121
|
+
view: result.slice(0, 16),
|
|
122
|
+
projection: result.slice(16, 32),
|
|
123
|
+
translate: result.slice(32, 35),
|
|
124
|
+
is3D: result[35],
|
|
125
|
+
mapWH: result.slice(36, 38),
|
|
126
|
+
screenWH: result.slice(38, 40),
|
|
127
|
+
z_level: result[40]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
export const CameraUniformBlockTotemCache = Object.freeze({
|
|
134
|
+
get: (globe) => { return globeProgramCache.getProgram(globe, CameraUniformBlockTotem) },
|
|
135
|
+
release: (globe) => { return globeProgramCache.releaseProgram(globe, CameraUniformBlockTotem) }
|
|
136
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { globeProgramCache } from "../programcache";
|
|
2
|
+
// Loads mouse position to buffer
|
|
3
|
+
// TODO implement it
|
|
4
|
+
export const CameraUniformBlockString = `
|
|
5
|
+
layout(std140) uniform GpuSelectionUniformBlock {
|
|
6
|
+
vec2 mouse_pixel_position;
|
|
7
|
+
vec2 mouse_radian_long_lat;
|
|
8
|
+
}; // 11 lines
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export default class
|
|
14
|
+
|
|
15
|
+
CameraUniformBlockTotem {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
19
|
+
this.id = "CameraUniformBlockTotem"
|
|
20
|
+
this.description = `Sets a uniform block and provides buffer for it. The following is the glsl uniform block:` + CameraUniformBlockString;
|
|
21
|
+
this.gl = null;
|
|
22
|
+
this.globe = null;
|
|
23
|
+
this.ubo = null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
init(globe, gl) {
|
|
28
|
+
this.gl = gl;
|
|
29
|
+
this.globe = globe;
|
|
30
|
+
this.ubo = this._createUBO();
|
|
31
|
+
this.traslateFloat32 = new Float32Array(3);
|
|
32
|
+
this.mapWHFloat32 = new Float32Array(2);
|
|
33
|
+
this.setGeometry();
|
|
34
|
+
this.resize();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
_createUBO() {
|
|
39
|
+
const { gl } = this;
|
|
40
|
+
const ubo = gl.createBuffer();
|
|
41
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
42
|
+
gl.bufferData(gl.UNIFORM_BUFFER, 164, gl.STREAM_DRAW);
|
|
43
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, ubo);
|
|
44
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
45
|
+
return ubo;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
resize() {
|
|
50
|
+
const { gl, globe, ubo } = this;
|
|
51
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
52
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 152, new Float32Array([globe.api_ScrW(), globe.api_ScrH()]));
|
|
53
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
setGeometry() {
|
|
58
|
+
const { gl, globe, ubo } = this;
|
|
59
|
+
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
60
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
61
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 140, new Float32Array([is3D]));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
draw3D(projection, modelView, translate) {
|
|
65
|
+
|
|
66
|
+
const { gl, traslateFloat32, ubo, mapWHFloat32, globe } = this;
|
|
67
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
68
|
+
{ // view, projection, translate
|
|
69
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, modelView);
|
|
70
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 64, projection);
|
|
71
|
+
traslateFloat32.set([translate.x, translate.y, translate.z], 0);
|
|
72
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 128, traslateFloat32);
|
|
73
|
+
}
|
|
74
|
+
{
|
|
75
|
+
// zoom level
|
|
76
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 160, new Float32Array([globe.api_GetCurrentLODWithDecimal()]));
|
|
77
|
+
}
|
|
78
|
+
{ // mapWH
|
|
79
|
+
if (globe.api_GetCurrentGeometry() === 1) {
|
|
80
|
+
const { width, height } = globe.api_GetCurrentWorldWH();
|
|
81
|
+
mapWHFloat32.set([width, height]);
|
|
82
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 144, mapWHFloat32);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
getUBO() {
|
|
90
|
+
return this.ubo;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
bind(bindingPoint) {
|
|
95
|
+
const { gl, ubo } = this;
|
|
96
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, ubo);
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
unbind(bindingPoint) {
|
|
101
|
+
const { gl } = this;
|
|
102
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, null);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
free() {
|
|
107
|
+
const { gl, ubo } = this;
|
|
108
|
+
gl.deleteBuffer(ubo);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
readBuffer() {
|
|
112
|
+
const result = new Float32Array(41);
|
|
113
|
+
this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, this.ubo);
|
|
114
|
+
this.gl.getBufferSubData(this.gl.UNIFORM_BUFFER, 0, result);
|
|
115
|
+
this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, null);
|
|
116
|
+
return {
|
|
117
|
+
view: result.slice(0, 16),
|
|
118
|
+
projection: result.slice(16, 32),
|
|
119
|
+
translate: result.slice(32, 35),
|
|
120
|
+
is3D: result[35],
|
|
121
|
+
mapWH: result.slice(36, 38),
|
|
122
|
+
screenWH: result.slice(38, 40),
|
|
123
|
+
z_level: result[40]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
export const CameraUniformBlockTotemCache = Object.freeze({
|
|
130
|
+
get: (globe) => { return globeProgramCache.getProgram(globe, CameraUniformBlockTotem) },
|
|
131
|
+
release: (globe) => { return globeProgramCache.releaseProgram(globe, CameraUniformBlockTotem) }
|
|
132
|
+
});
|
|
File without changes
|
|
File without changes
|
|
@@ -15,18 +15,27 @@ const defaultStyle = {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export class ContextTextWriter {
|
|
18
|
-
constructor(globe, { style = null } = {}) {
|
|
18
|
+
constructor(globe, { style = null, doDraw = true } = {}) {
|
|
19
19
|
this.globe = globe;
|
|
20
20
|
this.itemMap = new Map();
|
|
21
21
|
this.style = style || defaultStyle;
|
|
22
|
+
this.doDraw = doDraw;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
setStyle(style) {
|
|
25
26
|
this.style = style;
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
setOpacity(opacity) {
|
|
30
|
+
this.style.opacity = opacity;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
doDraw(boolean) {
|
|
34
|
+
this.doDraw = boolean;
|
|
35
|
+
}
|
|
28
36
|
|
|
29
37
|
draw() {
|
|
38
|
+
if (!this.doDraw) return;
|
|
30
39
|
const { globe, style, itemMap } = this;
|
|
31
40
|
const { textFont, opacity } = style;
|
|
32
41
|
for (const [key, { lat, long, text }] of itemMap) {
|