@pirireis/webglobeplugins 0.6.27-a → 0.6.28-a
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 +2 -7
- package/circle-line-chain/plugin.js +2 -4
- package/package.json +1 -1
- package/programs/line-on-globe/circle-accurate-flat.js +19 -2
- package/programs/line-on-globe/lines-color-instanced-flat.js +1 -1
- package/rangerings/index.js +1 -1
- package/{rangerings-2 → rangerings}/plugin.js +27 -24
- package/rangerings/rangeringangletext.js +31 -45
- package/{rangerings-2 → rangerings}/ring-account.js +7 -7
- package/timetracks/program.js +1 -1
- package/write-text/context-text.js +1 -1
- package/bearing-line/plugin-flat-old.js +0 -500
- package/bearing-line/pluginOLD.js +0 -430
- package/circle-line-chain/plugin_newer_old.js +0 -406
- package/circle-line-chain/plugin_old.js +0 -398
- package/rangerings/rangerings copy.js +0 -219
- package/rangerings/rangerings.js +0 -222
- package/rangerings-2/enum.js +0 -7
- package/rangerings-2/index.js +0 -4
- package/rangerings-2/rangeringangletext.js +0 -486
package/rangerings/rangerings.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { rings } from "../programs";
|
|
2
|
-
import { COMPASS_MODES } from "./enum";
|
|
3
|
-
import { PaddingFreeAngleCache } from "../programs/rings/distancering";
|
|
4
|
-
|
|
5
|
-
import RangeRingAngleText from "./rangeringangletext";
|
|
6
|
-
const { circleProgramCache, PaddingProgramCache, CirclePaddySharedBuffer } = rings;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef RangeRingData
|
|
10
|
-
* @property {number} centerX
|
|
11
|
-
* @property {number} centerY
|
|
12
|
-
* @property {Array<Ring>} rings
|
|
13
|
-
*
|
|
14
|
-
* @typedef Ring
|
|
15
|
-
* @property {number} radius
|
|
16
|
-
* @property {number} padding
|
|
17
|
-
* @property {[number, number, number]} color
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export default class {
|
|
23
|
-
|
|
24
|
-
constructor(id, { oneDegreePadding = true, compass = COMPASS_MODES.REAL, showNumbers = true, numbersStyle = null, opacity = 1 } = {}) {
|
|
25
|
-
this.id = id;
|
|
26
|
-
this.compass = compass;
|
|
27
|
-
this._showNumbers = showNumbers;
|
|
28
|
-
this._numbersStyle = numbersStyle;
|
|
29
|
-
this._opacity = opacity;
|
|
30
|
-
this.circleEdgeCount = 360;
|
|
31
|
-
this._onedegreepaddingOn = oneDegreePadding;
|
|
32
|
-
this.bufferManager = null;
|
|
33
|
-
|
|
34
|
-
this._deleteCounter = 0;
|
|
35
|
-
this._deleteThreshold = 10;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
setOneDegreePaddingOn(oneDegreePadding) {
|
|
40
|
-
this._onedegreepaddingOn = oneDegreePadding;
|
|
41
|
-
this.globe.DrawRender();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
init(globe, gl) {
|
|
45
|
-
this.gl = gl;
|
|
46
|
-
this.globe = globe;
|
|
47
|
-
this.circleFlatProgram = circleProgramCache.getProgram(globe);
|
|
48
|
-
this.paddyFlatProgram = PaddingProgramCache.getProgram(globe);
|
|
49
|
-
this.paddingFreeAngleProgram = PaddingFreeAngleCache.getProgram(globe);
|
|
50
|
-
if (this._showNumbers) {
|
|
51
|
-
this.textPlugin = new RangeRingAngleText(globe, this.id + "text", { flatCompassMode: this.compass, style: this._numbersStyle, opacity: this._opacity });
|
|
52
|
-
delete this._numbersStyle;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// TODO: Add text free
|
|
57
|
-
free() {
|
|
58
|
-
|
|
59
|
-
this.circleProgramCache?.releaseProgram(this.globe);
|
|
60
|
-
this.PaddingProgramCache?.releaseProgram(this.globe);
|
|
61
|
-
this.PaddingFreeAngleCache?.releaseProgram(this.globe);
|
|
62
|
-
this.gl.deleteVertexArray(this.bufferManager?.vao);
|
|
63
|
-
this.gl.deleteVertexArray(this.paddingBufferManager?.vao);
|
|
64
|
-
this.paddingBufferManager?.free();
|
|
65
|
-
this.bufferManager?.free();
|
|
66
|
-
this.textPlugin?.free();
|
|
67
|
-
this.circleFlatProgram = null;
|
|
68
|
-
this.paddyFlatProgram = null;
|
|
69
|
-
this.bufferManager = null;
|
|
70
|
-
this.paddingBufferManager = null;
|
|
71
|
-
this.textPlugin = null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
setGeometry() {
|
|
78
|
-
this.textPlugin?.setGeometry();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
draw3D() {
|
|
83
|
-
const { circleFlatProgram, paddyFlatProgram, paddingFreeAngleProgram, bufferManager, compass, gl, circleEdgeCount, paddingBufferManager, _opacity } = this;
|
|
84
|
-
if (this.bufferManager !== null && bufferManager.length > 0) {
|
|
85
|
-
gl.disable(gl.DEPTH_TEST);
|
|
86
|
-
circleFlatProgram.draw(bufferManager, compass, circleEdgeCount, _opacity);
|
|
87
|
-
if (this._onedegreepaddingOn) paddyFlatProgram.draw(bufferManager, 360, compass, _opacity);
|
|
88
|
-
paddingFreeAngleProgram.draw(paddingBufferManager, compass, _opacity);
|
|
89
|
-
gl.enable(gl.DEPTH_TEST);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
setOpacity(opacity) {
|
|
97
|
-
this._opacity = opacity;
|
|
98
|
-
this.textPlugin?.setOpacity(opacity); // TODO impolement this
|
|
99
|
-
this.globe.DrawRender();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* @param {RangeRingData} rangeRingData
|
|
105
|
-
* 0 compass limps
|
|
106
|
-
* other real distance limp
|
|
107
|
-
*/
|
|
108
|
-
setCampass(compass) {
|
|
109
|
-
this.compass = compass;
|
|
110
|
-
this.textPlugin?.setCompass(compass);
|
|
111
|
-
this.globe.DrawRender();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
initilizeBufferManager(initialRingCapacity, bufferDrawType) {
|
|
115
|
-
const { gl, globe } = this
|
|
116
|
-
this.bufferDrawType = bufferDrawType;
|
|
117
|
-
this.bufferManager = new CirclePaddySharedBuffer(gl, globe, { bufferType: bufferDrawType, initialRingCapacity: initialRingCapacity });
|
|
118
|
-
this.paddingBufferManager = this.paddingFreeAngleProgram.createBuffer({ bufferType: bufferDrawType, initialRingCapacity });
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @typedef {Array<{ringID, radius, paddingRange}>} rings
|
|
124
|
-
* @param {Array<centerID:string, x:number, y:number, stepAngle:number, rgba:[4 numbers], rings:rings} items
|
|
125
|
-
*/
|
|
126
|
-
insertBulk(items) {
|
|
127
|
-
const insertData = ringItemsToCircleBufferInsertDataAdaptor(items);
|
|
128
|
-
|
|
129
|
-
this.bufferManager.insertBulk(insertData);
|
|
130
|
-
for (const item of items) {
|
|
131
|
-
item.paddingAngles = angleToPaddingAngles(item.stepAngle, 0);
|
|
132
|
-
}
|
|
133
|
-
this.paddingBufferManager.insertBulk(items);
|
|
134
|
-
this.textPlugin?.insertBulk(items);
|
|
135
|
-
this.globe.DrawRender();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
* @param {Array<{centerID, x, y}>} items
|
|
142
|
-
*/
|
|
143
|
-
updateCentersXY(items) {
|
|
144
|
-
this.bufferManager.updateCentersXY(items);
|
|
145
|
-
this.paddingBufferManager.updateCentersXY(items);
|
|
146
|
-
this.textPlugin?.updateCentersXY(items);
|
|
147
|
-
this.globe.DrawRender();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @param {Array<{centerID, rgba:[4 numbers]}>} centerColors
|
|
153
|
-
*/
|
|
154
|
-
updateCentersColor(centerColors) {
|
|
155
|
-
this.bufferManager.updateCentersColor(centerColors);
|
|
156
|
-
this.paddingBufferManager.updateCentersColor(centerColors);
|
|
157
|
-
this.globe.DrawRender();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* @param {Array<{centerID}>} centerIds
|
|
163
|
-
*/
|
|
164
|
-
removeCenters(centerIds) {
|
|
165
|
-
this.bufferManager.removeCenters(centerIds);
|
|
166
|
-
this.paddingBufferManager.removeCenters(centerIds);
|
|
167
|
-
this.textPlugin?.removeCenters(centerIds);
|
|
168
|
-
this._deleteCounter += centerIds.length;
|
|
169
|
-
if (this._deleteCounter > this._deleteThreshold) {
|
|
170
|
-
// this is naive since we are not checking the actual deletion
|
|
171
|
-
// but it works
|
|
172
|
-
this._deleteCounter = 0;
|
|
173
|
-
this.bufferManager.defrag();
|
|
174
|
-
this.paddingBufferManager.defrag();
|
|
175
|
-
}
|
|
176
|
-
this.globe.DrawRender();
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
*
|
|
182
|
-
* @param {Array<{centerID, hide, textHide}>} centerHides
|
|
183
|
-
*/
|
|
184
|
-
updateCentersHide(centerHides) {
|
|
185
|
-
this.bufferManager.updateCentersHide(centerHides);
|
|
186
|
-
this.paddingBufferManager.updateCentersHide(centerHides);
|
|
187
|
-
this.textPlugin?.updateCentersHide(centerHides);
|
|
188
|
-
this.globe.DrawRender();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const ringItemsToCircleBufferInsertDataAdaptor = (ringItems) => {
|
|
196
|
-
|
|
197
|
-
const result = [];
|
|
198
|
-
for (const { centerID, x, y, rgba, rings, hide = 0, textHide = 0 } of ringItems) {
|
|
199
|
-
const resultRings = [];
|
|
200
|
-
for (const { ringID, radius, padding } of rings) {
|
|
201
|
-
resultRings.push({
|
|
202
|
-
ringID,
|
|
203
|
-
radius,
|
|
204
|
-
padding: padding / 5,
|
|
205
|
-
rgba,
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
result.push({
|
|
210
|
-
centerID,
|
|
211
|
-
x,
|
|
212
|
-
y,
|
|
213
|
-
rings: resultRings,
|
|
214
|
-
hide,
|
|
215
|
-
textHide
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
return result;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const angleToPaddingAngles = (gapDegree, offsetDegree = 0) => Array.from({ length: Math.ceil(360 / gapDegree) }, (_, i) => (i * gapDegree + offsetDegree) * Math.PI / 180);
|
|
222
|
-
|
package/rangerings-2/enum.js
DELETED
package/rangerings-2/index.js
DELETED