IW: Fix docs strings

This commit is contained in:
Ivan Willig 2014-02-06 21:16:22 -05:00
parent 84618be5df
commit f6a76ec666

View File

@ -7,11 +7,13 @@ carto.Renderer = function Renderer(env, options) {
this.options.mapnik_version = this.options.mapnik_version || 'latest'; this.options.mapnik_version = this.options.mapnik_version || 'latest';
}; };
// Prepare a MSS document (given as an string) into a /**
// XML Style fragment (mostly useful for debugging) * Prepare a MSS document (given as an string) into a
// * XML Style fragment (mostly useful for debugging)
// - @param {String} str the mss contents as a string. *
// - @param {Object} env renderer environment options. * @param {String} data the mss contents as a string.
* @param {Object} callback renderer environment options.
*/
carto.Renderer.prototype.renderMSS = function render(data, callback) { carto.Renderer.prototype.renderMSS = function render(data, callback) {
// effects is a container for side-effects, which currently // effects is a container for side-effects, which currently
// are limited to FontSets. // are limited to FontSets.
@ -60,11 +62,13 @@ carto.Renderer.prototype.renderMSS = function render(data, callback) {
return callback(null, output.join('\n')); return callback(null, output.join('\n'));
}; };
// Prepare a MML document (given as an object) into a /**
// fully-localized XML file ready for Mapnik2 consumption * Prepare a MML document (given as an object) into a
// * fully-localized XML file ready for Mapnik2 consumption
// - @param {String} str the JSON file as a string. *
// - @param {Object} env renderer environment options. * @param {String} m - the JSON file as a string.
* @param {Object} callback - renderer environment options.
*/
carto.Renderer.prototype.render = function render(m, callback) { carto.Renderer.prototype.render = function render(m, callback) {
// effects is a container for side-effects, which currently // effects is a container for side-effects, which currently
// are limited to FontSets. // are limited to FontSets.
@ -224,13 +228,14 @@ carto.Renderer.prototype.render = function render(m, callback) {
return callback(null, output.join('\n')); return callback(null, output.join('\n'));
}; };
// This function currently modifies 'current' /**
// * This function currently modifies 'current'
// @param {Array} the current list of rules * @param {Array} current current list of rules
// @param {Object} definition a Definition object to add to the rules * @param {Object} definition a Definition object to add to the rules
// @param {Object} byFilter an object/dictionary of existing filters. This is * @param {Object} byFilter an object/dictionary of existing filters. This is
// actually keyed `attachment->filter` * actually keyed `attachment->filter`
// @param {Object} env the current environment * @param {Object} env the current environment
*/
function addRules(current, definition, byFilter, env) { function addRules(current, definition, byFilter, env) {
var newFilters = definition.filters, var newFilters = definition.filters,
newRules = definition.rules, newRules = definition.rules,
@ -283,16 +288,18 @@ function addRules(current, definition, byFilter, env) {
return current; return current;
} }
// Apply inherited styles from their ancestors to them. /**
// * Apply inherited styles from their ancestors to them.
// called either once per render (in the case of mss) or per layer *
// (for mml) * called either once per render (in the case of mss) or per layer
// * (for mml)
// @param {Object} definitions: a list of definitions objects that contain .rules *
// @param {Object} env the environment * @param {Object} definitions - a list of definitions objects
// * that contain .rules
// result: an array of arrays is returned, in which each array refers to a * @param {Object} env - the environment
// specific attachment * @return {Array<Array>} an array of arrays is returned,
* in which each array refers to a specific attachment
*/
function inheritDefinitions(definitions, env) { function inheritDefinitions(definitions, env) {
var inheritTime = +new Date(); var inheritTime = +new Date();
// definitions are ordered by specificity, // definitions are ordered by specificity,
@ -364,16 +371,18 @@ function sortStyles(styles, env) {
return result; return result;
} }
// Find a rule like Map { background-color: #fff; }, /**
// if any, and return a list of properties to be inserted * Find a rule like Map { background-color: #fff; },
// into the <Map element of the resulting XML. Translates * if any, and return a list of properties to be inserted
// properties of the mml object at `m` directly into XML * into the <Map element of the resulting XML. Translates
// properties. * properties of the mml object at `m` directly into XML
// * properties.
// - @param {Object} m the mml object. *
// - @param {Array} definitions the output of toList. * @param {Object} m the mml object.
// - @param {Object} env. * @param {Array} definitions the output of toList.
// - @return {String} rendered properties. * @param {Object} env
* @return {String} rendered properties.
*/
function getMapProperties(m, definitions, env) { function getMapProperties(m, definitions, env) {
var rules = {}; var rules = {};
var symbolizers = carto.tree.Reference.data.symbolizers.map; var symbolizers = carto.tree.Reference.data.symbolizers.map;