From 121d220438727b84cddf9dd5811fa3111aa88e09 Mon Sep 17 00:00:00 2001 From: m-schuetz Date: Thu, 12 Jul 2018 15:54:09 +0200 Subject: [PATCH] spaces to tabs; promises to fetch/async/await; update dependencies --- build/potree/potree.js | 512 +++++++++++++++++------------------ package-lock.json | 284 ++++++++++--------- package.json | 11 +- src/PointCloudEptGeometry.js | 458 +++++++++++++++---------------- src/loader/EptLoader.js | 54 +--- 5 files changed, 652 insertions(+), 667 deletions(-) diff --git a/build/potree/potree.js b/build/potree/potree.js index 6b8fb483..072a33f1 100644 --- a/build/potree/potree.js +++ b/build/potree/potree.js @@ -4878,50 +4878,26 @@ Potree.GreyhoundLoader.createChildAABB = function (aabb, childIndex) { }; /** - * @class Loads mno files and returns a PointcloudOctree - * for a description of the mno binary file format, read mnoFileFormat.txt - * - * @author Markus Schuetz + * @author Connor Manning */ -class EptUtils { - static get(url) { - return new Promise((resolve, reject) => { - let xhr = Potree.XHRFactory.createXMLHttpRequest(); - xhr.open('GET', url, true); - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - if (xhr.status === 200 || xhr.status === 0) { - resolve(xhr.responseText); - } - else { - reject(xhr.responseText); - } - } - }; - xhr.send(null); - }); - } - - static getJson(url) { - return EptUtils.get(url).then((data) => JSON.parse(data)); - } -}; - Potree.EptLoader = class { - static load(file, callback) { - EptUtils.getJson(file) - .then((info) => { - let url = file.substr(0, file.lastIndexOf('entwine.json')); - let geometry = new Potree.PointCloudEptGeometry(url, info); - let root = new Potree.PointCloudEptGeometryNode(geometry); - geometry.root = root; - geometry.root.load(); + static async load(file, callback) { + + let response = await fetch(file); + let json = await response.json(); + + let url = file.substr(0, file.lastIndexOf('entwine.json')); + let geometry = new Potree.PointCloudEptGeometry(url, json); + let root = new Potree.PointCloudEptGeometryNode(geometry); + + geometry.root = root; + geometry.root.load(); + + callback(geometry); + } - callback(geometry); - }); - } }; @@ -11426,301 +11402,303 @@ Potree.PointCloudGreyhoundGeometryNode.prototype.dispose = function () { Object.assign(Potree.PointCloudGreyhoundGeometryNode.prototype, THREE.EventDispatcher.prototype); var toVector3 = function(v, offset) { - return new THREE.Vector3().fromArray(v, offset || 0); + return new THREE.Vector3().fromArray(v, offset || 0); } var toBox3 = function(b) { - return new THREE.Box3(this.toVector3(b), this.toVector3(b, 3)); + return new THREE.Box3(this.toVector3(b), this.toVector3(b, 3)); }; var toArray = function(b) { - return [b.min.x, b.min.y, b.min.z, b.max.x, b.max.y, b.max.z]; + return [b.min.x, b.min.y, b.min.z, b.max.x, b.max.y, b.max.z]; } Potree.PointCloudEptGeometry = class { - constructor(url, info) { - let version = info.version; - let schema = info.schema; - let bounds = info.bounds; - let boundsConforming = info.boundsConforming; + constructor(url, info) { + let version = info.version; + let schema = info.schema; + let bounds = info.bounds; + let boundsConforming = info.boundsConforming; - // TODO This is unused. - let offset = info.offset || [0, 0, 0]; - let scale = info.scale || 0.01; - if (Array.isArray(scale)) { - scale = Math.min(scale[0], scale[1], scale[2]); - } + // TODO This is unused. + let offset = info.offset || [0, 0, 0]; + let scale = info.scale || 0.01; + if (Array.isArray(scale)) { + scale = Math.min(scale[0], scale[1], scale[2]); + } - let dataStorage = info.dataStorage || 'laz'; - let hierarchyStorage = info.hierarchyStorage || 'json'; + let dataStorage = info.dataStorage || 'laz'; + let hierarchyStorage = info.hierarchyStorage || 'json'; - // Now convert to three.js types. - bounds = toBox3(bounds); - boundsConforming = toBox3(boundsConforming); - offset = toVector3(offset); // TODO - offset = bounds.min.clone(); - offset = toVector3([0, 0, 0]); // TODO + // Now convert to three.js types. + bounds = toBox3(bounds); + boundsConforming = toBox3(boundsConforming); + offset = toVector3(offset); // TODO + offset = bounds.min.clone(); + offset = toVector3([0, 0, 0]); // TODO - bounds.min.sub(offset); - bounds.max.sub(offset); - boundsConforming.min.sub(offset); - boundsConforming.max.sub(offset); + bounds.min.sub(offset); + bounds.max.sub(offset); + boundsConforming.min.sub(offset); + boundsConforming.max.sub(offset); - this.url = url; - this.info = info; + this.url = url; + this.info = info; - this.ticks = info.ticks; - this.boundingBox = bounds; - this.offset = offset; - this.tightBoundingBox = boundsConforming; - this.boundingSphere = this.boundingBox.getBoundingSphere(); - this.tightBoundingSphere = this.tightBoundingBox.getBoundingSphere(); - this.version = new Potree.Version('1.6'); + this.ticks = info.ticks; + this.boundingBox = bounds; + this.offset = offset; + this.tightBoundingBox = boundsConforming; + this.boundingSphere = this.boundingBox.getBoundingSphere(); + this.tightBoundingSphere = this.tightBoundingBox.getBoundingSphere(); + this.version = new Potree.Version('1.6'); - this.projection = info.srs; - this.pointAttributes = 'LAZ'; - this.spacing = - (this.boundingBox.max.x - this.boundingBox.min.x) / this.ticks; + this.projection = info.srs; + this.pointAttributes = 'LAZ'; + this.spacing = + (this.boundingBox.max.x - this.boundingBox.min.x) / this.ticks; - // TODO Switch on storage type. - this.loader = new Potree.EptLazLoader(); - this.hierarchyStep = info.hierarchyStep || 0; - } + // TODO Switch on storage type. + this.loader = new Potree.EptLazLoader(); + this.hierarchyStep = info.hierarchyStep || 0; + } }; Potree.EptKey = class { - constructor(ept, b, d, x, y, z) { - this.ept = ept; - this.b = b; - this.d = d; - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } + constructor(ept, b, d, x, y, z) { + this.ept = ept; + this.b = b; + this.d = d; + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } - name() { - return this.d + '-' + this.x + '-' + this.y + '-' + this.z; - } + name() { + return this.d + '-' + this.x + '-' + this.y + '-' + this.z; + } - step(a, b, c) { - let min = this.b.min.clone(); - let max = this.b.max.clone(); - let dst = new THREE.Vector3().subVectors(max, min); + step(a, b, c) { + let min = this.b.min.clone(); + let max = this.b.max.clone(); + let dst = new THREE.Vector3().subVectors(max, min); - if (a) min.x += dst.x / 2; - else max.x -= dst.x / 2; + if (a) min.x += dst.x / 2; + else max.x -= dst.x / 2; - if (b) min.y += dst.y / 2; - else max.y -= dst.y / 2; + if (b) min.y += dst.y / 2; + else max.y -= dst.y / 2; - if (c) min.z += dst.z / 2; - else max.z -= dst.z / 2; + if (c) min.z += dst.z / 2; + else max.z -= dst.z / 2; - return new Potree.EptKey( - this.ept, - new THREE.Box3(min, max), - this.d + 1, - this.x * 2 + a, - this.y * 2 + b, - this.z * 2 + c); - } + return new Potree.EptKey( + this.ept, + new THREE.Box3(min, max), + this.d + 1, + this.x * 2 + a, + this.y * 2 + b, + this.z * 2 + c); + } - children() { - var result = []; - for (var a = 0; a < 2; ++a) { - for (var b = 0; b < 2; ++b) { - for (var c = 0; c < 2; ++c) { - var add = this.step(a, b, c).name(); - if (!result.includes(add)) result = result.concat(add); - } - } - } - return result; - } + children() { + var result = []; + for (var a = 0; a < 2; ++a) { + for (var b = 0; b < 2; ++b) { + for (var c = 0; c < 2; ++c) { + var add = this.step(a, b, c).name(); + if (!result.includes(add)) result = result.concat(add); + } + } + } + return result; + } } Potree.PointCloudEptGeometryNode = class extends Potree.PointCloudTreeNode { - constructor(ept, b, d, x, y, z) { - super(); + constructor(ept, b, d, x, y, z) { + super(); - this.ept = ept; - this.key = new Potree.EptKey( - this.ept, - b || this.ept.boundingBox, - d || 0, - x, - y, - z); + this.ept = ept; + this.key = new Potree.EptKey( + this.ept, + b || this.ept.boundingBox, + d || 0, + x, + y, + z); - this.id = Potree.PointCloudEptGeometryNode.NextId++; - this.geometry = null; - this.boundingBox = this.key.b; - this.tightBoundingBox = this.boundingBox; - this.spacing = this.ept.spacing / Math.pow(2, this.key.d); - this.boundingSphere = this.boundingBox.getBoundingSphere(); + this.id = Potree.PointCloudEptGeometryNode.NextId++; + this.geometry = null; + this.boundingBox = this.key.b; + this.tightBoundingBox = this.boundingBox; + this.spacing = this.ept.spacing / Math.pow(2, this.key.d); + this.boundingSphere = this.boundingBox.getBoundingSphere(); - // These are set during hierarchy loading. - this.hasChildren = false; - this.children = { }; - this.numPoints = 0; + // These are set during hierarchy loading. + this.hasChildren = false; + this.children = { }; + this.numPoints = 0; - this.level = this.key.d; - this.loaded = false; - this.loading = false; - this.oneTimeDisposeHandlers = []; + this.level = this.key.d; + this.loaded = false; + this.loading = false; + this.oneTimeDisposeHandlers = []; - let k = this.key; - this.name = this.toPotreeName(k.d, k.x, k.y, k.z); - this.index = parseInt(this.name.charAt(this.name.length - 1)); - } + let k = this.key; + this.name = this.toPotreeName(k.d, k.x, k.y, k.z); + this.index = parseInt(this.name.charAt(this.name.length - 1)); + } - isGeometryNode() { return true; } - getLevel() { return this.level; } - isTreeNode() { return false; } - isLoaded() { return this.loaded; } - getBoundingSphere() { return this.boundingSphere; } - getBoundingBox() { return this.boundingBox; } - url() { return this.ept.url + this.filename(); } - getNumPoints() { return this.numPoints; } + isGeometryNode() { return true; } + getLevel() { return this.level; } + isTreeNode() { return false; } + isLoaded() { return this.loaded; } + getBoundingSphere() { return this.boundingSphere; } + getBoundingBox() { return this.boundingBox; } + url() { return this.ept.url + this.filename(); } + getNumPoints() { return this.numPoints; } - filename() { return this.key.name(); } + filename() { return this.key.name(); } - getChildren() { - let children = []; + getChildren() { + let children = []; - for (let i = 0; i < 8; i++) { - if (this.children[i]) { - children.push(this.children[i]); - } - } + for (let i = 0; i < 8; i++) { + if (this.children[i]) { + children.push(this.children[i]); + } + } - return children; - } + return children; + } - addChild(child) { - this.children[child.index] = child; - child.parent = this; - } + addChild(child) { + this.children[child.index] = child; + child.parent = this; + } - load() { - if (this.loaded || this.loading) return; - if (Potree.numNodesLoading >= Potree.maxNodesLoading) return; + load() { + if (this.loaded || this.loading) return; + if (Potree.numNodesLoading >= Potree.maxNodesLoading) return; - this.loading = true; - ++Potree.numNodesLoading; + this.loading = true; + ++Potree.numNodesLoading; - let hs = this.ept.hierarchyStep; - if (!this.key.d || (hs && (this.key.d % hs == 0) && this.hasChildren)) { - this.loadHierarchy(); - } - this.loadPoints(); - } + let hs = this.ept.hierarchyStep; + if (!this.key.d || (hs && (this.key.d % hs == 0) && this.hasChildren)) { + this.loadHierarchy(); + } + this.loadPoints(); + } - loadPoints(){ - this.ept.loader.load(this); - } + loadPoints(){ + this.ept.loader.load(this); + } - loadHierarchy() { - let nodes = { }; - nodes[this.filename()] = this; - this.hasChildren = false; + async loadHierarchy() { + let nodes = { }; + nodes[this.filename()] = this; + this.hasChildren = false; - EptUtils.getJson(this.ept.url + 'h/' + this.filename() + '.json') - .then((hier) => { - // Since we want to traverse top-down, and 10 comes - // lexicographically before 9 (for example), do a deep sort. - var keys = Object.keys(hier).sort((a, b) => { - let [da, xa, ya, za] = a.split('-').map((n) => parseInt(n, 10)); - let [db, xb, yb, zb] = b.split('-').map((n) => parseInt(n, 10)); - if (da < db) return -1; if (da > db) return 1; - if (xa < xb) return -1; if (xa > xb) return 1; - if (ya < yb) return -1; if (ya > yb) return 1; - if (za < zb) return -1; if (za > zb) return 1; - return 0; - }); + let eptHierarchyFile = `${this.ept.url}h/${this.filename()}.json`; + let response = await fetch(eptHierarchyFile); + let hier = await response.json(); - keys.forEach((v) => { - let [d, x, y, z] = v.split('-').map((n) => parseInt(n, 10)); - let a = x & 1, b = y & 1, c = z & 1; - let parentName = - (d - 1) + '-' + (x >> 1) + '-' + (y >> 1) + '-' + (z >> 1); + // Since we want to traverse top-down, and 10 comes + // lexicographically before 9 (for example), do a deep sort. + var keys = Object.keys(hier).sort((a, b) => { + let [da, xa, ya, za] = a.split('-').map((n) => parseInt(n, 10)); + let [db, xb, yb, zb] = b.split('-').map((n) => parseInt(n, 10)); + if (da < db) return -1; if (da > db) return 1; + if (xa < xb) return -1; if (xa > xb) return 1; + if (ya < yb) return -1; if (ya > yb) return 1; + if (za < zb) return -1; if (za > zb) return 1; + return 0; + }); - let parentNode = nodes[parentName]; - if (!parentNode) return; - parentNode.hasChildren = true; + keys.forEach((v) => { + let [d, x, y, z] = v.split('-').map((n) => parseInt(n, 10)); + let a = x & 1, b = y & 1, c = z & 1; + let parentName = + (d - 1) + '-' + (x >> 1) + '-' + (y >> 1) + '-' + (z >> 1); - let key = parentNode.key.step(a, b, c); + let parentNode = nodes[parentName]; + if (!parentNode) return; + parentNode.hasChildren = true; - let node = new Potree.PointCloudEptGeometryNode( - this.ept, - key.b, - key.d, - key.x, - key.y, - key.z); + let key = parentNode.key.step(a, b, c); - node.level = d; - node.numPoints = hier[v]; + let node = new Potree.PointCloudEptGeometryNode( + this.ept, + key.b, + key.d, + key.x, + key.y, + key.z); - let hs = this.ept.hierarchyStep; - if (hs && d % hs == 0) node.hasChildren = true; + node.level = d; + node.numPoints = hier[v]; - parentNode.addChild(node); - nodes[key.name()] = node; - }); - }); - } + let hs = this.ept.hierarchyStep; + if (hs && d % hs == 0) node.hasChildren = true; - doneLoading(bufferGeometry, tightBoundingBox, np, mean) { - bufferGeometry.boundingBox = this.boundingBox; - this.geometry = bufferGeometry; - this.tightBoundingBox = tightBoundingBox; - this.numPoints = np; - this.mean = mean; - this.loaded = true; - this.loading = false; - --Potree.numNodesLoading; - } + parentNode.addChild(node); + nodes[key.name()] = node; + }); + + } - toPotreeName(d, x, y, z) { - var name = 'r'; + doneLoading(bufferGeometry, tightBoundingBox, np, mean) { + bufferGeometry.boundingBox = this.boundingBox; + this.geometry = bufferGeometry; + this.tightBoundingBox = tightBoundingBox; + this.numPoints = np; + this.mean = mean; + this.loaded = true; + this.loading = false; + --Potree.numNodesLoading; + } - for (var i = 0; i < d; ++i) { - var shift = d - i - 1; - var mask = 1 << shift; - var step = 0; + toPotreeName(d, x, y, z) { + var name = 'r'; - if (x & mask) step += 4; - if (y & mask) step += 2; - if (z & mask) step += 1; + for (var i = 0; i < d; ++i) { + var shift = d - i - 1; + var mask = 1 << shift; + var step = 0; - name += step; - } + if (x & mask) step += 4; + if (y & mask) step += 2; + if (z & mask) step += 1; - return name; - } + name += step; + } - dispose() { - if (this.geometry && this.parent != null) { - this.geometry.dispose(); - this.geometry = null; - this.loaded = false; + return name; + } - // this.dispatchEvent( { type: 'dispose' } ); - for (let i = 0; i < this.oneTimeDisposeHandlers.length; i++) { - let handler = this.oneTimeDisposeHandlers[i]; - handler(); - } - this.oneTimeDisposeHandlers = []; - } - } + dispose() { + if (this.geometry && this.parent != null) { + this.geometry.dispose(); + this.geometry = null; + this.loaded = false; + + // this.dispatchEvent( { type: 'dispose' } ); + for (let i = 0; i < this.oneTimeDisposeHandlers.length; i++) { + let handler = this.oneTimeDisposeHandlers[i]; + handler(); + } + this.oneTimeDisposeHandlers = []; + } + } } Potree.PointCloudEptGeometryNode.NextId = 0; Object.assign( - Potree.PointCloudEptGeometryNode.prototype, - THREE.EventDispatcher.prototype); + Potree.PointCloudEptGeometryNode.prototype, + THREE.EventDispatcher.prototype); diff --git a/package-lock.json b/package-lock.json index 5d8069ae..bfbf2604 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,9 @@ } }, "acorn": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.1.tgz", - "integrity": "sha512-D/KGiCpM/VOtTMDS+wfjywEth926WUrArrzYov4N4SI7t+3y8747dPpCmmAvrm/Z3ygqMHnyPxvYYO0yTdn/nQ==" + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", + "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==" }, "acorn-jsx": { "version": "3.0.1", @@ -63,9 +63,9 @@ } }, "ansi-escapes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==" }, "ansi-red": { "version": "0.1.1", @@ -303,6 +303,11 @@ } } }, + "buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", + "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==" + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -540,17 +545,17 @@ } }, "color-convert": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", - "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", "requires": { - "color-name": "1.1.3" + "color-name": "1.1.1" } }, "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=" }, "component-emitter": { "version": "1.2.1", @@ -584,12 +589,13 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concat-stream": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.1.tgz", - "integrity": "sha512-gslSSJx03QKa59cIKqeJO9HQ/WZMotvYJCuaUULrLpjj8oG40kV2Z+gz82pVxlTkOADi4PJxQPPfhl1ELYrrXw==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "requires": { + "buffer-from": "1.1.0", "inherits": "2.0.3", - "readable-stream": "2.3.5", + "readable-stream": "2.3.6", "typedarray": "0.0.6" }, "dependencies": { @@ -604,23 +610,23 @@ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, "readable-stream": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", - "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", "isarray": "1.0.0", "process-nextick-args": "2.0.0", "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", + "string_decoder": "1.1.1", "util-deprecate": "1.0.2" } }, "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "requires": { "safe-buffer": "5.1.1" } @@ -738,15 +744,15 @@ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "requires": { - "lru-cache": "4.1.1", + "lru-cache": "4.1.3", "shebang-command": "1.2.0", "which": "1.3.0" }, "dependencies": { "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", "requires": { "pseudomap": "1.0.2", "yallist": "2.1.2" @@ -849,7 +855,7 @@ "requires": { "globby": "5.0.0", "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", + "is-path-in-cwd": "1.0.1", "object-assign": "4.1.1", "pify": "2.3.0", "pinkie-promise": "2.0.1", @@ -1002,34 +1008,34 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.18.2.tgz", - "integrity": "sha512-qy4i3wODqKMYfz9LUI8N2qYDkHkoieTbiHpMrYUI/WbjhXJQr7lI4VngixTgaG+yHX+NBCv7nW4hA0ShbvaNKw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz", + "integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==", "requires": { "ajv": "5.5.2", "babel-code-frame": "6.26.0", - "chalk": "2.3.2", - "concat-stream": "1.6.1", + "chalk": "2.4.1", + "concat-stream": "1.6.2", "cross-spawn": "5.1.0", "debug": "3.1.0", "doctrine": "2.1.0", "eslint-scope": "3.7.1", "eslint-visitor-keys": "1.0.0", "espree": "3.5.4", - "esquery": "1.0.0", + "esquery": "1.0.1", "esutils": "2.0.2", "file-entry-cache": "2.0.0", "functional-red-black-tree": "1.0.1", "glob": "7.1.2", - "globals": "11.3.0", + "globals": "11.7.0", "ignore": "3.3.7", "imurmurhash": "0.1.4", "inquirer": "3.3.0", "is-resolvable": "1.1.0", - "js-yaml": "3.11.0", + "js-yaml": "3.12.0", "json-stable-stringify-without-jsonify": "1.0.1", "levn": "0.3.0", - "lodash": "4.17.5", + "lodash": "4.17.10", "minimatch": "3.0.4", "mkdirp": "0.5.1", "natural-compare": "1.4.0", @@ -1037,6 +1043,7 @@ "path-is-inside": "1.0.2", "pluralize": "7.0.0", "progress": "2.0.0", + "regexpp": "1.1.0", "require-uncached": "1.0.3", "semver": "5.5.0", "strip-ansi": "4.0.0", @@ -1055,17 +1062,17 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "requires": { - "color-convert": "1.9.1" + "color-convert": "1.9.2" } }, "chalk": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", - "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "requires": { "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "5.3.0" + "supports-color": "5.4.0" } }, "debug": { @@ -1090,9 +1097,9 @@ } }, "lodash": { - "version": "4.17.5", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", - "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" }, "minimatch": { "version": "3.0.4", @@ -1126,9 +1133,9 @@ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "requires": { "has-flag": "3.0.0" } @@ -1165,9 +1172,9 @@ } }, "eslint-module-utils": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz", - "integrity": "sha512-jDI/X5l/6D1rRD/3T43q8Qgbls2nq5km5KSqiwlyUbGo5+04fXhMKdCPhjwbqAa6HXWaMxj8Q4hQDIh7IadJQw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz", + "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=", "requires": { "debug": "2.6.9", "pkg-dir": "1.0.0" @@ -1189,20 +1196,20 @@ } }, "eslint-plugin-import": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.9.0.tgz", - "integrity": "sha1-JgAu+/ylmJtyiKwEdQi9JPIXsWk=", + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.13.0.tgz", + "integrity": "sha512-t6hGKQDMIt9N8R7vLepsYXgDfeuhp6ZJSgtrLEDxonpSubyxUZHjhm6LsAaZX8q6GYVxkbT3kTsV9G5mBCFR6A==", "requires": { - "builtin-modules": "1.1.1", "contains-path": "0.1.0", "debug": "2.6.9", "doctrine": "1.5.0", "eslint-import-resolver-node": "0.3.2", - "eslint-module-utils": "2.1.1", - "has": "1.0.1", - "lodash": "4.17.5", + "eslint-module-utils": "2.2.0", + "has": "1.0.3", + "lodash": "4.17.10", "minimatch": "3.0.4", - "read-pkg-up": "2.0.0" + "read-pkg-up": "2.0.0", + "resolve": "1.8.1" }, "dependencies": { "debug": { @@ -1247,9 +1254,9 @@ } }, "lodash": { - "version": "4.17.5", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", - "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" }, "minimatch": { "version": "3.0.4", @@ -1291,6 +1298,14 @@ "read-pkg": "2.0.0" } }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "requires": { + "path-parse": "1.0.5" + } + }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -1325,14 +1340,14 @@ } }, "eslint-plugin-promise": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-3.6.0.tgz", - "integrity": "sha512-YQzM6TLTlApAr7Li8vWKR+K3WghjwKcYzY0d2roWap4SLK+kzuagJX/leTetIDWsFcTFnKNJXWupDCD6aZkP2Q==" + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-3.8.0.tgz", + "integrity": "sha512-JiFL9UFR15NKpHyGii1ZcvmtIqa3UTwiDAGb8atSffe43qJ3+1czVGN6UtkklpcJ2DVnqvTMzEKRaJdBkAL2aQ==" }, "eslint-plugin-standard": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz", - "integrity": "sha1-NNDJFbRe3G8BA5PH7vOCOwhWXPI=" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-3.1.0.tgz", + "integrity": "sha512-fVcdyuKRr0EZ4fjWl3c+gp1BANFJD1+RaWa2UPYfMZ6jCtp5RG00kSaXnK/dE5sYzt4kaWJ9qdxqUfc0d9kX0w==" }, "eslint-scope": { "version": "3.7.1", @@ -1353,7 +1368,7 @@ "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", "requires": { - "acorn": "5.5.1", + "acorn": "5.7.1", "acorn-jsx": "3.0.1" } }, @@ -1363,9 +1378,9 @@ "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" }, "esquery": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", - "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", "requires": { "estraverse": "4.2.0" } @@ -1567,19 +1582,22 @@ } }, "external-editor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.1.0.tgz", - "integrity": "sha512-E44iT5QVOUJBKij4IIV3uvxuNlbKS38Tw1HiupxEIHPv9qtC2PrDYohbXV5U+1jnfIXttny8gUhj+oZvflFlzA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", "requires": { "chardet": "0.4.2", - "iconv-lite": "0.4.19", + "iconv-lite": "0.4.23", "tmp": "0.0.33" }, "dependencies": { "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": "2.1.2" + } } } }, @@ -1961,9 +1979,9 @@ } }, "globals": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.3.0.tgz", - "integrity": "sha512-kkpcKNlmQan9Z5ZmgqKH/SMbSmjxQ7QjyNqfXVc8VJcoBV2UEg+sxQD15GQofGRh2hfpwUb70VC31DR7Rq5Hdw==" + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", + "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==" }, "globby": { "version": "5.0.0", @@ -2818,9 +2836,9 @@ } }, "has": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", - "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "requires": { "function-bind": "1.1.1" } @@ -2956,13 +2974,13 @@ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.3.2", + "ansi-escapes": "3.1.0", + "chalk": "2.4.1", "cli-cursor": "2.1.0", "cli-width": "2.2.0", - "external-editor": "2.1.0", + "external-editor": "2.2.0", "figures": "2.0.0", - "lodash": "4.17.5", + "lodash": "4.17.10", "mute-stream": "0.0.7", "run-async": "2.3.0", "rx-lite": "4.0.8", @@ -2982,23 +3000,23 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "requires": { - "color-convert": "1.9.1" + "color-convert": "1.9.2" } }, "chalk": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", - "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "requires": { "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "5.3.0" + "supports-color": "5.4.0" } }, "lodash": { - "version": "4.17.5", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", - "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" }, "strip-ansi": { "version": "4.0.0", @@ -3009,9 +3027,9 @@ } }, "supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "requires": { "has-flag": "3.0.0" } @@ -3146,9 +3164,9 @@ "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=" }, "is-path-in-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", - "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", "requires": { "is-path-inside": "1.0.1" } @@ -3226,9 +3244,9 @@ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" }, "js-yaml": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz", - "integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==", + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", "requires": { "argparse": "1.0.10", "esprima": "4.0.0" @@ -3806,9 +3824,9 @@ } }, "natives": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz", - "integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.3.tgz", + "integrity": "sha512-BZGSYV4YOLxzoTK73l0/s/0sH9l8SHs2ocReMH1f8JYSh5FUWu4ZrKCpJdRkWXV6HFR/pZDz7bwWOVAY07q77g==" }, "natural-compare": { "version": "1.4.0", @@ -4018,9 +4036,9 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "p-limit": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", - "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", "requires": { "p-try": "1.0.0" } @@ -4030,7 +4048,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "requires": { - "p-limit": "1.2.0" + "p-limit": "1.3.0" } }, "p-try": { @@ -4364,6 +4382,11 @@ "safe-regex": "1.1.0" } }, + "regexpp": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz", + "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==" + }, "repeat-element": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", @@ -4523,6 +4546,11 @@ "ret": "0.1.15" } }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "semver": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/semver/-/semver-2.3.2.tgz", @@ -5040,8 +5068,8 @@ "requires": { "ajv": "5.5.2", "ajv-keywords": "2.1.1", - "chalk": "2.3.2", - "lodash": "4.17.5", + "chalk": "2.4.1", + "lodash": "4.17.10", "slice-ansi": "1.0.0", "string-width": "2.1.1" }, @@ -5051,28 +5079,28 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "requires": { - "color-convert": "1.9.1" + "color-convert": "1.9.2" } }, "chalk": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", - "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "requires": { "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "5.3.0" + "supports-color": "5.4.0" } }, "lodash": { - "version": "4.17.5", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", - "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" }, "supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "requires": { "has-flag": "3.0.0" } @@ -5524,7 +5552,7 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", "requires": { - "natives": "1.1.1" + "natives": "1.1.3" } }, "readable-stream": { diff --git a/package.json b/package.json index 7b0c1f10..750460ec 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,12 @@ "test": "npm run lint" }, "dependencies": { - "eslint": "^4.18.2", + "eslint": "^4.19.1", "eslint-config-happiness": "^10.2.1", - "eslint-plugin-import": "^2.9.0", + "eslint-plugin-import": "^2.13.0", "eslint-plugin-node": "^5.2.1", - "eslint-plugin-promise": "^3.6.0", - "eslint-plugin-standard": "^3.0.1", + "eslint-plugin-promise": "^3.8.0", + "eslint-plugin-standard": "^3.1.0", "gulp": "~3.9.1", "gulp-concat": "~2.1.7", "gulp-connect": "^2.3.1", @@ -23,7 +23,8 @@ "gulp-uglify": "~0.2.1", "gulp-util": "~2.2.20", "jshint": "^2.9.5", - "through": "~2.3.4" + "through": "~2.3.4", + "natives": "1.1.3" }, "author": "Markus Schütz", "license": "BSD-2-CLAUSE" diff --git a/src/PointCloudEptGeometry.js b/src/PointCloudEptGeometry.js index 4aa312d3..767a271f 100644 --- a/src/PointCloudEptGeometry.js +++ b/src/PointCloudEptGeometry.js @@ -1,297 +1,299 @@ var toVector3 = function(v, offset) { - return new THREE.Vector3().fromArray(v, offset || 0); + return new THREE.Vector3().fromArray(v, offset || 0); } var toBox3 = function(b) { - return new THREE.Box3(this.toVector3(b), this.toVector3(b, 3)); + return new THREE.Box3(this.toVector3(b), this.toVector3(b, 3)); }; var toArray = function(b) { - return [b.min.x, b.min.y, b.min.z, b.max.x, b.max.y, b.max.z]; + return [b.min.x, b.min.y, b.min.z, b.max.x, b.max.y, b.max.z]; } Potree.PointCloudEptGeometry = class { - constructor(url, info) { - let version = info.version; - let schema = info.schema; - let bounds = info.bounds; - let boundsConforming = info.boundsConforming; + constructor(url, info) { + let version = info.version; + let schema = info.schema; + let bounds = info.bounds; + let boundsConforming = info.boundsConforming; - // TODO This is unused. - let offset = info.offset || [0, 0, 0]; - let scale = info.scale || 0.01; - if (Array.isArray(scale)) { - scale = Math.min(scale[0], scale[1], scale[2]); - } + // TODO This is unused. + let offset = info.offset || [0, 0, 0]; + let scale = info.scale || 0.01; + if (Array.isArray(scale)) { + scale = Math.min(scale[0], scale[1], scale[2]); + } - let dataStorage = info.dataStorage || 'laz'; - let hierarchyStorage = info.hierarchyStorage || 'json'; + let dataStorage = info.dataStorage || 'laz'; + let hierarchyStorage = info.hierarchyStorage || 'json'; - // Now convert to three.js types. - bounds = toBox3(bounds); - boundsConforming = toBox3(boundsConforming); - offset = toVector3(offset); // TODO - offset = bounds.min.clone(); - offset = toVector3([0, 0, 0]); // TODO + // Now convert to three.js types. + bounds = toBox3(bounds); + boundsConforming = toBox3(boundsConforming); + offset = toVector3(offset); // TODO + offset = bounds.min.clone(); + offset = toVector3([0, 0, 0]); // TODO - bounds.min.sub(offset); - bounds.max.sub(offset); - boundsConforming.min.sub(offset); - boundsConforming.max.sub(offset); + bounds.min.sub(offset); + bounds.max.sub(offset); + boundsConforming.min.sub(offset); + boundsConforming.max.sub(offset); - this.url = url; - this.info = info; + this.url = url; + this.info = info; - this.ticks = info.ticks; - this.boundingBox = bounds; - this.offset = offset; - this.tightBoundingBox = boundsConforming; - this.boundingSphere = this.boundingBox.getBoundingSphere(); - this.tightBoundingSphere = this.tightBoundingBox.getBoundingSphere(); - this.version = new Potree.Version('1.6'); + this.ticks = info.ticks; + this.boundingBox = bounds; + this.offset = offset; + this.tightBoundingBox = boundsConforming; + this.boundingSphere = this.boundingBox.getBoundingSphere(); + this.tightBoundingSphere = this.tightBoundingBox.getBoundingSphere(); + this.version = new Potree.Version('1.6'); - this.projection = info.srs; - this.pointAttributes = 'LAZ'; - this.spacing = - (this.boundingBox.max.x - this.boundingBox.min.x) / this.ticks; + this.projection = info.srs; + this.pointAttributes = 'LAZ'; + this.spacing = + (this.boundingBox.max.x - this.boundingBox.min.x) / this.ticks; - // TODO Switch on storage type. - this.loader = new Potree.EptLazLoader(); - this.hierarchyStep = info.hierarchyStep || 0; - } + // TODO Switch on storage type. + this.loader = new Potree.EptLazLoader(); + this.hierarchyStep = info.hierarchyStep || 0; + } }; Potree.EptKey = class { - constructor(ept, b, d, x, y, z) { - this.ept = ept; - this.b = b; - this.d = d; - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } + constructor(ept, b, d, x, y, z) { + this.ept = ept; + this.b = b; + this.d = d; + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } - name() { - return this.d + '-' + this.x + '-' + this.y + '-' + this.z; - } + name() { + return this.d + '-' + this.x + '-' + this.y + '-' + this.z; + } - step(a, b, c) { - let min = this.b.min.clone(); - let max = this.b.max.clone(); - let dst = new THREE.Vector3().subVectors(max, min); + step(a, b, c) { + let min = this.b.min.clone(); + let max = this.b.max.clone(); + let dst = new THREE.Vector3().subVectors(max, min); - if (a) min.x += dst.x / 2; - else max.x -= dst.x / 2; + if (a) min.x += dst.x / 2; + else max.x -= dst.x / 2; - if (b) min.y += dst.y / 2; - else max.y -= dst.y / 2; + if (b) min.y += dst.y / 2; + else max.y -= dst.y / 2; - if (c) min.z += dst.z / 2; - else max.z -= dst.z / 2; + if (c) min.z += dst.z / 2; + else max.z -= dst.z / 2; - return new Potree.EptKey( - this.ept, - new THREE.Box3(min, max), - this.d + 1, - this.x * 2 + a, - this.y * 2 + b, - this.z * 2 + c); - } + return new Potree.EptKey( + this.ept, + new THREE.Box3(min, max), + this.d + 1, + this.x * 2 + a, + this.y * 2 + b, + this.z * 2 + c); + } - children() { - var result = []; - for (var a = 0; a < 2; ++a) { - for (var b = 0; b < 2; ++b) { - for (var c = 0; c < 2; ++c) { - var add = this.step(a, b, c).name(); - if (!result.includes(add)) result = result.concat(add); - } - } - } - return result; - } + children() { + var result = []; + for (var a = 0; a < 2; ++a) { + for (var b = 0; b < 2; ++b) { + for (var c = 0; c < 2; ++c) { + var add = this.step(a, b, c).name(); + if (!result.includes(add)) result = result.concat(add); + } + } + } + return result; + } } Potree.PointCloudEptGeometryNode = class extends Potree.PointCloudTreeNode { - constructor(ept, b, d, x, y, z) { - super(); + constructor(ept, b, d, x, y, z) { + super(); - this.ept = ept; - this.key = new Potree.EptKey( - this.ept, - b || this.ept.boundingBox, - d || 0, - x, - y, - z); + this.ept = ept; + this.key = new Potree.EptKey( + this.ept, + b || this.ept.boundingBox, + d || 0, + x, + y, + z); - this.id = Potree.PointCloudEptGeometryNode.NextId++; - this.geometry = null; - this.boundingBox = this.key.b; - this.tightBoundingBox = this.boundingBox; - this.spacing = this.ept.spacing / Math.pow(2, this.key.d); - this.boundingSphere = this.boundingBox.getBoundingSphere(); + this.id = Potree.PointCloudEptGeometryNode.NextId++; + this.geometry = null; + this.boundingBox = this.key.b; + this.tightBoundingBox = this.boundingBox; + this.spacing = this.ept.spacing / Math.pow(2, this.key.d); + this.boundingSphere = this.boundingBox.getBoundingSphere(); - // These are set during hierarchy loading. - this.hasChildren = false; - this.children = { }; - this.numPoints = 0; + // These are set during hierarchy loading. + this.hasChildren = false; + this.children = { }; + this.numPoints = 0; - this.level = this.key.d; - this.loaded = false; - this.loading = false; - this.oneTimeDisposeHandlers = []; + this.level = this.key.d; + this.loaded = false; + this.loading = false; + this.oneTimeDisposeHandlers = []; - let k = this.key; - this.name = this.toPotreeName(k.d, k.x, k.y, k.z); - this.index = parseInt(this.name.charAt(this.name.length - 1)); - } + let k = this.key; + this.name = this.toPotreeName(k.d, k.x, k.y, k.z); + this.index = parseInt(this.name.charAt(this.name.length - 1)); + } - isGeometryNode() { return true; } - getLevel() { return this.level; } - isTreeNode() { return false; } - isLoaded() { return this.loaded; } - getBoundingSphere() { return this.boundingSphere; } - getBoundingBox() { return this.boundingBox; } - url() { return this.ept.url + this.filename(); } - getNumPoints() { return this.numPoints; } + isGeometryNode() { return true; } + getLevel() { return this.level; } + isTreeNode() { return false; } + isLoaded() { return this.loaded; } + getBoundingSphere() { return this.boundingSphere; } + getBoundingBox() { return this.boundingBox; } + url() { return this.ept.url + this.filename(); } + getNumPoints() { return this.numPoints; } - filename() { return this.key.name(); } + filename() { return this.key.name(); } - getChildren() { - let children = []; + getChildren() { + let children = []; - for (let i = 0; i < 8; i++) { - if (this.children[i]) { - children.push(this.children[i]); - } - } + for (let i = 0; i < 8; i++) { + if (this.children[i]) { + children.push(this.children[i]); + } + } - return children; - } + return children; + } - addChild(child) { - this.children[child.index] = child; - child.parent = this; - } + addChild(child) { + this.children[child.index] = child; + child.parent = this; + } - load() { - if (this.loaded || this.loading) return; - if (Potree.numNodesLoading >= Potree.maxNodesLoading) return; + load() { + if (this.loaded || this.loading) return; + if (Potree.numNodesLoading >= Potree.maxNodesLoading) return; - this.loading = true; - ++Potree.numNodesLoading; + this.loading = true; + ++Potree.numNodesLoading; - let hs = this.ept.hierarchyStep; - if (!this.key.d || (hs && (this.key.d % hs == 0) && this.hasChildren)) { - this.loadHierarchy(); - } - this.loadPoints(); - } + let hs = this.ept.hierarchyStep; + if (!this.key.d || (hs && (this.key.d % hs == 0) && this.hasChildren)) { + this.loadHierarchy(); + } + this.loadPoints(); + } - loadPoints(){ - this.ept.loader.load(this); - } + loadPoints(){ + this.ept.loader.load(this); + } - loadHierarchy() { - let nodes = { }; - nodes[this.filename()] = this; - this.hasChildren = false; + async loadHierarchy() { + let nodes = { }; + nodes[this.filename()] = this; + this.hasChildren = false; - EptUtils.getJson(this.ept.url + 'h/' + this.filename() + '.json') - .then((hier) => { - // Since we want to traverse top-down, and 10 comes - // lexicographically before 9 (for example), do a deep sort. - var keys = Object.keys(hier).sort((a, b) => { - let [da, xa, ya, za] = a.split('-').map((n) => parseInt(n, 10)); - let [db, xb, yb, zb] = b.split('-').map((n) => parseInt(n, 10)); - if (da < db) return -1; if (da > db) return 1; - if (xa < xb) return -1; if (xa > xb) return 1; - if (ya < yb) return -1; if (ya > yb) return 1; - if (za < zb) return -1; if (za > zb) return 1; - return 0; - }); + let eptHierarchyFile = `${this.ept.url}h/${this.filename()}.json`; + let response = await fetch(eptHierarchyFile); + let hier = await response.json(); - keys.forEach((v) => { - let [d, x, y, z] = v.split('-').map((n) => parseInt(n, 10)); - let a = x & 1, b = y & 1, c = z & 1; - let parentName = - (d - 1) + '-' + (x >> 1) + '-' + (y >> 1) + '-' + (z >> 1); + // Since we want to traverse top-down, and 10 comes + // lexicographically before 9 (for example), do a deep sort. + var keys = Object.keys(hier).sort((a, b) => { + let [da, xa, ya, za] = a.split('-').map((n) => parseInt(n, 10)); + let [db, xb, yb, zb] = b.split('-').map((n) => parseInt(n, 10)); + if (da < db) return -1; if (da > db) return 1; + if (xa < xb) return -1; if (xa > xb) return 1; + if (ya < yb) return -1; if (ya > yb) return 1; + if (za < zb) return -1; if (za > zb) return 1; + return 0; + }); - let parentNode = nodes[parentName]; - if (!parentNode) return; - parentNode.hasChildren = true; + keys.forEach((v) => { + let [d, x, y, z] = v.split('-').map((n) => parseInt(n, 10)); + let a = x & 1, b = y & 1, c = z & 1; + let parentName = + (d - 1) + '-' + (x >> 1) + '-' + (y >> 1) + '-' + (z >> 1); - let key = parentNode.key.step(a, b, c); + let parentNode = nodes[parentName]; + if (!parentNode) return; + parentNode.hasChildren = true; - let node = new Potree.PointCloudEptGeometryNode( - this.ept, - key.b, - key.d, - key.x, - key.y, - key.z); + let key = parentNode.key.step(a, b, c); - node.level = d; - node.numPoints = hier[v]; + let node = new Potree.PointCloudEptGeometryNode( + this.ept, + key.b, + key.d, + key.x, + key.y, + key.z); - let hs = this.ept.hierarchyStep; - if (hs && d % hs == 0) node.hasChildren = true; + node.level = d; + node.numPoints = hier[v]; - parentNode.addChild(node); - nodes[key.name()] = node; - }); - }); - } + let hs = this.ept.hierarchyStep; + if (hs && d % hs == 0) node.hasChildren = true; - doneLoading(bufferGeometry, tightBoundingBox, np, mean) { - bufferGeometry.boundingBox = this.boundingBox; - this.geometry = bufferGeometry; - this.tightBoundingBox = tightBoundingBox; - this.numPoints = np; - this.mean = mean; - this.loaded = true; - this.loading = false; - --Potree.numNodesLoading; - } + parentNode.addChild(node); + nodes[key.name()] = node; + }); + + } - toPotreeName(d, x, y, z) { - var name = 'r'; + doneLoading(bufferGeometry, tightBoundingBox, np, mean) { + bufferGeometry.boundingBox = this.boundingBox; + this.geometry = bufferGeometry; + this.tightBoundingBox = tightBoundingBox; + this.numPoints = np; + this.mean = mean; + this.loaded = true; + this.loading = false; + --Potree.numNodesLoading; + } - for (var i = 0; i < d; ++i) { - var shift = d - i - 1; - var mask = 1 << shift; - var step = 0; + toPotreeName(d, x, y, z) { + var name = 'r'; - if (x & mask) step += 4; - if (y & mask) step += 2; - if (z & mask) step += 1; + for (var i = 0; i < d; ++i) { + var shift = d - i - 1; + var mask = 1 << shift; + var step = 0; - name += step; - } + if (x & mask) step += 4; + if (y & mask) step += 2; + if (z & mask) step += 1; - return name; - } + name += step; + } - dispose() { - if (this.geometry && this.parent != null) { - this.geometry.dispose(); - this.geometry = null; - this.loaded = false; + return name; + } - // this.dispatchEvent( { type: 'dispose' } ); - for (let i = 0; i < this.oneTimeDisposeHandlers.length; i++) { - let handler = this.oneTimeDisposeHandlers[i]; - handler(); - } - this.oneTimeDisposeHandlers = []; - } - } + dispose() { + if (this.geometry && this.parent != null) { + this.geometry.dispose(); + this.geometry = null; + this.loaded = false; + + // this.dispatchEvent( { type: 'dispose' } ); + for (let i = 0; i < this.oneTimeDisposeHandlers.length; i++) { + let handler = this.oneTimeDisposeHandlers[i]; + handler(); + } + this.oneTimeDisposeHandlers = []; + } + } } Potree.PointCloudEptGeometryNode.NextId = 0; Object.assign( - Potree.PointCloudEptGeometryNode.prototype, - THREE.EventDispatcher.prototype); + Potree.PointCloudEptGeometryNode.prototype, + THREE.EventDispatcher.prototype); diff --git a/src/loader/EptLoader.js b/src/loader/EptLoader.js index 50595f98..241279eb 100644 --- a/src/loader/EptLoader.js +++ b/src/loader/EptLoader.js @@ -1,47 +1,23 @@ /** - * @class Loads mno files and returns a PointcloudOctree - * for a description of the mno binary file format, read mnoFileFormat.txt - * - * @author Markus Schuetz + * @author Connor Manning */ -class EptUtils { - static get(url) { - return new Promise((resolve, reject) => { - let xhr = Potree.XHRFactory.createXMLHttpRequest(); - xhr.open('GET', url, true); - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - if (xhr.status === 200 || xhr.status === 0) { - resolve(xhr.responseText); - } - else { - reject(xhr.responseText); - } - } - }; - xhr.send(null); - }); - } - - static getJson(url) { - return EptUtils.get(url).then((data) => JSON.parse(data)); - } -}; - Potree.EptLoader = class { - static load(file, callback) { - EptUtils.getJson(file) - .then((info) => { - let url = file.substr(0, file.lastIndexOf('entwine.json')); - let geometry = new Potree.PointCloudEptGeometry(url, info); - let root = new Potree.PointCloudEptGeometryNode(geometry); - geometry.root = root; - geometry.root.load(); + static async load(file, callback) { + + let response = await fetch(file); + let json = await response.json(); + + let url = file.substr(0, file.lastIndexOf('entwine.json')); + let geometry = new Potree.PointCloudEptGeometry(url, json); + let root = new Potree.PointCloudEptGeometryNode(geometry); + + geometry.root = root; + geometry.root.load(); + + callback(geometry); + } - callback(geometry); - }); - } };