From b738bd23da9d76981eb6872925a2857e52db6048 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Tue, 30 Oct 2018 15:13:08 -0400 Subject: [PATCH] Update documentation strings and change log. --- CHANGELOG.md | 2 ++ src/vtkjs/pointFeature.js | 20 +++++++--------- src/vtkjs/vtkjsRenderer.js | 49 +++++++++++++++++++++++++------------- 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc18c3ad35..5a29d9485e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,14 @@ ### Features - Feature selection API is now enabled automatically if any event handlers are bounds to the feature (#921) +- Added a VTK.js renderer which supports a point feature (#893) ### Improvements - Coordinate transforms on flat arrays are now faster (#939) - `convertColor` is memoized to speed up repeated calls (#936) - All features have a `featureType` property (#931) - When changing geometry sizes, buffers are reallocated less (#941) +- Initial rendering webGL features is somewhat faster (#943) ### Changes - Removed the dependency on the vgl module for the `object` and `timestamp` classes (#918) diff --git a/src/vtkjs/pointFeature.js b/src/vtkjs/pointFeature.js index b5750a57db..6bfdbcc46f 100644 --- a/src/vtkjs/pointFeature.js +++ b/src/vtkjs/pointFeature.js @@ -28,20 +28,18 @@ var vtkjs_pointFeature = function (arg) { object.call(this); /** - * Member variables - * * @private */ var m_this = this, + m_actor, + m_pointSet, + m_source, s_init = this._init, s_exit = this._exit, - m_actor = null, - m_pointSet = null, - m_source = null, s_update = this._update; /** - * Create pipeline + * Create pipeline. */ this._createPipeline = function () { m_pointSet = vtkPointSet.newInstance(); @@ -58,7 +56,7 @@ var vtkjs_pointFeature = function (arg) { }; /** - * Initialize + * Initialize. */ this._init = function () { s_init.call(m_this, arg); @@ -67,7 +65,7 @@ var vtkjs_pointFeature = function (arg) { }; /** - * Build this feature + * Build this feature. */ this._build = function () { var i, i3, posVal, @@ -117,11 +115,9 @@ var vtkjs_pointFeature = function (arg) { }; /** - * Update - * + * Update. */ this._update = function () { - s_update.call(m_this); if (m_this.dataTime().getMTime() >= m_this.buildTime().getMTime() || @@ -139,7 +135,7 @@ var vtkjs_pointFeature = function (arg) { }; /** - * Destroy + * Destroy. */ this._exit = function () { m_this.renderer().contextRenderer().removeActor(m_actor); diff --git a/src/vtkjs/vtkjsRenderer.js b/src/vtkjs/vtkjsRenderer.js index 4e62395880..90637e36b5 100644 --- a/src/vtkjs/vtkjsRenderer.js +++ b/src/vtkjs/vtkjsRenderer.js @@ -39,35 +39,45 @@ var vtkjsRenderer = function (arg) { var renderWindow = vtkRenderer.getRenderWindow(); /** - * Return width of the renderer + * Return width of the renderer. + * + * @returns {number} The width of the current canvas. */ this.width = function () { return m_width; }; /** - * Return height of the renderer + * Return height of the renderer. + * + * @returns {number} The height of the current canvas. */ this.height = function () { return m_height; }; /** - * Get context specific renderer + * Get context specific renderer. + * + * @returns {object} The vtkjs context renderer. */ this.contextRenderer = function () { return vtkjsren; }; /** - * Get API used by the renderer + * Get API used by the renderer. + * + * @returns {string} `vtkjs`. */ this.api = function () { return 'vtkjs'; }; /** - * Initialize + * Initialize. + * + * @returns {this} */ this._init = function () { if (m_this.initialized()) { @@ -87,7 +97,13 @@ var vtkjsRenderer = function (arg) { }; /** - * Handle resize event + * Handle resize event. + * + * @param {number} x The left coordinate. + * @param {number} y The top coordinate. + * @param {number} w The width in pixels. + * @param {number} h The height in pixels. + * @returns {this} */ this._resize = function (x, y, w, h) { vtkRenderer.resize(); @@ -97,6 +113,8 @@ var vtkjsRenderer = function (arg) { /** * Render. This actually schedules rendering for the next animation frame. + * + * @returns {this} */ this._render = function () { /* If we are already scheduled to render, don't schedule again. Rather, @@ -110,7 +128,7 @@ var vtkjsRenderer = function (arg) { }; /** - * This clears the render timer and actually renders. + * This actually renders. */ this._renderFrame = function () { var layer = m_this.layer(), @@ -127,7 +145,7 @@ var vtkjsRenderer = function (arg) { }; /** - * Exit + * Exit. */ this._exit = function () { // DO NOTHING @@ -146,18 +164,14 @@ var vtkjsRenderer = function (arg) { m_this.contextRenderer().getActiveCamera().setProjectionMatrix(projmat); }; - /** - * Connect to pan event. This is sufficient, as all zooms and rotations also - * produce a pan - */ + /* Connect to pan event. This is sufficient, as all zooms and rotations also + * produce a pan */ m_this.layer().geoOn(geo_event.pan, function (evt) { // TODO: We may only need to do this if the zoom level has changed. m_this._render(); }); - /** - * Connect to parallelprojection event - */ + /* Connect to parallelprojection event. */ m_this.layer().geoOn(geo_event.parallelprojection, function (evt) { // DO NOTHING }); @@ -170,7 +184,8 @@ inherit(vtkjsRenderer, renderer); registerRenderer('vtkjs', vtkjsRenderer); /** - * Report if the vtkjs renderer is supported. This is just a check if vtkjs is available. + * Report if the vtkjs renderer is supported. This is just a check if vtkjs is + * available. * * @returns {boolean} true if available. */ @@ -184,7 +199,7 @@ vtkjsRenderer.supported = function () { }; /** - * If the vtks renderer is not supported, supply the name of a renderer that + * If the vtkjs renderer is not supported, supply the name of a renderer that * should be used instead. This asks for the null renderer. * * @returns {null} `null` for the null renderer.