@pirireis/webglobeplugins 0.6.18 → 0.6.20

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.
@@ -1,336 +0,0 @@
1
-
2
- ## insertBulk
3
- ```json
4
- [
5
- {
6
- "chainID": "Mağrib",
7
- "points": [
8
- {
9
- "id": "Fas",
10
- "long": 0,
11
- "lat": 0,
12
- },
13
- {
14
- "id":"Cezayir",
15
- "long": 10,
16
- "lat": 20,
17
- },
18
- {
19
- "id":"Tunus",
20
- "long": 10,
21
- "lat": 15
22
- }
23
- ],
24
- "rgba": [1,0,0,1],
25
- "dashRatio": 0.1,
26
- "dashOpacity": 0.5,
27
- "circleDashAngle": 15,
28
- },
29
- ]
30
- ```
31
-
32
- ```js
33
- // ["distance"]
34
- updateCoordinatesBulk( items, contextTextWriterIDs=[]) {
35
- for ( const item of items){
36
- this._updateCoordsChain(item.chainID, item.points);
37
- }
38
- }
39
-
40
- _updateCoordsChain(chainID, nodes){
41
- const chain = this._chainMap(chainID); // chain is a `list`
42
- const updateIDs = [];
43
- for ( let i = 0; i< chain.length; i++){
44
- if ( )
45
- }
46
- }
47
- ```
48
-
49
-
50
- ```js
51
- // text
52
- const textContextMap = new Map(
53
- [
54
- [
55
- "distance",
56
- {
57
- writer: new ContextTextWriter(globe,),
58
- coordsAdaptor: (item, index, array) => { //
59
- const { long, lat } = globe.Math.GetMidPoint(item.long, item.lat, item.endLong, item.endLat);
60
- return {
61
- long,
62
- lat,
63
- }
64
- },
65
- textAdaptor: (item) => {
66
- const distance = globe.Math.GetDist2D(item.long, item.lat, item.endLong, item.endLat);
67
- return distance.toFixed(2) + "m";
68
- },
69
-
70
- }
71
- ]
72
- ]
73
- )
74
-
75
- // ["distance"]
76
- updateCoordinatesBulk(items, textWriterInjectionSubSetIDs = []) {
77
-
78
- }
79
-
80
- _updateChainCoords(chainID, points){
81
- this._updateCoordsBuffer();
82
- }
83
-
84
- ```
85
-
86
-
87
- ---
88
-
89
- ```js
90
- const connectNaive = (p1, p2) => {p1.set("to",p2);p2.set("from":p1)};
91
- const Tanca = new Map([["long", 0],[ "lat",0], ["from", null], ["to":null]]);
92
- const Cebelitarik = new Map([["long", 0],[ "lat",0], ["from", null], ["to":null]]);
93
- const Cezayir = new Map([["long", 0],[ "lat",0], ["from", null], ["to":null]]);
94
- const Tunus = new Map([["long", 0],[ "lat",0], ["from", null], ["to":null]]);
95
- const Tanca = {id, long,lat, toID}
96
-
97
- plugin.insertBulk([
98
- {
99
- chainID: "Mağrib",
100
- points: [
101
- {Tanca, to: Cebelitarik}
102
- {Cebelitarik, to:"Cezayir"},
103
- {Cezayir, to: "Tunus"}, // implicitly connects to Tunus
104
- {Tunus, to:null}
105
- ]),
106
- rgba: [1.0, 0.0, 0.0, 1.0],
107
- dashRatio: 0.1,
108
- dashOpacity: 0.5,
109
- circleDashAngle: 15,
110
- }
111
- ]);
112
- ```
113
- Advantage: User knows patterns of position data.
114
- Disadventage: Not json.
115
- Bug: How to insert into middle?
116
-
117
-
118
- coordinateAdaptor => (v, i, array) => {
119
- return {
120
- (v.long + array[i+1].long) / 2.0,
121
- }
122
- }
123
-
124
- ```js
125
- const connect = (chainMap, chainID, node) => {
126
- const chain = chainMap.get(chainID);
127
-
128
- }
129
-
130
- ```
131
- ---
132
-
133
- ## updateCoordinatesBulk
134
-
135
- updates pointMap;
136
- then updates buffers from updated version of pointMap;
137
-
138
- imparatively open next or prev
139
-
140
- ```json
141
- [
142
- {
143
- "chainID": "Mağrib",
144
- "points": [
145
- {
146
- ""Fas"": {
147
- " "l"ong": 100,
148
- "lat": 30
149
- }
150
- }
151
- ]
152
- }
153
- ]
154
- ```
155
-
156
-
157
- ## deleteBulk
158
-
159
- ```json
160
- [
161
- {
162
- "chainID": "Mağrib",
163
- "all": false,
164
- "points": [
165
- "Fas"
166
- ]
167
- }
168
- ]
169
- ```
170
-
171
-
172
- ## ContextTextWriter
173
-
174
- ```js
175
- {
176
-
177
- writer: new ContextTextWriter(globe),
178
- coordsAdaptor: (item) =>
179
- if (item.get("next") === null) return false;
180
- const goe = {
181
- long: point.get("long"),
182
- lat: point.get("lat"),
183
- endLong: point.get("next")?.get("long"),
184
- endLat: point.get("next")?.get("lat")
185
- }
186
- return globe.getMidPoint(geo.long,geo.lat, geo.endLong, geo.endLat)
187
- }
188
- },
189
- textAdaptor: (item) => {
190
- const angle = item.long, item.lat, item.endLong, item.endLat
191
- );
192
- if (angle < 0) {
193
- return (angle + 360).toFixed(2) + "°";
194
- }
195
- return angle.toFixed(2) + "°";
196
- },
197
- }
198
- ```
199
-
200
- ---
201
-
202
- ```js
203
- class Chain{
204
- constractor(id, {rgba = [1,0,0,1], dashOpacity = 1, dashRatio = 0.1, circleDashAngle = 30 } = []){
205
- this.id = 0;
206
- this.idMap = new Map();
207
- this.list = [];
208
- this._rgba = rgba;
209
- this._dashOpacity = dashOpacity;
210
- this._dashRatio = dashRatio;
211
- this._circleDashAngle = this.circleDashAngle;
212
- }
213
-
214
- add(item, fromID = null){
215
- this.idMap.set(item.id, item);
216
- let drawIndex;
217
- if (from === null) {
218
- this.list.push(item);
219
- drawIndex = this.list.length - 1;
220
- }
221
-
222
- for ( let i = 0 ; i < this.list.length ; i++){
223
- if ( fromID === this.list[i].id) {
224
- drawIndex = i;
225
- this.list.splice(i, 0, item);
226
- }
227
- }
228
-
229
- this._update( [i, i-1]);
230
- }
231
-
232
- nextID(id){
233
- // for loop if data source is a list. not performand.
234
- // pointer if data rouce is a node. Clunky
235
- // reconstract the map on (!append) operation.
236
- }
237
- }
238
-
239
- ```
240
-
241
- ---
242
- ## Design Priorities
243
-
244
- user interaction. insert, update, get data
245
- some processies are callback. callbacks uses the pattern user insert the data
246
-
247
- ContextTextWriter Plugin interaction I provided was imparative. I fit to that context because item had required data.
248
- Current context has uses next objects data in the chain.
249
-
250
- What is the imparative way to get next data?
251
- A `function` - A `pointer`
252
- If I go with a `pointer` I need to get the data with a `pointer`
253
- How to I provide a `function` to get the next data?
254
- ```js
255
- getNodeData(chainID, id){
256
- return this.chainMap.get(chainID).get(id)
257
- }
258
- // Problem to use this function the object of getNodeData must be created before creating contextTextWriterMap.
259
- ```
260
-
261
- how minimally hold the data
262
-
263
- how to render
264
-
265
-
266
-
267
- Edit mod. user asks chain data and bind placeholders.
268
-
269
-
270
-
271
- ## API
272
-
273
-
274
-
275
- getChain(chainID) => {pointID, long, lat}
276
-
277
-
278
-
279
- ## explore pattern
280
-
281
- (x, index, array ) doesnt fit.
282
-
283
-
284
-
285
-
286
- ## insertBulk
287
- ```json
288
- [
289
- {
290
- "chainID": "Mağrib",
291
- "points": [
292
- {
293
- "id": "Fas",
294
- "long": 0,
295
- "lat": 0,
296
- "to": "Cezayir"
297
- },
298
- {
299
- "id":"Cezayir",
300
- "long": 10,
301
- "lat": 20,
302
- "to": "Tunus"
303
- },
304
- {
305
- "id":"Tunus",
306
- "long": 10,
307
- "lat": 15
308
- }
309
- ],
310
- "rgba": [1,0,0,1],
311
- "dashRatio": 0.1,
312
- "dashOpacity": 0.5,
313
- "circleDashAngle": 15,
314
- },
315
- ]
316
- ```
317
-
318
- ```js
319
- // ["distance"]
320
- updateCoordinatesBulk( items, contextTextWriterIDs=[]) {
321
- for ( const item of items){
322
- this._updateCoordsChain(item.chainID, item.points);
323
- }
324
- }
325
-
326
- _updateCoordsChain(chainID, nodes){
327
- const chain = this._chainMap(chainID); // chain is a `list`
328
-
329
-
330
- }
331
- ```
332
-
333
-
334
- ##
335
- Get data from user with `to` keyword. implicitly add from keyword
336
-