Move RBush typedefs out of src/ol/typedefs.js

This commit is contained in:
Frederic Junod
2018-03-22 17:13:48 +01:00
parent c34e7e2246
commit 48740f0026
3 changed files with 14 additions and 12 deletions
+1 -1
View File
@@ -502,7 +502,7 @@ CanvasReplay.prototype.renderDeclutter_ = function(declutterGroup, feature) {
if (declutterGroup && declutterGroup.length > 5) { if (declutterGroup && declutterGroup.length > 5) {
const groupCount = declutterGroup[4]; const groupCount = declutterGroup[4];
if (groupCount == 1 || groupCount == declutterGroup.length - 5) { if (groupCount == 1 || groupCount == declutterGroup.length - 5) {
/** @type {ol.RBushEntry} */ /** @type {module:ol/structs/RBush~Entry} */
const box = { const box = {
minX: /** @type {number} */ (declutterGroup[0]), minX: /** @type {number} */ (declutterGroup[0]),
minY: /** @type {number} */ (declutterGroup[1]), minY: /** @type {number} */ (declutterGroup[1]),
+13 -4
View File
@@ -6,6 +6,15 @@ import rbush from 'rbush';
import {createOrUpdate, equals} from '../extent.js'; import {createOrUpdate, equals} from '../extent.js';
import {isEmpty} from '../obj.js'; import {isEmpty} from '../obj.js';
/**
* @typedef {Object} Entry
* @property {number} minX
* @property {number} minY
* @property {number} maxX
* @property {number} maxY
* @property {Object} [value]
*/
/** /**
* Wrapper around the RBush by Vladimir Agafonkin. * Wrapper around the RBush by Vladimir Agafonkin.
* *
@@ -26,7 +35,7 @@ const RBush = function(opt_maxEntries) {
* A mapping between the objects added to this rbush wrapper * A mapping between the objects added to this rbush wrapper
* and the objects that are actually added to the internal rbush. * and the objects that are actually added to the internal rbush.
* @private * @private
* @type {Object.<number, ol.RBushEntry>} * @type {Object.<number, module:ol/structs/RBush~Entry>}
*/ */
this.items_ = {}; this.items_ = {};
@@ -39,7 +48,7 @@ const RBush = function(opt_maxEntries) {
* @param {T} value Value. * @param {T} value Value.
*/ */
RBush.prototype.insert = function(extent, value) { RBush.prototype.insert = function(extent, value) {
/** @type {ol.RBushEntry} */ /** @type {module:ol/structs/RBush~Entry} */
const item = { const item = {
minX: extent[0], minX: extent[0],
minY: extent[1], minY: extent[1],
@@ -64,7 +73,7 @@ RBush.prototype.load = function(extents, values) {
const extent = extents[i]; const extent = extents[i];
const value = values[i]; const value = values[i];
/** @type {ol.RBushEntry} */ /** @type {module:ol/structs/RBush~Entry} */
const item = { const item = {
minX: extent[0], minX: extent[0],
minY: extent[1], minY: extent[1],
@@ -128,7 +137,7 @@ RBush.prototype.getAll = function() {
* @return {Array.<T>} All in extent. * @return {Array.<T>} All in extent.
*/ */
RBush.prototype.getInExtent = function(extent) { RBush.prototype.getInExtent = function(extent) {
/** @type {ol.RBushEntry} */ /** @type {module:ol/structs/RBush~Entry} */
const bbox = { const bbox = {
minX: extent[0], minX: extent[0],
minY: extent[1], minY: extent[1],
-7
View File
@@ -353,10 +353,3 @@ ol.WFSFeatureCollectionMetadata;
* insertIds: Array.<string>}} * insertIds: Array.<string>}}
*/ */
ol.WFSTransactionResponse; ol.WFSTransactionResponse;
/**
* @typedef {{minX: number, minY: number, maxX: number, maxY: number,
* value: (Object|undefined)}}
*/
ol.RBushEntry;