geojs 1.6.2 → 1.6.6
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/.github/workflows/main.yml +1 -1
- package/.nvmrc +1 -0
- package/CHANGELOG.md +19 -1
- package/README.md +14 -9
- package/geo.js +821 -395
- package/geo.lean.js +820 -394
- package/geo.lean.min.js +3 -3
- package/geo.min.js +4 -4
- package/package.json +8 -10
- package/src/annotation.js +11 -7
- package/src/annotationLayer.js +13 -9
- package/src/camera.js +5 -5
- package/src/canvas/pixelmapFeature.js +187 -0
- package/src/choroplethFeature.js +1 -1
- package/src/domRenderer.js +2 -1
- package/src/featureLayer.js +1 -1
- package/src/fileReader.js +2 -2
- package/src/imageTile.js +2 -1
- package/src/isolineFeature.js +1 -1
- package/src/layer.js +4 -2
- package/src/lineFeature.js +3 -3
- package/src/map.js +17 -15
- package/src/mapInteractor.js +17 -17
- package/src/markerFeature.js +2 -2
- package/src/meshFeature.js +1 -1
- package/src/osmLayer.js +2 -0
- package/src/pixelmapFeature.js +52 -228
- package/src/pointFeature.js +1 -1
- package/src/polygonFeature.js +3 -3
- package/src/quadFeature.js +1 -1
- package/src/registry.js +2 -2
- package/src/svg/svgRenderer.js +3 -3
- package/src/tileCache.js +1 -1
- package/src/tileLayer.js +10 -10
- package/src/trackFeature.js +19 -19
- package/src/transform.js +8 -9
- package/src/typedef.js +2 -0
- package/src/ui/sliderWidget.js +1 -1
- package/src/util/clustering.js +3 -3
- package/src/util/color.js +1 -1
- package/src/util/common.js +7 -7
- package/src/util/throttle.js +1 -1
- package/src/vtkjs/pointFeature.js +1 -1
- package/src/webgl/index.js +2 -0
- package/src/webgl/lookupTable2D.js +122 -0
- package/src/webgl/markerFeature.js +1 -1
- package/src/webgl/pixelmapFeature.frag +47 -0
- package/src/webgl/pixelmapFeature.js +172 -0
- package/src/webgl/pointFeature.js +1 -1
- package/src/webgl/quadFeature.js +32 -1
- package/src/webgl/webglRenderer.js +1 -0
package/src/mapInteractor.js
CHANGED
|
@@ -2037,26 +2037,26 @@ var mapInteractor = function (args) {
|
|
|
2037
2037
|
* map in pixels relative to the map's div.
|
|
2038
2038
|
* @param {geo.screenPosition} [options.center] The position of a touch
|
|
2039
2039
|
* event center relative to the window.
|
|
2040
|
-
* @param {string} [button] One of `left`, `middle`, or `right` for
|
|
2041
|
-
* events.
|
|
2042
|
-
* @param {string} [modifiers] A space-separated list of metakeys
|
|
2043
|
-
* down on mouse events.
|
|
2044
|
-
* @param {geo.screenPosition} [wheelDelta] The amount the wheel
|
|
2045
|
-
* both directions for wheel events. One step is often 20 units
|
|
2046
|
-
*
|
|
2047
|
-
* @param {number} [wheelMode] The wheel delta mode. See
|
|
2040
|
+
* @param {string} [options.button] One of `left`, `middle`, or `right` for
|
|
2041
|
+
* mouse events.
|
|
2042
|
+
* @param {string} [options.modifiers] A space-separated list of metakeys
|
|
2043
|
+
* that are down on mouse events.
|
|
2044
|
+
* @param {geo.screenPosition} [options.wheelDelta] The amount the wheel
|
|
2045
|
+
* moved in both directions for wheel events. One step is often 20 units
|
|
2046
|
+
* of movement.
|
|
2047
|
+
* @param {number} [options.wheelMode] The wheel delta mode. See
|
|
2048
2048
|
* https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent .
|
|
2049
|
-
* @param {boolean} [touch] `truthy` if this is a touch event.
|
|
2050
|
-
* @param {number} [rotation] Touch event rotation in degrees.
|
|
2051
|
-
* @param {number} [scale] Touch event scale. Initial events should
|
|
2052
|
-
* scale of 1; subsequent events should increase or decrease this
|
|
2053
|
-
* simulate spread and pinch actions.
|
|
2054
|
-
* @param {number[]} [pointers] A list of pointer numbers involved in
|
|
2055
|
-
* touch event. Pointers are number from one up, so `[1]` is the first
|
|
2049
|
+
* @param {boolean} [options.touch] `truthy` if this is a touch event.
|
|
2050
|
+
* @param {number} [options.rotation] Touch event rotation in degrees.
|
|
2051
|
+
* @param {number} [options.scale] Touch event scale. Initial events should
|
|
2052
|
+
* have a scale of 1; subsequent events should increase or decrease this
|
|
2053
|
+
* to simulate spread and pinch actions.
|
|
2054
|
+
* @param {number[]} [options.pointers] A list of pointer numbers involved in
|
|
2055
|
+
* a touch event. Pointers are number from one up, so `[1]` is the first
|
|
2056
2056
|
* touch point, `[1, 2]` are two touch points, and `[2]` is when the first
|
|
2057
2057
|
* point was released but the second is still touching.
|
|
2058
|
-
* @param {string} [pointerType] `mouse` if this is a mouse action
|
|
2059
|
-
* than a touch action.
|
|
2058
|
+
* @param {string} [options.pointerType] `mouse` if this is a mouse action
|
|
2059
|
+
* rather than a touch action.
|
|
2060
2060
|
* @returns {mapInteractor}
|
|
2061
2061
|
*/
|
|
2062
2062
|
this.simulateEvent = function (type, options) {
|
package/src/markerFeature.js
CHANGED
|
@@ -442,7 +442,7 @@ markerFeature.primitiveShapes = pointFeature.primitiveShapes;
|
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
444
|
* Marker symbols
|
|
445
|
-
* @enum
|
|
445
|
+
* @enum {number}
|
|
446
446
|
*/
|
|
447
447
|
markerFeature.symbols = {
|
|
448
448
|
// for circle (alias ellipse), the symbolValue is the ratio of the minor to
|
|
@@ -499,7 +499,7 @@ markerFeature.symbols = {
|
|
|
499
499
|
|
|
500
500
|
/**
|
|
501
501
|
* Marker scale modes
|
|
502
|
-
* @enum
|
|
502
|
+
* @enum {number}
|
|
503
503
|
*/
|
|
504
504
|
markerFeature.scaleMode = {
|
|
505
505
|
none: 0,
|
package/src/meshFeature.js
CHANGED
|
@@ -21,7 +21,7 @@ var feature = require('./feature');
|
|
|
21
21
|
* of these properties can be functions, which get passed `data`.
|
|
22
22
|
*
|
|
23
23
|
* @typedef {object} geo.meshFeature.meshSpec
|
|
24
|
-
* @property {number[]|
|
|
24
|
+
* @property {number[]|Array.<number[]>} [elements] If specified, a list of
|
|
25
25
|
* indices into the data array that form elements. If this is an array of
|
|
26
26
|
* arrays, each subarray must have at least either 3 values for triangular
|
|
27
27
|
* elements or 4 values for square elements. If this is a single array,
|
package/src/osmLayer.js
CHANGED
|
@@ -13,6 +13,8 @@ var quadFeature = require('./quadFeature');
|
|
|
13
13
|
* specified, use this as the layer opacity.
|
|
14
14
|
* @property {string} [source] If specified, use the predefined tile source
|
|
15
15
|
* (see {@link geo.osmLayer.tileSources}).
|
|
16
|
+
* @property {string} [crossDomain='anonymous'] Image CORS attribute. This is
|
|
17
|
+
* used for the `crossorigin` property when loading images.
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
/**
|
package/src/pixelmapFeature.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
var $ = require('jquery');
|
|
2
2
|
var inherit = require('./inherit');
|
|
3
3
|
var feature = require('./feature');
|
|
4
|
-
var geo_event = require('./event');
|
|
5
4
|
var util = require('./util');
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -72,12 +71,8 @@ var pixelmapFeature = function (arg) {
|
|
|
72
71
|
* @private
|
|
73
72
|
*/
|
|
74
73
|
var m_this = this,
|
|
75
|
-
m_quadFeature,
|
|
76
|
-
m_srcImage,
|
|
77
|
-
m_info,
|
|
78
74
|
s_update = this._update,
|
|
79
|
-
s_init = this._init
|
|
80
|
-
s_exit = this._exit;
|
|
75
|
+
s_init = this._init;
|
|
81
76
|
|
|
82
77
|
this.featureType = 'pixelmap';
|
|
83
78
|
|
|
@@ -113,7 +108,7 @@ var pixelmapFeature = function (arg) {
|
|
|
113
108
|
if (val === undefined) {
|
|
114
109
|
return m_this.style('url');
|
|
115
110
|
} else if (val !== m_this.style('url')) {
|
|
116
|
-
m_srcImage = m_info = undefined;
|
|
111
|
+
m_this.m_srcImage = m_this.m_info = undefined;
|
|
117
112
|
m_this.style('url', val);
|
|
118
113
|
m_this.dataTime().modified();
|
|
119
114
|
m_this.modified();
|
|
@@ -121,28 +116,6 @@ var pixelmapFeature = function (arg) {
|
|
|
121
116
|
return m_this;
|
|
122
117
|
};
|
|
123
118
|
|
|
124
|
-
/**
|
|
125
|
-
* Get the maximum index value from the pixelmap. This is a value present in
|
|
126
|
-
* the pixelmap.
|
|
127
|
-
*
|
|
128
|
-
* @returns {number} The maximum index value.
|
|
129
|
-
*/
|
|
130
|
-
this.maxIndex = function () {
|
|
131
|
-
if (m_info) {
|
|
132
|
-
/* This isn't just m_info.mappedColors.length - 1, since there
|
|
133
|
-
* may be more data than actual indices. */
|
|
134
|
-
if (m_info.maxIndex === undefined) {
|
|
135
|
-
m_info.maxIndex = 0;
|
|
136
|
-
for (var idx in m_info.mappedColors) {
|
|
137
|
-
if (m_info.mappedColors.hasOwnProperty(idx)) {
|
|
138
|
-
m_info.maxIndex = Math.max(m_info.maxIndex, idx);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return m_info.maxIndex;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
119
|
/**
|
|
147
120
|
* Get/Set color accessor.
|
|
148
121
|
*
|
|
@@ -162,35 +135,51 @@ var pixelmapFeature = function (arg) {
|
|
|
162
135
|
};
|
|
163
136
|
|
|
164
137
|
/**
|
|
165
|
-
*
|
|
166
|
-
* information from the quad to determine the pixelmap index value so that it
|
|
167
|
-
* can be included in the `found` results.
|
|
138
|
+
* Update.
|
|
168
139
|
*
|
|
169
|
-
* @
|
|
170
|
-
* @param {string|geo.transform|null} [gcs] Input gcs. `undefined` to use
|
|
171
|
-
* the interface gcs, `null` to use the map gcs, or any other transform.
|
|
172
|
-
* @returns {geo.feature.searchResult} An object with a list of features and
|
|
173
|
-
* feature indices that are located at the specified point.
|
|
140
|
+
* @returns {this}
|
|
174
141
|
*/
|
|
175
|
-
this.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
142
|
+
this._update = function () {
|
|
143
|
+
s_update.call(m_this);
|
|
144
|
+
if (m_this.buildTime().timestamp() <= m_this.dataTime().timestamp() ||
|
|
145
|
+
m_this.updateTime().timestamp() < m_this.timestamp()) {
|
|
146
|
+
m_this._build();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
m_this.updateTime().modified();
|
|
150
|
+
return m_this;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Get the maximum index value from the pixelmap. This is a value present in
|
|
155
|
+
* the pixelmap.
|
|
156
|
+
*
|
|
157
|
+
* @returns {number} The maximum index value.
|
|
158
|
+
*/
|
|
159
|
+
this.maxIndex = function () {
|
|
160
|
+
if (m_this.m_info) {
|
|
161
|
+
/* This isn't just m_info.mappedColors.length - 1, since there
|
|
162
|
+
* may be more data than actual indices. */
|
|
163
|
+
if (m_this.m_info.maxIndex === undefined) {
|
|
164
|
+
m_this.m_info.maxIndex = 0;
|
|
165
|
+
for (var idx in m_this.m_info.mappedColors) {
|
|
166
|
+
if (m_this.m_info.mappedColors.hasOwnProperty(idx)) {
|
|
167
|
+
m_this.m_info.maxIndex = Math.max(m_this.m_info.maxIndex, idx);
|
|
168
|
+
}
|
|
190
169
|
}
|
|
191
170
|
}
|
|
171
|
+
return m_this.m_info.maxIndex;
|
|
192
172
|
}
|
|
193
|
-
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Given the loaded pixelmap image, create a canvas the size of the image.
|
|
177
|
+
* Compute a color for each distinct index and recolor the canvas based on
|
|
178
|
+
* these colors, then draw the resultant image as a quad.
|
|
179
|
+
*
|
|
180
|
+
* @fires geo.event.pixelmap.prepared
|
|
181
|
+
*/
|
|
182
|
+
this._computePixelmap = function () {
|
|
194
183
|
};
|
|
195
184
|
|
|
196
185
|
/**
|
|
@@ -204,42 +193,42 @@ var pixelmapFeature = function (arg) {
|
|
|
204
193
|
* checks if this feature is built. Setting the build time avoids calling
|
|
205
194
|
* this a second time. */
|
|
206
195
|
m_this.buildTime().modified();
|
|
207
|
-
if (!m_srcImage) {
|
|
196
|
+
if (!m_this.m_srcImage) {
|
|
208
197
|
var src = m_this.style.get('url')();
|
|
209
198
|
if (util.isReadyImage(src)) {
|
|
210
199
|
/* we have an already loaded image, so we can just use it. */
|
|
211
|
-
m_srcImage = src;
|
|
200
|
+
m_this.m_srcImage = src;
|
|
212
201
|
m_this._computePixelmap();
|
|
213
202
|
} else if (src) {
|
|
214
203
|
var defer = $.Deferred(), prev_onload, prev_onerror;
|
|
215
204
|
if (src instanceof Image) {
|
|
216
205
|
/* we have an unloaded image. Hook to the load and error callbacks
|
|
217
206
|
* so that when it is loaded we can use it. */
|
|
218
|
-
m_srcImage = src;
|
|
207
|
+
m_this.m_srcImage = src;
|
|
219
208
|
prev_onload = src.onload;
|
|
220
209
|
prev_onerror = src.onerror;
|
|
221
210
|
} else {
|
|
222
211
|
/* we were given a url, so construct a new image */
|
|
223
|
-
m_srcImage = new Image();
|
|
212
|
+
m_this.m_srcImage = new Image();
|
|
224
213
|
// Only set the crossOrigin parameter if this is going across origins.
|
|
225
214
|
if (src.indexOf(':') >= 0 &&
|
|
226
215
|
src.indexOf('/') === src.indexOf(':') + 1) {
|
|
227
|
-
m_srcImage.crossOrigin = m_this.style.get('crossDomain')() || 'anonymous';
|
|
216
|
+
m_this.m_srcImage.crossOrigin = m_this.style.get('crossDomain')() || 'anonymous';
|
|
228
217
|
}
|
|
229
218
|
}
|
|
230
|
-
m_srcImage.onload = function () {
|
|
219
|
+
m_this.m_srcImage.onload = function () {
|
|
231
220
|
if (prev_onload) {
|
|
232
221
|
prev_onload.apply(m_this, arguments);
|
|
233
222
|
}
|
|
234
223
|
/* Only use this image if our pixelmap hasn't changed since we
|
|
235
224
|
* attached our handler */
|
|
236
225
|
if (m_this.style.get('url')() === src) {
|
|
237
|
-
m_info = undefined;
|
|
226
|
+
m_this.m_info = undefined;
|
|
238
227
|
m_this._computePixelmap();
|
|
239
228
|
}
|
|
240
229
|
defer.resolve();
|
|
241
230
|
};
|
|
242
|
-
m_srcImage.onerror = function () {
|
|
231
|
+
m_this.m_srcImage.onerror = function () {
|
|
243
232
|
if (prev_onerror) {
|
|
244
233
|
prev_onerror.apply(m_this, arguments);
|
|
245
234
|
}
|
|
@@ -248,180 +237,15 @@ var pixelmapFeature = function (arg) {
|
|
|
248
237
|
defer.promise(m_this);
|
|
249
238
|
m_this.layer().addPromise(m_this);
|
|
250
239
|
if (!(src instanceof Image)) {
|
|
251
|
-
m_srcImage.src = src;
|
|
240
|
+
m_this.m_srcImage.src = src;
|
|
252
241
|
}
|
|
253
242
|
}
|
|
254
|
-
} else if (m_info) {
|
|
243
|
+
} else if (m_this.m_info) {
|
|
255
244
|
m_this._computePixelmap();
|
|
256
245
|
}
|
|
257
246
|
return m_this;
|
|
258
247
|
};
|
|
259
248
|
|
|
260
|
-
/**
|
|
261
|
-
* Compute information for this pixelmap image. It is wasteful to call this
|
|
262
|
-
* if the pixelmap has already been prepared (it is invalidated by a change
|
|
263
|
-
* in the image).
|
|
264
|
-
*
|
|
265
|
-
* @returns {geo.pixelmapFeature.info}
|
|
266
|
-
*/
|
|
267
|
-
this._preparePixelmap = function () {
|
|
268
|
-
var i, idx, pixelData;
|
|
269
|
-
|
|
270
|
-
if (!util.isReadyImage(m_srcImage)) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
m_info = {
|
|
274
|
-
width: m_srcImage.naturalWidth,
|
|
275
|
-
height: m_srcImage.naturalHeight,
|
|
276
|
-
canvas: document.createElement('canvas')
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
m_info.canvas.width = m_info.width;
|
|
280
|
-
m_info.canvas.height = m_info.height;
|
|
281
|
-
m_info.context = m_info.canvas.getContext('2d');
|
|
282
|
-
|
|
283
|
-
m_info.context.drawImage(m_srcImage, 0, 0);
|
|
284
|
-
m_info.imageData = m_info.context.getImageData(
|
|
285
|
-
0, 0, m_info.canvas.width, m_info.canvas.height);
|
|
286
|
-
pixelData = m_info.imageData.data;
|
|
287
|
-
m_info.indices = new Array(pixelData.length / 4);
|
|
288
|
-
m_info.area = pixelData.length / 4;
|
|
289
|
-
|
|
290
|
-
m_info.mappedColors = {};
|
|
291
|
-
for (i = 0; i < pixelData.length; i += 4) {
|
|
292
|
-
idx = pixelData[i] + (pixelData[i + 1] << 8) + (pixelData[i + 2] << 16);
|
|
293
|
-
m_info.indices[i / 4] = idx;
|
|
294
|
-
if (!m_info.mappedColors[idx]) {
|
|
295
|
-
m_info.mappedColors[idx] = {first: i / 4};
|
|
296
|
-
}
|
|
297
|
-
m_info.mappedColors[idx].last = i / 4;
|
|
298
|
-
}
|
|
299
|
-
return m_info;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Given the loaded pixelmap image, create a canvas the size of the image.
|
|
304
|
-
* Compute a color for each distinct index and recolor the canvas based on
|
|
305
|
-
* these colors, then draw the resultant image as a quad.
|
|
306
|
-
*
|
|
307
|
-
* @fires geo.event.pixelmap.prepared
|
|
308
|
-
*/
|
|
309
|
-
this._computePixelmap = function () {
|
|
310
|
-
var data = m_this.data() || [],
|
|
311
|
-
colorFunc = m_this.style.get('color'),
|
|
312
|
-
i, idx, lastidx, color, pixelData, indices, mappedColors,
|
|
313
|
-
updateFirst, updateLast = -1, update, prepared;
|
|
314
|
-
|
|
315
|
-
if (!m_info) {
|
|
316
|
-
if (!m_this._preparePixelmap()) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
prepared = true;
|
|
320
|
-
}
|
|
321
|
-
mappedColors = m_info.mappedColors;
|
|
322
|
-
updateFirst = m_info.area;
|
|
323
|
-
for (idx in mappedColors) {
|
|
324
|
-
if (mappedColors.hasOwnProperty(idx)) {
|
|
325
|
-
color = colorFunc(data[idx], +idx) || {};
|
|
326
|
-
color = [
|
|
327
|
-
(color.r || 0) * 255,
|
|
328
|
-
(color.g || 0) * 255,
|
|
329
|
-
(color.b || 0) * 255,
|
|
330
|
-
color.a === undefined ? 255 : (color.a * 255)
|
|
331
|
-
];
|
|
332
|
-
mappedColors[idx].update = (
|
|
333
|
-
!mappedColors[idx].color ||
|
|
334
|
-
mappedColors[idx].color[0] !== color[0] ||
|
|
335
|
-
mappedColors[idx].color[1] !== color[1] ||
|
|
336
|
-
mappedColors[idx].color[2] !== color[2] ||
|
|
337
|
-
mappedColors[idx].color[3] !== color[3]);
|
|
338
|
-
if (mappedColors[idx].update) {
|
|
339
|
-
mappedColors[idx].color = color;
|
|
340
|
-
updateFirst = Math.min(mappedColors[idx].first, updateFirst);
|
|
341
|
-
updateLast = Math.max(mappedColors[idx].last, updateLast);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
/* If nothing was updated, we are done */
|
|
346
|
-
if (updateFirst >= updateLast) {
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
/* Update only the extent that has changed */
|
|
350
|
-
pixelData = m_info.imageData.data;
|
|
351
|
-
indices = m_info.indices;
|
|
352
|
-
for (i = updateFirst; i <= updateLast; i += 1) {
|
|
353
|
-
idx = indices[i];
|
|
354
|
-
if (idx !== lastidx) {
|
|
355
|
-
lastidx = idx;
|
|
356
|
-
color = mappedColors[idx].color;
|
|
357
|
-
update = mappedColors[idx].update;
|
|
358
|
-
}
|
|
359
|
-
if (update) {
|
|
360
|
-
pixelData[i * 4] = color[0];
|
|
361
|
-
pixelData[i * 4 + 1] = color[1];
|
|
362
|
-
pixelData[i * 4 + 2] = color[2];
|
|
363
|
-
pixelData[i * 4 + 3] = color[3];
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
/* Place the updated area into the canvas */
|
|
367
|
-
m_info.context.putImageData(
|
|
368
|
-
m_info.imageData, 0, 0, 0, Math.floor(updateFirst / m_info.width),
|
|
369
|
-
m_info.width, Math.ceil((updateLast + 1) / m_info.width));
|
|
370
|
-
|
|
371
|
-
/* If we haven't made a quad feature, make one now. The quad feature needs
|
|
372
|
-
* to have the canvas capability. */
|
|
373
|
-
if (!m_quadFeature) {
|
|
374
|
-
m_quadFeature = m_this.layer().createFeature('quad', {
|
|
375
|
-
selectionAPI: false,
|
|
376
|
-
gcs: m_this.gcs(),
|
|
377
|
-
visible: m_this.visible(undefined, true)
|
|
378
|
-
});
|
|
379
|
-
m_this.dependentFeatures([m_quadFeature]);
|
|
380
|
-
m_quadFeature.style({
|
|
381
|
-
image: m_info.canvas,
|
|
382
|
-
position: m_this.style.get('position')})
|
|
383
|
-
.data([{}])
|
|
384
|
-
.draw();
|
|
385
|
-
}
|
|
386
|
-
/* If we prepared the pixelmap and rendered it, send a prepared event */
|
|
387
|
-
if (prepared) {
|
|
388
|
-
m_this.geoTrigger(geo_event.pixelmap.prepared, {
|
|
389
|
-
pixelmap: m_this
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Update.
|
|
396
|
-
*
|
|
397
|
-
* @returns {this}
|
|
398
|
-
*/
|
|
399
|
-
this._update = function () {
|
|
400
|
-
s_update.call(m_this);
|
|
401
|
-
if (m_this.buildTime().timestamp() <= m_this.dataTime().timestamp() ||
|
|
402
|
-
m_this.updateTime().timestamp() < m_this.timestamp()) {
|
|
403
|
-
m_this._build();
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
m_this.updateTime().modified();
|
|
407
|
-
return m_this;
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Destroy. Deletes the associated quadFeature.
|
|
412
|
-
*
|
|
413
|
-
* @returns {this}
|
|
414
|
-
*/
|
|
415
|
-
this._exit = function () {
|
|
416
|
-
if (m_quadFeature && m_this.layer()) {
|
|
417
|
-
m_this.layer().deleteFeature(m_quadFeature);
|
|
418
|
-
m_quadFeature = null;
|
|
419
|
-
m_this.dependentFeatures([]);
|
|
420
|
-
}
|
|
421
|
-
s_exit();
|
|
422
|
-
return m_this;
|
|
423
|
-
};
|
|
424
|
-
|
|
425
249
|
/**
|
|
426
250
|
* Initialize.
|
|
427
251
|
*
|
package/src/pointFeature.js
CHANGED
package/src/polygonFeature.js
CHANGED
|
@@ -565,9 +565,9 @@ var polygonFeature = function (arg) {
|
|
|
565
565
|
*
|
|
566
566
|
* @param {array} data A new data array.
|
|
567
567
|
* @param {number} [tolerance] The maximum variation allowed in map.gcs
|
|
568
|
-
* units. A value of zero will only remove perfectly
|
|
569
|
-
* not specified, this is set to a half display pixel at the map's
|
|
570
|
-
* zoom level.
|
|
568
|
+
* units. A value of zero will only remove perfectly collinear points.
|
|
569
|
+
* If not specified, this is set to a half display pixel at the map's
|
|
570
|
+
* current zoom level.
|
|
571
571
|
* @param {function} [posFunc=this.style.get('position')] The function to
|
|
572
572
|
* get the position of each vertex.
|
|
573
573
|
* @param {function} [polyFunc=this.style.get('polygon')] The function to
|
package/src/quadFeature.js
CHANGED
package/src/registry.js
CHANGED
|
@@ -60,7 +60,7 @@ util.registerRenderer = function (name, func) {
|
|
|
60
60
|
* @param {geo.layer} layer The layer associated with the renderer.
|
|
61
61
|
* @param {HTMLCanvasElement} [canvas] A canvas object to share between
|
|
62
62
|
* renderers.
|
|
63
|
-
* @param {object} options Options for the new renderer.
|
|
63
|
+
* @param {object} [options] Options for the new renderer.
|
|
64
64
|
* @returns {geo.renderer|null} The new renderer or null if no such name is
|
|
65
65
|
* registered.
|
|
66
66
|
*/
|
|
@@ -83,7 +83,7 @@ util.createRenderer = function (name, layer, canvas, options) {
|
|
|
83
83
|
*
|
|
84
84
|
* @alias geo.checkRenderer
|
|
85
85
|
* @param {string|null} name Name of the desired renderer.
|
|
86
|
-
* @param {boolean} noFallback If truthy, don't recommend a fallback.
|
|
86
|
+
* @param {boolean} [noFallback] If truthy, don't recommend a fallback.
|
|
87
87
|
* @returns {string|null|false} The name of the renderer that should be used
|
|
88
88
|
* or false if no valid renderer can be determined.
|
|
89
89
|
*/
|
package/src/svg/svgRenderer.js
CHANGED
|
@@ -484,10 +484,10 @@ var svgRenderer = function (arg) {
|
|
|
484
484
|
* Create a new feature element from an object that describes the feature
|
|
485
485
|
* attributes. To be called from feature classes only.
|
|
486
486
|
*
|
|
487
|
-
* @param {object} arg
|
|
487
|
+
* @param {object} arg
|
|
488
488
|
* @param {string} arg.id A unique string identifying the feature.
|
|
489
489
|
* @param {array} arg.data Array of data objects used in a d3 data method.
|
|
490
|
-
* @param {function} [
|
|
490
|
+
* @param {function} [arg.dataIndex] A function that returns a unique id for
|
|
491
491
|
* each data element. This is passed to the data access function.
|
|
492
492
|
* @param {object} arg.style An object with style values or functions.
|
|
493
493
|
* @param {object} arg.attributes An object containing element attributes.
|
|
@@ -500,7 +500,7 @@ var svgRenderer = function (arg) {
|
|
|
500
500
|
* attributes and styles set when new. If falsy, features always have
|
|
501
501
|
* attributes and styles updated.
|
|
502
502
|
* @param {boolean} [arg.sortByZ] If truthy, sort features by the `d.zIndex`.
|
|
503
|
-
* @param {string} [parentId] If set, the group ID of the parent element.
|
|
503
|
+
* @param {string} [arg.parentId] If set, the group ID of the parent element.
|
|
504
504
|
* @returns {this}
|
|
505
505
|
*/
|
|
506
506
|
this._drawFeatures = function (arg) {
|
package/src/tileCache.js
CHANGED
|
@@ -55,7 +55,7 @@ var tileCache = function (options) {
|
|
|
55
55
|
* Remove a tile from the cache.
|
|
56
56
|
*
|
|
57
57
|
* @param {string|geo.tile} tile The tile or its hash.
|
|
58
|
-
* @returns {
|
|
58
|
+
* @returns {boolean} `true` if a tile was removed.
|
|
59
59
|
*/
|
|
60
60
|
this.remove = function (tile) {
|
|
61
61
|
var hash = typeof tile === 'string' ? tile : tile.toString();
|
package/src/tileLayer.js
CHANGED
|
@@ -525,7 +525,7 @@ var tileLayer = function (arg) {
|
|
|
525
525
|
/**
|
|
526
526
|
* Returns a tile's bounds in a gcs.
|
|
527
527
|
*
|
|
528
|
-
* @param {object|tile} indexOrTile Either a tile or an object with
|
|
528
|
+
* @param {object|geo.tile} indexOrTile Either a tile or an object with
|
|
529
529
|
* {x, y, level}` specifying a tile.
|
|
530
530
|
* @param {string|geo.transform|null} [gcs] `undefined` to use the
|
|
531
531
|
* interface gcs, `null` to use the map gcs, or any other transform.
|
|
@@ -668,7 +668,7 @@ var tileLayer = function (arg) {
|
|
|
668
668
|
* @param {number} maxLevel The zoom level
|
|
669
669
|
* @param {geo.geoBounds} bounds The map bounds
|
|
670
670
|
* @param {boolean} sorted Return a sorted list
|
|
671
|
-
* @param {boolean} onlyIfChanged If the set of tiles have not changed
|
|
671
|
+
* @param {boolean} [onlyIfChanged] If the set of tiles have not changed
|
|
672
672
|
* (even if their desired order has), return undefined instead of an
|
|
673
673
|
* array of tiles.
|
|
674
674
|
* @returns {geo.tile[]} An array of tile objects
|
|
@@ -1134,7 +1134,7 @@ var tileLayer = function (arg) {
|
|
|
1134
1134
|
* origin.
|
|
1135
1135
|
*
|
|
1136
1136
|
* @param {object} pt A point in world space coordinates with `x` and `y`.
|
|
1137
|
-
* @param {number
|
|
1137
|
+
* @param {number} [zoom] If unspecified, use the map zoom.
|
|
1138
1138
|
* @returns {object} Local coordinates with `x` and `y`.
|
|
1139
1139
|
*/
|
|
1140
1140
|
this.toLocal = function (pt, zoom) {
|
|
@@ -1180,7 +1180,7 @@ var tileLayer = function (arg) {
|
|
|
1180
1180
|
* create the element if it doesn't already exist.
|
|
1181
1181
|
*
|
|
1182
1182
|
* @param {number} level The zoom level of the layer to fetch.
|
|
1183
|
-
* @returns {
|
|
1183
|
+
* @returns {HTMLElement} The layer's DOM element.
|
|
1184
1184
|
*/
|
|
1185
1185
|
this._getSubLayer = function (level) {
|
|
1186
1186
|
if (!m_this.canvas()) {
|
|
@@ -1512,8 +1512,8 @@ var tileLayer = function (arg) {
|
|
|
1512
1512
|
* @param {geo.geoBounds} [bounds] The view bounds (if unspecified, assume
|
|
1513
1513
|
* global bounds)
|
|
1514
1514
|
* @param {number} bounds.level The zoom level the bounds are given as.
|
|
1515
|
-
* @param {number} zoom Keep in bound tile at this zoom level.
|
|
1516
|
-
* @param {boolean} doneLoading If true, allow purging additional tiles.
|
|
1515
|
+
* @param {number} [zoom] Keep in bound tile at this zoom level.
|
|
1516
|
+
* @param {boolean} [doneLoading] If true, allow purging additional tiles.
|
|
1517
1517
|
* @returns {boolean}
|
|
1518
1518
|
*/
|
|
1519
1519
|
this._canPurge = function (tile, bounds, zoom, doneLoading) {
|
|
@@ -1604,9 +1604,9 @@ var tileLayer = function (arg) {
|
|
|
1604
1604
|
/**
|
|
1605
1605
|
* Get or set the subdomains used for templating.
|
|
1606
1606
|
*
|
|
1607
|
-
* @param {string|
|
|
1607
|
+
* @param {string|string[]} [subdomains] A comma-separated list, a string of
|
|
1608
1608
|
* single character subdomains, or a list.
|
|
1609
|
-
* @returns {string|
|
|
1609
|
+
* @returns {string|string[]|this}
|
|
1610
1610
|
*/
|
|
1611
1611
|
this.subdomains = function (subdomains) {
|
|
1612
1612
|
if (subdomains === undefined) {
|
|
@@ -1644,8 +1644,8 @@ var tileLayer = function (arg) {
|
|
|
1644
1644
|
/**
|
|
1645
1645
|
* Get/Set visibility of the layer.
|
|
1646
1646
|
*
|
|
1647
|
-
* @param {boolean
|
|
1648
|
-
*
|
|
1647
|
+
* @param {boolean} [val] If unspecified, return the visibility, otherwise
|
|
1648
|
+
* set it.
|
|
1649
1649
|
* @returns {boolean|this} Either the visibility (if getting) or the layer
|
|
1650
1650
|
* (if setting).
|
|
1651
1651
|
*/
|