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 b738bd2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 29 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
20 changes: 8 additions & 12 deletions src/vtkjs/pointFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -58,7 +56,7 @@ var vtkjs_pointFeature = function (arg) {
};

/**
* Initialize
* Initialize.
*/
this._init = function () {
s_init.call(m_this, arg);
Expand All @@ -67,7 +65,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 +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() ||
Expand All @@ -139,7 +135,7 @@ var vtkjs_pointFeature = function (arg) {
};

/**
* Destroy
* Destroy.
*/
this._exit = function () {
m_this.renderer().contextRenderer().removeActor(m_actor);
Expand Down
49 changes: 32 additions & 17 deletions src/vtkjs/vtkjsRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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();
Expand All @@ -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,
Expand All @@ -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(),
Expand All @@ -127,7 +145,7 @@ var vtkjsRenderer = function (arg) {
};

/**
* Exit
* Exit.
*/
this._exit = function () {
// DO NOTHING
Expand All @@ -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
});
Expand All @@ -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.
*/
Expand All @@ -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.
Expand Down

0 comments on commit b738bd2

Please sign in to comment.