Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve polygon and line documentation. #824

Merged
merged 5 commits into from
May 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/canvas/canvasRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var renderer = require('../renderer');
/**
* Create a new instance of class canvasRenderer.
*
* @class geo.canvas.renderer
* @class
* @alias geo.canvas.renderer
* @extends geo.renderer
* @param {object} arg Options for the renderer.
* @param {geo.layer} [arg.layer] Layer associated with the renderer.
Expand Down
3 changes: 2 additions & 1 deletion src/canvas/heatmapFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ var timestamp = require('../timestamp');
* Inspired from
* https://github.com/mourner/simpleheat/blob/gh-pages/simpleheat.js
*
* @class geo.canvas.heatmapFeature
* @class
* @alias geo.canvas.heatmapFeature
* @param {Object} arg Options object
* @extends geo.heatmapFeature
* @returns {canvas_heatmapFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/canvas/lineFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var lineFeature = require('../lineFeature');
/**
* Create a new instance of class lineFeature.
*
* @class geo.canvas.lineFeature
* @class
* @alias geo.canvas.lineFeature
* @extends geo.lineFeature
* @param {geo.lineFeature.spec} arg
* @returns {geo.canvas.lineFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/canvas/pixelmapFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var pixelmapFeature = require('../pixelmapFeature');
/**
* Create a new instance of class pixelmapFeature
*
* @class geo.canvas.pixelmapFeature
* @class
* @alias geo.canvas.pixelmapFeature
* @param {Object} arg Options object
* @extends geo.pixelmapFeature
* @returns {canvas_pixelmapFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/canvas/quadFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var util = require('../util');
/**
* Create a new instance of class quadFeature.
*
* @class geo.canvas.quadFeature
* @class
* @alias geo.canvas.quadFeature
* @param {geo.quadFeature.spec} arg Options object.
* @extends geo.quadFeature
* @returns {geo.canvas.quadFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/choroplethFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var feature = require('./feature');
/**
* Create a new instance of class choroplethFeature
*
* @class geo.choroplethFeature
* @class
* @alias geo.choroplethFeature
* @param {Object} arg Options object
* @extends geo.feature
* @param {Array} [colorRange] Color lookup table for
Expand Down
3 changes: 2 additions & 1 deletion src/d3/d3Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var renderer = require('../renderer');
/**
* Create a new instance of class d3Renderer.
*
* @class geo.d3.renderer
* @class
* @alias geo.d3.renderer
* @extends geo.renderer
* @param {object} arg Options for the renderer.
* @param {geo.layer} [arg.layer] Layer associated with the renderer.
Expand Down
3 changes: 2 additions & 1 deletion src/d3/graphFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ var registerFeature = require('../registry').registerFeature;
var graphFeature = require('../graphFeature');

/**
* @class geo.d3.graphFeature
* @class
* @alias geo.d3.graphFeature
* @extends geo.graphFeature
*/
var d3_graphFeature = function (arg) {
Expand Down
3 changes: 2 additions & 1 deletion src/d3/lineFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var lineFeature = require('../lineFeature');
/**
* Create a new instance of class lineFeature.
*
* @class geo.d3.lineFeature
* @class
* @alias geo.d3.lineFeature
* @extends geo.lineFeature
* @param {geo.lineFeature.spec} arg
* @returns {geo.d3.lineFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/d3/pathFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var pathFeature = require('../pathFeature');
/**
* Create a new instance of class pathFeature
*
* @class geo.d3.pathFeature
* @class
* @alias geo.d3.pathFeature
* @extends geo.pathFeature
* @extends geo.d3.object
* @returns {geo.d3.pathFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/d3/pointFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var pointFeature = require('../pointFeature');
*
* Create a new instance of pointFeature
*
* @class geo.d3.pointFeature
* @class
* @alias geo.d3.pointFeature
* @extends geo.pointFeature
* @extends geo.d3.object
* @returns {geo.d3.pointFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/d3/quadFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var quadFeature = require('../quadFeature');
/**
* Create a new instance of class quadFeature.
*
* @class geo.d3.quadFeature
* @class
* @alias geo.d3.quadFeature
* @param {geo.quadFeature.spec} arg Options object.
* @extends geo.quadFeature
* @returns {geo.d3.quadFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/d3/vectorFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var vectorFeature = require('../vectorFeature');
/**
* Create a new instance of vectorFeature
*
* @class geo.d3.vectorFeature
* @class
* @alias geo.d3.vectorFeature
* @extends geo.vectorFeature
* @extends geo.d3.object
* @returns {geo.d3.vectorFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/domRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var registerRenderer = require('./registry').registerRenderer;
/**
* Create a new instance of class domRenderer.
*
* @class geo.domRenderer
* @class
* @alias geo.domRenderer
* @extends geo.renderer
* @param {object} arg Options for the renderer.
* @param {geo.layer} [arg.layer] Layer associated with the renderer.
Expand Down
6 changes: 5 additions & 1 deletion src/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,11 @@ var feature = function (arg) {
};

/**
* Get/Set style used by the feature.
* Get/Set style used by the feature. Styles can be constant values or
* functions. If a function, the style is typically called with parameters
* such as `(dataElement, dataIndex)` or, if the specific style of a feature
* has a subfeature style, with `(subfeatureElement, subfeatureIndex,
* dataElement, dataIndex)`.
*
* @param {string|object} [arg1] If `undefined`, return the current style
* object. If a string and `arg2` is undefined, return the style
Expand Down
3 changes: 2 additions & 1 deletion src/fileReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var object = require('./object');
/**
* Create a new instance of class fileReader
*
* @class geo.fileReader
* @class
* @alias geo.fileReader
* @extends geo.object
* @returns {geo.fileReader}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/gl/choroplethFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var choroplethFeature = require('../choroplethFeature');
/**
* Create a new instance of choroplethFeature
*
* @class geo.gl.choroplethFeature
* @class
* @alias geo.gl.choroplethFeature
* @extends geo.choroplethFeature
* @returns {geo.gl.choroplethFeature}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/gl/contourFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var contourFeature = require('../contourFeature');
/**
* Create a new instance of contourFeature
*
* @class geo.gl.contourFeature
* @class
* @alias geo.gl.contourFeature
* @extends geo.contourFeature
* @returns {geo.gl.contourFeature}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/gl/lineFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ var flagsDebug = { // uses 1 bit
/**
* Create a new instance of lineFeature.
*
* @class geo.gl.lineFeature
* @class
* @alias geo.gl.lineFeature
* @extends geo.lineFeature
* @param {geo.lineFeature.spec} arg
* @returns {geo.gl.lineFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/gl/pointFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var pointFeature = require('../pointFeature');
/**
* Create a new instance of pointFeature
*
* @class geo.gl.pointFeature
* @class
* @alias geo.gl.pointFeature
* @extends geo.pointFeature
* @returns {geo.gl.pointFeature}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/gl/quadFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var quadFeature = require('../quadFeature');
/**
* Create a new instance of class quadFeature.
*
* @class geo.gl.quadFeature
* @class
* @alias geo.gl.quadFeature
* @param {geo.quadFeature.spec} arg Options object.
* @extends geo.quadFeature
* @returns {geo.gl.quadFeature}
Expand Down
3 changes: 2 additions & 1 deletion src/gl/vglRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var renderer = require('../renderer');
/**
* Create a new instance of class vglRenderer.
*
* @class geo.gl.vglRenderer
* @class
* @alias geo.gl.vglRenderer
* @extends geo.renderer
* @param {object} arg Options for the renderer.
* @param {geo.layer} [arg.layer] Layer associated with the renderer.
Expand Down
3 changes: 2 additions & 1 deletion src/graphFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var feature = require('./feature');
/**
* Create a new instance of class graphFeature
*
* @class geo.graphFeature
* @class
* @alias geo.graphFeature
* @extends geo.feature
* @returns {geo.graphFeature}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/heatmapFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var transform = require('./transform');
/**
* Create a new instance of class heatmapFeature
*
* @class geo.heatmapFeature
* @class
* @alias geo.heatmapFeature
* @param {Object} arg Options object
* @extends geo.feature
* @param {Object|Function} [position] Position of the data. Default is
Expand Down
24 changes: 14 additions & 10 deletions src/lineFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ var util = require('./util');
/**
* Create a new instance of class lineFeature.
*
* @class geo.lineFeature
* @class
* @alias geo.lineFeature
* @extends geo.feature
* @param {geo.lineFeature.spec} arg
* @returns {geo.lineFeature}
Expand Down Expand Up @@ -82,11 +83,13 @@ var lineFeature = function (arg) {
};

/**
* Get/set lineaccessor.
* Get/set line accessor.
*
* @param {object} [val] if specified, use this for the line accessor
* and return the feature. If not specified, return the current line.
* @returns {object|this} The current line or this feature.
* @param {object|function} [val] If not specified, return the current line
* accessor. If specified, use this for the line accessor and return
* `this`. If a function is given, the function is passed `(dataElement,
* dataIndex)` and returns an array of vertex elements.
* @returns {object|function|this} The current line accessor or this feature.
*/
this.line = function (val) {
if (val === undefined) {
Expand All @@ -102,10 +105,11 @@ var lineFeature = function (arg) {
/**
* Get/Set position accessor.
*
* @param {object} [val] if specified, use this for the position accessor
* and return the feature. If not specified, return the current
* position.
* @returns {object|this} The current position or this feature.
* @param {object|function} [val] If not specified, return the current
* position accessor. If specified, use this for the position accessor
* and return `this`. If a function is given, this is called with
* `(vertexElement, vertexIndex, dataElement, dataIndex)`.
* @returns {object|function|this} The current position or this feature.
*/
this.position = function (val) {
if (val === undefined) {
Expand Down Expand Up @@ -259,7 +263,7 @@ var lineFeature = function (arg) {
};

/**
* Take a set of data, reduce the number of vertices per linen using the
* Take a set of data, reduce the number of vertices per line using the
* Ramer–Douglas–Peucker algorithm, and use the result as the new data.
* This changes the instance's data, the position accessor, and the line
* accessor.
Expand Down
3 changes: 2 additions & 1 deletion src/pathFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var feature = require('./feature');
/**
* Create a new instance of class pathFeature
*
* @class geo.pathFeature
* @class
* @alias geo.pathFeature
* @extends geo.feature
* @returns {geo.pathFeature}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/pixelmapFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ var util = require('./util');
/**
* Create a new instance of class imagemapFeature
*
* @class geo.pixelmapFeature
* @class
* @alias geo.pixelmapFeature
* @param {Object} arg Options object
* @extends geo.feature
* @param {Object|Function|HTMLImageElement} [url] URL of a pixel map or an
Expand Down
3 changes: 2 additions & 1 deletion src/pointFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var feature = require('./feature');
/**
* Create a new instance of class pointFeature
*
* @class geo.pointFeature
* @class
* @alias geo.pointFeature
* @param {object} arg Options object
* @param {boolean} arg.clustering Enable point clustering
* @extends geo.feature
Expand Down
33 changes: 16 additions & 17 deletions src/polygonFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ var transform = require('./transform');
* @typedef {geo.feature.spec} geo.polygonFeature.spec
* @property {object|function} [position] Position of the data. Default is
* (data).
* @property {object|function} [polygon] Polygons from the data. Default is
* (data). Typically, the data is an array of polygons, each of which is of
* the form {outer: [(coordinates)], inner: [[(coordinates of first hole)],
* [(coordinates of second hole)], ...]}. The inner record is optional.
* Alternately, if there are no holes, a polygon can just be an array of
* coordinates in the form of geo.geoPosition. The first and last point of
* each polygon may be the same.
* @property {geo.polygon|function} [polygon] Polygons from the data. Default
* (data).
* @property {object} [style] Style object with default style options.
* @property {boolean|function} [style.fill=true] True to fill polygon.
* @property {geo.geoColor|function} [style.fillColor] Color to fill each
Expand Down Expand Up @@ -105,8 +100,8 @@ var polygonFeature = function (arg) {
* get the position of each vertex.
* @param {function} [polyFunc=this.style.get('polygon')] The function to
* get each polygon.
* @returns {object[]} An array of polygon positions. Each has `outer` and
* `inner` if it has any coordinates, or is undefined.
* @returns {geo.polygonObject[]} An array of polygon positions. Each has
* `outer` and `inner` if it has any coordinates, or is `undefined`.
*/
function getCoordinates(data, posFunc, polyFunc) {
data = data || m_this.data();
Expand Down Expand Up @@ -154,8 +149,8 @@ var polygonFeature = function (arg) {
/**
* Get the set of normalized polygon coordinates.
*
* @returns {object[]} An array of polygon positions. Each has `outer` and
* `inner` if it has any coordinates, or is undefined.
* @returns {geo.polygonObject[]} An array of polygon positions. Each has
* `outer` and `inner` if it has any coordinates, or is `undefined`.
*/
this.polygonCoordinates = function () {
return m_coordinates;
Expand Down Expand Up @@ -188,9 +183,12 @@ var polygonFeature = function (arg) {
/**
* Get/set polygon accessor.
*
* @param {object} [val] if specified, use this for the polygon accessor
* and return the feature. If not specified, return the current polygon.
* @returns {object|this} The current polygon or this feature.
* @param {object|function} [val] If not specified, return the current
* polygon accessor. If specified, use this for the polygon accessor and
* return `this`. If a function is given, the function is passed
* `(dataElement, dataIndex)` and returns a `geo.polygon`.
* @returns {object|function|this} The current polygon accessor or this
* feature.
*/
this.polygon = function (val) {
if (val === undefined) {
Expand All @@ -207,9 +205,10 @@ var polygonFeature = function (arg) {
/**
* Get/Set position accessor.
*
* @param {object} [val] if specified, use this for the position accessor
* and return the feature. If not specified, return the current
* position.
* @param {object|function} [val] If not specified, return the current
* position accessor. If specified, use this for the position accessor
* and return `this`. If a function is given, this is called with
* `(vertexElement, vertexIndex, dataElement, dataIndex)`.
* @returns {object|this} The current position or this feature.
*/
this.position = function (val) {
Expand Down
Loading