gridviz 3.0.35 → 3.0.37

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.
Files changed (67) hide show
  1. package/README.md +129 -129
  2. package/dist/gridviz.js +21056 -17487
  3. package/dist/gridviz.min.js +2 -2
  4. package/package.json +74 -74
  5. package/src/button/Button.js +67 -67
  6. package/src/button/FullscreenButton.js +121 -121
  7. package/src/button/ZoomButtons.js +103 -103
  8. package/src/core/Dataset.js +232 -154
  9. package/src/core/Drawable.js +78 -78
  10. package/src/core/GeoCanvas.js +443 -443
  11. package/src/core/Layer.js +23 -23
  12. package/src/core/Legend.js +108 -108
  13. package/src/core/Map.js +650 -568
  14. package/src/core/MultiResolutionDataset.js +93 -93
  15. package/src/core/Style.js +98 -98
  16. package/src/core/Tooltip.js +182 -182
  17. package/src/dataset/COGeo.js +25 -25
  18. package/src/dataset/CSVGrid.js +112 -112
  19. package/src/dataset/GeoTIFF.js +122 -122
  20. package/src/dataset/JSGrid.js +55 -55
  21. package/src/dataset/TiledGrid.js +311 -302
  22. package/src/dataset/worker.js +18 -18
  23. package/src/index.js +79 -79
  24. package/src/layer/BackgroundLayer.js +173 -173
  25. package/src/layer/BackgroundLayerImage.js +81 -81
  26. package/src/layer/BackgroundLayerWMS.js +104 -104
  27. package/src/layer/GeoJSONLayer.js +276 -276
  28. package/src/layer/GridLayer.js +166 -166
  29. package/src/layer/LabelLayer.js +194 -194
  30. package/src/legend/ColorCategoryLegend.js +109 -109
  31. package/src/legend/ColorDiscreteLegend.js +100 -100
  32. package/src/legend/ColorLegend.js +115 -115
  33. package/src/legend/OrientationLegend.js +89 -89
  34. package/src/legend/SizeLegend.js +224 -224
  35. package/src/legend/TernaryLegend.js +302 -302
  36. package/src/style/CompositionStyle.js +291 -291
  37. package/src/style/DotDensityStyle.js +133 -133
  38. package/src/style/ImageStyle.js +100 -100
  39. package/src/style/Interpolator.js +258 -258
  40. package/src/style/IsoFenceStyle.js +217 -217
  41. package/src/style/JoyPlotStyle.js +180 -180
  42. package/src/style/LegoStyle.js +132 -132
  43. package/src/style/MosaicStyle.js +99 -99
  44. package/src/style/NinjaStarStyle.js +102 -102
  45. package/src/style/PillarStyle.js +207 -207
  46. package/src/style/SegmentStyle.js +105 -105
  47. package/src/style/ShadingRayStyle.js +280 -280
  48. package/src/style/ShadingStyle.js +72 -72
  49. package/src/style/ShapeColorSizeStyle.js +147 -147
  50. package/src/style/SideCategoryStyle.js +112 -112
  51. package/src/style/SideStyle.js +217 -217
  52. package/src/style/SideTanakaStyle.js +154 -154
  53. package/src/style/SquareColorCategoryWebGLStyle.js +311 -294
  54. package/src/style/SquareColorWebGLStyle.js +126 -126
  55. package/src/style/StrokeStyle.js +135 -135
  56. package/src/style/TextStyle.js +110 -110
  57. package/src/style/TimeSeriesStyle.js +222 -222
  58. package/src/utils/WebGLRectangleColoring.js +106 -106
  59. package/src/utils/WebGLSquareColoring.js +114 -118
  60. package/src/utils/WebGLSquareColoringAdvanced.js +223 -227
  61. package/src/utils/WebGLSquareColoringKS.js +153 -153
  62. package/src/utils/scale.js +255 -255
  63. package/src/utils/stretching.js +120 -120
  64. package/src/utils/ternary.js +208 -208
  65. package/src/utils/utils.js +125 -125
  66. package/src/utils/webGLUtils.js +178 -73
  67. package/src/utils/zoomUtils.js +142 -142
