gridviz 3.0.34 → 3.0.36
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 +129 -129
- package/dist/gridviz.js +17487 -17471
- package/dist/gridviz.min.js +2 -2
- package/package.json +73 -73
- package/src/button/Button.js +67 -67
- package/src/button/FullscreenButton.js +121 -121
- package/src/button/ZoomButtons.js +103 -103
- package/src/core/Dataset.js +154 -154
- package/src/core/Drawable.js +78 -78
- package/src/core/GeoCanvas.js +443 -443
- package/src/core/Layer.js +23 -23
- package/src/core/Legend.js +108 -108
- package/src/core/Map.js +568 -552
- package/src/core/MultiResolutionDataset.js +93 -93
- package/src/core/Style.js +98 -98
- package/src/core/Tooltip.js +182 -182
- package/src/dataset/COGeo.js +25 -25
- 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 -302
- package/src/dataset/worker.js +18 -18
- package/src/index.js +79 -79
- package/src/layer/BackgroundLayer.js +173 -173
- package/src/layer/BackgroundLayerImage.js +81 -81
- package/src/layer/BackgroundLayerWMS.js +104 -104
- package/src/layer/GeoJSONLayer.js +276 -276
- package/src/layer/GridLayer.js +166 -166
- 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/Interpolator.js +258 -258
- package/src/style/IsoFenceStyle.js +217 -217
- package/src/style/JoyPlotStyle.js +180 -180
- package/src/style/LegoStyle.js +132 -132
- 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/ShadingRayStyle.js +280 -280
- package/src/style/ShadingStyle.js +72 -72
- package/src/style/ShapeColorSizeStyle.js +147 -147
- package/src/style/SideCategoryStyle.js +112 -112
- package/src/style/SideStyle.js +217 -217
- package/src/style/SideTanakaStyle.js +154 -154
- package/src/style/SquareColorCategoryWebGLStyle.js +307 -294
- package/src/style/SquareColorWebGLStyle.js +126 -126
- package/src/style/StrokeStyle.js +135 -135
- package/src/style/TextStyle.js +110 -110
- package/src/style/TimeSeriesStyle.js +222 -222
- package/src/utils/WebGLRectangleColoring.js +106 -106
- package/src/utils/WebGLSquareColoring.js +118 -118
- package/src/utils/WebGLSquareColoringAdvanced.js +227 -227
- package/src/utils/WebGLSquareColoringKS.js +153 -153
- package/src/utils/scale.js +255 -255
- package/src/utils/stretching.js +120 -120
- package/src/utils/ternary.js +208 -208
- package/src/utils/utils.js +125 -125
- package/src/utils/webGLUtils.js +73 -73
- package/src/utils/zoomUtils.js +142 -142
package/src/style/SideStyle.js
CHANGED
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
//@ts-check
|
|
2
|
-
'use strict'
|
|
3
|
-
|
|
4
|
-
import { Style } from '../core/Style.js'
|
|
5
|
-
|
|
6
|
-
/** @typedef {{ x:number, y:number, or:"v"|"h", c1:(import('../core/Dataset').Cell)|undefined, c2:(import('../core/Dataset').Cell)|undefined }} Side */
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {function(Array.<Side>,number, number):*} SideViewScale */
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @module style
|
|
13
|
-
* @author Julien Gaffuri
|
|
14
|
-
*/
|
|
15
|
-
export class SideStyle extends Style {
|
|
16
|
-
/** @param {object} opts */
|
|
17
|
-
constructor(opts = {}) {
|
|
18
|
-
super(opts)
|
|
19
|
-
|
|
20
|
-
/** A function returning the color of a cell side.
|
|
21
|
-
* @type {function(Side, number, number, object):string} */
|
|
22
|
-
this.color = opts.color || ((side, resolution, z, sideViewScale) => '#EA6BAC')
|
|
23
|
-
|
|
24
|
-
/** A function returning the width of a cell side, in geo unit
|
|
25
|
-
* @type {function(Side, number, number, object):number} */
|
|
26
|
-
this.width = opts.width || ((side, resolution, z, sideViewScale) => resolution / 5)
|
|
27
|
-
|
|
28
|
-
/** A function returning the length of a cell side, in geo unit
|
|
29
|
-
* @type {function(Side, number, number, object):number} */
|
|
30
|
-
this.length = opts.length || ((side, resolution, z, sideViewScale) => resolution)
|
|
31
|
-
|
|
32
|
-
/** Set to A or true so that the side is drawn as a diamond */
|
|
33
|
-
this.diamond = opts.diamond
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @param {Array.<import("../core/Dataset").Cell>} cells
|
|
38
|
-
* @param {number} resolution
|
|
39
|
-
* @param {import("../core/GeoCanvas").GeoCanvas} geoCanvas
|
|
40
|
-
*/
|
|
41
|
-
draw(cells, geoCanvas, resolution) {
|
|
42
|
-
//filter
|
|
43
|
-
if (this.filter) cells = cells.filter(this.filter)
|
|
44
|
-
|
|
45
|
-
//
|
|
46
|
-
const z = geoCanvas.view.z
|
|
47
|
-
const ctx = geoCanvas.offscreenCtx
|
|
48
|
-
|
|
49
|
-
//build sides
|
|
50
|
-
|
|
51
|
-
/** @type {Array.<Side>} */
|
|
52
|
-
const sides = SideStyle.buildSides(cells, resolution)
|
|
53
|
-
if (sides.length == 0) return
|
|
54
|
-
|
|
55
|
-
//get side view scale
|
|
56
|
-
const viewScale = this.viewScale ? this.viewScale(sides, resolution, z) : undefined
|
|
57
|
-
|
|
58
|
-
//draw sides
|
|
59
|
-
|
|
60
|
-
ctx.lineCap = 'butt'
|
|
61
|
-
const r2 = resolution * 0.5
|
|
62
|
-
for (let side of sides) {
|
|
63
|
-
//color
|
|
64
|
-
/** @type {string|undefined} */
|
|
65
|
-
const col = this.color ? this.color(side, resolution, z, viewScale) : undefined
|
|
66
|
-
if (!col || col == 'none') continue
|
|
67
|
-
|
|
68
|
-
if (this.diamond) {
|
|
69
|
-
//set color
|
|
70
|
-
ctx.fillStyle = col
|
|
71
|
-
|
|
72
|
-
//draw diamond
|
|
73
|
-
const x = side.x,
|
|
74
|
-
y = side.y
|
|
75
|
-
ctx.beginPath()
|
|
76
|
-
ctx.moveTo(x - r2, y)
|
|
77
|
-
ctx.lineTo(x, y + r2)
|
|
78
|
-
ctx.lineTo(x + r2, y)
|
|
79
|
-
ctx.lineTo(x, y - r2)
|
|
80
|
-
ctx.closePath()
|
|
81
|
-
ctx.fill()
|
|
82
|
-
} else {
|
|
83
|
-
//width
|
|
84
|
-
/** @type {number|undefined} */
|
|
85
|
-
const wG = this.width ? this.width(side, resolution, z, viewScale) : undefined
|
|
86
|
-
if (!wG || wG <= 0) continue
|
|
87
|
-
|
|
88
|
-
//length
|
|
89
|
-
/** @type {number|undefined} */
|
|
90
|
-
const lG = this.length ? this.length(side, resolution, z, viewScale) : undefined
|
|
91
|
-
if (!lG || lG <= 0) continue
|
|
92
|
-
const lG2 = lG * 0.5
|
|
93
|
-
|
|
94
|
-
//set width
|
|
95
|
-
ctx.lineWidth = wG
|
|
96
|
-
//set color
|
|
97
|
-
ctx.strokeStyle = col
|
|
98
|
-
|
|
99
|
-
//draw segment with correct orientation
|
|
100
|
-
const x = side.x,
|
|
101
|
-
y = side.y
|
|
102
|
-
ctx.beginPath()
|
|
103
|
-
if (side.or === 'v') {
|
|
104
|
-
ctx.moveTo(x, y - lG2)
|
|
105
|
-
ctx.lineTo(x, y + lG2)
|
|
106
|
-
} else {
|
|
107
|
-
ctx.moveTo(x - lG2, y)
|
|
108
|
-
ctx.lineTo(x + lG2, y)
|
|
109
|
-
}
|
|
110
|
-
ctx.stroke()
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
//update legends
|
|
115
|
-
this.updateLegends({ style: this, resolution: resolution, z: z, viewScale: viewScale })
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
*
|
|
120
|
-
* @param {Array.<import('../core/Dataset').Cell>} cells The cells to use to build the sides.
|
|
121
|
-
* @param {number} resolution The cells resolution
|
|
122
|
-
* @param {boolean} withHorizontal Set to true to build horizontal sides, false otherwise.
|
|
123
|
-
* @param {boolean} withVertical Set to true to build vertical sides, false otherwise.
|
|
124
|
-
* @param {boolean} center Set to true so that the side coordinate are those of its center point rather than its left/bottom point (the side x,y coordinates are those of the left point for horizontal sides, and of the bottom point for vertical sides)
|
|
125
|
-
* @returns { Array.<Side> }
|
|
126
|
-
*/
|
|
127
|
-
static buildSides(cells, resolution, withHorizontal = true, withVertical = true, center = true, eps = 0.01) {
|
|
128
|
-
/** @type { Array.<Side> } */
|
|
129
|
-
const sides = []
|
|
130
|
-
|
|
131
|
-
// half resolution
|
|
132
|
-
const r2 = center ? resolution / 2 : 0
|
|
133
|
-
|
|
134
|
-
// epsilon
|
|
135
|
-
eps = resolution * eps
|
|
136
|
-
const abs = Math.abs
|
|
137
|
-
|
|
138
|
-
//make horizontal sides
|
|
139
|
-
//sort cells by x and y
|
|
140
|
-
cells.sort((c1, c2) => (c2.x == c1.x ? c1.y - c2.y : c1.x - c2.x))
|
|
141
|
-
let c1 = cells[0]
|
|
142
|
-
for (let i = 1; i < cells.length; i++) {
|
|
143
|
-
let c2 = cells[i]
|
|
144
|
-
|
|
145
|
-
if (abs(c1.y + resolution - c2.y) < eps && abs(c1.x - c2.x) < eps)
|
|
146
|
-
//cells in same column and touch along horizontal side
|
|
147
|
-
//make shared side
|
|
148
|
-
sides.push({
|
|
149
|
-
or: 'h',
|
|
150
|
-
x: c1.x + r2,
|
|
151
|
-
y: c2.y,
|
|
152
|
-
c1: c1,
|
|
153
|
-
c2: c2,
|
|
154
|
-
})
|
|
155
|
-
else {
|
|
156
|
-
//cells do not touch along horizontal side
|
|
157
|
-
//make two sides: top one for c1, bottom for c2
|
|
158
|
-
sides.push({
|
|
159
|
-
or: 'h',
|
|
160
|
-
x: c1.x + r2,
|
|
161
|
-
y: c1.y + resolution,
|
|
162
|
-
c1: c1,
|
|
163
|
-
c2: undefined,
|
|
164
|
-
})
|
|
165
|
-
sides.push({
|
|
166
|
-
or: 'h',
|
|
167
|
-
x: c2.x + r2,
|
|
168
|
-
y: c2.y,
|
|
169
|
-
c1: undefined,
|
|
170
|
-
c2: c2,
|
|
171
|
-
})
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
c1 = c2
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
//make vertical sides
|
|
178
|
-
//sort cells by y and x
|
|
179
|
-
cells.sort((c1, c2) => (c2.y == c1.y ? c1.x - c2.x : c1.y - c2.y))
|
|
180
|
-
c1 = cells[0]
|
|
181
|
-
for (let i = 1; i < cells.length; i++) {
|
|
182
|
-
let c2 = cells[i]
|
|
183
|
-
|
|
184
|
-
if (abs(c1.x + resolution - c2.x) < eps && abs(c1.y - c2.y) < eps)
|
|
185
|
-
//cells in same row and touch along vertical side
|
|
186
|
-
//make shared side
|
|
187
|
-
sides.push({
|
|
188
|
-
or: 'v',
|
|
189
|
-
x: c1.x + resolution,
|
|
190
|
-
y: c1.y + r2,
|
|
191
|
-
c1: c1,
|
|
192
|
-
c2: c2,
|
|
193
|
-
})
|
|
194
|
-
else {
|
|
195
|
-
//cells do not touch along vertical side
|
|
196
|
-
//make two sides: right one for c1, left for c2
|
|
197
|
-
sides.push({
|
|
198
|
-
or: 'v',
|
|
199
|
-
x: c1.x + resolution,
|
|
200
|
-
y: c1.y + r2,
|
|
201
|
-
c1: c1,
|
|
202
|
-
c2: undefined,
|
|
203
|
-
})
|
|
204
|
-
sides.push({
|
|
205
|
-
or: 'v',
|
|
206
|
-
x: c2.x,
|
|
207
|
-
y: c2.y + r2,
|
|
208
|
-
c1: undefined,
|
|
209
|
-
c2: c2,
|
|
210
|
-
})
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
c1 = c2
|
|
214
|
-
}
|
|
215
|
-
return sides
|
|
216
|
-
}
|
|
217
|
-
}
|
|
1
|
+
//@ts-check
|
|
2
|
+
'use strict'
|
|
3
|
+
|
|
4
|
+
import { Style } from '../core/Style.js'
|
|
5
|
+
|
|
6
|
+
/** @typedef {{ x:number, y:number, or:"v"|"h", c1:(import('../core/Dataset').Cell)|undefined, c2:(import('../core/Dataset').Cell)|undefined }} Side */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {function(Array.<Side>,number, number):*} SideViewScale */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @module style
|
|
13
|
+
* @author Julien Gaffuri
|
|
14
|
+
*/
|
|
15
|
+
export class SideStyle extends Style {
|
|
16
|
+
/** @param {object} opts */
|
|
17
|
+
constructor(opts = {}) {
|
|
18
|
+
super(opts)
|
|
19
|
+
|
|
20
|
+
/** A function returning the color of a cell side.
|
|
21
|
+
* @type {function(Side, number, number, object):string} */
|
|
22
|
+
this.color = opts.color || ((side, resolution, z, sideViewScale) => '#EA6BAC')
|
|
23
|
+
|
|
24
|
+
/** A function returning the width of a cell side, in geo unit
|
|
25
|
+
* @type {function(Side, number, number, object):number} */
|
|
26
|
+
this.width = opts.width || ((side, resolution, z, sideViewScale) => resolution / 5)
|
|
27
|
+
|
|
28
|
+
/** A function returning the length of a cell side, in geo unit
|
|
29
|
+
* @type {function(Side, number, number, object):number} */
|
|
30
|
+
this.length = opts.length || ((side, resolution, z, sideViewScale) => resolution)
|
|
31
|
+
|
|
32
|
+
/** Set to A or true so that the side is drawn as a diamond */
|
|
33
|
+
this.diamond = opts.diamond
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {Array.<import("../core/Dataset").Cell>} cells
|
|
38
|
+
* @param {number} resolution
|
|
39
|
+
* @param {import("../core/GeoCanvas").GeoCanvas} geoCanvas
|
|
40
|
+
*/
|
|
41
|
+
draw(cells, geoCanvas, resolution) {
|
|
42
|
+
//filter
|
|
43
|
+
if (this.filter) cells = cells.filter(this.filter)
|
|
44
|
+
|
|
45
|
+
//
|
|
46
|
+
const z = geoCanvas.view.z
|
|
47
|
+
const ctx = geoCanvas.offscreenCtx
|
|
48
|
+
|
|
49
|
+
//build sides
|
|
50
|
+
|
|
51
|
+
/** @type {Array.<Side>} */
|
|
52
|
+
const sides = SideStyle.buildSides(cells, resolution)
|
|
53
|
+
if (sides.length == 0) return
|
|
54
|
+
|
|
55
|
+
//get side view scale
|
|
56
|
+
const viewScale = this.viewScale ? this.viewScale(sides, resolution, z) : undefined
|
|
57
|
+
|
|
58
|
+
//draw sides
|
|
59
|
+
|
|
60
|
+
ctx.lineCap = 'butt'
|
|
61
|
+
const r2 = resolution * 0.5
|
|
62
|
+
for (let side of sides) {
|
|
63
|
+
//color
|
|
64
|
+
/** @type {string|undefined} */
|
|
65
|
+
const col = this.color ? this.color(side, resolution, z, viewScale) : undefined
|
|
66
|
+
if (!col || col == 'none') continue
|
|
67
|
+
|
|
68
|
+
if (this.diamond) {
|
|
69
|
+
//set color
|
|
70
|
+
ctx.fillStyle = col
|
|
71
|
+
|
|
72
|
+
//draw diamond
|
|
73
|
+
const x = side.x,
|
|
74
|
+
y = side.y
|
|
75
|
+
ctx.beginPath()
|
|
76
|
+
ctx.moveTo(x - r2, y)
|
|
77
|
+
ctx.lineTo(x, y + r2)
|
|
78
|
+
ctx.lineTo(x + r2, y)
|
|
79
|
+
ctx.lineTo(x, y - r2)
|
|
80
|
+
ctx.closePath()
|
|
81
|
+
ctx.fill()
|
|
82
|
+
} else {
|
|
83
|
+
//width
|
|
84
|
+
/** @type {number|undefined} */
|
|
85
|
+
const wG = this.width ? this.width(side, resolution, z, viewScale) : undefined
|
|
86
|
+
if (!wG || wG <= 0) continue
|
|
87
|
+
|
|
88
|
+
//length
|
|
89
|
+
/** @type {number|undefined} */
|
|
90
|
+
const lG = this.length ? this.length(side, resolution, z, viewScale) : undefined
|
|
91
|
+
if (!lG || lG <= 0) continue
|
|
92
|
+
const lG2 = lG * 0.5
|
|
93
|
+
|
|
94
|
+
//set width
|
|
95
|
+
ctx.lineWidth = wG
|
|
96
|
+
//set color
|
|
97
|
+
ctx.strokeStyle = col
|
|
98
|
+
|
|
99
|
+
//draw segment with correct orientation
|
|
100
|
+
const x = side.x,
|
|
101
|
+
y = side.y
|
|
102
|
+
ctx.beginPath()
|
|
103
|
+
if (side.or === 'v') {
|
|
104
|
+
ctx.moveTo(x, y - lG2)
|
|
105
|
+
ctx.lineTo(x, y + lG2)
|
|
106
|
+
} else {
|
|
107
|
+
ctx.moveTo(x - lG2, y)
|
|
108
|
+
ctx.lineTo(x + lG2, y)
|
|
109
|
+
}
|
|
110
|
+
ctx.stroke()
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
//update legends
|
|
115
|
+
this.updateLegends({ style: this, resolution: resolution, z: z, viewScale: viewScale })
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
*
|
|
120
|
+
* @param {Array.<import('../core/Dataset').Cell>} cells The cells to use to build the sides.
|
|
121
|
+
* @param {number} resolution The cells resolution
|
|
122
|
+
* @param {boolean} withHorizontal Set to true to build horizontal sides, false otherwise.
|
|
123
|
+
* @param {boolean} withVertical Set to true to build vertical sides, false otherwise.
|
|
124
|
+
* @param {boolean} center Set to true so that the side coordinate are those of its center point rather than its left/bottom point (the side x,y coordinates are those of the left point for horizontal sides, and of the bottom point for vertical sides)
|
|
125
|
+
* @returns { Array.<Side> }
|
|
126
|
+
*/
|
|
127
|
+
static buildSides(cells, resolution, withHorizontal = true, withVertical = true, center = true, eps = 0.01) {
|
|
128
|
+
/** @type { Array.<Side> } */
|
|
129
|
+
const sides = []
|
|
130
|
+
|
|
131
|
+
// half resolution
|
|
132
|
+
const r2 = center ? resolution / 2 : 0
|
|
133
|
+
|
|
134
|
+
// epsilon
|
|
135
|
+
eps = resolution * eps
|
|
136
|
+
const abs = Math.abs
|
|
137
|
+
|
|
138
|
+
//make horizontal sides
|
|
139
|
+
//sort cells by x and y
|
|
140
|
+
cells.sort((c1, c2) => (c2.x == c1.x ? c1.y - c2.y : c1.x - c2.x))
|
|
141
|
+
let c1 = cells[0]
|
|
142
|
+
for (let i = 1; i < cells.length; i++) {
|
|
143
|
+
let c2 = cells[i]
|
|
144
|
+
|
|
145
|
+
if (abs(c1.y + resolution - c2.y) < eps && abs(c1.x - c2.x) < eps)
|
|
146
|
+
//cells in same column and touch along horizontal side
|
|
147
|
+
//make shared side
|
|
148
|
+
sides.push({
|
|
149
|
+
or: 'h',
|
|
150
|
+
x: c1.x + r2,
|
|
151
|
+
y: c2.y,
|
|
152
|
+
c1: c1,
|
|
153
|
+
c2: c2,
|
|
154
|
+
})
|
|
155
|
+
else {
|
|
156
|
+
//cells do not touch along horizontal side
|
|
157
|
+
//make two sides: top one for c1, bottom for c2
|
|
158
|
+
sides.push({
|
|
159
|
+
or: 'h',
|
|
160
|
+
x: c1.x + r2,
|
|
161
|
+
y: c1.y + resolution,
|
|
162
|
+
c1: c1,
|
|
163
|
+
c2: undefined,
|
|
164
|
+
})
|
|
165
|
+
sides.push({
|
|
166
|
+
or: 'h',
|
|
167
|
+
x: c2.x + r2,
|
|
168
|
+
y: c2.y,
|
|
169
|
+
c1: undefined,
|
|
170
|
+
c2: c2,
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
c1 = c2
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
//make vertical sides
|
|
178
|
+
//sort cells by y and x
|
|
179
|
+
cells.sort((c1, c2) => (c2.y == c1.y ? c1.x - c2.x : c1.y - c2.y))
|
|
180
|
+
c1 = cells[0]
|
|
181
|
+
for (let i = 1; i < cells.length; i++) {
|
|
182
|
+
let c2 = cells[i]
|
|
183
|
+
|
|
184
|
+
if (abs(c1.x + resolution - c2.x) < eps && abs(c1.y - c2.y) < eps)
|
|
185
|
+
//cells in same row and touch along vertical side
|
|
186
|
+
//make shared side
|
|
187
|
+
sides.push({
|
|
188
|
+
or: 'v',
|
|
189
|
+
x: c1.x + resolution,
|
|
190
|
+
y: c1.y + r2,
|
|
191
|
+
c1: c1,
|
|
192
|
+
c2: c2,
|
|
193
|
+
})
|
|
194
|
+
else {
|
|
195
|
+
//cells do not touch along vertical side
|
|
196
|
+
//make two sides: right one for c1, left for c2
|
|
197
|
+
sides.push({
|
|
198
|
+
or: 'v',
|
|
199
|
+
x: c1.x + resolution,
|
|
200
|
+
y: c1.y + r2,
|
|
201
|
+
c1: c1,
|
|
202
|
+
c2: undefined,
|
|
203
|
+
})
|
|
204
|
+
sides.push({
|
|
205
|
+
or: 'v',
|
|
206
|
+
x: c2.x,
|
|
207
|
+
y: c2.y + r2,
|
|
208
|
+
c1: undefined,
|
|
209
|
+
c2: c2,
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
c1 = c2
|
|
214
|
+
}
|
|
215
|
+
return sides
|
|
216
|
+
}
|
|
217
|
+
}
|