Skip to content

Commit

Permalink
Update documentation strings and change log.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Oct 30, 2018
1 parent c12131e commit 154bb5f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 35 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 12 additions & 14 deletions src/vtkjs/pointFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ var registerFeature = require('../registry').registerFeature;
var pointFeature = require('../pointFeature');

/**
* Create a new instance of pointFeature
* Create a new instance of vtkjs.pointFeature.
*
* @class geo.vtkjs.pointFeature
* @class
* @alias geo.vtkjs.pointFeature
* @extends geo.pointFeature
* @param {geo.pointFeature.spec} arg
* @returns {geo.vtkjs.pointFeature}
*/
var vtkjs_pointFeature = function (arg) {
Expand All @@ -28,20 +30,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();
Expand All @@ -58,7 +58,7 @@ var vtkjs_pointFeature = function (arg) {
};

/**
* Initialize
* Initialize.
*/
this._init = function () {
s_init.call(m_this, arg);
Expand All @@ -67,7 +67,7 @@ var vtkjs_pointFeature = function (arg) {
};

/**
* Build this feature
* Build this feature.
*/
this._build = function () {
var i, i3, posVal,
Expand Down Expand Up @@ -117,11 +117,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() ||
Expand All @@ -139,7 +137,7 @@ var vtkjs_pointFeature = function (arg) {
};

/**
* Destroy
* Destroy.
*/
this._exit = function () {
m_this.renderer().contextRenderer().removeActor(m_actor);
Expand Down
61 changes: 40 additions & 21 deletions src/vtkjs/vtkjsRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ var registerRenderer = require('../registry').registerRenderer;
var renderer = require('../renderer');

/**
* Create a new instance of class vtkjsRenderer
* Create a new instance of class vtkjsRenderer.
*
* @class geo.gl.vtkjsRenderer
* @class
* @alias geo.vtkjs.vglRenderer
* @extends geo.renderer
* @param canvas
* @returns {geo.gl.vtkjsRenderer}
* @param {object} arg Options for the renderer.
* @param {geo.layer} [arg.layer] Layer associated with the renderer.
* @param {HTMLElement} [arg.canvas] Canvas element associated with the
* renderer.
* @returns {geo.vtkjs.vtkjsRenderer}
*/
var vtkjsRenderer = function (arg) {
'use strict';
Expand Down Expand Up @@ -39,35 +43,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()) {
Expand All @@ -87,7 +101,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();
Expand All @@ -97,6 +117,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,
Expand All @@ -110,7 +132,7 @@ var vtkjsRenderer = function (arg) {
};

/**
* This clears the render timer and actually renders.
* This actually renders.
*/
this._renderFrame = function () {
var layer = m_this.layer(),
Expand All @@ -127,7 +149,7 @@ var vtkjsRenderer = function (arg) {
};

/**
* Exit
* Exit.
*/
this._exit = function () {
// DO NOTHING
Expand All @@ -146,18 +168,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
});
Expand All @@ -170,7 +188,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.
*/
Expand All @@ -184,7 +203,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.
Expand Down

0 comments on commit 154bb5f

Please sign in to comment.