@pirireis/webglobeplugins 0.9.6 → 0.9.7
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/package.json +5 -2
- package/Math/angle-calculation.js +0 -14
- package/Math/arc.ts +0 -76
- package/Math/bounds/line-bbox.js +0 -225
- package/Math/constants.ts +0 -11
- package/Math/frustum/camera.ts +0 -32
- package/Math/frustum/from-globeinfo.ts +0 -63
- package/Math/frustum/types.ts +0 -11
- package/Math/globe-util/horizon-plane.ts +0 -137
- package/Math/index.js +0 -0
- package/Math/juction/arc-plane.ts +0 -114
- package/Math/juction/line-sphere.ts +0 -30
- package/Math/juction/plane-plane.ts +0 -66
- package/Math/line.ts +0 -70
- package/Math/matrix4.ts +0 -0
- package/Math/methods.js +0 -237
- package/Math/plane.ts +0 -86
- package/Math/quaternion.ts +0 -120
- package/Math/roadmap.md +0 -10
- package/Math/types.ts +0 -45
- package/Math/utils.js +0 -3
- package/Math/vec3.ts +0 -155
- package/algorithms/search-binary.js +0 -14
- package/altitude-locator/adaptors.js +0 -0
- package/altitude-locator/draw-subset-obj.js +0 -27
- package/altitude-locator/keymethod.js +0 -0
- package/altitude-locator/plugin.js +0 -439
- package/altitude-locator/types.js +0 -26
- package/arrowfield/adaptor.js +0 -11
- package/arrowfield/index.js +0 -3
- package/arrowfield/plugin.js +0 -128
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -512
- package/circle-line-chain/chain-list-map.js +0 -221
- package/circle-line-chain/init.js +0 -0
- package/circle-line-chain/plugin.js +0 -469
- package/circle-line-chain/readme.md +0 -57
- package/circle-line-chain/util.js +0 -1
- package/compass-rose/compass-rose-padding-flat.js +0 -266
- package/compass-rose/compass-text-writer.js +0 -173
- package/compass-rose/index.js +0 -3
- package/compassrose/compassrose.js +0 -341
- package/compassrose/index.js +0 -2
- package/depth-locator/readme.md +0 -26
- package/globe-types.ts +0 -13
- package/heatwave/index.js +0 -4
- package/heatwave/isobar/objectarraylabels.js +0 -247
- package/heatwave/isobar/plugin.js +0 -340
- package/heatwave/isobar/quadtreecontours.js +0 -336
- package/heatwave/plugins/heatwaveglobeshell.js +0 -258
- package/jest.config.js +0 -6
- package/partialrings/buffer-manager.js +0 -89
- package/partialrings/goals.md +0 -17
- package/partialrings/index.js +0 -3
- package/partialrings/plugin.js +0 -160
- package/partialrings/program.js +0 -324
- package/pin/pin-object-array.js +0 -381
- package/pin/pin-point-totem.js +0 -77
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
- package/point-heat-map/index.js +0 -0
- package/point-heat-map/plugin-webworker.js +0 -151
- package/point-heat-map/point-to-heat-map-flow.js +0 -150
- package/point-heat-map/readme.md +0 -15
- package/point-tracks/key-methods.js +0 -3
- package/point-tracks/plugin.js +0 -394
- package/programs/arrowfield/index.js +0 -2
- package/programs/arrowfield/logic.js +0 -286
- package/programs/arrowfield/object.js +0 -89
- package/programs/data2legend/density-to-legend.js +0 -115
- package/programs/data2legend/point-to-density-texture.js +0 -114
- package/programs/float2legendwithratio/index.js +0 -3
- package/programs/float2legendwithratio/logic.js +0 -194
- package/programs/float2legendwithratio/object.js +0 -141
- package/programs/globe-util/is-globe-moved.js +0 -27
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/noise/noises.js +0 -0
- package/programs/globeshell/wiggle/index.js +0 -6
- package/programs/globeshell/wiggle/logic.js +0 -371
- package/programs/globeshell/wiggle/object.js +0 -93
- package/programs/helpers/blender/index.js +0 -0
- package/programs/helpers/blender/program.js +0 -91
- package/programs/helpers/fadeaway/index.js +0 -3
- package/programs/helpers/fadeaway/logic.js +0 -76
- package/programs/helpers/fadeaway/object.js +0 -20
- package/programs/helpers/index.js +0 -2
- package/programs/index.js +0 -21
- package/programs/interface.ts +0 -7
- package/programs/line-on-globe/angled-line.js +0 -206
- package/programs/line-on-globe/circle-accurate-3d.js +0 -167
- package/programs/line-on-globe/circle-accurate-flat.js +0 -262
- package/programs/line-on-globe/circle-accurate.js +0 -202
- package/programs/line-on-globe/circle.js +0 -191
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
- package/programs/line-on-globe/index.js +0 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
- package/programs/line-on-globe/linestrip.ts +0 -228
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
- package/programs/line-on-globe/to-the-surface.js +0 -129
- package/programs/line-on-globe/util.js +0 -8
- package/programs/picking/pickable-renderer.js +0 -216
- package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
- package/programs/point-on-globe/element-point-glow.js +0 -184
- package/programs/point-on-globe/square-pixel-point.js +0 -189
- package/programs/programcache.ts +0 -131
- package/programs/rings/distancering/circleflatprogram.js +0 -136
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
- package/programs/rings/distancering/index.js +0 -5
- package/programs/rings/distancering/paddyflatprogram.js +0 -146
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
- package/programs/rings/distancering/shader.js +0 -0
- package/programs/rings/index.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie.js +0 -315
- package/programs/totems/camerauniformblock.d.ts +0 -48
- package/programs/totems/camerauniformblock.js +0 -197
- package/programs/totems/canvas-webglobe-info.js +0 -136
- package/programs/totems/gpu-selection-uniform-block.js +0 -132
- package/programs/totems/index.ts +0 -2
- package/programs/two-d/pixel-circle.js +0 -0
- package/programs/two-d/pixel-padding-for-compass.js +0 -174
- package/programs/util.js +0 -20
- package/programs/vectorfields/index.js +0 -3
- package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
- package/programs/vectorfields/logics/index.js +0 -5
- package/programs/vectorfields/logics/pixelbased.js +0 -161
- package/programs/vectorfields/logics/ubo.js +0 -64
- package/programs/vectorfields/pingpongbuffermanager.js +0 -80
- package/publish.bat +0 -60
- package/rangerings/enum.js +0 -3
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -649
- package/rangerings/rangeringangletext.js +0 -368
- package/rangerings/ring-account.js +0 -129
- package/shaders/fragment-toy/firework.js +0 -55
- package/shaders/fragment-toy/singularity.js +0 -59
- package/shape-on-terrain/arc/naive/plugin.ts +0 -304
- package/shape-on-terrain/goal.md +0 -12
- package/tests/Math/junction/arc-plane.test.ts +0 -133
- package/tests/Math/junction/plane-plane.test.ts +0 -82
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -14
- package/timetracks/adaptors-line-strip.js +0 -80
- package/timetracks/adaptors.js +0 -133
- package/timetracks/index.js +0 -6
- package/timetracks/plugin-line-strip.js +0 -295
- package/timetracks/plugin.js +0 -304
- package/timetracks/program-line-strip.js +0 -688
- package/timetracks/program.js +0 -850
- package/timetracks/programpoint-line-strip.js +0 -175
- package/timetracks/programpoint.js +0 -168
- package/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -22
- package/types.ts +0 -17
- package/util/account/bufferoffsetmanager.js +0 -209
- package/util/account/index.js +0 -6
- package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
- package/util/account/single-attribute-buffer-management/index.ts +0 -13
- package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
- package/util/account/single-attribute-buffer-management/types.ts +0 -39
- package/util/account/util.js +0 -22
- package/util/algorithms/index.js +0 -0
- package/util/algorithms/search-binary.js +0 -26
- package/util/check/get.js +0 -13
- package/util/check/index.js +0 -0
- package/util/check/typecheck.js +0 -39
- package/util/geometry/index.js +0 -53
- package/util/gl-util/buffer/attribute-loader.ts +0 -85
- package/util/gl-util/buffer/index.ts +0 -6
- package/util/gl-util/buffer/types.ts +0 -13
- package/util/gl-util/draw-options/methods.ts +0 -66
- package/util/gl-util/draw-options/types.ts +0 -28
- package/util/gl-util/uniform-block/manager.ts +0 -187
- package/util/gl-util/uniform-block/roadmap.md +0 -70
- package/util/gl-util/uniform-block/shader.js +0 -0
- package/util/gl-util/uniform-block/types.ts +0 -27
- package/util/heatwavedatamanager/datamanager.js +0 -168
- package/util/heatwavedatamanager/index.js +0 -3
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/index.js +0 -13
- package/util/interpolation/index.js +0 -0
- package/util/interpolation/timetrack/index.js +0 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
- package/util/interpolation/timetrack/web-worker-str.js +0 -180
- package/util/interpolation/timetrack/web-worker.js +0 -51
- package/util/jshelpers/data-filler.js +0 -19
- package/util/jshelpers/equality.js +0 -17
- package/util/jshelpers/index.js +0 -1
- package/util/jshelpers/timefilters.js +0 -32
- package/util/picking/fence.js +0 -46
- package/util/picking/picker-displayer.js +0 -177
- package/util/programs/draw-texture-on-canvas.js +0 -102
- package/util/programs/index.js +0 -1
- package/util/programs/shapesonglobe.js +0 -246
- package/util/programs/supersampletotextures.js +0 -142
- package/util/programs/texturetoglobe.js +0 -203
- package/util/shaderfunctions/geometrytransformations.ts +0 -388
- package/util/shaderfunctions/index.js +0 -2
- package/util/shaderfunctions/nodata.js +0 -10
- package/util/shaderfunctions/noisefunctions.js +0 -44
- package/util/surface-line-data/arc-bboxes.ts +0 -42
- package/util/surface-line-data/arcs-to-cuts.js +0 -74
- package/util/surface-line-data/cut-arc.js +0 -0
- package/util/surface-line-data/flow.ts +0 -52
- package/util/surface-line-data/rbush-manager.js +0 -0
- package/util/surface-line-data/types.ts +0 -27
- package/util/surface-line-data/web-worker.js +0 -0
- package/util/webglobe/gldefaultstates.js +0 -5
- package/util/webglobe/index.js +0 -2
- package/util/webglobe/rasteroverlay.js +0 -96
- package/util/webglobjectbuilders.ts +0 -456
- package/util/webglobjectbuilders1.js +0 -271
- package/waveparticles/adaptor.js +0 -16
- package/waveparticles/index.js +0 -3
- package/waveparticles/plugin.js +0 -313
- package/wind/imagetovectorfieldandmagnitude.js +0 -39
- package/wind/index.js +0 -5
- package/wind/plugin.js +0 -1057
- package/wind/vectorfieldimage.js +0 -27
- package/write-text/attached-text-writer.js +0 -105
- package/write-text/context-text.js +0 -125
- package/write-text/context-text3.js +0 -178
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -7
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Road Map
|
|
2
|
-
|
|
3
|
-
## CircleLine
|
|
4
|
-
Atomic unit is the circle-line constructed from a circle and a line with start and end point which indicates the radius.
|
|
5
|
-
|
|
6
|
-
### Attributes
|
|
7
|
-
Main attributes: StartPoint, EndPoint, Radius
|
|
8
|
-
Other attributes: Color, opacity, dash opacity, dash ratio
|
|
9
|
-
|
|
10
|
-
### API
|
|
11
|
-
API is the manipulation of above attributes
|
|
12
|
-
|
|
13
|
-
### Implementation
|
|
14
|
-
|
|
15
|
-
Buffer Orchestrater is enough.
|
|
16
|
-
|
|
17
|
-
## ChainOfCircleLines
|
|
18
|
-
Composit unit is a chain of circle-lines.
|
|
19
|
-
|
|
20
|
-
### Attributes
|
|
21
|
-
|
|
22
|
-
Main attributes: one to many relation of a chain and its circle-lines
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# API
|
|
26
|
-
- startChain(chainID) //
|
|
27
|
-
- addPointToChain(chainID)
|
|
28
|
-
- editPointOfChain(chainID, pointID) //
|
|
29
|
-
- divideChain(chainID, )
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Concept Formation
|
|
34
|
-
|
|
35
|
-
Circle-Line has ( startPoint, endPoint )
|
|
36
|
-
|
|
37
|
-
Chain Has [...circle-line] -> [ c0, c1, c2 ...] -> c0.endPoint == c1.startPoint, c1.endPoint == c2.startPoint
|
|
38
|
-
|
|
39
|
-
## Modes
|
|
40
|
-
|
|
41
|
-
Focus Mod
|
|
42
|
-
- mouse icon hides and edge point icon is displayed
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## interaction points ( this can be a new module)
|
|
46
|
-
changes the mouse icon
|
|
47
|
-
plugin creates them.
|
|
48
|
-
interaction points carryin carries information about how to interact with the plugin.
|
|
49
|
-
|
|
50
|
-
- On Edges
|
|
51
|
-
Updates coordinates on right click and carry
|
|
52
|
-
deletes on right
|
|
53
|
-
- on mid point of a radius line (+)
|
|
54
|
-
Addes an edge to mid points. ( deletes the old one and inserts 2)
|
|
55
|
-
|
|
56
|
-
UserInterface
|
|
57
|
-
- drawNewMethod
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const keyMethod = (chainKey, nodeKey) => `${chainKey}_${nodeKey}`;
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { PixelPaddingForFlatCompassCache } from "../programs/two-d/pixel-padding-for-compass";
|
|
2
|
-
import { BufferManager, BufferOrchestrator } from "../util/account";
|
|
3
|
-
|
|
4
|
-
import { PixelPaddingCompassTextWriter } from "./compass-text-writer"
|
|
5
|
-
|
|
6
|
-
const PaddingAngle = 30;
|
|
7
|
-
const textGapFit = 10;
|
|
8
|
-
|
|
9
|
-
export class PixelPaddingCompassPlugin {
|
|
10
|
-
constructor(id, {
|
|
11
|
-
opacity = 1,
|
|
12
|
-
textAngleOn = true,
|
|
13
|
-
|
|
14
|
-
defaultProperties = {
|
|
15
|
-
rgba: [1, 1, 1, 1],
|
|
16
|
-
pixelRadiusRatioBig: 0.8,
|
|
17
|
-
pixelRadiusRatioSmall: 0.6,
|
|
18
|
-
},
|
|
19
|
-
font = {
|
|
20
|
-
name: 'Arial',
|
|
21
|
-
textColor: '#FFFFFF',
|
|
22
|
-
hollowColor: '#000000',
|
|
23
|
-
size: 12, // piksel
|
|
24
|
-
hollow: true,
|
|
25
|
-
bold: true,
|
|
26
|
-
italic: false,
|
|
27
|
-
},
|
|
28
|
-
northFont = {
|
|
29
|
-
name: 'Arial',
|
|
30
|
-
textColor: '#BBAA00',
|
|
31
|
-
hollowColor: '#000000',
|
|
32
|
-
size: 14, // piksel
|
|
33
|
-
hollow: true,
|
|
34
|
-
bold: true,
|
|
35
|
-
italic: false,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
} = {}) {
|
|
40
|
-
this.id = id;
|
|
41
|
-
this.textAngleOn = textAngleOn
|
|
42
|
-
this.defaultProperties = defaultProperties
|
|
43
|
-
this.bufferOrchestrator = new BufferOrchestrator({ capacity: 10 });
|
|
44
|
-
|
|
45
|
-
this._font_hold = { font, northFont };
|
|
46
|
-
this.compassMap = new CompassMap(this);
|
|
47
|
-
this._opacity = opacity;
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
init(globe, gl) {
|
|
52
|
-
this.globe = globe;
|
|
53
|
-
this.resize();
|
|
54
|
-
this.gl = gl;
|
|
55
|
-
if (this.textAngleOn) {
|
|
56
|
-
this._createTextWriter();
|
|
57
|
-
}
|
|
58
|
-
this._initOrchestrations()
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @param {string} key
|
|
64
|
-
* @param {number} long
|
|
65
|
-
* @param {number} lat
|
|
66
|
-
* @typedef properties
|
|
67
|
-
* @property {number} pixelRadiusRatioBig
|
|
68
|
-
* @property {number} pixelRadiusRatioSmall
|
|
69
|
-
* @property {[4 numbers between 0-1]} rgba
|
|
70
|
-
*/
|
|
71
|
-
insert(key, long, lat, properties = null) {
|
|
72
|
-
this.__insertText(key, null, null, { properties, update: true });
|
|
73
|
-
this.compassMap.insert(key, long, lat, properties);
|
|
74
|
-
this.globe.DrawRender();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @param {string} key
|
|
81
|
-
*/
|
|
82
|
-
delete(key) {
|
|
83
|
-
this.compassMap.delete(key);
|
|
84
|
-
this.globe.DrawRender();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
setFont({ textFont = null, northFont = null } = {}) {
|
|
90
|
-
if (textFont) this.writer.setFont(textFont);
|
|
91
|
-
if (northFont) this.writer.setNorthFont(northFont);
|
|
92
|
-
this.globe.DrawRender();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
setOpacity(opacity) {
|
|
97
|
-
this._opacity = opacity;
|
|
98
|
-
this.writer?.setOpacity(opacity);
|
|
99
|
-
this.globe.DrawRender();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
getTextWriter() {
|
|
103
|
-
return this.writer;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
_initOrchestrations() {
|
|
107
|
-
const { gl, globe } = this;
|
|
108
|
-
this.paddingProgram = PixelPaddingForFlatCompassCache.get(globe);
|
|
109
|
-
{
|
|
110
|
-
// createBuffers
|
|
111
|
-
const bufferType = "DYNAMIC_DRAW";
|
|
112
|
-
const initialCapacity = this.bufferOrchestrator.capacity;
|
|
113
|
-
this.bufferManagersCompMap = new Map(
|
|
114
|
-
[
|
|
115
|
-
["screenCoordinates", {
|
|
116
|
-
'bufferManager': new BufferManager(gl, 2, { bufferType, initialCapacity }),
|
|
117
|
-
'adaptor': (item) => new Float32Array([item.x, item.y])
|
|
118
|
-
}],
|
|
119
|
-
["pixelRadiusRatioSmall", {
|
|
120
|
-
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
121
|
-
'adaptor': (item) => new Float32Array([item.properties.pixelRadiusRatioSmall])
|
|
122
|
-
}],
|
|
123
|
-
["pixelRadiusRatioBig", {
|
|
124
|
-
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
125
|
-
'adaptor': (item) => new Float32Array([item.properties.pixelRadiusRatioBig])
|
|
126
|
-
}],
|
|
127
|
-
["rgba", {
|
|
128
|
-
'bufferManager': new BufferManager(gl, 4, { bufferType, initialCapacity }),
|
|
129
|
-
'adaptor': (item) => new Float32Array(item.properties.rgba)
|
|
130
|
-
}],
|
|
131
|
-
]
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const obj = function (bufferManagerComp) {
|
|
135
|
-
return { 'buffer': bufferManagerComp.bufferManager.buffer, 'stride': 0, 'offset': 0 }
|
|
136
|
-
};
|
|
137
|
-
this.paddingVao = this.paddingProgram.createVAO(
|
|
138
|
-
...['screenCoordinates', 'pixelRadiusRatioSmall', 'pixelRadiusRatioBig', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
_createTextWriter() {
|
|
143
|
-
this.writer = new PixelPaddingCompassTextWriter(this.globe, { angle: PaddingAngle, ...this._font_hold });
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
resize() {
|
|
148
|
-
this.writer?.resize();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
__insertText(key, x, y, { properties, update = false } = {}) {
|
|
153
|
-
if (!this.writer) return;
|
|
154
|
-
if (update) {
|
|
155
|
-
let radius;
|
|
156
|
-
if (properties != null && properties.pixelRadiusRatioBig) {
|
|
157
|
-
radius = properties.pixelRadiusRatioBig * this.radiusMultiplier;
|
|
158
|
-
} else {
|
|
159
|
-
radius = this.defaultProperties.pixelRadiusRatioBig * this.radiusMultiplier;
|
|
160
|
-
}
|
|
161
|
-
this.writer.insertTextItem(key, x, y, radius + textGapFit);
|
|
162
|
-
} else {
|
|
163
|
-
this.writer.insertTextItem(key, x, y)
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Globe API interface methods
|
|
168
|
-
|
|
169
|
-
draw2D() {
|
|
170
|
-
const { gl, globe, paddingProgram, paddingVao, bufferOrchestrator, bufferManagersCompMap } = this;
|
|
171
|
-
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
172
|
-
if (is3D) return;
|
|
173
|
-
const items = this.compassMap.query(globe, this.writer);
|
|
174
|
-
if (items.length === 0) return;
|
|
175
|
-
bufferOrchestrator.flush();
|
|
176
|
-
bufferOrchestrator.insertBulk(items, bufferManagersCompMap);
|
|
177
|
-
items.forEach((v) => {
|
|
178
|
-
this.__insertText(v.key, v.x, v.y)
|
|
179
|
-
});
|
|
180
|
-
gl.disable(gl.DEPTH_TEST);
|
|
181
|
-
paddingProgram.draw(paddingVao, bufferOrchestrator.length, this._opacity)
|
|
182
|
-
gl.enable(gl.DEPTH_TEST);
|
|
183
|
-
this.writer?.draw();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
free() {
|
|
187
|
-
this.compassMap.free();
|
|
188
|
-
const { globe, gl, paddingVao } = this;
|
|
189
|
-
gl.deleteVertexArray(paddingVao);
|
|
190
|
-
PixelPaddingForFlatCompassCache.release(globe);
|
|
191
|
-
this.bufferManagersCompMap.forEach(v => {
|
|
192
|
-
v.bufferManager.free();
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
resize() {
|
|
198
|
-
this.radiusMultiplier = this._shorterDimension() * 0.5;
|
|
199
|
-
this._reinsertAllText();
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
_reinsertAllText() {
|
|
204
|
-
this.compassMap.query(this.globe, this.writer).forEach((v) => {
|
|
205
|
-
this.__insertText(v.key, v.x, v.y, { properties: v.properties, update: true });
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
_shorterDimension() {
|
|
210
|
-
const globe = this.globe;
|
|
211
|
-
return Math.min(globe.api_ScrW(), globe.api_ScrH());
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
class CompassMap {
|
|
218
|
-
constructor(parent) {
|
|
219
|
-
this.coordsMemory = new Map();
|
|
220
|
-
this.propertyMemory = new Map();
|
|
221
|
-
this.parent = parent;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
insert(key, long, lat, properties = null) {
|
|
225
|
-
this.coordsMemory.set(key, [long, lat]);
|
|
226
|
-
if (properties) this.propertyMemory.set(key, properties);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
delete(key) {
|
|
230
|
-
this.coordsMemory.delete(key);
|
|
231
|
-
this.propertyMemory.delete(key);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
free() {
|
|
235
|
-
this.coordsMemory.clear();
|
|
236
|
-
this.propertyMemory.clear();
|
|
237
|
-
this.coordsMemory = null;
|
|
238
|
-
this.propertyMemory = null;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
query(globe, writer) {
|
|
242
|
-
const { coordsMemory, propertyMemory } = this;
|
|
243
|
-
const defaultProperties = this.parent.defaultProperties;
|
|
244
|
-
const result = [];
|
|
245
|
-
coordsMemory.forEach((v, k, c) => {
|
|
246
|
-
const { x, y } = globe.api_GetScreenPointFromGeo(
|
|
247
|
-
{
|
|
248
|
-
long: v[0],
|
|
249
|
-
lat: v[1],
|
|
250
|
-
z: 0,
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
);
|
|
254
|
-
writer?.insertTextItem(k, x, y);
|
|
255
|
-
|
|
256
|
-
if (x !== null) {
|
|
257
|
-
const properties = { ...defaultProperties, ...propertyMemory.get(k) };
|
|
258
|
-
result.push({ key: k, x, y, properties })
|
|
259
|
-
}
|
|
260
|
-
})
|
|
261
|
-
return result;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function isOnTheScreen(globe, points) { }
|
|
266
|
-
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { CSZMode, CSMeasureTextPositionTypes } from "@pirireis/webglobe";
|
|
2
|
-
|
|
3
|
-
// const defaultStyle = {
|
|
4
|
-
// textFont: {
|
|
5
|
-
// name: 'Arial',
|
|
6
|
-
// textColor: '#FFFFFF', // beyaz
|
|
7
|
-
// hollowColor: '#000000', // siyah
|
|
8
|
-
// size: 12, // piksel
|
|
9
|
-
// hollow: true,
|
|
10
|
-
// bold: true,
|
|
11
|
-
// italic: false,
|
|
12
|
-
// },
|
|
13
|
-
// opacity: 1.0,
|
|
14
|
-
// zMode: CSZMode.Z_GROUND_PERVERTEX,
|
|
15
|
-
// }
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* TODOs:
|
|
19
|
-
* 1) update all if initials change (propably need a context and a callback to iterate over data)
|
|
20
|
-
* 2) expose a mechanic to update text on zoom change
|
|
21
|
-
* 3) extend the mechanic on 2 to other events
|
|
22
|
-
*/
|
|
23
|
-
const yGapFit = -2
|
|
24
|
-
const xGapFit = -5
|
|
25
|
-
|
|
26
|
-
export class PixelPaddingCompassTextWriter {
|
|
27
|
-
constructor(globe, {
|
|
28
|
-
font = {
|
|
29
|
-
name: 'Arial',
|
|
30
|
-
textColor: '#FFFFFF', // beyaz
|
|
31
|
-
hollowColor: '#000000', // siyah
|
|
32
|
-
size: 12, // piksel
|
|
33
|
-
hollow: true,
|
|
34
|
-
bold: true,
|
|
35
|
-
italic: false,
|
|
36
|
-
}, northFont = {
|
|
37
|
-
name: 'Arial',
|
|
38
|
-
textColor: '#BB0000', // beyaz
|
|
39
|
-
hollowColor: '#000000', // siyah
|
|
40
|
-
size: 14, // piksel
|
|
41
|
-
hollow: true,
|
|
42
|
-
bold: true,
|
|
43
|
-
italic: false,
|
|
44
|
-
|
|
45
|
-
}, doDraw = true, angle = 30, } = {}) {
|
|
46
|
-
this.globe = globe;
|
|
47
|
-
this.itemMap = new Map();
|
|
48
|
-
this.font = font;
|
|
49
|
-
this.northFont = northFont;
|
|
50
|
-
this.doDraw = doDraw;
|
|
51
|
-
this.angle = angle;
|
|
52
|
-
this.angles = []
|
|
53
|
-
this.texts = []
|
|
54
|
-
this.positions = []
|
|
55
|
-
let currentAngle = 0;
|
|
56
|
-
while (currentAngle < 360) {
|
|
57
|
-
if (currentAngle > 180) {
|
|
58
|
-
this.positions.push(CSMeasureTextPositionTypes.CENTER);
|
|
59
|
-
} else {
|
|
60
|
-
this.positions.push(null);
|
|
61
|
-
}
|
|
62
|
-
this.angles.push(currentAngle);
|
|
63
|
-
if (currentAngle == 0) {
|
|
64
|
-
this.texts.push("K");
|
|
65
|
-
} else {
|
|
66
|
-
// to string 3 chars fill left with 0
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.texts.push(currentAngle.toString().padStart(3, '0'));
|
|
70
|
-
}
|
|
71
|
-
currentAngle += this.angle;
|
|
72
|
-
}
|
|
73
|
-
this._lastNorthAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
|
|
74
|
-
this.offsets = this.__offset(this._lastNorthAngle);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
setKeyAdaptor(adaptor) {
|
|
80
|
-
this.keyAdaptor = adaptor;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
setDoDraw(bool) {
|
|
84
|
-
this.doDraw = bool;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
setFont(font) {
|
|
88
|
-
this.font = font;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
setNorthFont(font) {
|
|
92
|
-
this.northFont = font;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
setOpacity(opacity) {
|
|
96
|
-
this.opacity = opacity;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
_checkSetOffsets() {
|
|
101
|
-
const { globe } = this;
|
|
102
|
-
const newAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);;
|
|
103
|
-
if (newAngle !== this._lastNorthAngle) {
|
|
104
|
-
this._lastNorthAngle = newAngle;
|
|
105
|
-
this.offsets = this.__offset();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
draw() {
|
|
111
|
-
if (!this.doDraw) return;
|
|
112
|
-
const { globe, font, opacity: opacity_, northFont, itemMap, texts, angles, positions } = this;
|
|
113
|
-
this._checkSetOffsets();// zMode: CSZMode.Z_GROUND_PERVERTEX,
|
|
114
|
-
const offsets = this.offsets;
|
|
115
|
-
for (const [key, { center, radius, opacity = null }] of itemMap) {
|
|
116
|
-
const o = opacity === null ? opacity_ : opacity * opacity_;
|
|
117
|
-
if (center.x !== null && center.y !== null) {
|
|
118
|
-
offsets.forEach(({ offsetX, offsetY }, i) => {
|
|
119
|
-
const text = texts[i];
|
|
120
|
-
const angle = angles[i];
|
|
121
|
-
font.position = positions[i];
|
|
122
|
-
if (angle === 0) {
|
|
123
|
-
globe.api_DrawContextTextMultiLine(text, northFont, o, { x: center.x + offsetX * radius + xGapFit, y: center.y + offsetY * radius + yGapFit });
|
|
124
|
-
|
|
125
|
-
} else {
|
|
126
|
-
globe.api_DrawContextTextMultiLine(text, font, o, { x: center.x + offsetX * radius + xGapFit, y: center.y + offsetY * radius + yGapFit });
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
insertTextItem(key, x, y, radius = undefined) {
|
|
137
|
-
const item = this.getItem(key);
|
|
138
|
-
item.center = { x, y };
|
|
139
|
-
if (radius === undefined) return;
|
|
140
|
-
if (item.radius != undefined && item.radius === radius) return;
|
|
141
|
-
item.radius = radius;
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
getItem(key) {
|
|
146
|
-
if (!this.itemMap.has(key)) this.itemMap.set(key, {});
|
|
147
|
-
return this.itemMap.get(key);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
__calculateOffset(angle) {
|
|
151
|
-
const rAngle = (angle - 90) * (Math.PI / 180);
|
|
152
|
-
return { offsetX: Math.cos(rAngle + this._lastNorthAngle), offsetY: Math.sin(rAngle + this._lastNorthAngle) };
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
__offset() {
|
|
156
|
-
const angle = this.angle;
|
|
157
|
-
const offsets = []
|
|
158
|
-
let currentAngle = 0;
|
|
159
|
-
while (currentAngle < 360) {
|
|
160
|
-
offsets.push(this.__calculateOffset(currentAngle));
|
|
161
|
-
|
|
162
|
-
currentAngle += angle;
|
|
163
|
-
}
|
|
164
|
-
return offsets;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
clear() {
|
|
169
|
-
this.itemMap.clear();
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
package/compass-rose/index.js
DELETED