@@ -1,78 +1,78 @@
1
- //@ts-check
2
- 'use strict'
3
-
4
- /**
5
- * This is an abstract class used to group elements shared between Layer and Style classes.
6
- *
7
- * @abstract
8
- * @module core
9
- * @author Joseph Davies, Julien Gaffuri
10
- */
11
- export class Drawable {
12
- /**
13
- * @param {object} opts
14
- */
15
- constructor(opts) {
16
- opts = opts || {}
17
-
18
- /** A function specifying if the element should be visible or not.
19
- * The function parameter is the zoom level.
20
- * @type {function(number):boolean} */
21
- this.visible = opts.visible
22
-
23
- /** A function returning the alpha (transparency/opacity), between 0.0 (fully transparent) and 1.0 (fully opaque).
24
- * The function parameter is the zoom level.
25
- * (see CanvasRenderingContext2D: globalAlpha property)
26
- * @type {(function(number):number)|undefined} */
27
- this.alpha = opts.alpha
28
-
29
- /** A function returning the blend operation.
30
- * The function parameter is the zoom level.
31
- * (see CanvasRenderingContext2D: globalCompositeOperation property)
32
- * @type {function(number):GlobalCompositeOperation} */
33
- this.blendOperation = opts.blendOperation //|| ((z) => 'source-over')
34
-
35
- /** @type {(function(number):string)|undefined} */
36
- this.filterColor = opts.filterColor // (z) => "#eee7"
37
- /** @type {(function(number):GlobalCompositeOperation|"none")|undefined} */
38
- this.filterBlendOperation = opts.filterBlendOperation // (z) => "multiply"
39
- }
40
-
41
- /**
42
- * Draw filter.
43
- *
44
- * @param {import("./GeoCanvas.js").GeoCanvas} geoCanvas The canvas where to draw the layer.
45
- * @returns {void}
46
- * @abstract
47
- */
48
- drawFilter(geoCanvas) {
49
- //no filter: return
50
- if (!this.filterColor) return
51
-
52
- //get filter
53
- const fc = this.filterColor(geoCanvas.view.z)
54
-
55
- //no filter: return
56
- if (!fc || fc == 'none') return
57
-
58
- //draw filter
59
-
60
- //set color
61
- geoCanvas.offscreenCtx.fillStyle = fc
62
-
63
- //save blend mode and set new, if any
64
- let bo = undefined, bo2 = undefined
65
- if (this.filterBlendOperation) {
66
- bo = geoCanvas.offscreenCtx.globalCompositeOperation
67
- bo2 = this.filterBlendOperation(geoCanvas.view.z)
68
- }
69
- if (bo2 && bo2 != "none") geoCanvas.offscreenCtx.globalCompositeOperation = bo2;
70
-
71
- //draw
72
- geoCanvas.offscreenCtx.fillRect(0, 0, geoCanvas.w, geoCanvas.h)
73
-
74
- //restore blend mode
75
- if (bo) geoCanvas.offscreenCtx.globalCompositeOperation = bo;
76
-
77
- }
78
- }
1
+ //@ts-check
2
+ 'use strict'
3
+
4
+ /**
5
+ * This is an abstract class used to group elements shared between Layer and Style classes.
6
+ *
7
+ * @abstract
8
+ * @module core
9
+ * @author Joseph Davies, Julien Gaffuri
10
+ */
11
+ export class Drawable {
12
+ /**
13
+ * @param {object} opts
14
+ */
15
+ constructor(opts) {
16
+ opts = opts || {}
17
+
18
+ /** A function specifying if the element should be visible or not.
19
+ * The function parameter is the zoom level.
20
+ * @type {function(number):boolean} */
21
+ this.visible = opts.visible
22
+
23
+ /** A function returning the alpha (transparency/opacity), between 0.0 (fully transparent) and 1.0 (fully opaque).
24
+ * The function parameter is the zoom level.
25
+ * (see CanvasRenderingContext2D: globalAlpha property)
26
+ * @type {(function(number):number)|undefined} */
27
+ this.alpha = opts.alpha
28
+
29
+ /** A function returning the blend operation.
30
+ * The function parameter is the zoom level.
31
+ * (see CanvasRenderingContext2D: globalCompositeOperation property)
32
+ * @type {function(number):GlobalCompositeOperation} */
33
+ this.blendOperation = opts.blendOperation //|| ((z) => 'source-over')
34
+
35
+ /** @type {(function(number):string)|undefined} */
36
+ this.filterColor = opts.filterColor // (z) => "#eee7"
37
+ /** @type {(function(number):GlobalCompositeOperation|"none")|undefined} */
38
+ this.filterBlendOperation = opts.filterBlendOperation // (z) => "multiply"
39
+ }
40
+
41
+ /**
42
+ * Draw filter.
43
+ *
44
+ * @param {import("./GeoCanvas.js").GeoCanvas} geoCanvas The canvas where to draw the layer.
45
+ * @returns {void}
46
+ * @abstract
47
+ */
48
+ drawFilter(geoCanvas) {
49
+ //no filter: return
50
+ if (!this.filterColor) return
51
+
52
+ //get filter
53
+ const fc = this.filterColor(geoCanvas.view.z)
54
+
55
+ //no filter: return
56
+ if (!fc || fc == 'none') return
57
+
58
+ //draw filter
59
+
60
+ //set color
61
+ geoCanvas.offscreenCtx.fillStyle = fc
62
+
63
+ //save blend mode and set new, if any
64
+ let bo = undefined, bo2 = undefined
65
+ if (this.filterBlendOperation) {
66
+ bo = geoCanvas.offscreenCtx.globalCompositeOperation
67
+ bo2 = this.filterBlendOperation(geoCanvas.view.z)
68
+ }
69
+ if (bo2 && bo2 != "none") geoCanvas.offscreenCtx.globalCompositeOperation = bo2;
70
+
71
+ //draw
72
+ geoCanvas.offscreenCtx.fillRect(0, 0, geoCanvas.w, geoCanvas.h)
73
+
74
+ //restore blend mode
75
+ if (bo) geoCanvas.offscreenCtx.globalCompositeOperation = bo;
76
+
77
+ }
78
+ }