gridviz 3.0.18 → 3.0.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.
- package/README.md +128 -127
- package/dist/gridviz.js +7862 -7819
- package/dist/gridviz.min.js +1 -1
- package/package.json +74 -74
- package/src/button/ZoomButtons.js +101 -101
- package/src/core/Dataset.js +154 -154
- package/src/core/Drawable.js +60 -60
- package/src/core/GeoCanvas.js +430 -419
- package/src/core/Layer.js +23 -23
- package/src/core/Legend.js +108 -108
- package/src/core/Map.js +516 -503
- package/src/core/MultiResolutionDataset.js +93 -93
- package/src/core/Style.js +98 -98
- package/src/core/Tooltip.js +1 -0
- package/src/dataset/CSVGrid.js +112 -112
- package/src/dataset/GeoTIFF.js +122 -122
- package/src/dataset/JSGrid.js +55 -55
- package/src/dataset/TiledGrid.js +302 -289
- package/src/dataset/worker.js +18 -18
- package/src/index.js +77 -77
- package/src/layer/BackgroundLayer.js +162 -162
- package/src/layer/BackgroundLayerImage.js +81 -81
- package/src/layer/BackgroundLayerWMS.js +104 -104
- package/src/layer/GeoJSONLayer.js +214 -214
- package/src/layer/GridLayer.js +148 -148
- package/src/layer/LabelLayer.js +194 -194
- package/src/legend/ColorCategoryLegend.js +109 -109
- package/src/legend/ColorDiscreteLegend.js +100 -100
- package/src/legend/ColorLegend.js +115 -115
- package/src/legend/OrientationLegend.js +89 -89
- package/src/legend/SizeLegend.js +224 -224
- package/src/legend/TernaryLegend.js +302 -302
- package/src/style/CompositionStyle.js +291 -291
- package/src/style/DotDensityStyle.js +133 -133
- package/src/style/ImageStyle.js +100 -100
- package/src/style/IsoFenceStyle.js +217 -217
- package/src/style/JoyPlotStyle.js +127 -127
- package/src/style/LegoStyle.js +110 -110
- package/src/style/MosaicStyle.js +99 -99
- package/src/style/NinjaStarStyle.js +102 -102
- package/src/style/PillarStyle.js +207 -207
- package/src/style/SegmentStyle.js +105 -105
- package/src/style/ShapeColorSizeStyle.js +147 -147
- package/src/style/SideCategoryStyle.js +112 -112
- package/src/style/SideStyle.js +212 -212
- package/src/style/SquareColorCategoryWebGLStyle.js +107 -107
- package/src/style/SquareColorWebGLStyle.js +126 -126
- package/src/style/StrokeStyle.js +135 -135
- package/src/style/TanakaStyle.js +69 -69
- package/src/style/TextStyle.js +110 -110
- package/src/style/TimeSeriesStyle.js +222 -222
- package/src/utils/scale.js +218 -218
- package/src/utils/stretching.js +120 -120
- package/src/utils/ternary.js +208 -203
- package/src/utils/utils.js +58 -58
- package/src/utils/webGLUtils.js +72 -72
package/src/core/Drawable.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
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
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Draw layer filter.
|
|
41
|
-
*
|
|
42
|
-
* @param {import("./GeoCanvas.js").GeoCanvas} geoCanvas The canvas where to draw the layer.
|
|
43
|
-
* @returns {void}
|
|
44
|
-
* @abstract
|
|
45
|
-
*/
|
|
46
|
-
drawFilter(geoCanvas) {
|
|
47
|
-
//no filter: return
|
|
48
|
-
if (!this.filterColor) return
|
|
49
|
-
|
|
50
|
-
//get filter
|
|
51
|
-
const fc = this.filterColor(geoCanvas.view.z)
|
|
52
|
-
|
|
53
|
-
//no filter: return
|
|
54
|
-
if (!fc || fc == 'none') return
|
|
55
|
-
|
|
56
|
-
//draw filter
|
|
57
|
-
geoCanvas.offscreenCtx.fillStyle = fc
|
|
58
|
-
geoCanvas.offscreenCtx.fillRect(0, 0, geoCanvas.w, geoCanvas.h)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
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
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Draw layer filter.
|
|
41
|
+
*
|
|
42
|
+
* @param {import("./GeoCanvas.js").GeoCanvas} geoCanvas The canvas where to draw the layer.
|
|
43
|
+
* @returns {void}
|
|
44
|
+
* @abstract
|
|
45
|
+
*/
|
|
46
|
+
drawFilter(geoCanvas) {
|
|
47
|
+
//no filter: return
|
|
48
|
+
if (!this.filterColor) return
|
|
49
|
+
|
|
50
|
+
//get filter
|
|
51
|
+
const fc = this.filterColor(geoCanvas.view.z)
|
|
52
|
+
|
|
53
|
+
//no filter: return
|
|
54
|
+
if (!fc || fc == 'none') return
|
|
55
|
+
|
|
56
|
+
//draw filter
|
|
57
|
+
geoCanvas.offscreenCtx.fillStyle = fc
|
|
58
|
+
geoCanvas.offscreenCtx.fillRect(0, 0, geoCanvas.w, geoCanvas.h)
|
|
59
|
+
}
|
|
60
|
+
}
|