Improve defined properties documentation.
This also removes some wrapping functions that are unnecessary.
MODIFY
src/annotationLayer.js
src/annotationLayer.js
@@ -381,6 +381,8 @@ var annotationLayer = function (args) {
* @param {string|geo.transform|null} [gcs] `undefined` to use the interface
* gcs, `null` to use the map gcs, or any other transform.
* @returns {this} The current layer.
+ * @fires geo.event.annotation.add_before
+ * @fires geo.event.annotation.add
*/
this.addAnnotation = function (annotation, gcs) {
var pos = $.inArray(annotation, m_annotations);
@@ -413,6 +415,7 @@ var annotationLayer = function (args) {
* @param {boolean} update If `false`, don't update the layer after removing
* the annotation.
* @returns {boolean} `true` if an annotation was removed.
+ * @fires geo.event.annotation.remove
*/
this.removeAnnotation = function (annotation, update) {
var pos = $.inArray(annotation, m_annotations);
@@ -504,6 +507,7 @@ var annotationLayer = function (args) {
* @param {geo.annotation} [editAnnotation] If `arg === this.modes.edit`,
* this is the annotation that should be edited.
* @returns {string|null|this} The current mode or the layer.
+ * @fires geo.event.annotation.mode
*/
this.mode = function (arg, editAnnotation) {
if (arg === undefined) {
@@ -651,6 +655,7 @@ var annotationLayer = function (args) {
* @param {geo.feature} feature The feature to convert.
* @param {string|geo.transform|null} [gcs] `undefined` to use the interface
* gcs, `null` to use the map gcs, or any other transform.
+ * @fires geo.event.annotation.update
*/
this._geojsonFeatureToAnnotation = function (feature, gcs) {
var dataList = feature.data(),
@@ -1028,6 +1033,7 @@ var annotationLayer = function (args) {
* @param {object[]|null} labels The list of labels to display of `null` for
* no labels.
* @returns {this} The class instance.
+ * @fires geo.event.annotation.layerAdd
*/
this._updateLabels = function (labels) {
if (!labels || !labels.length) {
@@ -1083,6 +1089,7 @@ var annotationLayer = function (args) {
* Remove the label feature if it exists.
*
* @returns {this} The current layer.
+ * @fires geo.event.annotation.layerRemove
*/
this._removeLabelFeature = function () {
if (m_labelLayer) {

MODIFY
src/camera.js
src/camera.js
@@ -150,6 +150,7 @@ var camera = function (spec) {
* Update the internal state of the camera on change to camera
* parameters.
* @protected
+ * @fires geo.event.camera.view
*/
this._update = function () {
this._bounds = null;
@@ -165,6 +166,8 @@ var camera = function (spec) {
/**
* Getter/setter for the view matrix.
* @note copies the matrix value on set.
+ * @property {mat4} view The view matrix.
+ * @name geo.camera#view
*/
Object.defineProperty(this, 'view', {
get: function () {
@@ -179,12 +182,12 @@ var camera = function (spec) {
/**
* Getter/setter for the view bounds.
*
- * If not provided, near and far bounds will be set to [-1, 1] by
- * default. We will probably want to change this to a unit specific
- * value initialized by the map when drawing true 3D objects or
- * tilting the camera.
- *
- * Returned near/far bounds are also -1, 1 for the moment.
+ * @property {object} bounds The view bounds.
+ * @property {number} bounds.left
+ * @property {number} bounds.top
+ * @property {number} bounds.right
+ * @property {number} bounds.bottom
+ * @name geo.camera#bounds
*/
Object.defineProperty(this, 'bounds', {
get: function () {
@@ -203,7 +206,10 @@ var camera = function (spec) {
* Getter for the "display" matrix. This matrix converts from
* world coordinates into display coordinates. This matrix exists to
* generate matrix3d css transforms that can be used in layers that
- * render on the DOM.
+ * render on the DOM. Read only.
+ *
+ * @property {mat4} display The display matrix.
+ * @name geo.camera#display
*/
Object.defineProperty(this, 'display', {
get: function () {
@@ -230,7 +236,10 @@ var camera = function (spec) {
/**
* Getter for the "world" matrix. This matrix converts from
* display coordinates into world coordinates. This is constructed
- * by inverting the "display" matrix.
+ * by inverting the "display" matrix. Read only.
+ *
+ * @property {mat4} world The world matrix.
+ * @name geo.camera#world
*/
Object.defineProperty(this, 'world', {
get: function () {
@@ -246,6 +255,11 @@ var camera = function (spec) {
/**
* Getter/setter for the projection type.
+ *
+ * @property {string} projection The projection type. One of `parallel` or
+ * `perspective`.
+ * @name geo.camera#projection
+ * @fires geo.event.camera.projection
*/
Object.defineProperty(this, 'projection', {
get: function () {
@@ -268,10 +282,10 @@ var camera = function (spec) {
});
/**
- * Getter for the projection matrix (when applicable).
- * This generally shouldn't be modified directly because
- * the rest of the code assumes that the clipping bounds
- * are [-1, -1, -1] to [1, 1, 1] in camera coordinates.
+ * Getter for the projection matrix. Read only.
+ *
+ * @property {mat4} projectionMatrix The projection matrix.
+ * @name geo.camera#projectionMatrix
*/
Object.defineProperty(this, 'projectionMatrix', {
get: function () {
@@ -280,7 +294,11 @@ var camera = function (spec) {
});
/**
- * Getter for the transform matrix.
+ * Getter for the transform matrix. This is the projection multiplied by the
+ * view matrix. Read only.
+ *
+ * @property {mat4} transform The transform matrix.
+ * @name geo.camera#transform
*/
Object.defineProperty(this, 'transform', {
get: function () {
@@ -289,7 +307,10 @@ var camera = function (spec) {
});
/**
- * Getter for the inverse transform matrix.
+ * Getter for the inverse transform matrix. Read only.
+ *
+ * @property {mat4} inverse The inverse transform matrix.
+ * @name geo.camera#inverse
*/
Object.defineProperty(this, 'inverse', {
get: function () {
@@ -303,6 +324,14 @@ var camera = function (spec) {
* The viewport consists of a width and height in pixels, plus a left and
* top offset in pixels. The offsets are only used to determine if pixel
* alignment is possible.
+ *
+ * @property {object} viewport The viewport in pixels.
+ * @property {number} viewport.width
+ * @property {number} viewport.height
+ * @property {number} viewport.top
+ * @property {number} viewport.left
+ * @name geo.camera#viewport
+ * @fires geo.event.camera.viewport
*/
Object.defineProperty(this, 'viewport', {
get: function () {

MODIFY
src/d3/d3Renderer.js
src/d3/d3Renderer.js
@@ -445,6 +445,7 @@ var d3Renderer = function (arg) {
* @param {number} w New width in pixels.
* @param {number} h New height in pixels.
* @returns {this}
+ * @fires geo.event.d3.rescale
*/
this._resize = function (x, y, w, h) {
if (!m_corners) {

MODIFY
src/d3/rescale.js
src/d3/rescale.js
+/**
+ * @namespace geo.event.d3
+ */
+
+/**
+ * @event geo.event.d3.rescale
+ * @type {geo.event.base}
+ * @property {number} scale The scale as a ratio of the original render size.
+ */
module.exports = 'geo_d3_rescale';

MODIFY
src/feature.js
src/feature.js
@@ -191,6 +191,7 @@ var feature = function (arg) {
* Private mousemove handler. This uses `pointSearch` to determine which
* features the mouse is over, then fires appropriate events.
*
+ * @fires geo.event.feature.mouseover_order
* @fires geo.event.feature.mouseover
* @fires geo.event.feature.mouseout
* @fires geo.event.feature.mousemove
@@ -319,6 +320,7 @@ var feature = function (arg) {
* feature.
*
* @param {geo.event} evt The event that triggered this handler.
+ * @fires geo.event.feature.mouseclick_order
* @fires geo.event.feature.mouseclick
*/
this._handleMouseclick = function (evt) {

MODIFY
src/fetchQueue.js
src/fetchQueue.js
-module.exports = (function () {
- 'use strict';
-
var $ = require('jquery');
/**
@@ -45,6 +42,8 @@ module.exports = (function () {
/**
* Get/set the maximum concurrent deferred object size.
+ * @property {number} size The maximum number of deferred objects.
+ * @name geo.fetchQueue#size
*/
Object.defineProperty(this, 'size', {
get: function () { return this._size; },
@@ -55,16 +54,18 @@ module.exports = (function () {
});
/**
- * Get the current queue size.
- * @returns {number} The queue size.
+ * Get the current queue size. Read only.
+ * @property {number} length The current queue size.
+ * @name geo.fetchQueue#length
*/
Object.defineProperty(this, 'length', {
get: function () { return this._queue.length; }
});
/**
- * Get the current number of processing items.
- * @returns {number} The number of processing items.
+ * Get the current number of processing items. Read only.
+ * @property {number} processing The current number of processing items.
+ * @name geo.fetchQueue#processing
*/
Object.defineProperty(this, 'processing', {
get: function () { return this._processing; }
@@ -231,5 +232,4 @@ module.exports = (function () {
return this;
};
- return fetchQueue;
-})();
+module.exports = fetchQueue;

MODIFY
src/imageTile.js
src/imageTile.js
var inherit = require('./inherit');
var tile = require('./tile');
-module.exports = (function () {
- 'use strict';
-
/**
* This class defines a tile that is part of a standard "image pyramid", such
* as an open street map tile set. Every tile is uniquely indexed by a row,
@@ -51,12 +48,12 @@ module.exports = (function () {
tile.call(this, spec);
/**
- * Read only accessor to the Image object used by the
- * tile. Note, this method does not gaurantee that the
- * image data is available. Use the promise interface
- * to add asyncronous handlers.
+ * Read only accessor to the Image object used by the tile. Note, this
+ * method does not guarantee that the image data is available. Use the
+ * promise interface to add asynchronous handlers.
*
- * @returns {Image}
+ * @property {Image} image The image object used by the tile.
+ * @name geo.imageTile#image
*/
Object.defineProperty(this, 'image', {
get: function () { return this._image; }
@@ -113,5 +110,5 @@ module.exports = (function () {
};
inherit(imageTile, tile);
- return imageTile;
-})();
+
+module.exports = imageTile;

MODIFY
src/map.js
src/map.js
@@ -657,6 +657,7 @@ var map = function (arg) {
*
* @param {geo.screenSize} [arg] Size in pixels.
* @returns {geo.screenSize|this} The size in pixels or the map object.
+ * @fires geo.event.resize
*/
this.size = function (arg) {
if (arg === undefined) {
@@ -1598,6 +1599,7 @@ var map = function (arg) {
* include the attribution. If `true`, always include it.
* @returns {deferred} A jQuery Deferred object. The done function receives
* either a data URL or an `HTMLCanvasElement` with the result.
+ * @fires geo.event.screenshot.ready
*/
this.screenshot = function (layers, type, encoderOptions, opts) {
var defer;

MODIFY
src/mapInteractor.js
src/mapInteractor.js
@@ -444,6 +444,7 @@ var mapInteractor = function (args) {
* @param {object} evt The event with metakeys.
* @param {object} keys Keys used to trigger the event. `keys.simulated` is
* true if artificially triggered.
+ * @fires geo.event.keyaction
*/
this._handleKeys = function (action, evt, keys) {
if (keys && keys.simulated === true) {
@@ -642,6 +643,7 @@ var mapInteractor = function (args) {
/**
* Retrigger a mouse movement with the current mouse state.
+ * @fires geo.event.mousemove
*/
this.retriggerMouseMove = function () {
m_this.map().geoTrigger(geo_event.mousemove, m_this.mouse());
@@ -987,6 +989,8 @@ var mapInteractor = function (args) {
* Handle event when a mouse button is pressed.
*
* @param {jQuery.Event} evt The event that triggered this.
+ * @fires geo.event.brushstart
+ * @fires geo.event.actiondown
*/
this._handleMouseDown = function (evt) {
var action, actionRecord;
@@ -1095,6 +1099,7 @@ var mapInteractor = function (args) {
* Handle mouse move event.
*
* @param {jQuery.Event} evt The event that triggered this.
+ * @fires geo.event.mousemove
*/
this._handleMouseMove = function (evt) {
if (m_paused) {
@@ -1196,6 +1201,8 @@ var mapInteractor = function (args) {
* Handle mouse move event on the document (temporary bindings).
*
* @param {jQuery.Event} evt The event that triggered this.
+ * @fires geo.event.brush
+ * @fires geo.event.actionmove
*/
this._handleMouseMoveDocument = function (evt) {
var dx, dy, selectionObj;
@@ -1418,6 +1425,12 @@ var mapInteractor = function (args) {
* Removes temporary bindings.
*
* @param {jQuery.Event} evt The event that triggered this.
+ * @fires geo.event.brushend
+ * @fires geo.event.actionselection
+ * @fires geo.event.actionup
+ * @fires geo.event.select
+ * @fires geo.event.zoomselect
+ * @fires geo.event.unzoomselect
*/
this._handleMouseUpDocument = function (evt) {
var selectionObj, oldAction;
@@ -1511,6 +1524,7 @@ var mapInteractor = function (args) {
* events were triggered in the interim.
*
* @param {jQuery.Event} evt The event that triggered this.
+ * @fires geo.event.mouseup
*/
this._handleMouseClick = function (evt) {
@@ -1649,6 +1663,7 @@ var mapInteractor = function (args) {
*
* @returns {function} A function that takes a jQuery.Event for mouse wheel
* actions.
+ * @fires geo.event.actionwheel
*/
function throttled_wheel() {
var my_queue = {};

MODIFY
src/osmLayer.js
src/osmLayer.js
-module.exports = (function () {
- 'use strict';
-
var $ = require('jquery');
var inherit = require('./inherit');
var tileLayer = require('./tileLayer');
@@ -84,5 +81,5 @@ module.exports = (function () {
* reprojection, they will need to require the
* quadFeature.capabilities.imageFull feature */
registry.registerLayer('osm', osmLayer, [quadFeature.capabilities.image]);
- return osmLayer;
-})();
+
+module.exports = osmLayer;

MODIFY
src/pixelmapFeature.js
src/pixelmapFeature.js
@@ -259,6 +259,8 @@ var pixelmapFeature = function (arg) {
* Given the loaded pixelmap image, create a canvas the size of the image.
* Compute a color for each distinct index and recolor the canvas based on
* thise colors, then draw the resultant image as a quad.
+ *
+ * @fires geo.event.pixelmap.prepared
*/
this._computePixelmap = function () {
var data = m_this.data() || [],

MODIFY
src/tile.js
src/tile.js
-module.exports = (function () {
- 'use strict';
-
var $ = require('jquery');
/**
@@ -44,9 +41,12 @@ module.exports = (function () {
this._queue = spec.queue || null;
/**
- * Return the index coordinates.
+ * Return the index coordinates. Read only.
*
- * @returns {object} The index with `x` and `y` properties.
+ * @property {object} index The tile index.
+ * @property {number} index.x The tile x index.
+ * @property {number} index.y The tile y index.
+ * @name geo.tile#index
*/
Object.defineProperty(this, 'index', {
get:
@@ -54,18 +54,24 @@ module.exports = (function () {
});
/**
- * Return the tile size.
+ * Return the tile size. Read only.
*
- * @returns {object} The size with `x` and `y` properties.
+ * @property {object} size The tile size.
+ * @property {number} size.x The tile width.
+ * @property {number} size.y The tile height.
+ * @name geo.tile#size
*/
Object.defineProperty(this, 'size', {
get: function () { return this._size; }
});
/**
- * Return the tile overlap.
+ * Return the tile overlap. Read only.
*
- * @returns {object} The overlap with `x` and `y` properties.
+ * @property {object} overlap The tile overlap.
+ * @property {number} overlap.x The tile x overlap.
+ * @property {number} overlap.y The tile y overlap.
+ * @name geo.tile#overlap
*/
Object.defineProperty(this, 'overlap', {
get: function () { return this._overlap; }
@@ -167,7 +173,8 @@ module.exports = (function () {
/**
* Computes the global coordinates of the bottom edge.
- * @returns {number}
+ * @property {number} bottom The global coordinates of the bottom edge.
+ * @name geo.tile#bottom
*/
Object.defineProperty(this, 'bottom', {
get: function () {
@@ -177,7 +184,8 @@ module.exports = (function () {
/**
* Computes the global coordinates of the top edge.
- * @returns {number}
+ * @property {number} top The global coordinates of the top edge.
+ * @name geo.tile#top
*/
Object.defineProperty(this, 'top', {
get: function () {
@@ -187,7 +195,8 @@ module.exports = (function () {
/**
* Computes the global coordinates of the left edge.
- * @returns {number}
+ * @property {number} left The global coordinates of the left edge.
+ * @name geo.tile#left
*/
Object.defineProperty(this, 'left', {
get: function () {
@@ -197,7 +206,8 @@ module.exports = (function () {
/**
* Computes the global coordinates of the right edge.
- * @returns {number}
+ * @property {number} right The global coordinates of the right edge.
+ * @name geo.tile#right
*/
Object.defineProperty(this, 'right', {
get: function () {
@@ -217,5 +227,5 @@ module.exports = (function () {
return this;
};
};
- return tile;
-})();
+
+module.exports = tile;

MODIFY
src/tileCache.js
src/tileCache.js
-module.exports = (function () {
- 'use strict';
-
/**
* This class implements a simple cache for tile objects. Each tile is
* stored in cache object keyed by a configurable hashing function. Another
@@ -22,8 +19,8 @@ module.exports = (function () {
/**
* Get/set the maximum cache size.
- * @param {number} The new maximum cache size.
- * @returns {number} The maximum cache size.
+ * @property {number} size The maximum cache size.
+ * @name geo.tileCache#size
*/
Object.defineProperty(this, 'size', {
get: function () { return this._size; },
@@ -36,8 +33,9 @@ module.exports = (function () {
});
/**
- * Get the current cache size.
- * @returns {number}
+ * Get the current cache size. Read only.
+ * @property {number} length The current cache size.
+ * @name geo.tileCache#length
*/
Object.defineProperty(this, 'length', {
get: function () { return this._atime.length; }
@@ -151,5 +149,5 @@ module.exports = (function () {
this.clear();
return this;
};
- return tileCache;
-})();
+
+module.exports = tileCache;

MODIFY
src/tileLayer.js
src/tileLayer.js
-module.exports = (function () {
- 'use strict';
-
var inherit = require('./inherit');
var featureLayer = require('./featureLayer');
@@ -232,7 +229,9 @@ module.exports = (function () {
var m_tileOffsetValues = {};
/**
- * Readonly accessor to the options object
+ * Readonly accessor to the options object.
+ * @property {object} options A copy of the options object.
+ * @name geo.tileLayer#options
*/
Object.defineProperty(this, 'options', {get: function () {
return $.extend({}, this._options);
@@ -240,7 +239,8 @@ module.exports = (function () {
/**
* Readonly accessor to the tile cache object.
- * @returns {geo.tileCache}
+ * @property {geo.tileCache} cache The tile cache object.
+ * @name geo.tileLayer#cache
*/
Object.defineProperty(this, 'cache', {get: function () {
return this._cache;
@@ -249,7 +249,10 @@ module.exports = (function () {
/**
* Readonly accessor to the active tile mapping. This is an object
* containing all currently drawn tiles (hash(tile) => tile).
- * @returns {object}
+ *
+ * @property {object} activeTiles The keys are `hash(tile)` and the values
+ * are tiles.
+ * @name geo.tileLayer#activeTiles
*/
Object.defineProperty(this, 'activeTiles', {get: function () {
return $.extend({}, this._activeTiles); // copy on output
@@ -1589,5 +1592,5 @@ module.exports = (function () {
};
inherit(tileLayer, featureLayer);
- return tileLayer;
-})();
+
+module.exports = tileLayer;

Improve defined properties documentation.

This also removes some wrapping functions that are unnecessary.