diff --git a/examples/dynamicData/clock.js b/examples/dynamicData/clock.js index 9c6cbb1698..c57b78a070 100644 --- a/examples/dynamicData/clock.js +++ b/examples/dynamicData/clock.js @@ -1,4 +1,3 @@ -////////////////////////////////////////////////////////////////////////////// /** * Stores the current time for a map, triggers time keeping events, and * handles the animation state and interaction. @@ -7,7 +6,6 @@ * @extends geo.object * @returns {geo.clock} */ -////////////////////////////////////////////////////////////////////////////// geo.clock = function (opts) { 'use strict'; @@ -17,11 +15,9 @@ geo.clock = function (opts) { geo.object.call(this, opts); opts = opts || {}; - ////////////////////////////////////////////////////////////////////////////// /** * @private */ - ////////////////////////////////////////////////////////////////////////////// var m_this = this, m_now = new Date(0), m_start = null, @@ -34,11 +30,9 @@ geo.clock = function (opts) { m_currentAnimation = null, m_object = null; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set the geo.object to trigger events on. */ - ////////////////////////////////////////////////////////////////////////////// this.object = function (arg) { if (arg === undefined) { return m_object; @@ -47,21 +41,17 @@ geo.clock = function (opts) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Returns true if attached to a valid geo.object. * @private */ - ////////////////////////////////////////////////////////////////////////////// this._attached = function () { return (m_object instanceof geo.object); }; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set the current time. */ - ////////////////////////////////////////////////////////////////////////////// this.now = function (arg) { var previous = m_now; if (arg === undefined) { @@ -80,11 +70,9 @@ geo.clock = function (opts) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set the animation start time. */ - ////////////////////////////////////////////////////////////////////////////// this.start = function (arg) { if (arg === undefined) { return m_start; @@ -93,11 +81,9 @@ geo.clock = function (opts) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set the animation end time. */ - ////////////////////////////////////////////////////////////////////////////// this.end = function (arg) { if (arg === undefined) { return m_end; @@ -106,11 +92,9 @@ geo.clock = function (opts) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set the animation time step. */ - ////////////////////////////////////////////////////////////////////////////// this.step = function (arg) { if (arg === undefined) { return m_step; @@ -119,13 +103,11 @@ geo.clock = function (opts) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set looping control of the clock. This controls how many times the * animation will repeat before stopping. Default * ``Number.POSITIVE_INFINITY``, the animation repeats forever. */ - ////////////////////////////////////////////////////////////////////////////// this.loop = function (arg) { if (arg === undefined) { return m_loop; @@ -134,7 +116,6 @@ geo.clock = function (opts) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set the animation state. Valid values are: * @@ -145,7 +126,6 @@ geo.clock = function (opts) { * This will also trigger relevant events, but they may be fired * asynchronously. */ - ////////////////////////////////////////////////////////////////////////////// this.state = function (arg, step) { if (arg === undefined) { @@ -172,13 +152,11 @@ geo.clock = function (opts) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set the animation frame rate. This is approximately the number * of frames displayed per second. A null value will use the browser's * native requestAnimationFrame to draw new frames. */ - ////////////////////////////////////////////////////////////////////////////// this.framerate = function (arg) { if (arg === undefined) { return m_rate; @@ -187,37 +165,31 @@ geo.clock = function (opts) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Step to the next frame in the animation. Pauses the animation if it is * playing. */ - ////////////////////////////////////////////////////////////////////////////// this.stepForward = function () { m_this.state('pause'); m_this._setNextFrame(1); return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Step to the previous frame in the animation. Pauses the animation if it is * playing. */ - ////////////////////////////////////////////////////////////////////////////// this.stepBackward = function () { m_this.state('pause'); m_this._setNextFrame(-1); return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Step to the next frame in the animation. Will set the state to stop * if the animation has reached the end and there are no more loops. * @private */ - ////////////////////////////////////////////////////////////////////////////// this._setNextFrame = function (step) { var next = new Date(m_this.now().valueOf() + step * m_this.step()); @@ -237,14 +209,12 @@ geo.clock = function (opts) { m_this.now(next); }; - ////////////////////////////////////////////////////////////////////////////// /** * Start an animation. * @param {integer} step The animation frame step (+1 for forward -1 for * reverse, etc). * @private */ - ////////////////////////////////////////////////////////////////////////////// this._animate = function (step) { var myAnimation = {}; m_currentAnimation = myAnimation; diff --git a/src/action.js b/src/action.js index a8435e6bbe..a5802175d1 100644 --- a/src/action.js +++ b/src/action.js @@ -1,9 +1,7 @@ -////////////////////////////////////////////////////////////////////////////// /** * Common object containing all action types that are provided by the GeoJS * API. */ -////////////////////////////////////////////////////////////////////////////// var geo_action = { momentum: 'geo_action_momentum', pan: 'geo_action_pan', diff --git a/src/annotation.js b/src/annotation.js index a80d61d5ba..4ba03bee5b 100644 --- a/src/annotation.js +++ b/src/annotation.js @@ -19,7 +19,6 @@ var annotationState = { var annotationActionOwner = 'annotationAction'; -///////////////////////////////////////////////////////////////////////////// /** * Base annotation class * @@ -35,7 +34,6 @@ var annotationActionOwner = 'annotationAction'; * annotation.state values. * @returns {geo.annotation} */ -///////////////////////////////////////////////////////////////////////////// var annotation = function (type, args) { 'use strict'; if (!(this instanceof annotation)) { @@ -422,7 +420,6 @@ var annotation = function (type, args) { }; }; -///////////////////////////////////////////////////////////////////////////// /** * Rectangle annotation class * @@ -437,7 +434,6 @@ var annotation = function (type, args) { * fill, fillColor, fillOpacity, stroke, strokeWidth, strokeColor, * strokeOpacity */ -///////////////////////////////////////////////////////////////////////////// var rectangleAnnotation = function (args) { 'use strict'; if (!(this instanceof rectangleAnnotation)) { @@ -694,7 +690,6 @@ var rectangleRequiredFeatures = {}; rectangleRequiredFeatures[polygonFeature.capabilities.feature] = true; registerAnnotation('rectangle', rectangleAnnotation, rectangleRequiredFeatures); -///////////////////////////////////////////////////////////////////////////// /** * Polygon annotation class * @@ -711,7 +706,6 @@ registerAnnotation('rectangle', rectangleAnnotation, rectangleRequiredFeatures); * fill, fillColor, fillOpacity, stroke, strokeWidth, strokeColor, * strokeOpacity */ -///////////////////////////////////////////////////////////////////////////// var polygonAnnotation = function (args) { 'use strict'; if (!(this instanceof polygonAnnotation)) { @@ -941,7 +935,6 @@ polygonRequiredFeatures[polygonFeature.capabilities.feature] = true; polygonRequiredFeatures[lineFeature.capabilities.basic] = [annotationState.create]; registerAnnotation('polygon', polygonAnnotation, polygonRequiredFeatures); -///////////////////////////////////////////////////////////////////////////// /** * Line annotation class * @@ -955,7 +948,6 @@ registerAnnotation('polygon', polygonAnnotation, polygonRequiredFeatures); * strokeWidth, strokeColor, strokeOpacity, strokeOffset, closed, lineCap, * lineJoin */ -///////////////////////////////////////////////////////////////////////////// var lineAnnotation = function (args) { 'use strict'; if (!(this instanceof lineAnnotation)) { @@ -1236,7 +1228,6 @@ var lineRequiredFeatures = {}; lineRequiredFeatures[lineFeature.capabilities.basic] = [annotationState.create]; registerAnnotation('line', lineAnnotation, lineRequiredFeatures); -///////////////////////////////////////////////////////////////////////////// /** * Point annotation class * @@ -1251,7 +1242,6 @@ registerAnnotation('line', lineAnnotation, lineRequiredFeatures); * the radius is based on the zoom level at first instantiation. Otherwise, if * it is a number, the radius is used at that zoom level. */ -///////////////////////////////////////////////////////////////////////////// var pointAnnotation = function (args) { 'use strict'; if (!(this instanceof pointAnnotation)) { diff --git a/src/annotationLayer.js b/src/annotationLayer.js index 8ca08f1253..52c14d59bf 100644 --- a/src/annotationLayer.js +++ b/src/annotationLayer.js @@ -7,7 +7,6 @@ var transform = require('./transform'); var $ = require('jquery'); var Mousetrap = require('mousetrap'); -///////////////////////////////////////////////////////////////////////////// /** * Layer to handle direct interactions with different features. Annotations * (features) can be created by calling mode() or cancelled @@ -28,7 +27,6 @@ var Mousetrap = require('mousetrap'); * start point. * @returns {geo.annotationLayer} */ -///////////////////////////////////////////////////////////////////////////// var annotationLayer = function (args) { 'use strict'; if (!(this instanceof annotationLayer)) { @@ -629,11 +627,9 @@ var annotationLayer = function (args) { return value; }; - /////////////////////////////////////////////////////////////////////////// /** * Update layer */ - /////////////////////////////////////////////////////////////////////////// this._update = function (request) { if (m_this.getMTime() > m_buildTime.getMTime()) { /* Interally, we have a set of feature levels (to provide z-index @@ -741,13 +737,11 @@ var annotationLayer = function (args) { } }; - /////////////////////////////////////////////////////////////////////////// /** * Initialize */ - /////////////////////////////////////////////////////////////////////////// this._init = function () { - /// Call super class init + // Call super class init s_init.call(m_this); if (!m_this.map().interactor()) { @@ -764,13 +758,11 @@ var annotationLayer = function (args) { return m_this; }; - /////////////////////////////////////////////////////////////////////////// /** * Free all resources */ - /////////////////////////////////////////////////////////////////////////// this._exit = function () { - /// Call super class exit + // Call super class exit s_exit.call(m_this); m_annotations = []; m_features = []; diff --git a/src/camera.js b/src/camera.js index 2a486e6de1..53528b9e5a 100644 --- a/src/camera.js +++ b/src/camera.js @@ -7,7 +7,6 @@ var mat4 = require('gl-mat4'); var vec4 = require('gl-vec4'); - ////////////////////////////////////////////////////////////////////////////// /** * This class defines the raw interface for a camera. At a low level, the * camera provides a methods for converting between a map's coordinate system @@ -51,7 +50,6 @@ * @param {object} spec.viewport.height * @returns {geo.camera} */ - ////////////////////////////////////////////////////////////////////////////// var camera = function (spec) { if (!(this instanceof camera)) { return new camera(spec); diff --git a/src/canvas/canvasRenderer.js b/src/canvas/canvasRenderer.js index 1174f19a26..524b4f4a51 100644 --- a/src/canvas/canvasRenderer.js +++ b/src/canvas/canvasRenderer.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerRenderer = require('../registry').registerRenderer; var renderer = require('../renderer'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class canvasRenderer * @@ -11,7 +10,6 @@ var renderer = require('../renderer'); * @param canvas * @returns {geo.canvas.canvasRenderer} */ -////////////////////////////////////////////////////////////////////////////// var canvasRenderer = function (arg) { 'use strict'; @@ -32,20 +30,16 @@ var canvasRenderer = function (arg) { m_clearCanvas = arg; }; - //////////////////////////////////////////////////////////////////////////// /** * Get API used by the renderer */ - //////////////////////////////////////////////////////////////////////////// this.api = function () { return 'canvas'; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { if (m_this.initialized()) { return m_this; @@ -68,11 +62,9 @@ var canvasRenderer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Handle resize event */ - //////////////////////////////////////////////////////////////////////////// this._resize = function (x, y, w, h) { m_this.canvas().attr('width', w); m_this.canvas().attr('height', h); @@ -81,21 +73,17 @@ var canvasRenderer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Render */ - //////////////////////////////////////////////////////////////////////////// this._render = function () { m_this.layer().map().scheduleAnimationFrame(this._renderFrame); return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Render during an animation frame callback. */ - //////////////////////////////////////////////////////////////////////////// this._renderFrame = function () { var layer = m_this.layer(), map = layer.map(), @@ -116,11 +104,9 @@ var canvasRenderer = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Exit */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.canvas().remove(); s_exit(); diff --git a/src/canvas/heatmapFeature.js b/src/canvas/heatmapFeature.js index 85481c50f9..4f41ec243d 100644 --- a/src/canvas/heatmapFeature.js +++ b/src/canvas/heatmapFeature.js @@ -3,7 +3,6 @@ var registerFeature = require('../registry').registerFeature; var heatmapFeature = require('../heatmapFeature'); var timestamp = require('../timestamp'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class heatmapFeature * Inspired from @@ -14,7 +13,6 @@ var timestamp = require('../timestamp'); * @extends geo.heatmapFeature * @returns {canvas_heatmapFeature} */ -////////////////////////////////////////////////////////////////////////////// var canvas_heatmapFeature = function (arg) { 'use strict'; @@ -26,11 +24,9 @@ var canvas_heatmapFeature = function (arg) { object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var geo_event = require('../event'); var m_this = this, @@ -44,12 +40,10 @@ var canvas_heatmapFeature = function (arg) { s_update = this._update, m_renderTime = timestamp(); - //////////////////////////////////////////////////////////////////////////// /** * Meta functions for converting from geojs styles to canvas. * @private */ - //////////////////////////////////////////////////////////////////////////// this._convertColor = function (c) { var color; if (c.hasOwnProperty('r') && @@ -62,12 +56,10 @@ var canvas_heatmapFeature = function (arg) { return color; }; - //////////////////////////////////////////////////////////////////////////// /** * Compute gradient (color lookup table) * @protected */ - //////////////////////////////////////////////////////////////////////////// this._computeGradient = function () { var canvas, stop, context2d, gradient, colors; @@ -93,12 +85,10 @@ var canvas_heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Create circle for each data point * @protected */ - //////////////////////////////////////////////////////////////////////////// this._createCircle = function () { var circle, ctx, r, r2, blur, gaussian; r = m_this.style('radius'); @@ -157,12 +147,10 @@ var canvas_heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Compute color for each pixel on the screen * @protected */ - //////////////////////////////////////////////////////////////////////////// this._colorize = function (pixels, gradient) { var grad = new Uint32Array(gradient.buffer), pixlen = pixels.length, @@ -183,7 +171,6 @@ var canvas_heatmapFeature = function (arg) { pixels.set(m_typedClampedBuffer); }; - //////////////////////////////////////////////////////////////////////////// /** * Render individual data points on the canvas. * @protected @@ -192,7 +179,6 @@ var canvas_heatmapFeature = function (arg) { * @param {Array} data the main data array. * @param {number} radius the sum of radius and blurRadius. */ - //////////////////////////////////////////////////////////////////////////// this._renderPoints = function (context2d, map, data, radius) { var position = m_this.gcsPosition(), intensityFunc = m_this.intensity(), @@ -213,7 +199,6 @@ var canvas_heatmapFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Render data points on the canvas by binning. * @protected @@ -223,7 +208,6 @@ var canvas_heatmapFeature = function (arg) { * @param {number} radius the sum of radius and blurRadius. * @param {number} binSize size of the bins in pixels. */ - //////////////////////////////////////////////////////////////////////////// this._renderBinnedData = function (context2d, map, data, radius, binSize) { var position = m_this.gcsPosition(), intensityFunc = m_this.intensity(), @@ -313,14 +297,12 @@ var canvas_heatmapFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Render the data on the canvas, then colorize the resulting opacity map. * @protected * @param {object} context2d the canvas context to draw in. * @param {object} map the parent map object. */ - //////////////////////////////////////////////////////////////////////////// this._renderOnCanvas = function (context2d, map) { if (m_renderTime.getMTime() < m_this.buildTime().getMTime()) { @@ -381,12 +363,10 @@ var canvas_heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize * @protected */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { s_init.call(m_this, arg); @@ -395,12 +375,10 @@ var canvas_heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update * @protected */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); if (m_this.buildTime().getMTime() <= m_this.dataTime().getMTime() || @@ -411,22 +389,18 @@ var canvas_heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update the css transform for the layer as part of an animation frame. * @protected */ - //////////////////////////////////////////////////////////////////////////// this._setTransform = function () { m_this.layer().canvas()[0].style.transform = m_heatMapTransform; }; - //////////////////////////////////////////////////////////////////////////// /** * Animate pan (and zoom) * @protected */ - //////////////////////////////////////////////////////////////////////////// this._animatePan = function (e) { var map = m_this.layer().map(), @@ -475,12 +449,10 @@ var canvas_heatmapFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy * @protected */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { s_exit.call(m_this); }; diff --git a/src/canvas/lineFeature.js b/src/canvas/lineFeature.js index 3a57f91ff3..31173af607 100644 --- a/src/canvas/lineFeature.js +++ b/src/canvas/lineFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var lineFeature = require('../lineFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class lineFeature * @@ -11,7 +10,6 @@ var lineFeature = require('../lineFeature'); * @extends geo.canvas.object * @returns {geo.canvas.lineFeature} */ -////////////////////////////////////////////////////////////////////////////// var canvas_lineFeature = function (arg) { 'use strict'; if (!(this instanceof canvas_lineFeature)) { @@ -24,21 +22,17 @@ var canvas_lineFeature = function (arg) { lineFeature.call(this, arg); object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this; - //////////////////////////////////////////////////////////////////////////// /** * Render the data on the canvas. * @protected * @param {object} context2d the canvas context to draw in. * @param {object} map the parent map object. */ - //////////////////////////////////////////////////////////////////////////// this._renderOnCanvas = function (context2d, map) { var data = m_this.data(), posFunc = m_this.position(), diff --git a/src/canvas/object.js b/src/canvas/object.js index e8cc9c7ad0..de7d297306 100644 --- a/src/canvas/object.js +++ b/src/canvas/object.js @@ -1,13 +1,11 @@ var inherit = require('../inherit'); var sceneObject = require('../sceneObject'); -////////////////////////////////////////////////////////////////////////////// /** * Canvas specific subclass of object which rerenders when the object is drawn. * @class geo.canvas.object * @extends geo.sceneObject */ -////////////////////////////////////////////////////////////////////////////// var canvas_object = function (arg) { 'use strict'; @@ -30,11 +28,9 @@ var canvas_object = function (arg) { this._renderOnCanvas = function () { }; - //////////////////////////////////////////////////////////////////////////// /** * Redraw the object. */ - //////////////////////////////////////////////////////////////////////////// this.draw = function () { m_this._update(); m_this.renderer()._render(); diff --git a/src/canvas/pixelmapFeature.js b/src/canvas/pixelmapFeature.js index e8333a900f..4effb0eb90 100644 --- a/src/canvas/pixelmapFeature.js +++ b/src/canvas/pixelmapFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var pixelmapFeature = require('../pixelmapFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class pixelmapFeature * @@ -11,7 +10,6 @@ var pixelmapFeature = require('../pixelmapFeature'); * @extends geo.pixelmapFeature * @returns {canvas_pixelmapFeature} */ -////////////////////////////////////////////////////////////////////////////// var canvas_pixelmapFeature = function (arg) { 'use strict'; diff --git a/src/canvas/quadFeature.js b/src/canvas/quadFeature.js index 29a52a068f..693f939eb2 100644 --- a/src/canvas/quadFeature.js +++ b/src/canvas/quadFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var quadFeature = require('../quadFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class quadFeature * @@ -11,7 +10,6 @@ var quadFeature = require('../quadFeature'); * @extends geo.quadFeature * @returns {geo.canvas.quadFeature} */ -////////////////////////////////////////////////////////////////////////////// var canvas_quadFeature = function (arg) { 'use strict'; @@ -31,11 +29,9 @@ var canvas_quadFeature = function (arg) { s_update = this._update, m_quads; - //////////////////////////////////////////////////////////////////////////// /** * Build this feature */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { if (!m_this.position()) { return; @@ -107,11 +103,9 @@ var canvas_quadFeature = function (arg) { this._renderColorQuads(context, map); }; - //////////////////////////////////////////////////////////////////////////// /** * Update */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); if (m_this.buildTime().getMTime() <= m_this.dataTime().getMTime() || @@ -122,20 +116,16 @@ var canvas_quadFeature = function (arg) { m_this.updateTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { s_init.call(m_this, arg); }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { s_exit.call(m_this); diff --git a/src/choroplethFeature.js b/src/choroplethFeature.js index dee0efb875..7fb7e0fab5 100644 --- a/src/choroplethFeature.js +++ b/src/choroplethFeature.js @@ -1,7 +1,6 @@ var inherit = require('./inherit'); var feature = require('./feature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class choroplethFeature * @@ -27,7 +26,6 @@ var feature = require('./feature'); * If undefined input, return all the choropleth values as an object. * @returns {geo.choroplethFeature} */ -////////////////////////////////////////////////////////////////////////////// var choroplethFeature = function (arg) { 'use strict'; if (!(this instanceof choroplethFeature)) { @@ -39,11 +37,9 @@ var choroplethFeature = function (arg) { var $ = require('jquery'); var ensureFunction = require('./util').ensureFunction; - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var d3 = require('d3'), m_this = this, s_init = this._init, @@ -78,7 +74,6 @@ var choroplethFeature = function (arg) { }, arg.choropleth); - //////////////////////////////////////////////////////////////////////////// /** * Get/Set choropleth scalar data * @@ -91,7 +86,6 @@ var choroplethFeature = function (arg) { * is d3.mean. * @returns {geo.feature.choropleth} */ - //////////////////////////////////////////////////////////////////////////// this.scalar = function (data, aggregator) { var scalarId, scalarValue; @@ -124,7 +118,6 @@ var choroplethFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set choropleth accessor * @@ -138,7 +131,6 @@ var choroplethFeature = function (arg) { * @param {Object|String} [arg2] arg2 defines the value of the key (arg1). * @returns {geo.feature.choropleth} */ - //////////////////////////////////////////////////////////////////////////// this.choropleth = function (arg1, arg2) { var choropleth; @@ -162,7 +154,6 @@ var choroplethFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set choropleth getter * @@ -174,7 +165,6 @@ var choroplethFeature = function (arg) { * choropleth. * @return {function} */ - //////////////////////////////////////////////////////////////////////////// this.choropleth.get = function (key) { var all = {}, k; if (key === undefined) { @@ -188,7 +178,6 @@ var choroplethFeature = function (arg) { return ensureFunction(m_choropleth[key]); }; - //////////////////////////////////////////////////////////////////////////// /** * A method that adds a polygon feature to the current layer. * @@ -196,7 +185,6 @@ var choroplethFeature = function (arg) { * @param {geo.color} fillColor * @return {geo.feature} */ - //////////////////////////////////////////////////////////////////////////// this._addPolygonFeature = function (feature, fillColor) { var newFeature = m_this.layer() .createFeature('polygon', {}); @@ -235,7 +223,6 @@ var choroplethFeature = function (arg) { return newFeature; }; - //////////////////////////////////////////////////////////////////////////// /** * A method that adds polygons from a given feature to the current layer. * @@ -243,20 +230,17 @@ var choroplethFeature = function (arg) { * @param geo.color * @return [{geo.feature}] */ - //////////////////////////////////////////////////////////////////////////// this._featureToPolygons = function (feature, fillValue) { return m_this ._addPolygonFeature(feature, fillValue); }; - //////////////////////////////////////////////////////////////////////////// /** * A method that sets a choropleth scale's domain and range. * * @param {undefined | function({})} valueAccessor * @return {geo.feature.choropleth} */ - //////////////////////////////////////////////////////////////////////////// this._generateScale = function (valueAccessor) { var extent = d3.extent(m_this.scalar(), valueAccessor || undefined); @@ -269,12 +253,10 @@ var choroplethFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Generate scale for choropleth.data(), make polygons from features. * @returns: [ [geo.feature.polygon, ...] , ... ] */ - //////////////////////////////////////////////////////////////////////////// this.createChoropleth = function () { var choropleth = m_this.choropleth, data = m_this.data(), @@ -302,11 +284,9 @@ var choroplethFeature = function (arg) { }); }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); diff --git a/src/contourFeature.js b/src/contourFeature.js index fe7dee4cce..d44550c395 100644 --- a/src/contourFeature.js +++ b/src/contourFeature.js @@ -1,7 +1,6 @@ var inherit = require('./inherit'); var feature = require('./feature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class contourFeature * @@ -10,7 +9,6 @@ var feature = require('./feature'); * @returns {geo.contourFeature} * */ -////////////////////////////////////////////////////////////////////////////// var contourFeature = function (arg) { 'use strict'; if (!(this instanceof contourFeature)) { @@ -23,11 +21,9 @@ var contourFeature = function (arg) { arg = arg || {}; feature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, m_contour = {}, s_init = this._init, @@ -41,24 +37,20 @@ var contourFeature = function (arg) { m_contour = arg.contour; } - //////////////////////////////////////////////////////////////////////////// /** * Override the parent data method to keep track of changes to the * internal coordinates. */ - //////////////////////////////////////////////////////////////////////////// this.data = function (arg) { var ret = s_data(arg); return ret; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set contour accessor * * @returns {geo.pointFeature} */ - //////////////////////////////////////////////////////////////////////////// this.contour = function (arg1, arg2) { if (arg1 === undefined) { return m_contour; @@ -110,7 +102,6 @@ var contourFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * A uniform getter that always returns a function even for constant values. * If undefined input, return all the contour values as an object. @@ -118,7 +109,6 @@ var contourFeature = function (arg) { * @param {string|undefined} key * @return {function} */ - //////////////////////////////////////////////////////////////////////////// this.contour.get = function (key) { if (key === undefined) { var all = {}, k; @@ -132,13 +122,11 @@ var contourFeature = function (arg) { return util.ensureFunction(m_contour[key]); }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set position accessor * * @returns {geo.pointFeature} */ - //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_this.style('position'); @@ -150,7 +138,6 @@ var contourFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Create a set of vertices, values at the vertices, and opacities at the * vertices. Create a set of triangles of indices into the vertex array. @@ -161,7 +148,6 @@ var contourFeature = function (arg) { * contour data that can be used, only elements is guaranteed to * exist, and it will be a zero-length array. */ - //////////////////////////////////////////////////////////////////////////// this.createContours = function () { var i, i3, j, idx, k, val, numPts, usedPts = 0, usePos, item, idxMap = {}, @@ -357,11 +343,9 @@ var contourFeature = function (arg) { return result; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); diff --git a/src/d3/d3Renderer.js b/src/d3/d3Renderer.js index 3dcd9ed326..8693038ea3 100644 --- a/src/d3/d3Renderer.js +++ b/src/d3/d3Renderer.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerRenderer = require('../registry').registerRenderer; var renderer = require('../renderer'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class d3Renderer * @@ -10,7 +9,6 @@ var renderer = require('../renderer'); * @extends geo.renderer * @returns {geo.d3.d3Renderer} */ -////////////////////////////////////////////////////////////////////////////// var d3Renderer = function (arg) { 'use strict'; @@ -45,12 +43,10 @@ var d3Renderer = function (arg) { m_svg = null, m_defs = null; - //////////////////////////////////////////////////////////////////////////// /** * Set attributes to a d3 selection. * @private */ - //////////////////////////////////////////////////////////////////////////// function setAttrs(select, attrs) { var key; for (key in attrs) { @@ -60,12 +56,10 @@ var d3Renderer = function (arg) { } } - //////////////////////////////////////////////////////////////////////////// /** * Meta functions for converting from geojs styles to d3. * @private */ - //////////////////////////////////////////////////////////////////////////// this._convertColor = function (f, g) { f = util.ensureFunction(f); g = g || function () { return true; }; @@ -90,12 +84,10 @@ var d3Renderer = function (arg) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Set styles to a d3 selection. Ignores unkown style keys. * @private */ - //////////////////////////////////////////////////////////////////////////// function setStyles(select, styles) { var key, k, f; function fillFunc() { @@ -155,14 +147,12 @@ var d3Renderer = function (arg) { } } - //////////////////////////////////////////////////////////////////////////// /** * Get the svg group element associated with this renderer instance, or of a * group within the render instance. * * @private */ - //////////////////////////////////////////////////////////////////////////// function getGroup(parentId) { if (parentId) { return m_svg.select('.group-' + parentId); @@ -170,12 +160,10 @@ var d3Renderer = function (arg) { return m_svg.select('.group-' + m_this._d3id()); } - //////////////////////////////////////////////////////////////////////////// /** * Set the initial lat-lon coordinates of the map view. * @private */ - //////////////////////////////////////////////////////////////////////////// function initCorners() { var layer = m_this.layer(), map = layer.map(), @@ -195,13 +183,11 @@ var d3Renderer = function (arg) { }; } - //////////////////////////////////////////////////////////////////////////// /** * Set the translation, scale, and zoom for the current view. * @note rotation not yet supported * @private */ - //////////////////////////////////////////////////////////////////////////// this._setTransform = function () { if (!m_corners) { initCorners(); @@ -251,13 +237,11 @@ var d3Renderer = function (arg) { m_transform.rotation = rotation; }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from screen pixel coordinates to the local coordinate system * in the SVG group element taking into account the transform. * @private */ - //////////////////////////////////////////////////////////////////////////// this.baseToLocal = function (pt) { pt = { x: (pt.x - m_transform.dx) / m_scale, @@ -275,13 +259,11 @@ var d3Renderer = function (arg) { return pt; }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from the local coordinate system in the SVG group element * to screen pixel coordinates. * @private */ - //////////////////////////////////////////////////////////////////////////// this.localToBase = function (pt) { if (m_transform.rotation) { var sinr = Math.sin(m_transform.rotation), @@ -299,11 +281,9 @@ var d3Renderer = function (arg) { return pt; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { if (!m_this.canvas()) { var canvas; @@ -381,16 +361,13 @@ var d3Renderer = function (arg) { m_this._setTransform(); }; - //////////////////////////////////////////////////////////////////////////// /** * Get API used by the renderer */ - //////////////////////////////////////////////////////////////////////////// this.api = function () { return 'd3'; }; - //////////////////////////////////////////////////////////////////////////// /** * Return the current scaling factor to build features that shouldn't * change size during zooms. For example: @@ -401,16 +378,13 @@ var d3Renderer = function (arg) { * This will create a circle element with radius r0 independent of the * current zoom level. */ - //////////////////////////////////////////////////////////////////////////// this.scaleFactor = function () { return m_scale; }; - //////////////////////////////////////////////////////////////////////////// /** * Handle resize event */ - //////////////////////////////////////////////////////////////////////////// this._resize = function (x, y, w, h) { if (!m_corners) { initCorners(); @@ -421,19 +395,15 @@ var d3Renderer = function (arg) { m_this.layer().geoTrigger(d3Rescale, { scale: m_scale }, true); }; - //////////////////////////////////////////////////////////////////////////// /** * Update noop for geo.d3.object api. */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { }; - //////////////////////////////////////////////////////////////////////////// /** * Exit */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_features = {}; m_this.canvas().remove(); @@ -446,17 +416,14 @@ var d3Renderer = function (arg) { s_exit(); }; - //////////////////////////////////////////////////////////////////////////// /** * Get the definitions dom element for the layer * @protected */ - //////////////////////////////////////////////////////////////////////////// this._definitions = function () { return m_defs; }; - //////////////////////////////////////////////////////////////////////////// /** * Create a new feature element from an object that describes the feature * attributes. To be called from feature classes only. @@ -481,7 +448,6 @@ var d3Renderer = function (arg) { * parentId: If set, the group ID of the parent element. * } */ - //////////////////////////////////////////////////////////////////////////// this._drawFeatures = function (arg) { m_features[arg.id] = { data: arg.data, @@ -498,12 +464,10 @@ var d3Renderer = function (arg) { return m_this.__render(arg.id, arg.parentId); }; - //////////////////////////////////////////////////////////////////////////// /** * Updates a feature by performing a d3 data join. If no input id is * provided then this method will update all features. */ - //////////////////////////////////////////////////////////////////////////// this.__render = function (id, parentId) { var key; if (id === undefined) { @@ -568,20 +532,16 @@ var d3Renderer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Returns a d3 selection for the given feature id. */ - //////////////////////////////////////////////////////////////////////////// this.select = function (id, parentId) { return getGroup(parentId).selectAll('.' + id); }; - //////////////////////////////////////////////////////////////////////////// /** * Removes a feature from the layer. */ - //////////////////////////////////////////////////////////////////////////// this._removeFeature = function (id) { m_removeIds[id] = true; m_this.layer().map().scheduleAnimationFrame(m_this._renderFrame); @@ -592,11 +552,9 @@ var d3Renderer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Override draw method to do nothing. */ - //////////////////////////////////////////////////////////////////////////// this.draw = function () { }; diff --git a/src/d3/graphFeature.js b/src/d3/graphFeature.js index 990d51fde2..a1110ef60f 100644 --- a/src/d3/graphFeature.js +++ b/src/d3/graphFeature.js @@ -16,11 +16,9 @@ var d3_graphFeature = function (arg) { } graphFeature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * Returns a d3 selection for the graph elements */ - //////////////////////////////////////////////////////////////////////////// this.select = function () { var renderer = m_this.renderer(), selection = {}, diff --git a/src/d3/lineFeature.js b/src/d3/lineFeature.js index 75150ad006..babfda6646 100644 --- a/src/d3/lineFeature.js +++ b/src/d3/lineFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var lineFeature = require('../lineFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class lineFeature * @@ -11,7 +10,6 @@ var lineFeature = require('../lineFeature'); * @extends geo.d3.object * @returns {geo.d3.lineFeature} */ -////////////////////////////////////////////////////////////////////////////// var d3_lineFeature = function (arg) { 'use strict'; if (!(this instanceof d3_lineFeature)) { @@ -27,34 +25,28 @@ var d3_lineFeature = function (arg) { lineFeature.call(this, arg); object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_init = this._init, m_buildTime = timestamp(), m_maxIdx = 0, s_update = this._update; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { var data = m_this.data() || [], s_style = m_this.style(), @@ -116,13 +108,11 @@ var d3_lineFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * @override */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); diff --git a/src/d3/object.js b/src/d3/object.js index 048c20c52f..e40e974aa7 100644 --- a/src/d3/object.js +++ b/src/d3/object.js @@ -1,14 +1,12 @@ var inherit = require('../inherit'); var sceneObject = require('../sceneObject'); -////////////////////////////////////////////////////////////////////////////// /** * D3 specific subclass of object which adds an id property for d3 selections * on groups of objects by class id. * @class geo.d3.object * @extends geo.sceneObject */ -////////////////////////////////////////////////////////////////////////////// var d3_object = function (arg) { 'use strict'; @@ -32,31 +30,25 @@ var d3_object = function (arg) { return m_id; }; - //////////////////////////////////////////////////////////////////////////// /** * Returns a d3 selection for the feature elements */ - //////////////////////////////////////////////////////////////////////////// this.select = function () { return m_this.renderer().select(m_this._d3id()); }; - //////////////////////////////////////////////////////////////////////////// /** * Redraw the object. */ - //////////////////////////////////////////////////////////////////////////// this.draw = function () { m_this._update(); s_draw(); return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Removes the element from the svg and the renderer */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.renderer()._removeFeature(m_this._d3id()); s_exit(); diff --git a/src/d3/pathFeature.js b/src/d3/pathFeature.js index 6360f5c623..0b519bcd4e 100644 --- a/src/d3/pathFeature.js +++ b/src/d3/pathFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var pathFeature = require('../pathFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class pathFeature * @@ -11,7 +10,6 @@ var pathFeature = require('../pathFeature'); * @extends geo.d3.object * @returns {geo.d3.pathFeature} */ -////////////////////////////////////////////////////////////////////////////// var d3_pathFeature = function (arg) { 'use strict'; if (!(this instanceof d3_pathFeature)) { @@ -27,11 +25,9 @@ var d3_pathFeature = function (arg) { pathFeature.call(this, arg); object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_init = this._init, m_buildTime = timestamp(), @@ -40,23 +36,19 @@ var d3_pathFeature = function (arg) { m_style.style = {}; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { var data = m_this.data() || [], s_style = m_this.style(), @@ -103,13 +95,11 @@ var d3_pathFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * @override */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); diff --git a/src/d3/pointFeature.js b/src/d3/pointFeature.js index 9d9fc7253a..608f0a6eea 100644 --- a/src/d3/pointFeature.js +++ b/src/d3/pointFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var pointFeature = require('../pointFeature'); -////////////////////////////////////////////////////////////////////////////// /** * * Create a new instance of pointFeature @@ -12,7 +11,6 @@ var pointFeature = require('../pointFeature'); * @extends geo.d3.object * @returns {geo.d3.pointFeature} */ -////////////////////////////////////////////////////////////////////////////// var d3_pointFeature = function (arg) { 'use strict'; if (!(this instanceof d3_pointFeature)) { @@ -26,34 +24,28 @@ var d3_pointFeature = function (arg) { pointFeature.call(this, arg); d3_object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_init = this._init, s_update = this._update, m_buildTime = timestamp(), m_style = {}; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { var data = m_this.data(), s_style = m_this.style.get(), @@ -92,13 +84,11 @@ var d3_pointFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * @override */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); diff --git a/src/d3/quadFeature.js b/src/d3/quadFeature.js index 7b01825878..a2dfa27d5f 100644 --- a/src/d3/quadFeature.js +++ b/src/d3/quadFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var quadFeature = require('../quadFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class quadFeature * @@ -11,7 +10,6 @@ var quadFeature = require('../quadFeature'); * @extends geo.quadFeature * @returns {geo.d3.quadFeature} */ -////////////////////////////////////////////////////////////////////////////// var d3_quadFeature = function (arg) { 'use strict'; if (!(this instanceof d3_quadFeature)) { @@ -31,11 +29,9 @@ var d3_quadFeature = function (arg) { s_update = this._update, m_quads; - //////////////////////////////////////////////////////////////////////////// /** * Build this feature */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { if (!this.position()) { return; @@ -190,11 +186,9 @@ var d3_quadFeature = function (arg) { this.buildTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Update */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); if (m_this.buildTime().getMTime() <= m_this.dataTime().getMTime() || @@ -204,20 +198,16 @@ var d3_quadFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { s_init.call(m_this, arg); }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { s_exit.call(m_this); }; diff --git a/src/d3/uniqueID.js b/src/d3/uniqueID.js index 2fd47993dc..83088bbfbe 100644 --- a/src/d3/uniqueID.js +++ b/src/d3/uniqueID.js @@ -1,13 +1,11 @@ var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz', strLength = 8; -////////////////////////////////////////////////////////////////////////////// /** * Get a random string to use as a div ID * @function geo.d3.uniqueID * @returns {string} */ -////////////////////////////////////////////////////////////////////////////// var uniqueID = function () { var strArray = [], i; diff --git a/src/d3/vectorFeature.js b/src/d3/vectorFeature.js index 976748ee3b..9eaed21518 100644 --- a/src/d3/vectorFeature.js +++ b/src/d3/vectorFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var vectorFeature = require('../vectorFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of vectorFeature * @@ -11,7 +10,6 @@ var vectorFeature = require('../vectorFeature'); * @extends geo.d3.object * @returns {geo.d3.vectorFeature} */ -////////////////////////////////////////////////////////////////////////////// var d3_vectorFeature = function (arg) { 'use strict'; if (!(this instanceof d3_vectorFeature)) { @@ -26,11 +24,9 @@ var d3_vectorFeature = function (arg) { vectorFeature.call(this, arg); object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_init = this._init, s_exit = this._exit, @@ -38,7 +34,6 @@ var d3_vectorFeature = function (arg) { m_buildTime = timestamp(), m_style = {}; - //////////////////////////////////////////////////////////////////////////// /** * Generate a unique ID for a marker definition * @private @@ -46,12 +41,10 @@ var d3_vectorFeature = function (arg) { * @param {number} i The marker index * @param {string} position The marker's vector position (head or tail) */ - //////////////////////////////////////////////////////////////////////////// function markerID(d, i, position) { return m_this._d3id() + '_marker_' + i + '_' + position; } - //////////////////////////////////////////////////////////////////////////// /** * Add marker styles for vector arrows. * @private @@ -61,7 +54,6 @@ var d3_vectorFeature = function (arg) { * @param {function} originStyle The marker style for the vector head * @param {function} endStyle The marker style for the vector tail */ - //////////////////////////////////////////////////////////////////////////// function updateMarkers(data, stroke, opacity, originStyle, endStyle) { var markerConfigs = { @@ -154,23 +146,19 @@ var d3_vectorFeature = function (arg) { sel.exit().remove(); } - //////////////////////////////////////////////////////////////////////////// /** * Initialize * @protected */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Build * @protected */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { var data = m_this.data(), s_style = m_this.style.get(), @@ -256,12 +244,10 @@ var d3_vectorFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update * @protected */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); @@ -280,12 +266,10 @@ var d3_vectorFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Exit * @protected */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { s_exit.call(m_this); m_style = {}; diff --git a/src/event.js b/src/event.js index ac077a0fb8..155e4eed62 100644 --- a/src/event.js +++ b/src/event.js @@ -1,4 +1,3 @@ -////////////////////////////////////////////////////////////////////////////// /** * Common object containing all event types that are provided by the GeoJS * API. Each property contained here is a valid target for event handling @@ -20,16 +19,12 @@ * }); * */ -////////////////////////////////////////////////////////////////////////////// var geo_event = {}; -////////////////////////////////////////////////////////////////////////////// /* * Event types */ -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// /** * Triggered when a layer is added to the map. * @@ -38,10 +33,8 @@ var geo_event = {}; * @property {geo.map} target The current map. * @property {geo.layer} layer The new layer that was added. */ -////////////////////////////////////////////////////////////////////////////// geo_event.layerAdd = 'geo_layerAdd'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when a layer is removed from the map. * @@ -50,10 +43,8 @@ geo_event.layerAdd = 'geo_layerAdd'; * @property {geo.map} target The current map. * @property {geo.layer} layer The old layer that was removed. */ -////////////////////////////////////////////////////////////////////////////// geo_event.layerRemove = 'geo_layerRemove'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when the map's zoom level is changed. * @@ -63,10 +54,8 @@ geo_event.layerRemove = 'geo_layerRemove'; * @property {geo.screenPosition} screenPosition The screen position of the * mouse pointer. */ -////////////////////////////////////////////////////////////////////////////// geo_event.zoom = 'geo_zoom'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when the map is rotated around the current map center (pointing * downward so that positive angles are clockwise rotations). @@ -78,10 +67,8 @@ geo_event.zoom = 'geo_zoom'; * @property {geo.screenPosition} screenPosition The screen position of the * mouse pointer. */ -////////////////////////////////////////////////////////////////////////////// geo_event.rotate = 'geo_rotate'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when the map is panned either by user interaction or map * transition. @@ -92,10 +79,8 @@ geo_event.rotate = 'geo_rotate'; * @property {number} screenDelta.x Horizontal pan distance in pixels. * @property {number} screenDelta.y Vertical pan distance in pixels. */ -////////////////////////////////////////////////////////////////////////////// geo_event.pan = 'geo_pan'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when the map's canvas is resized. * @@ -105,10 +90,8 @@ geo_event.pan = 'geo_pan'; * @property {number} width The new width in pixels. * @property {number} height The new height in pixels. */ -////////////////////////////////////////////////////////////////////////////// geo_event.resize = 'geo_resize'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered on every call to {@link geo.map#draw} before the map is rendered. * @@ -116,10 +99,8 @@ geo_event.resize = 'geo_resize'; * @type {object} * @property {geo.map} target The current map. */ -////////////////////////////////////////////////////////////////////////////// geo_event.draw = 'geo_draw'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered on every call to {@link geo.map#draw} after the map is rendered. * @@ -127,20 +108,16 @@ geo_event.draw = 'geo_draw'; * @type {object} * @property {geo.map} target The current map. */ -////////////////////////////////////////////////////////////////////////////// geo_event.drawEnd = 'geo_drawEnd'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered on every `mousemove` over the map's DOM element unless a click * might occur. The event object extends {@link geo.mouseState}. * * @event geo.event.mousemove */ -////////////////////////////////////////////////////////////////////////////// geo_event.mousemove = 'geo_mousemove'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered on `mouseup` events that happen soon enough and close enough to a * `mousedown` event. The event object extends {@link geo.mouseState}. @@ -149,60 +126,48 @@ geo_event.mousemove = 'geo_mousemove'; * @property {geo.mouseButtons} buttonsDown The buttons that were down at the * start of the click action. */ -////////////////////////////////////////////////////////////////////////////// geo_event.mouseclick = 'geo_mouseclick'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered on every `mousemove` during a brushing selection. * The event object extends {@link geo.brushSelection}. * * @event geo.event.brush */ -////////////////////////////////////////////////////////////////////////////// geo_event.brush = 'geo_brush'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered after a brush selection ends. * The event object extends {@link geo.brushSelection}. * * @event geo.event.brushend */ -////////////////////////////////////////////////////////////////////////////// geo_event.brushend = 'geo_brushend'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when a brush selection starts. * The event object extends {@link geo.brushSelection}. * * @event geo.event.brushstart */ -////////////////////////////////////////////////////////////////////////////// geo_event.brushstart = 'geo_brushstart'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when brushing results in a selection. * The event object extends {@link geo.brushSelection}. * * @event geo.event.select */ -////////////////////////////////////////////////////////////////////////////// geo_event.select = 'geo_select'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when brushing results in a zoom selection. * The event object extends {@link geo.brushSelection}. * * @event geo.event.zoomselect */ -////////////////////////////////////////////////////////////////////////////// geo_event.zoomselect = 'geo_zoomselect'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when brushing results in a zoom-out selection. * The event object extends {@link geo.brushSelection}. @@ -210,11 +175,9 @@ geo_event.zoomselect = 'geo_zoomselect'; * @event geo.event.unzoomselect */ -////////////////////////////////////////////////////////////////////////////// geo_event.unzoomselect = 'geo_unzoomselect'; //DWM:: -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an action is initiated with mouse down. * @@ -223,10 +186,8 @@ geo_event.unzoomselect = 'geo_unzoomselect'; * @property {geo.mouseState} mouse The mouse state. * @property {jQuery.Event} event The triggering jQuery event. */ -////////////////////////////////////////////////////////////////////////////// geo_event.actiondown = 'geo_actiondown'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an action is being processed during mouse movement. * @@ -235,10 +196,8 @@ geo_event.actiondown = 'geo_actiondown'; * @property {geo.mouseState} mouse The mouse state. * @property {jQuery.Event} event The triggering event. */ -////////////////////////////////////////////////////////////////////////////// geo_event.actionmove = 'geo_actionmove'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an action is ended with a mouse up. * @@ -247,10 +206,8 @@ geo_event.actionmove = 'geo_actionmove'; * @property {geo.mouseState} mouse The mouse state. * @property {jQuery.Event} event The triggering event. */ -////////////////////////////////////////////////////////////////////////////// geo_event.actionup = 'geo_actionup'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an action results in a selection. * @@ -263,10 +220,8 @@ geo_event.actionup = 'geo_actionup'; * @property {geo.screenPosition} upperRight Upper right of selection in screen * coordinates. */ -////////////////////////////////////////////////////////////////////////////// geo_event.actionselection = 'geo_actionselection'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an action is triggered with a mouse wheel event. * @@ -275,10 +230,8 @@ geo_event.actionselection = 'geo_actionselection'; * @property {geo.mouseState} mouse The mouse state. * @property {jQuery.Event} event The triggering event. */ -////////////////////////////////////////////////////////////////////////////// geo_event.actionwheel = 'geo_actionwheel'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an action is triggered via the keyboard. * @@ -298,10 +251,8 @@ geo_event.actionwheel = 'geo_actionwheel'; * movement is preferred, 1 a medium movement, and 2 a large movement. * @property {jQuery.Event} event The triggering event */ -////////////////////////////////////////////////////////////////////////////// geo_event.keyaction = 'geo_keyaction'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered before a map navigation animation begins. Set * `event.geo.cancelAnimation` to cancel the animation of the navigation. This @@ -316,10 +267,8 @@ geo_event.keyaction = 'geo_keyaction'; * @property {number} duration The duration of the transition in milliseconds. * @property {function} ease The easing function. */ -////////////////////////////////////////////////////////////////////////////// geo_event.transitionstart = 'geo_transitionstart'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered after a map navigation animation ends. * @@ -330,10 +279,8 @@ geo_event.transitionstart = 'geo_transitionstart'; * @property {number} duration The duration of the transition in milliseconds. * @property {function} ease The easing function. */ -////////////////////////////////////////////////////////////////////////////// geo_event.transitionend = 'geo_transitionend'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered if a map navigation animation is canceled. * @@ -344,11 +291,9 @@ geo_event.transitionend = 'geo_transitionend'; * @property {number} duration The duration of the transition in milliseconds. * @property {function} ease The easing function. */ -////////////////////////////////////////////////////////////////////////////// geo_event.transitioncancel = 'geo_transitioncancel'; //DWM:: -////////////////////////////////////////////////////////////////////////////// /** * Triggered when the parallel projection mode is changes. * @@ -357,10 +302,8 @@ geo_event.transitioncancel = 'geo_transitioncancel'; * @property {boolean} paralellProjection `true` if parallel projection is * turned on. */ -////////////////////////////////////////////////////////////////////////////// geo_event.parallelprojection = 'geo_parallelprojection'; -//////////////////////////////////////////////////////////////////////////// /** * This event object provides mouse/keyboard events that can be handled * by the features. This provides a similar interface as core events, @@ -371,7 +314,6 @@ geo_event.parallelprojection = 'geo_parallelprojection'; * with the option 'selectionAPI'. * @namespace geo.event.feature */ -//////////////////////////////////////////////////////////////////////////// geo_event.feature = { /** * The event is the feature version of {@link geo.event.mousemove}. @@ -415,12 +357,10 @@ geo_event.feature = { brush: 'geo_feature_brush' }; -//////////////////////////////////////////////////////////////////////////// /** * These events are triggered by the pixelmap feature. * @namespace geo.event.pixelmap */ -//////////////////////////////////////////////////////////////////////////// geo_event.pixelmap = { /** * Report that an image associated with a pixel map has been prepared and @@ -434,14 +374,11 @@ geo_event.pixelmap = { prepared: 'geo_pixelmap_prepared' }; -//////////////////////////////////////////////////////////////////////////// /** * These events are triggered by the map screenshot feature. * @namespace geo.event.screenshot */ -//////////////////////////////////////////////////////////////////////////// geo_event.screenshot = { - //////////////////////////////////////////////////////////////////////////// /** * Triggered when a screenshot has been completed. * @@ -451,21 +388,17 @@ geo_event.screenshot = { * @property {string|HTMLCanvasElement} screenshot The screenshot as a * dataURL string or the canvas, depending on the screenshot request. */ - //////////////////////////////////////////////////////////////////////////// ready: 'geo_screenshot_ready' }; //DWM:: -//////////////////////////////////////////////////////////////////////////// /** * These events are triggered by the camera when it's internal state is * mutated. * @namespace geo.event.camera */ -//////////////////////////////////////////////////////////////////////////// geo_event.camera = {}; -////////////////////////////////////////////////////////////////////////////// /** * Triggered after a general view matrix change (any change in the visible * bounds). This is equivalent to the union of pan and zoom. @@ -474,10 +407,8 @@ geo_event.camera = {}; * @type {object} * @property {geo.camera} camera The camera instance. */ -////////////////////////////////////////////////////////////////////////////// geo_event.camera.view = 'geo_camera_view'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered after a projection change. * @@ -486,10 +417,8 @@ geo_event.camera.view = 'geo_camera_view'; * @property {string} type The projection type, either `'perspective'` or * `'parallel'`. */ -////////////////////////////////////////////////////////////////////////////// geo_event.camera.projection = 'geo_camera_projection'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered after a viewport change. * @@ -497,18 +426,14 @@ geo_event.camera.projection = 'geo_camera_projection'; * @property {geo.camera} camera The camera instance. * @property {geo.screenSize} viewport The new viewport size. */ -////////////////////////////////////////////////////////////////////////////// geo_event.camera.viewport = 'geo_camera_viewport'; -//////////////////////////////////////////////////////////////////////////// /** * These events are triggered by the annotation layer. * @namespace geo.event.annotation */ -//////////////////////////////////////////////////////////////////////////// geo_event.annotation = {}; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an annotation has been added. * @@ -516,10 +441,8 @@ geo_event.annotation = {}; * @type {object} * @property {geo.annotation} annotation The annotation that was added. */ -////////////////////////////////////////////////////////////////////////////// geo_event.annotation.add = 'geo_annotation_add'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an annotation is about to be added. * @@ -527,10 +450,8 @@ geo_event.annotation.add = 'geo_annotation_add'; * @type {object} * @property {geo.annotation} annotation The annotation that will be added. */ -////////////////////////////////////////////////////////////////////////////// geo_event.annotation.add_before = 'geo_annotation_add_before'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an annotation has been altered. This is currently only * triggered when updating existing annotations via the geojson function. @@ -539,10 +460,8 @@ geo_event.annotation.add_before = 'geo_annotation_add_before'; * @type {object} * @property {geo.annotation} annotation The annotation that was altered. */ -////////////////////////////////////////////////////////////////////////////// geo_event.annotation.update = 'geo_annotation_update'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an annotation has been removed. * @@ -550,10 +469,8 @@ geo_event.annotation.update = 'geo_annotation_update'; * @type {object} * @property {geo.annotation} annotation The annotation that was removed. */ -////////////////////////////////////////////////////////////////////////////// geo_event.annotation.remove = 'geo_annotation_remove'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when an annotation's state changes. * @@ -561,10 +478,8 @@ geo_event.annotation.remove = 'geo_annotation_remove'; * @type {object} * @property {geo.annotation} annotation The annotation that changed. */ -////////////////////////////////////////////////////////////////////////////// geo_event.annotation.state = 'geo_annotation_state'; -////////////////////////////////////////////////////////////////////////////// /** * Triggered when the annotation mode is changed. * @@ -575,7 +490,6 @@ geo_event.annotation.state = 'geo_annotation_state'; * @property {string?} oldMode The annotation mode before this change. This is * one of the values from `geo.annotation.annotationState`. */ -////////////////////////////////////////////////////////////////////////////// geo_event.annotation.mode = 'geo_annotation_mode'; module.exports = geo_event; diff --git a/src/feature.js b/src/feature.js index f03fd85e79..4a8d9f09a4 100644 --- a/src/feature.js +++ b/src/feature.js @@ -4,7 +4,6 @@ var sceneObject = require('./sceneObject'); var timestamp = require('./timestamp'); var geo_event = require('./event'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class feature * @@ -12,7 +11,6 @@ var geo_event = require('./event'); * @extends geo.sceneObject * @returns {geo.feature} */ -////////////////////////////////////////////////////////////////////////////// var feature = function (arg) { 'use strict'; if (!(this instanceof feature)) { @@ -22,11 +20,9 @@ var feature = function (arg) { var util = require('./util'); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// arg = arg || {}; var m_this = this, @@ -48,11 +44,9 @@ var feature = function (arg) { // data items, such as individual vertices on lines or polygons. this._subfeatureStyles = {}; - //////////////////////////////////////////////////////////////////////////// /** * Private method to bind mouse handlers on the map element. */ - //////////////////////////////////////////////////////////////////////////// this._bindMouseHandlers = function () { // Don't bind handlers for improved performance on features that don't @@ -70,11 +64,9 @@ var feature = function (arg) { m_this.geoOn(geo_event.brush, m_this._handleBrush); }; - //////////////////////////////////////////////////////////////////////////// /** * Private method to unbind mouse handlers on the map element. */ - //////////////////////////////////////////////////////////////////////////// this._unbindMouseHandlers = function () { m_this.geoOff(geo_event.mousemove, m_this._handleMousemove); m_this.geoOff(geo_event.mouseclick, m_this._handleMouseclick); @@ -82,7 +74,6 @@ var feature = function (arg) { m_this.geoOff(geo_event.brush, m_this._handleBrush); }; - //////////////////////////////////////////////////////////////////////////// /** * For binding mouse events, use functions with * the following call signatures: @@ -99,9 +90,7 @@ var feature = function (arg) { * // do something with the feature marker. * }); */ - //////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////// /** * Search for features containing the given point. * @@ -115,7 +104,6 @@ var feature = function (arg) { * @argument {Object} coordinate * @returns {Object} */ - //////////////////////////////////////////////////////////////////////////// this.pointSearch = function () { // base class method does nothing return { @@ -124,21 +112,17 @@ var feature = function (arg) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Returns an array of line indices that are contained in the given box. */ - //////////////////////////////////////////////////////////////////////////// this.boxSearch = function (lowerLeft, upperRight, opts) { // base class method does nothing return []; }; - //////////////////////////////////////////////////////////////////////////// /** * Private mousemove handler */ - //////////////////////////////////////////////////////////////////////////// this._handleMousemove = function () { var mouse = m_this.layer().map().interactor().mouse(), data = m_this.data(), @@ -230,11 +214,9 @@ var feature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Private mouseclick handler */ - //////////////////////////////////////////////////////////////////////////// this._handleMouseclick = function (evt) { var mouse = m_this.layer().map().interactor().mouse(), data = m_this.data(), @@ -255,11 +237,9 @@ var feature = function (arg) { }); }; - //////////////////////////////////////////////////////////////////////////// /** * Private brush handler. */ - //////////////////////////////////////////////////////////////////////////// this._handleBrush = function (brush) { var idx = m_this.boxSearch(brush.gcs.lowerLeft, brush.gcs.upperRight), data = m_this.data(); @@ -277,11 +257,9 @@ var feature = function (arg) { }); }; - //////////////////////////////////////////////////////////////////////////// /** * Private brushend handler. */ - //////////////////////////////////////////////////////////////////////////// this._handleBrushend = function (brush) { var idx = m_this.boxSearch(brush.gcs.lowerLeft, brush.gcs.upperRight), data = m_this.data(); @@ -299,11 +277,9 @@ var feature = function (arg) { }); }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set style used by the feature */ - //////////////////////////////////////////////////////////////////////////// this.style = function (arg1, arg2) { if (arg1 === undefined) { return m_style; @@ -320,7 +296,6 @@ var feature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * A uniform getter that always returns a function even for constant styles. * Maybe extend later to support accessor-like objects. If undefined input, @@ -329,7 +304,6 @@ var feature = function (arg) { * @param {string|undefined} key * @return {function} */ - //////////////////////////////////////////////////////////////////////////// this.style.get = function (key) { var out; if (key === undefined) { @@ -358,7 +332,6 @@ var feature = function (arg) { return out; }; - //////////////////////////////////////////////////////////////////////////// /** * Set style(s) from array(s). For each style, the array should have one * value per data item. The values are not converted or validated. Color @@ -379,7 +352,6 @@ var feature = function (arg) { * once. * @returns {object} the feature */ - //////////////////////////////////////////////////////////////////////////// this.updateStyleFromArray = function (keyOrObject, styleArray, refresh) { if (typeof keyOrObject !== 'string') { $.each(keyOrObject, function (key, value) { @@ -420,29 +392,23 @@ var feature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get layer referenced by the feature */ - //////////////////////////////////////////////////////////////////////////// this.layer = function () { return m_layer; }; - //////////////////////////////////////////////////////////////////////////// /** * Get renderer used by the feature */ - //////////////////////////////////////////////////////////////////////////// this.renderer = function () { return m_renderer; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set projection of the feature */ - //////////////////////////////////////////////////////////////////////////// this.gcs = function (val) { if (val === undefined) { if (m_gcs === undefined && m_renderer) { @@ -456,7 +422,6 @@ var feature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from the renderer's input gcs coordinates to display coordinates. * @@ -476,7 +441,6 @@ var feature = function (arg) { return c; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set visibility of the feature * @@ -488,7 +452,6 @@ var feature = function (arg) { * @return {boolean|object} either the visibility (if getting) or the feature * (if setting). */ - //////////////////////////////////////////////////////////////////////////// this.visible = function (val, direct) { if (val === undefined) { if (!direct && m_layer && m_layer.visible && !m_layer.visible()) { @@ -515,12 +478,10 @@ var feature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set a list of dependent features. Dependent features have their * visibility changed at the same time as the feature. */ - //////////////////////////////////////////////////////////////////////////// this.dependentFeatures = function (arg) { if (arg === undefined) { return m_dependentFeatures.slice(); @@ -529,13 +490,11 @@ var feature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set bin of the feature * * Bin number is typically used for sorting the order of rendering */ - //////////////////////////////////////////////////////////////////////////// this.bin = function (val) { if (val === undefined) { return m_bin; @@ -546,11 +505,9 @@ var feature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set timestamp of data change */ - //////////////////////////////////////////////////////////////////////////// this.dataTime = function (val) { if (val === undefined) { return m_dataTime; @@ -561,11 +518,9 @@ var feature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set timestamp of last time build happened */ - //////////////////////////////////////////////////////////////////////////// this.buildTime = function (val) { if (val === undefined) { return m_buildTime; @@ -576,11 +531,9 @@ var feature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set timestamp of last time update happened */ - //////////////////////////////////////////////////////////////////////////// this.updateTime = function (val) { if (val === undefined) { return m_updateTime; @@ -591,13 +544,11 @@ var feature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set the data array for the feature. * * @returns {Array|this} */ - //////////////////////////////////////////////////////////////////////////// this.data = function (data) { if (data === undefined) { return m_this.style('data') || []; @@ -609,7 +560,6 @@ var feature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set if the selection API is enabled for this feature. * @@ -621,7 +571,6 @@ var feature = function (arg) { * @return {boolean|object} either the selectionAPI state (if getting) or the * feature (if setting). */ - //////////////////////////////////////////////////////////////////////////// this.selectionAPI = function (arg, direct) { if (arg === undefined) { if (!direct && m_layer && m_layer.selectionAPI && !m_layer.selectionAPI()) { @@ -638,13 +587,11 @@ var feature = function (arg) { return this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize * * Derived class should implement this */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { if (!m_layer) { throw new Error('Feature requires a valid layer'); @@ -655,33 +602,27 @@ var feature = function (arg) { m_this._bindMouseHandlers(); }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * Derived class should implement this */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * Derived class should implement this */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy * * Derived class should implement this */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this._unbindMouseHandlers(); m_selectedFeatures = []; diff --git a/src/featureLayer.js b/src/featureLayer.js index 7ca8d0ab95..df2c3b2749 100644 --- a/src/featureLayer.js +++ b/src/featureLayer.js @@ -3,7 +3,6 @@ var layer = require('./layer'); var geo_event = require('./event'); var registry = require('./registry'); -////////////////////////////////////////////////////////////////////////////// /** * Layer to draw points, lines, and polygons on the map The polydata layer * provide mechanisms to create and draw geometrical shapes such as points, @@ -12,7 +11,6 @@ var registry = require('./registry'); * @extends geo.layer * @returns {geo.featureLayer} */ -////////////////////////////////////////////////////////////////////////////// var featureLayer = function (arg) { 'use strict'; if (!(this instanceof featureLayer)) { @@ -20,11 +18,9 @@ var featureLayer = function (arg) { } layer.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, m_features = [], s_init = this._init, @@ -34,7 +30,6 @@ var featureLayer = function (arg) { s_selectionAPI = this.selectionAPI, s_draw = this.draw; - //////////////////////////////////////////////////////////////////////////// /** * Create feature give a name * @@ -42,7 +37,6 @@ var featureLayer = function (arg) { * @param {object} arg properties for the new feature * @returns {geo.Feature} Will return a new feature */ - //////////////////////////////////////////////////////////////////////////// this.createFeature = function (featureName, arg) { var newFeature = registry.createFeature( @@ -53,13 +47,11 @@ var featureLayer = function (arg) { return newFeature; }; - //////////////////////////////////////////////////////////////////////////// /** * Add a feature to the layer if it is not already present. * * @param {object} feature the feature to add. */ - //////////////////////////////////////////////////////////////////////////// this.addFeature = function (feature) { /* try to remove the feature first so that we don't have two copies */ this.removeFeature(feature); @@ -70,13 +62,11 @@ var featureLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Remove feature without destroying it * * @param {object} feature the feature to remove. */ - //////////////////////////////////////////////////////////////////////////// this.removeFeature = function (feature) { var pos; @@ -91,13 +81,11 @@ var featureLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Delete feature * * @param {object} feature the feature to delete. */ - //////////////////////////////////////////////////////////////////////////// this.deleteFeature = function (feature) { // call _exit first, as destroying the feature affect other features @@ -111,13 +99,11 @@ var featureLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set drawables * * @returns {Array} */ - //////////////////////////////////////////////////////////////////////////// this.features = function (val) { if (val === undefined) { return m_features.slice(); @@ -139,20 +125,18 @@ var featureLayer = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { if (m_this.initialized()) { return m_this; } - /// Call super class init + // Call super class init s_init.call(m_this, true); - /// Bind events to handlers + // Bind events to handlers m_this.geoOn(geo_event.resize, function (event) { if (m_this.renderer()) { m_this.renderer()._resize(event.x, event.y, event.width, event.height); @@ -187,11 +171,9 @@ var featureLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update layer */ - //////////////////////////////////////////////////////////////////////////// this._update = function (request) { var i; @@ -199,7 +181,7 @@ var featureLayer = function (arg) { return m_this; } - /// Call base class update + // Call base class update s_update.call(m_this, request); if (m_this.dataTime().getMTime() > m_this.updateTime().getMTime()) { @@ -217,21 +199,17 @@ var featureLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Free all resources */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.clear(); s_exit(); }; - //////////////////////////////////////////////////////////////////////////// /** * Draw */ - //////////////////////////////////////////////////////////////////////////// this.draw = function () { if (m_this.visible()) { // Call sceneObject.draw, which calls draw on all child objects. @@ -246,7 +224,6 @@ var featureLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set visibility of the layer * @@ -255,7 +232,6 @@ var featureLayer = function (arg) { * @return {boolean|object} either the visibility (if getting) or the layer * (if setting). */ - //////////////////////////////////////////////////////////////////////////// this.visible = function (val) { if (val === undefined) { return s_visible(); @@ -276,7 +252,6 @@ var featureLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set selectionAPI of the layer * @@ -285,7 +260,6 @@ var featureLayer = function (arg) { * @return {boolean|object} either the selectionAPI state (if getting) or the * layer (if setting). */ - //////////////////////////////////////////////////////////////////////////// this.selectionAPI = function (val) { if (val === undefined) { return s_selectionAPI(); @@ -303,11 +277,9 @@ var featureLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Clear all features in layer */ - //////////////////////////////////////////////////////////////////////////// this.clear = function () { while (m_features.length) { m_this.deleteFeature(m_features[0]); diff --git a/src/fetchQueue.js b/src/fetchQueue.js index 855db4734e..282ac9e145 100644 --- a/src/fetchQueue.js +++ b/src/fetchQueue.js @@ -3,7 +3,6 @@ module.exports = (function () { var $ = require('jquery'); - ////////////////////////////////////////////////////////////////////////////// /** * This class implements a queue for Deferred objects. Whenever one of the * objects in the queue completes (resolved or rejected), another item in the @@ -29,7 +28,6 @@ module.exports = (function () { * Deferred object and must return a truthy value if the object is still * needed. */ - ////////////////////////////////////////////////////////////////////////////// var fetchQueue = function (options) { if (!(this instanceof fetchQueue)) { return new fetchQueue(options); diff --git a/src/fileReader.js b/src/fileReader.js index 41a4adb5fd..7b5cec191d 100644 --- a/src/fileReader.js +++ b/src/fileReader.js @@ -2,7 +2,6 @@ var inherit = require('./inherit'); var featureLayer = require('./featureLayer'); var object = require('./object'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class fileReader * @@ -10,7 +9,6 @@ var object = require('./object'); * @extends geo.object * @returns {geo.fileReader} */ -////////////////////////////////////////////////////////////////////////////// var fileReader = function (arg) { 'use strict'; if (!(this instanceof fileReader)) { @@ -18,11 +16,9 @@ var fileReader = function (arg) { } object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// arg = arg || {}; if (!(arg.layer instanceof featureLayer)) { @@ -31,41 +27,33 @@ var fileReader = function (arg) { var m_layer = arg.layer; - //////////////////////////////////////////////////////////////////////////// /** * Get the feature layer attached to the reader */ - //////////////////////////////////////////////////////////////////////////// this.layer = function () { return m_layer; }; - //////////////////////////////////////////////////////////////////////////// /** * Tells the caller if it can handle the given file by returning a boolean. */ - //////////////////////////////////////////////////////////////////////////// this.canRead = function () { return false; }; - //////////////////////////////////////////////////////////////////////////// /** * Reads the file object and calls the done function when finished. As an * argument to done, provides a boolean that reports if the read was a * success. Possibly, it can call done with an object containing details * of the read operation. */ - //////////////////////////////////////////////////////////////////////////// this.read = function (file, done) { done(false); }; - //////////////////////////////////////////////////////////////////////////// /** * Return a FileReader with handlers attached. */ - //////////////////////////////////////////////////////////////////////////// function newFileReader(done, progress) { var reader = new FileReader(); if (progress) { @@ -80,24 +68,20 @@ var fileReader = function (arg) { return reader; } - //////////////////////////////////////////////////////////////////////////// /** * Private method for reading a file object as a string. Calls done with * the string content when finished or an error object if unsuccessful. * Optionally, the caller can provide a progress method that is called * after reading each slice. */ - //////////////////////////////////////////////////////////////////////////// this._getString = function (file, done, progress) { var reader = newFileReader(done, progress); reader.readAsText(file); }; - //////////////////////////////////////////////////////////////////////////// /** * Like _getString, but returns an ArrayBuffer object. */ - //////////////////////////////////////////////////////////////////////////// this._getArrayBuffer = function (file, done, progress) { var reader = newFileReader(done, progress); reader.readAsText(file); diff --git a/src/gl/choroplethFeature.js b/src/gl/choroplethFeature.js index 2cad3264a1..607a1befd7 100644 --- a/src/gl/choroplethFeature.js +++ b/src/gl/choroplethFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var choroplethFeature = require('../choroplethFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of choroplethFeature * @@ -10,7 +9,6 @@ var choroplethFeature = require('../choroplethFeature'); * @extends geo.choroplethFeature * @returns {geo.gl.choroplethFeature} */ -////////////////////////////////////////////////////////////////////////////// var gl_choroplethFeature = function (arg) { 'use strict'; @@ -20,11 +18,9 @@ var gl_choroplethFeature = function (arg) { arg = arg || {}; choroplethFeature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, m_gl_polygons = null, s_exit = this._exit, @@ -50,34 +46,28 @@ var gl_choroplethFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { m_this.buildTime().modified(); return (m_gl_polygons = createGLChoropleth()); }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * @override */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); if (m_this.dataTime().getMTime() >= m_this.buildTime().getMTime() || @@ -88,11 +78,9 @@ var gl_choroplethFeature = function (arg) { m_this.updateTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy Polygon Sub-Features */ - //////////////////////////////////////////////////////////////////////////// this._wipePolygons = function () { if (m_gl_polygons) { m_gl_polygons.map(function (polygon) { @@ -102,11 +90,9 @@ var gl_choroplethFeature = function (arg) { m_gl_polygons = null; }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this._wipePolygons(); s_exit(); diff --git a/src/gl/contourFeature.js b/src/gl/contourFeature.js index 31576b8498..f9c56d66a0 100644 --- a/src/gl/contourFeature.js +++ b/src/gl/contourFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var contourFeature = require('../contourFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of contourFeature * @@ -10,7 +9,6 @@ var contourFeature = require('../contourFeature'); * @extends geo.contourFeature * @returns {geo.gl.contourFeature} */ -////////////////////////////////////////////////////////////////////////////// var gl_contourFeature = function (arg) { 'use strict'; @@ -27,11 +25,9 @@ var gl_contourFeature = function (arg) { object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_exit = this._exit, m_textureUnit = 7, @@ -164,11 +160,9 @@ var gl_contourFeature = function (arg) { m_mapper.boundsDirtyTimestamp().modified(); } - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { var blend = vgl.blend(), prog = vgl.shaderProgram(), @@ -234,13 +228,11 @@ var gl_contourFeature = function (arg) { m_mapper.setGeometryData(geom); }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { if (m_actor) { m_this.renderer().contextRenderer().removeActor(m_actor); @@ -252,13 +244,11 @@ var gl_contourFeature = function (arg) { m_this.buildTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * @override */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); @@ -272,11 +262,9 @@ var gl_contourFeature = function (arg) { m_this.updateTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.renderer().contextRenderer().removeActor(m_actor); s_exit(); diff --git a/src/gl/lineFeature.js b/src/gl/lineFeature.js index 332e34ad8a..96258c9b09 100644 --- a/src/gl/lineFeature.js +++ b/src/gl/lineFeature.js @@ -33,7 +33,6 @@ var flagsDebug = { // uses 1 bit debug: 1 }; -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of lineFeature * @@ -41,7 +40,6 @@ var flagsDebug = { // uses 1 bit * @extends geo.lineFeature * @returns {geo.gl.lineFeature} */ -////////////////////////////////////////////////////////////////////////////// var gl_lineFeature = function (arg) { 'use strict'; if (!(this instanceof gl_lineFeature)) { @@ -57,11 +55,9 @@ var gl_lineFeature = function (arg) { object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_exit = this._exit, m_actor, @@ -536,35 +532,29 @@ var gl_lineFeature = function (arg) { m_mapper.boundsDirtyTimestamp().modified(); } - //////////////////////////////////////////////////////////////////////////// /** * Return the arrangement of vertices used for each line segment. * * @returns {Number} */ - //////////////////////////////////////////////////////////////////////////// this.featureVertices = function () { // return [[0, -1], [0, 1], [1, -1], [1, 1], [1, -1], [0, 1]]; return [[0, 'corner', -1], [0, 'near', 1], [1, 'far', -1], [1, 'corner', 1], [1, 'near', -1], [0, 'far', 1]]; }; - //////////////////////////////////////////////////////////////////////////// /** * Return the number of vertices used for each line segment. * * @returns {Number} */ - //////////////////////////////////////////////////////////////////////////// this.verticesPerFeature = function () { return m_this.featureVertices().length; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { var prog = vgl.shaderProgram(), vs = createVertexShader(), @@ -652,13 +642,11 @@ var gl_lineFeature = function (arg) { m_mapper.setGeometryData(geom); }; - //////////////////////////////////////////////////////////////////////////// /** * Return list of actors * * @returns {vgl.actor[]} */ - //////////////////////////////////////////////////////////////////////////// this.actors = function () { if (!m_actor) { return []; @@ -666,13 +654,11 @@ var gl_lineFeature = function (arg) { return [m_actor]; }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { createGLLines(); @@ -682,13 +668,11 @@ var gl_lineFeature = function (arg) { m_this.buildTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * @override */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); @@ -705,11 +689,9 @@ var gl_lineFeature = function (arg) { m_this.updateTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.renderer().contextRenderer().removeActor(m_actor); m_actor = null; diff --git a/src/gl/object.js b/src/gl/object.js index dbb0959db2..30b1b958ab 100644 --- a/src/gl/object.js +++ b/src/gl/object.js @@ -1,10 +1,8 @@ -////////////////////////////////////////////////////////////////////////////// /** * VGL specific subclass of object which rerenders when the object is drawn. * @class geo.gl.object * @extends geo.sceneObject */ -////////////////////////////////////////////////////////////////////////////// var gl_object = function (arg) { 'use strict'; @@ -20,11 +18,9 @@ var gl_object = function (arg) { var m_this = this, s_draw = this.draw; - //////////////////////////////////////////////////////////////////////////// /** * Redraw the object. */ - //////////////////////////////////////////////////////////////////////////// this.draw = function () { m_this._update({mayDelay: true}); m_this.renderer()._render(); diff --git a/src/gl/pointFeature.js b/src/gl/pointFeature.js index 1e2b54bf06..514049baee 100644 --- a/src/gl/pointFeature.js +++ b/src/gl/pointFeature.js @@ -3,7 +3,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var pointFeature = require('../pointFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of pointFeature * @@ -11,7 +10,6 @@ var pointFeature = require('../pointFeature'); * @extends geo.pointFeature * @returns {geo.gl.pointFeature} */ -////////////////////////////////////////////////////////////////////////////// var gl_pointFeature = function (arg) { 'use strict'; if (!(this instanceof gl_pointFeature)) { @@ -27,11 +25,9 @@ var gl_pointFeature = function (arg) { object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_exit = this._exit, m_actor = null, @@ -353,13 +349,11 @@ var gl_pointFeature = function (arg) { m_mapper.boundsDirtyTimestamp().modified(); } - //////////////////////////////////////////////////////////////////////////// /** * Return list of actors * * @returns {vgl.actor[]} */ - //////////////////////////////////////////////////////////////////////////// this.actors = function () { if (!m_actor) { return []; @@ -367,13 +361,11 @@ var gl_pointFeature = function (arg) { return [m_actor]; }; - //////////////////////////////////////////////////////////////////////////// /** * Return the number of vertices used for each point. * * @returns {Number} */ - //////////////////////////////////////////////////////////////////////////// this.verticesPerFeature = function () { var unit = pointPolygon(0, 0, 1, 1); return unit.length / 2; @@ -454,11 +446,9 @@ var gl_pointFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { var prog = vgl.shaderProgram(), vertexShader = createVertexShader(), @@ -555,13 +545,11 @@ var gl_pointFeature = function (arg) { m_mapper.setGeometryData(geom); }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { if (m_actor) { @@ -575,13 +563,11 @@ var gl_pointFeature = function (arg) { m_this.buildTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * @override */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); @@ -604,11 +590,9 @@ var gl_pointFeature = function (arg) { m_this.updateTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.renderer().contextRenderer().removeActor(m_actor); m_actor = null; diff --git a/src/gl/polygonFeature.js b/src/gl/polygonFeature.js index 8c12bd6b66..3d156f9942 100644 --- a/src/gl/polygonFeature.js +++ b/src/gl/polygonFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var polygonFeature = require('../polygonFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of polygonFeature * @@ -10,7 +9,6 @@ var polygonFeature = require('../polygonFeature'); * @extends geo.polygonFeature * @returns {geo.gl.polygonFeature} */ -////////////////////////////////////////////////////////////////////////////// var gl_polygonFeature = function (arg) { 'use strict'; if (!(this instanceof gl_polygonFeature)) { @@ -27,11 +25,9 @@ var gl_polygonFeature = function (arg) { object.call(this); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_exit = this._exit, m_actor = vgl.actor(), @@ -263,12 +259,10 @@ var gl_polygonFeature = function (arg) { } } - //////////////////////////////////////////////////////////////////////////// /** * Initialize * @memberof geo.gl.polygonFeature */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { var prog = vgl.shaderProgram(), posAttr = vgl.vertexAttribute('pos'), @@ -312,14 +306,12 @@ var gl_polygonFeature = function (arg) { s_init.call(m_this, arg); }; - //////////////////////////////////////////////////////////////////////////// /** * Build * * @memberof geo.gl.polygonFeature * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { createGLPolygons(m_this.dataTime().getMTime() < m_this.buildTime().getMTime() && m_geometry); @@ -330,14 +322,12 @@ var gl_polygonFeature = function (arg) { m_this.buildTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Update * * @memberof geo.gl.polygonFeature * @override */ - //////////////////////////////////////////////////////////////////////////// this._update = function (opts) { if (opts && opts.mayDelay) { m_updateAnimFrameRef = m_this.layer().map().scheduleAnimationFrame(m_this._update); @@ -359,12 +349,10 @@ var gl_polygonFeature = function (arg) { m_this.updateTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy * @memberof geo.gl.polygonFeature */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.renderer().contextRenderer().removeActor(m_actor); s_exit(); diff --git a/src/gl/quadFeature.js b/src/gl/quadFeature.js index 55fe0a8f52..3611909c4d 100644 --- a/src/gl/quadFeature.js +++ b/src/gl/quadFeature.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerFeature = require('../registry').registerFeature; var quadFeature = require('../quadFeature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class quadFeature * @@ -11,7 +10,6 @@ var quadFeature = require('../quadFeature'); * @extends geo.quadFeature * @returns {geo.gl.quadFeature} */ -////////////////////////////////////////////////////////////////////////////// var gl_quadFeature = function (arg) { 'use strict'; if (!(this instanceof gl_quadFeature)) { @@ -141,11 +139,9 @@ var gl_quadFeature = function (arg) { m_glColorCompileTimestamp.modified(); } - //////////////////////////////////////////////////////////////////////////// /** * Build this feature */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { var mapper, mat, prog, srctex, unicrop, geom; @@ -361,11 +357,9 @@ var gl_quadFeature = function (arg) { mapper.undoBindVertexData(renderState); }; - //////////////////////////////////////////////////////////////////////////// /** * Update */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); if (m_this.buildTime().getMTime() <= m_this.dataTime().getMTime() || @@ -383,20 +377,16 @@ var gl_quadFeature = function (arg) { m_this.updateTime().modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { s_init.call(m_this, arg); }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { if (m_actor_image) { m_this.renderer().contextRenderer().removeActor(m_actor_image); diff --git a/src/gl/vglRenderer.js b/src/gl/vglRenderer.js index 51cc9a0669..c52174c7f6 100644 --- a/src/gl/vglRenderer.js +++ b/src/gl/vglRenderer.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerRenderer = require('../registry').registerRenderer; var renderer = require('../renderer'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class vglRenderer * @@ -11,7 +10,6 @@ var renderer = require('../renderer'); * @param canvas * @returns {geo.gl.vglRenderer} */ -////////////////////////////////////////////////////////////////////////////// var vglRenderer = function (arg) { 'use strict'; @@ -37,48 +35,38 @@ var vglRenderer = function (arg) { s_init = this._init, s_exit = this._exit; - /// TODO: Move this API to the base class - //////////////////////////////////////////////////////////////////////////// + // TODO: Move this API to the base class /** * Return width of the renderer */ - //////////////////////////////////////////////////////////////////////////// this.width = function () { return m_width; }; - //////////////////////////////////////////////////////////////////////////// /** * Return height of the renderer */ - //////////////////////////////////////////////////////////////////////////// this.height = function () { return m_height; }; - //////////////////////////////////////////////////////////////////////////// /** * Get context specific renderer */ - //////////////////////////////////////////////////////////////////////////// this.contextRenderer = function () { return m_contextRenderer; }; - //////////////////////////////////////////////////////////////////////////// /** * Get API used by the renderer */ - //////////////////////////////////////////////////////////////////////////// this.api = function () { return 'vgl'; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { if (m_this.initialized()) { return m_this; @@ -117,11 +105,9 @@ var vglRenderer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Handle resize event */ - //////////////////////////////////////////////////////////////////////////// this._resize = function (x, y, w, h) { var renderWindow = m_viewer.renderWindow(); @@ -137,11 +123,9 @@ var vglRenderer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Render. This actually schedules rendering for the next animation frame. */ - //////////////////////////////////////////////////////////////////////////// this._render = function () { /* If we are already scheduled to render, don't schedule again. Rather, * mark that we should render after other animation frame requests occur. @@ -164,11 +148,9 @@ var vglRenderer = function (arg) { m_viewer.render(); }; - //////////////////////////////////////////////////////////////////////////// /** * Exit */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.canvas().remove(); m_viewer.exit(); diff --git a/src/graphFeature.js b/src/graphFeature.js index 549186da3f..47df524ebb 100644 --- a/src/graphFeature.js +++ b/src/graphFeature.js @@ -1,7 +1,6 @@ var inherit = require('./inherit'); var feature = require('./feature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class graphFeature * @@ -9,7 +8,6 @@ var feature = require('./feature'); * @extends geo.feature * @returns {geo.graphFeature} */ -////////////////////////////////////////////////////////////////////////////// var graphFeature = function (arg) { 'use strict'; @@ -23,11 +21,9 @@ var graphFeature = function (arg) { var util = require('./util'); var registry = require('./registry'); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_draw = this.draw, s_style = this.style, @@ -38,11 +34,9 @@ var graphFeature = function (arg) { s_init = this._init, s_exit = this._exit; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); @@ -66,33 +60,27 @@ var graphFeature = function (arg) { m_this.nodes(function (d) { return d; }); }; - //////////////////////////////////////////////////////////////////////////// /** * Call child _build methods */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { m_this.children().forEach(function (child) { child._build(); }); }; - //////////////////////////////////////////////////////////////////////////// /** * Call child _update methods */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { m_this.children().forEach(function (child) { child._update(); }); }; - //////////////////////////////////////////////////////////////////////////// /** * Custom _exit method to remove all sub-features */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.data([]); m_links.forEach(function (link) { @@ -106,11 +94,9 @@ var graphFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set style */ - //////////////////////////////////////////////////////////////////////////// this.style = function (arg, arg2) { var out = s_style.call(m_this, arg, arg2); if (out !== m_this) { @@ -124,11 +110,9 @@ var graphFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set links accessor. */ - //////////////////////////////////////////////////////////////////////////// this.links = function (arg) { if (arg === undefined) { return m_children; @@ -138,11 +122,9 @@ var graphFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set nodes */ - //////////////////////////////////////////////////////////////////////////// this.nodes = function (val) { if (val === undefined) { return m_nodes; @@ -152,29 +134,23 @@ var graphFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get internal node feature */ - //////////////////////////////////////////////////////////////////////////// this.nodeFeature = function () { return m_points; }; - //////////////////////////////////////////////////////////////////////////// /** * Get internal link features */ - //////////////////////////////////////////////////////////////////////////// this.linkFeatures = function () { return m_links; }; - //////////////////////////////////////////////////////////////////////////// /** * Build the feature for drawing */ - //////////////////////////////////////////////////////////////////////////// this.draw = function () { var layer = m_this.layer(), diff --git a/src/heatmapFeature.js b/src/heatmapFeature.js index 7ed2fdfd7f..418bc2b633 100644 --- a/src/heatmapFeature.js +++ b/src/heatmapFeature.js @@ -3,7 +3,6 @@ var inherit = require('./inherit'); var feature = require('./feature'); var transform = require('./transform'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class heatmapFeature * @@ -44,9 +43,7 @@ var transform = require('./transform'); * gaussian distribution. * @returns {geo.heatmapFeature} */ -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// var heatmapFeature = function (arg) { 'use strict'; if (!(this instanceof heatmapFeature)) { @@ -55,11 +52,9 @@ var heatmapFeature = function (arg) { arg = arg || {}; feature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, m_position, m_intensity, @@ -77,13 +72,11 @@ var heatmapFeature = function (arg) { m_binned = arg.binned !== undefined ? arg.binned : 'auto'; m_updateDelay = arg.updateDelay ? parseInt(arg.updateDelay, 10) : 1000; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set maxIntensity * * @returns {geo.heatmap} */ - //////////////////////////////////////////////////////////////////////////// this.maxIntensity = function (val) { if (val === undefined) { return m_maxIntensity; @@ -95,13 +88,11 @@ var heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set maxIntensity * * @returns {geo.heatmap} */ - //////////////////////////////////////////////////////////////////////////// this.minIntensity = function (val) { if (val === undefined) { return m_minIntensity; @@ -113,13 +104,11 @@ var heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set updateDelay * * @returns {geo.heatmap} */ - //////////////////////////////////////////////////////////////////////////// this.updateDelay = function (val) { if (val === undefined) { return m_updateDelay; @@ -129,13 +118,11 @@ var heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set binned * * @returns {geo.heatmap} */ - //////////////////////////////////////////////////////////////////////////// this.binned = function (val) { if (val === undefined) { return m_binned; @@ -157,13 +144,11 @@ var heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set position accessor * * @returns {geo.heatmap} */ - //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_position; @@ -175,25 +160,21 @@ var heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get pre-computed gcs position accessor * * @returns {geo.heatmap} */ - //////////////////////////////////////////////////////////////////////////// this.gcsPosition = function () { this._update(); return m_gcsPosition; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set intensity * * @returns {geo.heatmap} */ - //////////////////////////////////////////////////////////////////////////// this.intensity = function (val) { if (val === undefined) { return m_intensity; @@ -205,11 +186,9 @@ var heatmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); @@ -235,12 +214,10 @@ var heatmapFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Build * @override */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { var data = m_this.data(), intensity = null, diff --git a/src/imageTile.js b/src/imageTile.js index 644051b078..4ffaaf0300 100644 --- a/src/imageTile.js +++ b/src/imageTile.js @@ -4,7 +4,6 @@ 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, @@ -34,7 +33,6 @@ module.exports = (function () { * @param {number} [spec.overlap.x=0] * @param {number} [spec.overlap.y=0] */ - ////////////////////////////////////////////////////////////////////////////// var imageTile = function (spec) { if (!(this instanceof imageTile)) { return new imageTile(spec); diff --git a/src/inherit.js b/src/inherit.js index e6d6381b2c..df2d9af3d5 100644 --- a/src/inherit.js +++ b/src/inherit.js @@ -2,11 +2,9 @@ function newfunc() { return function () {}; } -////////////////////////////////////////////////////////////////////////////// /** * Convenient function to define JS inheritance */ -////////////////////////////////////////////////////////////////////////////// module.exports = function (C, P) { var F = newfunc(); F.prototype = P.prototype; diff --git a/src/jsonReader.js b/src/jsonReader.js index 80eedc6a4b..7f3bfd4cb8 100644 --- a/src/jsonReader.js +++ b/src/jsonReader.js @@ -2,7 +2,6 @@ var inherit = require('./inherit'); var registerFileReader = require('./registry').registerFileReader; var fileReader = require('./fileReader'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class jsonReader * @@ -10,7 +9,6 @@ var fileReader = require('./fileReader'); * @extends geo.fileReader * @returns {geo.jsonReader} */ -////////////////////////////////////////////////////////////////////////////// var jsonReader = function (arg) { 'use strict'; if (!(this instanceof jsonReader)) { diff --git a/src/layer.js b/src/layer.js index da5676b7d2..43da661acf 100644 --- a/src/layer.js +++ b/src/layer.js @@ -5,7 +5,6 @@ var checkRenderer = require('./registry').checkRenderer; var rendererForFeatures = require('./registry').rendererForFeatures; var rendererForAnnotations = require('./registry').rendererForAnnotations; -////////////////////////////////////////////////////////////////////////////// /** * @class geo.layer * @extends geo.sceneObject @@ -15,7 +14,6 @@ var rendererForAnnotations = require('./registry').rendererForAnnotations; * to the index of the layer inside the map) * @returns {geo.layer} */ -////////////////////////////////////////////////////////////////////////////// var layer = function (arg) { 'use strict'; @@ -32,11 +30,9 @@ var layer = function (arg) { var geo_event = require('./event'); var camera = require('./camera'); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_exit = this._exit, m_id = arg.id === undefined ? layer.newLayerId() : arg.id, @@ -65,18 +61,15 @@ var layer = function (arg) { throw new Error('Layers must be initialized on a map.'); } - //////////////////////////////////////////////////////////////////////////// /** * Get the name of the renderer. * * @returns {string} */ - //////////////////////////////////////////////////////////////////////////// this.rendererName = function () { return m_rendererName; }; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the z-index of the layer. The z-index controls the display * order of the layers in much the same way as the CSS z-index property. @@ -84,7 +77,6 @@ var layer = function (arg) { * @param {number} [zIndex] The new z-index * @returns {number|this} */ - //////////////////////////////////////////////////////////////////////////// this.zIndex = function (zIndex) { if (zIndex === undefined) { return m_zIndex; @@ -94,7 +86,6 @@ var layer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Bring the layer above the given number of layers. This will rotate the * current z-indices for this and the next `n` layers. @@ -102,7 +93,6 @@ var layer = function (arg) { * @param {number} [n=1] The number of positions to move * @returns {this} */ - //////////////////////////////////////////////////////////////////////////// this.moveUp = function (n) { var order, i, me = null, tmp, sign; @@ -143,7 +133,6 @@ var layer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Bring the layer below the given number of layers. This will rotate the * current z-indices for this and the previous `n` layers. @@ -151,7 +140,6 @@ var layer = function (arg) { * @param {number} [n=1] The number of positions to move * @returns {this} */ - //////////////////////////////////////////////////////////////////////////// this.moveDown = function (n) { if (n === undefined) { n = 1; @@ -159,40 +147,33 @@ var layer = function (arg) { return m_this.moveUp(-n); }; - //////////////////////////////////////////////////////////////////////////// /** * Bring the layer to the top of the map layers. * * @returns {this} */ - //////////////////////////////////////////////////////////////////////////// this.moveToTop = function () { return m_this.moveUp(m_this.map().children().length - 1); }; - //////////////////////////////////////////////////////////////////////////// /** * Bring the layer to the bottom of the map layers. * * @returns {this} */ - //////////////////////////////////////////////////////////////////////////// this.moveToBottom = function () { return m_this.moveDown(m_this.map().children().length - 1); }; - //////////////////////////////////////////////////////////////////////////// /** * Get whether or not the layer is sticky (navigates with the map). * * @returns {Boolean} */ - //////////////////////////////////////////////////////////////////////////// this.sticky = function () { return m_sticky; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set whether or not the layer is active. An active layer will receive * native mouse when the layer is on top. Non-active layers will never @@ -200,7 +181,6 @@ var layer = function (arg) { * * @returns {Boolean|object} */ - //////////////////////////////////////////////////////////////////////////// this.active = function (arg) { if (arg === undefined) { return m_active; @@ -212,24 +192,20 @@ var layer = function (arg) { return this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get root node of the layer * * @returns {div} */ - //////////////////////////////////////////////////////////////////////////// this.node = function () { return m_node; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set id of the layer * * @returns {String} */ - //////////////////////////////////////////////////////////////////////////// this.id = function (val) { if (val === undefined) { return m_id; @@ -239,13 +215,11 @@ var layer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set name of the layer * * @returns {String} */ - //////////////////////////////////////////////////////////////////////////// this.name = function (val) { if (val === undefined) { return m_name; @@ -255,57 +229,45 @@ var layer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set map of the layer */ - //////////////////////////////////////////////////////////////////////////// this.map = function () { return m_map; }; - //////////////////////////////////////////////////////////////////////////// /** * Get renderer for the layer if any */ - //////////////////////////////////////////////////////////////////////////// this.renderer = function () { return m_renderer; }; - //////////////////////////////////////////////////////////////////////////// /** * Get canvas of the layer * */ - //////////////////////////////////////////////////////////////////////////// this.canvas = function () { return m_canvas; }; - //////////////////////////////////////////////////////////////////////////// /** * Return last time data got changed */ - //////////////////////////////////////////////////////////////////////////// this.dataTime = function () { return m_dataTime; }; - //////////////////////////////////////////////////////////////////////////// /** * Return the modified time for the last update that did something */ - //////////////////////////////////////////////////////////////////////////// this.updateTime = function () { return m_updateTime; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set if the layer has been initialized */ - //////////////////////////////////////////////////////////////////////////// this.initialized = function (val) { if (val !== undefined) { m_initialized = val; @@ -314,7 +276,6 @@ var layer = function (arg) { return m_initialized; }; - //////////////////////////////////////////////////////////////////////////// /** * Transform coordinates from world coordinates into a local coordinate * system specific to the underlying renderer. This method is exposed @@ -322,7 +283,6 @@ var layer = function (arg) { * not be called directly. The default implementation is the identity * operator. */ - //////////////////////////////////////////////////////////////////////////// this.toLocal = function (input) { if (m_this._toLocalMatrix) { camera.applyTransform(m_this._toLocalMatrix, input); @@ -330,11 +290,9 @@ var layer = function (arg) { return input; }; - //////////////////////////////////////////////////////////////////////////// /** * Transform coordinates from a local coordinate system to world coordinates. */ - //////////////////////////////////////////////////////////////////////////// this.fromLocal = function (input) { if (m_this._fromLocalMatrix) { camera.applyTransform(m_this._fromLocalMatrix, input); @@ -342,7 +300,6 @@ var layer = function (arg) { return input; }; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the attribution html content that will displayed with the * layer. By default, nothing will be displayed. Note, this content @@ -351,7 +308,6 @@ var layer = function (arg) { * @param {string?} arg An html fragment * @returns {string|this} Chainable as a setter */ - //////////////////////////////////////////////////////////////////////////// this.attribution = function (arg) { if (arg !== undefined) { m_attribution = arg; @@ -361,7 +317,6 @@ var layer = function (arg) { return m_attribution; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set visibility of the layer * @@ -370,7 +325,6 @@ var layer = function (arg) { * @return {boolean|object} either the visibility (if getting) or the layer * (if setting). */ - //////////////////////////////////////////////////////////////////////////// this.visible = function (val) { if (val === undefined) { return m_visible; @@ -383,7 +337,6 @@ var layer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set selectionAPI of the layer * @@ -392,7 +345,6 @@ var layer = function (arg) { * @return {boolean|object} either the selectionAPI state (if getting) or the * layer (if setting). */ - //////////////////////////////////////////////////////////////////////////// this.selectionAPI = function (val) { if (val === undefined) { return m_selectionAPI; @@ -403,7 +355,6 @@ var layer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Init layer * @@ -411,7 +362,6 @@ var layer = function (arg) { * resize, pan, and zoom events itself, set this flag to true to avoid * binding them here. */ - //////////////////////////////////////////////////////////////////////////// this._init = function (noEvents) { if (m_initialized) { return m_this; @@ -442,7 +392,7 @@ var layer = function (arg) { m_initialized = true; if (!noEvents) { - /// Bind events to handlers + // Bind events to handlers m_this.geoOn(geo_event.resize, function (event) { m_this._update({event: event}); }); @@ -463,11 +413,9 @@ var layer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Clean up resouces */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.geoOff(); if (m_renderer) { @@ -481,39 +429,31 @@ var layer = function (arg) { s_exit(); }; - //////////////////////////////////////////////////////////////////////////// /** * Update layer */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { }; - //////////////////////////////////////////////////////////////////////////// /** * Return the width of the layer in pixels. * **DEPRECIATED: use map.size instead. */ - //////////////////////////////////////////////////////////////////////////// this.width = function () { return m_this.map().size().width; }; - //////////////////////////////////////////////////////////////////////////// /** * Return the height of the layer in pixels * **DEPRECIATED: use map.size instead. */ - //////////////////////////////////////////////////////////////////////////// this.height = function () { return m_this.map().size().height; }; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the current layer opacity. */ - //////////////////////////////////////////////////////////////////////////// this.opacity = function (opac) { if (opac !== undefined) { m_opacity = opac; diff --git a/src/lineFeature.js b/src/lineFeature.js index 8e4107010f..75a0244641 100644 --- a/src/lineFeature.js +++ b/src/lineFeature.js @@ -3,7 +3,6 @@ var feature = require('./feature'); var timestamp = require('./timestamp'); var transform = require('./transform'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class lineFeature * @@ -49,7 +48,6 @@ var transform = require('./transform'); * mode. This is a single value that applies to all lines. * @returns {geo.lineFeature} */ -////////////////////////////////////////////////////////////////////////////// var lineFeature = function (arg) { 'use strict'; if (!(this instanceof lineFeature)) { @@ -61,11 +59,9 @@ var lineFeature = function (arg) { arg = arg || {}; feature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_init = this._init, m_pointSearchTime = timestamp(), @@ -81,13 +77,11 @@ var lineFeature = function (arg) { strokeWidth: true }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set line accessor * * @returns {geo.pointFeature} */ - //////////////////////////////////////////////////////////////////////////// this.line = function (val) { if (val === undefined) { return m_this.style('line'); @@ -99,13 +93,11 @@ var lineFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set position accessor * * @returns {geo.pointFeature} */ - //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_this.style('position'); @@ -117,11 +109,9 @@ var lineFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Cache information needed for point searches. */ - //////////////////////////////////////////////////////////////////////////// this._updatePointSearchInfo = function () { if (m_pointSearchTime.getMTime() >= m_this.dataTime().getMTime() && m_pointSearchTime.getMTime() >= m_this.getMTime()) { @@ -165,7 +155,6 @@ var lineFeature = function (arg) { return m_pointSearchInfo; }; - //////////////////////////////////////////////////////////////////////////// /** * Returns an array of datum indices that contain the given point. * This is a slow implementation with runtime order of the number of @@ -176,7 +165,6 @@ var lineFeature = function (arg) { * that variable width lines will have a greater selection region than their * visual size at the narrow end. */ - //////////////////////////////////////////////////////////////////////////// this.pointSearch = function (p) { var data = m_this.data(), indices = [], found = []; if (!data || !data.length || !m_this.layer()) { @@ -231,11 +219,9 @@ var lineFeature = function (arg) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Returns an array of line indices that are contained in the given box. */ - //////////////////////////////////////////////////////////////////////////// this.boxSearch = function (lowerLeft, upperRight, opts) { var pos = m_this.position(), idx = [], @@ -267,11 +253,9 @@ var lineFeature = function (arg) { return idx; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { arg = arg || {}; s_init.call(m_this, arg); diff --git a/src/map.js b/src/map.js index 45dba89d6f..0d0b97ff9b 100644 --- a/src/map.js +++ b/src/map.js @@ -3,7 +3,6 @@ var vgl = require('vgl'); var inherit = require('./inherit'); var sceneObject = require('./sceneObject'); -////////////////////////////////////////////////////////////////////////////// /** * Creates a new map object * @@ -66,7 +65,6 @@ var sceneObject = require('./sceneObject'); * * @returns {geo.map} */ -////////////////////////////////////////////////////////////////////////////// var map = function (arg) { 'use strict'; if (!(this instanceof map)) { @@ -89,12 +87,10 @@ var map = function (arg) { var mapInteractor = require('./mapInteractor'); var uiLayer = require('./ui/uiLayer'); - //////////////////////////////////////////////////////////////////////////// /** * Private member variables * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_exit = this._exit, // See https://en.wikipedia.org/wiki/Web_Mercator @@ -158,7 +154,6 @@ var map = function (arg) { m_clampBoundsY = arg.clampBoundsY === undefined ? true : arg.clampBoundsY; m_clampZoom = arg.clampZoom === undefined ? true : arg.clampZoom; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the number of world space units per display pixel at the given * zoom level. @@ -168,7 +163,6 @@ var map = function (arg) { * specified zoom level. Otherwise return the current value. * @returns {number|this} */ - //////////////////////////////////////////////////////////////////////////// this.unitsPerPixel = function (zoom, unit) { zoom = zoom || 0; if (unit) { @@ -182,7 +176,6 @@ var map = function (arg) { return Math.pow(2, -zoom) * m_unitsPerPixel; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the animation queue. Two maps can share a single animation queue * to ensure synchronized animations. When setting, the animation queue will @@ -191,7 +184,6 @@ var map = function (arg) { * @param {array} [queue] The animation queue to use. * @returns {array|this} The current animation queue or the current map. */ - //////////////////////////////////////////////////////////////////////////// this.animationQueue = function (queue) { if (queue === undefined) { return m_animationQueue; @@ -215,7 +207,6 @@ var map = function (arg) { return this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the autoResize flag. * @@ -223,7 +214,6 @@ var map = function (arg) { * the size of the browser window changes. * @returns {boolean|this} The current state of autoResize or the current map. */ - //////////////////////////////////////////////////////////////////////////// this.autoResize = function (autoResize) { if (autoResize === undefined) { return m_autoResize; @@ -238,7 +228,6 @@ var map = function (arg) { return this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the `clampBoundsX` setting. If changed, adjust the bounds of the * map as needed. @@ -246,7 +235,6 @@ var map = function (arg) { * @param {boolean} [clamp] The new clamp value. * @returns {boolean|this} */ - //////////////////////////////////////////////////////////////////////////// this.clampBoundsX = function (clamp) { if (clamp === undefined) { return m_clampBoundsX; @@ -258,7 +246,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the `clampBoundsY` setting. If changed, adjust the bounds of the * map as needed. @@ -266,7 +253,6 @@ var map = function (arg) { * @param {boolean} [clamp] The new clamp value. * @returns {boolean|this} */ - //////////////////////////////////////////////////////////////////////////// this.clampBoundsY = function (clamp) { if (clamp === undefined) { return m_clampBoundsY; @@ -278,7 +264,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the `clampZoom` setting. If changed, adjust the bounds of the map * as needed. @@ -286,7 +271,6 @@ var map = function (arg) { * @param {boolean} [clamp] The new clamp value. * @returns {boolean|this} */ - //////////////////////////////////////////////////////////////////////////// this.clampZoom = function (clamp) { if (clamp === undefined) { return m_clampZoom; @@ -299,7 +283,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the `allowRotation` setting. If changed, adjust the map as * needed. @@ -311,7 +294,6 @@ var map = function (arg) { * or to specific values). * @returns {boolean|function|this} */ - //////////////////////////////////////////////////////////////////////////// this.allowRotation = function (allowRotation) { if (allowRotation === undefined) { return m_allowRotation; @@ -326,35 +308,29 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get the map's world coordinate origin in gcs coordinates. * * @returns {geo.geoPosition} */ - //////////////////////////////////////////////////////////////////////////// this.origin = function () { return $.extend({}, m_origin); }; - //////////////////////////////////////////////////////////////////////////// /** * Get the camera * * @returns {geo.camera} */ - //////////////////////////////////////////////////////////////////////////// this.camera = function () { return m_camera; }; - //////////////////////////////////////////////////////////////////////////// /** * Get map gcs. This is the coordinate system used in drawing the map. * * @returns {string} A string used by {@linkcode geo.transform}. */ - //////////////////////////////////////////////////////////////////////////// this.gcs = function (arg) { if (arg === undefined) { return m_gcs; @@ -372,14 +348,12 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get map interface gcs. This is the coordinate system used when getting or * setting map bounds, center, and other values. * * @returns {string} A string used by {@linkcode geo.transform}. */ - //////////////////////////////////////////////////////////////////////////// this.ingcs = function (arg) { if (arg === undefined) { return m_ingcs; @@ -388,18 +362,15 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get root DOM node of the map. * * @returns {object} */ - //////////////////////////////////////////////////////////////////////////// this.node = function () { return m_node; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set zoom level of the map. * @@ -417,7 +388,6 @@ var map = function (arg) { * @fires geo.event.zoom * @fires geo.event.pan */ - //////////////////////////////////////////////////////////////////////////// this.zoom = function (val, origin, ignoreDiscreteZoom) { if (val === undefined) { return m_zoom; @@ -458,7 +428,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Pan the map by a number of display pixels. * @@ -475,7 +444,6 @@ var map = function (arg) { * @returns {this} * @fires geo.event.pan */ - //////////////////////////////////////////////////////////////////////////// this.pan = function (delta, ignoreDiscreteZoom, ignoreClampBounds) { var evt = { screenDelta: delta @@ -520,7 +488,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the map rotation. The rotation is performed around the current * view center. Rotation mostly ignores `clampBoundsX`, as the behavior @@ -539,7 +506,6 @@ var map = function (arg) { * @fires geo.event.rotate * @fires geo.event.pan */ - //////////////////////////////////////////////////////////////////////////// this.rotation = function (rotation, origin, ignoreRotationFunc) { if (rotation === undefined) { return m_rotation; @@ -578,7 +544,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Set center of the map to the given geographic coordinates, or get the * current center. Uses bare objects {x: 0, y: 0}. @@ -599,7 +564,6 @@ var map = function (arg) { * @returns {geo.geoPosition|this} * @fires geo.event.pan */ - //////////////////////////////////////////////////////////////////////////// this.center = function (coordinates, gcs, ignoreDiscreteZoom, ignoreClampBounds) { var center; @@ -622,7 +586,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Add a layer to the map. * @@ -631,7 +594,6 @@ var map = function (arg) { * @return {geo.layer} * @fires geo.event.layerAdd */ - //////////////////////////////////////////////////////////////////////////// this.createLayer = function (layerName, arg) { arg = arg || {}; var newLayer = registry.createLayer( @@ -656,7 +618,6 @@ var map = function (arg) { return newLayer; }; - //////////////////////////////////////////////////////////////////////////// /** * Remove a layer from the map. * @@ -664,7 +625,6 @@ var map = function (arg) { * @return {geo.layer} * @fires geo.event.layerRemove */ - //////////////////////////////////////////////////////////////////////////// this.deleteLayer = function (layer) { if (layer !== null && layer !== undefined) { @@ -685,14 +645,12 @@ var map = function (arg) { return layer; }; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the size of the map. * * @param {geo.screenSize} [arg] Size in pixels. * @returns {geo.screenSize|this} The size in pixels or the map object. */ - //////////////////////////////////////////////////////////////////////////// this.size = function (arg) { if (arg === undefined) { return { @@ -729,14 +687,12 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get the rotated size of the map. This is the width and height of the * non-rotated area necessary to enclose the rotated area in pixels. * * @returns {geo.screenSize} The size that fits the rotated map. */ - //////////////////////////////////////////////////////////////////////////// this.rotatedSize = function () { if (!this.rotation()) { return { @@ -752,7 +708,6 @@ var map = function (arg) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from gcs coordinates to map world coordinates. * @@ -761,7 +716,6 @@ var map = function (arg) { * the interface gcs, `null` to use the map gcs, or any other transform. * @return {geo.worldPosition} World space coordinates. */ - //////////////////////////////////////////////////////////////////////////// this.gcsToWorld = function (c, gcs) { gcs = (gcs === null ? m_gcs : (gcs === undefined ? m_ingcs : gcs)); if (gcs !== m_gcs) { @@ -778,7 +732,6 @@ var map = function (arg) { return c; }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from map world coordinates to gcs coordinates. * @@ -787,7 +740,6 @@ var map = function (arg) { * the interface gcs, `null` to use the map gcs, or any other transform. * @return {geo.geoPosition} GCS space coordinates. */ - //////////////////////////////////////////////////////////////////////////// this.worldToGcs = function (c, gcs) { if (m_origin.x || m_origin.y || m_origin.z) { c = transform.affineInverse( @@ -804,7 +756,6 @@ var map = function (arg) { return c; }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from gcs coordinates to display coordinates. This is identical to * calling `gcsToWorld` and then `worldToDisplay`. @@ -814,13 +765,11 @@ var map = function (arg) { * the interface gcs, `null` to use the map gcs, or any other transform. * @return {geo.screenPosition} Display space coordinates. */ - //////////////////////////////////////////////////////////////////////////// this.gcsToDisplay = function (c, gcs) { c = m_this.gcsToWorld(c, gcs); return m_this.worldToDisplay(c); }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from world coordinates to display coordinates using the attached * camera. @@ -828,12 +777,10 @@ var map = function (arg) { * @param {geo.worldPosition} c The input coordinate to convert. * @return {geo.screenPosition} Display space coordinates. */ - //////////////////////////////////////////////////////////////////////////// this.worldToDisplay = function (c) { return m_camera.worldToDisplay(c); }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from display to gcs coordinates. This is identical to calling * `displayToWorld` and then `worldToGcs`. @@ -843,13 +790,11 @@ var map = function (arg) { * the interface gcs, `null` to use the map gcs, or any other transform. * @return {geo.geoPosition} GCS space coordinates. */ - //////////////////////////////////////////////////////////////////////////// this.displayToGcs = function (c, gcs) { c = m_this.displayToWorld(c); // done via camera return m_this.worldToGcs(c, gcs); }; - //////////////////////////////////////////////////////////////////////////// /** * Convert from display coordinates to world coordinates using the attached * camera. @@ -857,19 +802,16 @@ var map = function (arg) { * @param {geo.screenPosition} c The input coordinate to convert. * @return {geo.worldPosition} World space coordinates. */ - //////////////////////////////////////////////////////////////////////////// this.displayToWorld = function (c) { return m_camera.displayToWorld(c); }; - //////////////////////////////////////////////////////////////////////////// /** * Redraw the map and all its layers. * * @fires geo.event.draw * @fires geo.event.drawEnd */ - //////////////////////////////////////////////////////////////////////////// this.draw = function () { var i, layers = m_this.children(); @@ -890,7 +832,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get, set, or create and set a file reader to a layer in the map to be used * as a drop target. @@ -903,7 +844,6 @@ var map = function (arg) { * layer, otherwise create a layer using these options. * @returns {geo.fileReader|this} */ - //////////////////////////////////////////////////////////////////////////// this.fileReader = function (readerOrName, opts) { if (readerOrName === undefined) { return m_fileReader; @@ -921,11 +861,9 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize the map. */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { if (m_node === undefined || m_node === null) { @@ -940,11 +878,9 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update map. This updates all layers of the map. */ - //////////////////////////////////////////////////////////////////////////// this._update = function (request) { var i, layers = m_this.children(); for (i = 0; i < layers.length; i += 1) { @@ -953,12 +889,10 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Exit this map. This removes all layers, destroys current interactor, and * empties the associated DOM node. */ - //////////////////////////////////////////////////////////////////////////// this.exit = function () { var i, layers = m_this.children(); for (i = layers.length - 1; i >= 0; i -= 1) { @@ -977,7 +911,6 @@ var map = function (arg) { s_exit(); }; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the map interactor. * @@ -985,7 +918,6 @@ var map = function (arg) { * @returns {geo.mapInteractor|this} The current map interactor or the map * object. */ - //////////////////////////////////////////////////////////////////////////// this.interactor = function (arg) { if (arg === undefined) { return m_interactor; @@ -1007,7 +939,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the min/max zoom range. * @@ -1021,7 +952,6 @@ var map = function (arg) { * current dimensions and settings, the `origMin` value is the value that * was specified via this function or when the map was created. */ - //////////////////////////////////////////////////////////////////////////// this.zoomRange = function (arg, noRefresh) { if (arg === undefined) { return $.extend({}, m_validZoomRange); @@ -1039,7 +969,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get the current transition or start an animated zoom/pan/rotate. If a * second transition is requested while a transition is already in progress, @@ -1083,7 +1012,6 @@ var map = function (arg) { * @fires geo.event.transitionend * @fires geo.event.transitioncancel */ - //////////////////////////////////////////////////////////////////////////// this.transition = function (opts, gcs, animTime) { if (opts === undefined) { @@ -1292,7 +1220,6 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Cancel any existing transition. The transition will send a cancel event * at the next animation frame, but no further activity occurs. @@ -1304,7 +1231,6 @@ var map = function (arg) { * @returns {boolean} `true` if a transition was in progress. * @fires geo.event.transitioncancel */ - //////////////////////////////////////////////////////////////////////////// this.transitionCancel = function (source) { if (m_transition && (m_transition.cancel !== true || m_queuedTransition)) { m_transition.cancel = true; @@ -1315,7 +1241,6 @@ var map = function (arg) { return false; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the locations of the current map edges. When set, the left-top * and right-bottom corners are transformed to the map's gcs and then used @@ -1328,7 +1253,6 @@ var map = function (arg) { * returned bounds are converted from the map projection to this gcs. * @return {geo.geoBounds} The actual new map bounds. */ - //////////////////////////////////////////////////////////////////////////// this.bounds = function (bds, gcs) { var nav; @@ -1357,7 +1281,6 @@ var map = function (arg) { true); }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the maximum view area of the map. If the map wraps, this is the * unwrapped area. @@ -1369,7 +1292,6 @@ var map = function (arg) { * returned bounds are converted from the map projection to this gcs. * @return {geo.geoBounds|this} The map maximum bounds or the map object. */ - //////////////////////////////////////////////////////////////////////////// this.maxBounds = function (bounds, gcs) { gcs = (gcs === null ? m_gcs : (gcs === undefined ? m_ingcs : gcs)); if (bounds === undefined) { @@ -1408,7 +1330,6 @@ var map = function (arg) { return this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get the center zoom level necessary to display the given bounds. * @@ -1420,7 +1341,6 @@ var map = function (arg) { * gcs, `null` to use the map gcs, or any other transform. * @return {geo.zoomAndCenter} */ - //////////////////////////////////////////////////////////////////////////// this.zoomAndCenterFromBounds = function (bounds, rotation, gcs) { var center, zoom; @@ -1461,7 +1381,6 @@ var map = function (arg) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Get the bounds that will be displayed with the given zoom and center. * @@ -1481,7 +1400,6 @@ var map = function (arg) { * the center of the bounds (rather than being forced to be at the edge). * @return {geo.geoBounds} */ - //////////////////////////////////////////////////////////////////////////// this.boundsFromZoomAndCenter = function (zoom, center, rotation, gcs, ignoreDiscreteZoom, ignoreClampBounds) { var width, height, halfw, halfh, bounds, units; @@ -1535,7 +1453,6 @@ var map = function (arg) { return bounds; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set the discrete zoom flag. If `true`, the map will snap to integer * zoom levels. @@ -1543,7 +1460,6 @@ var map = function (arg) { * @param {boolean} [discreteZoom] If specified, the new discrete zoom flag. * @return {boolean|this} The current discrete zoom flag or the map object. */ - //////////////////////////////////////////////////////////////////////////// this.discreteZoom = function (discreteZoom) { if (discreteZoom === undefined) { return m_discreteZoom; @@ -1559,16 +1475,13 @@ var map = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get the layers contained in the map. * Alias of {@linkcode geo.sceneObject#children}. * @method */ - //////////////////////////////////////////////////////////////////////////// this.layers = this.children; - //////////////////////////////////////////////////////////////////////////// /** * Update the attribution notice displayed on the bottom right corner of * the map. The content of this notice is managed by individual layers. @@ -1584,7 +1497,6 @@ var map = function (arg) { * * @returns {this} Chainable. */ - //////////////////////////////////////////////////////////////////////////// this.updateAttribution = function () { // clear any existing attribution content m_this.node().find('.geo-attribution').remove(); @@ -1848,17 +1760,15 @@ var map = function (arg) { } } - //////////////////////////////////////////////////////////////////////////// - // - // The following are some private methods for interacting with the camera. - // In order to hide the complexity of dealing with map aspect ratios, - // clamping behavior, resetting zoom levels on resize, etc. from the - // layers, the map handles camera movements directly. This requires - // passing all camera movement events through the map initially. The - // map uses these methods to fix up the events according to the constraints - // of the display and passes the event to the layers. - // - //////////////////////////////////////////////////////////////////////////// + /* + * The following are some private methods for interacting with the camera. + * In order to hide the complexity of dealing with map aspect ratios, + * clamping behavior, resetting zoom levels on resize, etc. from the + * layers, the map handles camera movements directly. This requires + * passing all camera movement events through the map initially. The + * map uses these methods to fix up the events according to the constraints + * of the display and passes the event to the layers. + */ /** * Calculate the scaling factor to fit the given map bounds into the viewport * with the correct aspect ratio. @@ -2226,12 +2136,10 @@ var map = function (arg) { m_this.size({width: m_node.width(), height: m_node.height()}); } - //////////////////////////////////////////////////////////////////////////// - // - // All the methods are now defined. From here, we are initializing all - // internal variables and event handlers. - // - //////////////////////////////////////////////////////////////////////////// + /* + * All the methods are now defined. From here, we are initializing all + * internal variables and event handlers. + */ this._init(arg); diff --git a/src/mapInteractor.js b/src/mapInteractor.js index 7aa4c029c9..c129727a30 100644 --- a/src/mapInteractor.js +++ b/src/mapInteractor.js @@ -3,7 +3,6 @@ var object = require('./object'); var util = require('./util'); var Mousetrap = require('mousetrap'); -////////////////////////////////////////////////////////////////////////////// /** * The mapInteractor class is responsible for handling raw events from the * browser and interpreting them as map navigation interactions. This class @@ -14,7 +13,6 @@ var Mousetrap = require('mousetrap'); * @extends geo.object * @returns {geo.mapInteractor} */ -////////////////////////////////////////////////////////////////////////////// var mapInteractor = function (args) { 'use strict'; if (!(this instanceof mapInteractor)) { @@ -264,67 +262,69 @@ var mapInteractor = function (args) { m_options.keyboard.actions = $.extend(true, {}, args.keyboard.actions); } - // options supported: - // { - // // throttle mouse events to at most this many milliseconds each (default 30) - // throttle: number - // - // // Clamp zoom events to discrete (integer) zoom levels. If a number is - // // provided then zoom events will be debounced (and accumulated) - // // with the given delay. The default debounce interval is 400 ms. - // discreteZoom: boolean | number > 0 - // - // // A list of available actions. See above - // actions: [] - // - // // wheel scale factor to change the magnitude of wheel interactions - // wheelScaleX: 1 - // wheelScaleY: 1 - // - // // zoom scale factor to change the magnitude of zoom move interactions - // zoomScale: 1 - // - // // scale factor to change the magnitude of wheel rotation interactions - // rotateWheelScale: 1 - // - // // enable momentum when panning - // momentum: { - // enabled: true | false, - // maxSpeed: number, // don't allow animation to pan faster than this - // minSpeed: number, // stop animations if the speed is less than this - // stopTime: number, // if the mouse hasn't moved for this many - // // milliseconds, don't apply momentum - // drag: number, // drag coefficient - // actions: [geo_action.pan, geo_action.zoom] - // // actions on which to apply momentum - // } - // - // // enable spring clamping to screen edges to enforce clamping - // spring: { - // enabled: true | false, - // springConstant: number, - // } - // - // // enable animation for both discrete and continuous zoom - // zoomAnimation: { - // enabled: true | false, - // duration: number, // milliseconds - // ease: function // easing function - // } - // - // // enable the "click" event - // // A click will be registered when a mouse down is followed - // // by a mouse up in less than the given number of milliseconds - // // and the standard handler will *not* be called - // // If the duration is <= 0, then clicks will only be canceled by - // // a mousemove. - // click: { - // enabled: true | false, - // buttons: {left: true, right: true, middle: true} - // duration: 0, - // cancelOnMove: true // cancels click if the mouse is moved before release - // } - // } + /* + * options supported: + * { + * * throttle mouse events to at most this many milliseconds each (default 30) + * throttle: number + * + * * Clamp zoom events to discrete (integer) zoom levels. If a number is + * * provided then zoom events will be debounced (and accumulated) + * * with the given delay. The default debounce interval is 400 ms. + * discreteZoom: boolean | number > 0 + * + * * A list of available actions. See above + * actions: [] + * + * * wheel scale factor to change the magnitude of wheel interactions + * wheelScaleX: 1 + * wheelScaleY: 1 + * + * * zoom scale factor to change the magnitude of zoom move interactions + * zoomScale: 1 + * + * * scale factor to change the magnitude of wheel rotation interactions + * rotateWheelScale: 1 + * + * * enable momentum when panning + * momentum: { + * enabled: true | false, + * maxSpeed: number, // don't allow animation to pan faster than this + * minSpeed: number, // stop animations if the speed is less than this + * stopTime: number, // if the mouse hasn't moved for this many + * * milliseconds, don't apply momentum + * drag: number, // drag coefficient + * actions: [geo_action.pan, geo_action.zoom] + * * actions on which to apply momentum + * } + * + * * enable spring clamping to screen edges to enforce clamping + * spring: { + * enabled: true | false, + * springConstant: number, + * } + * + * * enable animation for both discrete and continuous zoom + * zoomAnimation: { + * enabled: true | false, + * duration: number, * milliseconds + * ease: function * easing function + * } + * + * * enable the "click" event + * * A click will be registered when a mouse down is followed + * * by a mouse up in less than the given number of milliseconds + * * and the standard handler will *not* be called + * * If the duration is <= 0, then clicks will only be canceled by + * * a mousemove. + * click: { + * enabled: true | false, + * buttons: {left: true, right: true, middle: true} + * duration: 0, + * cancelOnMove: true // cancels click if the mouse is moved before release + * } + * } + */ // default mouse object m_mouse = { @@ -360,41 +360,43 @@ var mapInteractor = function (args) { } }; - // The interactor state determines what actions are taken in response to - // core browser events. - // - // i.e. - // { - // 'action': geo_action.pan, // an ongoing pan event - // 'origin': {...}, // mouse object at the start of the action - // 'delta': {x: *, y: *} // mouse movement since action start - // // not including the current event - // } - // - // { - // 'action': geo_action.zoom, // an ongoing zoom event - // ... - // } - // - // { - // 'action': geo_action.rotate, // an ongoing rotate event - // 'origin': {...}, // mouse object at the start of the action - // 'delta': {x: *, y: *} // mouse movement since action start - // // not including the current event - // } - // - // { - // 'acton': geo_action.select, - // 'origin': {...}, - // 'delta': {x: *, y: *} - // } - // - // { - // 'action': geo_action.momentum, - // 'origin': {...}, - // 'handler': function () { }, // called in animation loop - // 'timer': animate loop timer - // } + /* + * The interactor state determines what actions are taken in response to + * core browser events. + * + * i.e. + * { + * 'action': geo_action.pan, * an ongoing pan event + * 'origin': {...}, * mouse object at the start of the action + * 'delta': {x: *, y: *} // mouse movement since action start + * * not including the current event + * } + * + * { + * 'action': geo_action.zoom, * an ongoing zoom event + * ... + * } + * + * { + * 'action': geo_action.rotate, * an ongoing rotate event + * 'origin': {...}, * mouse object at the start of the action + * 'delta': {x: *, y: *} // mouse movement since action start + * * not including the current event + * } + * + * { + * 'acton': geo_action.select, + * 'origin': {...}, + * 'delta': {x: *, y: *} + * } + * + * { + * 'action': geo_action.momentum, + * 'origin': {...}, + * 'handler': function () { }, // called in animation loop + * 'timer': animate loop timer + * } + */ m_state = {}; /** @@ -603,12 +605,10 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Connects events to a map. If the map is not set, then this does nothing. * @returns {geo.mapInteractor} */ - //////////////////////////////////////////////////////////////////////////// this._connectEvents = function () { if (!m_options.map) { return m_this; @@ -696,13 +696,11 @@ var mapInteractor = function (args) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Disconnects events to a map. If the map is not set, then this does * nothing. * @returns {geo.mapInteractor} */ - //////////////////////////////////////////////////////////////////////////// this._disconnectEvents = function () { if (m_boundKeys) { if (m_keyHandler) { @@ -725,14 +723,12 @@ var mapInteractor = function (args) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Sets or gets map for this interactor, adds draw region layer if needed * * @param {geo.map} newMap optional * @returns {geo.interactorStyle|geo.map} */ - //////////////////////////////////////////////////////////////////////////// this.map = function (val) { if (val !== undefined) { m_options.map = val; @@ -742,14 +738,12 @@ var mapInteractor = function (args) { return m_options.map; }; - //////////////////////////////////////////////////////////////////////////// /** * Gets/sets the options object for the interactor. * * @param {object} opts optional * @returns {geo.interactorStyle|object} */ - //////////////////////////////////////////////////////////////////////////// this.options = function (opts) { if (opts === undefined) { return $.extend({}, m_options); @@ -761,13 +755,11 @@ var mapInteractor = function (args) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Stores the current mouse position from an event * * @param {jQuery.Event} evt JQuery event with the mouse position. */ - //////////////////////////////////////////////////////////////////////////// this._getMousePosition = function (evt) { var offset = $node.offset(), dt, t; @@ -796,11 +788,9 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Stores the current mouse button */ - //////////////////////////////////////////////////////////////////////////// this._getMouseButton = function (evt) { for (var prop in m_mouse.buttons) { if (m_mouse.buttons.hasOwnProperty(prop)) { @@ -821,11 +811,9 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Stores the current keyboard modifiers */ - //////////////////////////////////////////////////////////////////////////// this._getMouseModifiers = function (evt) { m_mouse.modifiers.alt = evt.altKey; m_mouse.modifiers.ctrl = evt.ctrlKey; @@ -833,14 +821,12 @@ var mapInteractor = function (args) { m_mouse.modifiers.shift = evt.shiftKey; }; - //////////////////////////////////////////////////////////////////////////// /** * Compute a selection information object. * * @private * @returns {geo.brushSelection} */ - //////////////////////////////////////////////////////////////////////////// this._getSelection = function () { var origin = m_state.origin, mouse = m_this.mouse(), @@ -891,7 +877,6 @@ var mapInteractor = function (args) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Immediately cancel an ongoing action. * @@ -900,7 +885,6 @@ var mapInteractor = function (args) { * canceled. * @returns {bool} If an action was canceled */ - //////////////////////////////////////////////////////////////////////////// this.cancel = function (action, keepQueue) { var out; if (!action) { @@ -918,12 +902,10 @@ var mapInteractor = function (args) { return out; }; - //////////////////////////////////////////////////////////////////////////// /** * Set the value of whether a click is possible. Cancel any outstanding * timer for this process. */ - //////////////////////////////////////////////////////////////////////////// this._setClickMaybe = function (value) { m_clickMaybe = value; if (m_clickMaybeTimeout) { @@ -932,11 +914,9 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Handle event when a mouse button is pressed */ - //////////////////////////////////////////////////////////////////////////// this._handleMouseDown = function (evt) { var action, actionRecord; @@ -1033,11 +1013,9 @@ var mapInteractor = function (args) { }; - //////////////////////////////////////////////////////////////////////////// /** * Handle mouse move event */ - //////////////////////////////////////////////////////////////////////////// this._handleMouseMove = function (evt) { if (m_paused) { return; @@ -1136,11 +1114,9 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Handle mouse move event on the document (temporary bindings) */ - //////////////////////////////////////////////////////////////////////////// this._handleMouseMoveDocument = function (evt) { var dx, dy, selectionObj; @@ -1293,7 +1269,6 @@ var mapInteractor = function (args) { }; } - //////////////////////////////////////////////////////////////////////////// /** * Based on the screen coordinates of a selection, zoom or unzoom and * recenter. @@ -1306,7 +1281,6 @@ var mapInteractor = function (args) { * @param {object} upperRight the x and y coordinates of the upper right * corner of the zoom rectangle. */ - //////////////////////////////////////////////////////////////////////////// this._zoomFromSelection = function (action, lowerLeft, upperRight) { if (action !== geo_action.zoomselect && action !== geo_action.unzoomselect) { return; @@ -1359,12 +1333,10 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Handle event when a mouse button is unpressed on the document. * Removes temporary bindings. */ - //////////////////////////////////////////////////////////////////////////// this._handleMouseUpDocument = function (evt) { var selectionObj, oldAction; @@ -1431,11 +1403,9 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Handle event when a mouse button is unpressed */ - //////////////////////////////////////////////////////////////////////////// this._handleMouseUp = function (evt) { if (m_paused) { return; @@ -1448,14 +1418,12 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Handle event when a mouse click is detected. A mouse click is a simulated * event that occurs when the time between a mouse down and mouse up * is less than the configured duration and (optionally) if no mousemove * events were triggered in the interim. */ - //////////////////////////////////////////////////////////////////////////// this._handleMouseClick = function (evt) { /* Cancel a selection if it is occurring */ @@ -1485,13 +1453,11 @@ var mapInteractor = function (args) { m_this.map().geoTrigger(geo_event.mouseclick, details); }; - //////////////////////////////////////////////////////////////////////////// /** * Private wrapper around the map zoom method that is debounced to support * discrete zoom interactions. * @param {number} deltaZ The zoom increment */ - //////////////////////////////////////////////////////////////////////////// function debounced_zoom() { var deltaZ = 0, delay = 400, origin, startZoom, targetZoom; @@ -1586,13 +1552,11 @@ var mapInteractor = function (args) { } } - //////////////////////////////////////////////////////////////////////////// /** * Attaches wrapped methods for accumulating fast mouse wheel events and * throttling map interactions. * @private */ - //////////////////////////////////////////////////////////////////////////// function throttled_wheel() { var my_queue = {}; @@ -1697,14 +1661,11 @@ var mapInteractor = function (args) { } } - //////////////////////////////////////////////////////////////////////////// /** * Handle mouse wheel event. (Defined inside _connectEvents). */ - //////////////////////////////////////////////////////////////////////////// this._handleMouseWheel = function () {}; - //////////////////////////////////////////////////////////////////////////// /** * Start up a spring back action when the map bounds are out of range. * Not to be user callable. @@ -1712,7 +1673,6 @@ var mapInteractor = function (args) { * @protected * */ - //////////////////////////////////////////////////////////////////////////// this.springBack = function (initialVelocity, origAction) { if (m_state.action === geo_action.momentum) { return; @@ -1789,19 +1749,15 @@ var mapInteractor = function (args) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Handle double click event */ - //////////////////////////////////////////////////////////////////////////// this._handleDoubleClick = function () { }; - //////////////////////////////////////////////////////////////////////////// /** * Public method that unbinds all events */ - //////////////////////////////////////////////////////////////////////////// this.destroy = function () { m_this._disconnectEvents(); if (m_this.map()) { @@ -1810,20 +1766,16 @@ var mapInteractor = function (args) { m_this.map(null); }; - //////////////////////////////////////////////////////////////////////////// /** * Get current mouse information */ - //////////////////////////////////////////////////////////////////////////// this.mouse = function () { return $.extend(true, {}, m_mouse); }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set current keyboard information */ - //////////////////////////////////////////////////////////////////////////// this.keyboard = function (newValue) { if (newValue === undefined) { return $.extend(true, {}, m_options.keyboard || {}); @@ -1831,18 +1783,15 @@ var mapInteractor = function (args) { return m_this.options({keyboard: newValue}); }; - //////////////////////////////////////////////////////////////////////////// /** * Get the current interactor state * * @returns {geo.interactorState} */ - //////////////////////////////////////////////////////////////////////////// this.state = function () { return $.extend(true, {}, m_state); }; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the pause state of the interactor, which * ignores all native mouse and keyboard events. @@ -1851,7 +1800,6 @@ var mapInteractor = function (args) { * current state. * @returns {bool|this} */ - //////////////////////////////////////////////////////////////////////////// this.pause = function (value) { if (value === undefined) { return m_paused; @@ -1920,7 +1868,6 @@ var mapInteractor = function (args) { return removed; }; - //////////////////////////////////////////////////////////////////////////// /** * Simulate a DOM mouse event on connected map. * @@ -1939,7 +1886,6 @@ var mapInteractor = function (args) { * @param {object} options * @returns {mapInteractor} */ - //////////////////////////////////////////////////////////////////////////// this.simulateEvent = function (type, options) { var evt, page, offset, which; diff --git a/src/object.js b/src/object.js index 2bb3b92be0..54ab0fb0e9 100644 --- a/src/object.js +++ b/src/object.js @@ -1,7 +1,6 @@ var vgl = require('vgl'); var inherit = require('./inherit'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class object * @@ -10,7 +9,6 @@ var inherit = require('./inherit'); * @extends vgl.object * @returns {geo.object} */ -////////////////////////////////////////////////////////////////////////////// var object = function () { 'use strict'; if (!(this instanceof object)) { @@ -22,7 +20,6 @@ var object = function () { m_idleHandlers = [], m_promiseCount = 0; - ////////////////////////////////////////////////////////////////////////////// /** * Bind a handler that will be called once when all internal promises are * resolved. @@ -30,7 +27,6 @@ var object = function () { * @param {function} handler A function taking no arguments. * @returns {this} */ - ////////////////////////////////////////////////////////////////////////////// this.onIdle = function (handler) { if (m_promiseCount) { m_idleHandlers.push(handler); @@ -40,7 +36,6 @@ var object = function () { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Add a new promise object preventing idle event handlers from being called * until it is resolved. @@ -48,7 +43,6 @@ var object = function () { * @param {Promise} promise A promise object. * @returns {this} */ - ////////////////////////////////////////////////////////////////////////////// this.addPromise = function (promise) { // called on any resolution of the promise function onDone() { @@ -65,7 +59,6 @@ var object = function () { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Bind an event handler to this object. * @@ -75,7 +68,6 @@ var object = function () { * triggered. The function is passed a {@link geo.event} object. * @returns {this} */ - ////////////////////////////////////////////////////////////////////////////// this.geoOn = function (event, handler) { if (Array.isArray(event)) { event.forEach(function (e) { @@ -90,7 +82,6 @@ var object = function () { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Trigger an event (or events) on this object and call all handlers. * @@ -100,7 +91,6 @@ var object = function () { * {@link geo.event} object passed to the handlers. * @returns {this} */ - ////////////////////////////////////////////////////////////////////////////// this.geoTrigger = function (event, args) { // if we have an array of events, recall with single events @@ -124,7 +114,6 @@ var object = function () { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Remove handlers from one event or an array of events. If no event is * provided all handlers will be removed. @@ -136,7 +125,6 @@ var object = function () { * remove from the events or a falsey value to remove all handlers * from the events. */ - ////////////////////////////////////////////////////////////////////////////// this.geoOff = function (event, arg) { if (event === undefined) { m_eventHandlers = {}; @@ -166,11 +154,9 @@ var object = function () { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Free all resources and destroy the object. */ - ////////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.geoOff(); }; diff --git a/src/osmLayer.js b/src/osmLayer.js index 2a2a3c14e5..3a99d4ce2d 100644 --- a/src/osmLayer.js +++ b/src/osmLayer.js @@ -7,7 +7,6 @@ module.exports = (function () { var registry = require('./registry'); var quadFeature = require('./quadFeature'); - ////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of osmLayer * @@ -18,7 +17,6 @@ module.exports = (function () { * imageFormat (such as png or jpeg), and displayLast * (to decide whether or not render tiles from last zoom level). */ - ////////////////////////////////////////////////////////////////////////////// var osmLayer = function (arg) { var imageTile = require('./imageTile'); diff --git a/src/pathFeature.js b/src/pathFeature.js index 7bd659ab10..00efeb43ac 100644 --- a/src/pathFeature.js +++ b/src/pathFeature.js @@ -2,7 +2,6 @@ var $ = require('jquery'); var inherit = require('./inherit'); var feature = require('./feature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class pathFeature * @@ -10,7 +9,6 @@ var feature = require('./feature'); * @extends geo.feature * @returns {geo.pathFeature} */ -////////////////////////////////////////////////////////////////////////////// var pathFeature = function (arg) { 'use strict'; if (!(this instanceof pathFeature)) { @@ -19,22 +17,18 @@ var pathFeature = function (arg) { arg = arg || {}; feature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, m_position = arg.position === undefined ? [] : arg.position, s_init = this._init; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set positions * * @returns {geo.pathFeature} */ - //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_position; @@ -46,11 +40,9 @@ var pathFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); diff --git a/src/pixelmapFeature.js b/src/pixelmapFeature.js index facb46bc5d..c8706d87bf 100644 --- a/src/pixelmapFeature.js +++ b/src/pixelmapFeature.js @@ -4,7 +4,6 @@ var feature = require('./feature'); var geo_event = require('./event'); var util = require('./util'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class imagemapFeature * @@ -32,9 +31,7 @@ var util = require('./util'); * transformations for those two triangles. * @returns {geo.pixelmapFeature} */ -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// var pixelmapFeature = function (arg) { 'use strict'; if (!(this instanceof pixelmapFeature)) { @@ -43,11 +40,9 @@ var pixelmapFeature = function (arg) { arg = arg || {}; feature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, m_quadFeature, m_srcImage, @@ -56,13 +51,11 @@ var pixelmapFeature = function (arg) { s_init = this._init, s_exit = this._exit; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set position accessor * * @returns {geo.pixelmap} */ - //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_this.style('position'); @@ -74,13 +67,11 @@ var pixelmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set url accessor * * @returns {geo.pixelmap} */ - //////////////////////////////////////////////////////////////////////////// this.url = function (val) { if (val === undefined) { return m_this.style('url'); @@ -93,14 +84,12 @@ var pixelmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get the maximum index value from the pixelmap. This is a value present in * the pixelmap. * * @returns {geo.pixelmap} */ - //////////////////////////////////////////////////////////////////////////// this.maxIndex = function () { if (m_info) { /* This isn't just m_info.mappedColors.length - 1, since there @@ -117,13 +106,11 @@ var pixelmapFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set color accessor * * @returns {geo.pixelmap} */ - //////////////////////////////////////////////////////////////////////////// this.color = function (val) { if (val === undefined) { return m_this.style('color'); @@ -161,11 +148,9 @@ var pixelmapFeature = function (arg) { return {index: [], found: []}; }; - //////////////////////////////////////////////////////////////////////////// /** * Build */ - //////////////////////////////////////////////////////////////////////////// this._build = function () { /* Set the build time at the start of the call. A build can result in * drawing a quad, which can trigger a full layer update, which in tern @@ -356,11 +341,9 @@ var pixelmapFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Update */ - //////////////////////////////////////////////////////////////////////////// this._update = function () { s_update.call(m_this); if (m_this.buildTime().getMTime() <= m_this.dataTime().getMTime() || @@ -372,12 +355,10 @@ var pixelmapFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy * @memberof geo.pixelmapFeature */ - //////////////////////////////////////////////////////////////////////////// this._exit = function (abc) { if (m_quadFeature && m_this.layer()) { m_this.layer().deleteFeature(m_quadFeature); @@ -387,11 +368,9 @@ var pixelmapFeature = function (arg) { s_exit(); }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { arg = arg || {}; s_init.call(m_this, arg); diff --git a/src/pointFeature.js b/src/pointFeature.js index 1ed2f7aeef..e939aaab55 100644 --- a/src/pointFeature.js +++ b/src/pointFeature.js @@ -1,7 +1,6 @@ var inherit = require('./inherit'); var feature = require('./feature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class pointFeature * @@ -11,7 +10,6 @@ var feature = require('./feature'); * @extends geo.feature * @returns {geo.pointFeature} */ -////////////////////////////////////////////////////////////////////////////// var pointFeature = function (arg) { 'use strict'; if (!(this instanceof pointFeature)) { @@ -27,11 +25,9 @@ var pointFeature = function (arg) { var util = require('./util'); var kdbush = require('kdbush'); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_init = this._init, m_rangeTree = null, @@ -46,13 +42,11 @@ var pointFeature = function (arg) { this.featureType = 'point'; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set clustering option * * @returns {geo.pointFeature|boolean} */ - //////////////////////////////////////////////////////////////////////////// this.clustering = function (val) { if (val === undefined) { return m_clustering; @@ -70,12 +64,10 @@ var pointFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Generate the clustering tree from positions. This might be async in the * future. */ - //////////////////////////////////////////////////////////////////////////// this._clusterData = function () { if (!m_clustering) { // clustering is not enabled, so this is a no-op @@ -104,13 +96,11 @@ var pointFeature = function (arg) { m_this._handleZoom(m_this.layer().map().zoom()); }; - //////////////////////////////////////////////////////////////////////////// /** * Handle zoom events for clustering. This keeps track of the last * clustering level, and only regenerates the displayed points when the * zoom level changes. */ - //////////////////////////////////////////////////////////////////////////// this._handleZoom = function (zoom) { // get the current zoom level rounded down var z = Math.floor(zoom); @@ -146,13 +136,11 @@ var pointFeature = function (arg) { m_this.data(data); }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set position * * @returns {geo.pointFeature} */ - //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_this.style('position'); @@ -173,12 +161,10 @@ var pointFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Update the current range tree object. Should be called whenever the * data changes. */ - //////////////////////////////////////////////////////////////////////////// this._updateRangeTree = function () { if (m_rangeTreeTime.getMTime() >= m_this.dataTime().getMTime()) { return; @@ -209,14 +195,12 @@ var pointFeature = function (arg) { m_rangeTreeTime.modified(); }; - //////////////////////////////////////////////////////////////////////////// /** * Returns an array of datum indices that contain the given point. * Largely adapted from wigglemaps pointQuerier: * * https://github.com/dotskapes/wigglemaps/blob/cf5bed3fbfe2c3e48d31799462a80c564be1fb60/src/query/PointQuerier.js */ - //////////////////////////////////////////////////////////////////////////// this.pointSearch = function (p) { var min, max, data, idx = [], found = [], ifound = [], map, pt, corners, @@ -281,11 +265,9 @@ var pointFeature = function (arg) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Returns an array of datum indices that are contained in the given box. */ - //////////////////////////////////////////////////////////////////////////// this.boxSearch = function (lowerLeft, upperRight) { var pos = m_this.position(), idx = []; @@ -303,11 +285,9 @@ var pointFeature = function (arg) { return idx; }; - //////////////////////////////////////////////////////////////////////////// /** * Overloaded data method that updates the internal range tree on write. */ - //////////////////////////////////////////////////////////////////////////// this.data = function (data) { if (data === undefined) { return s_data(); @@ -324,11 +304,9 @@ var pointFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { arg = arg || {}; s_init.call(m_this, arg); diff --git a/src/polygonFeature.js b/src/polygonFeature.js index 370bcd7c14..b8cedc2d3c 100644 --- a/src/polygonFeature.js +++ b/src/polygonFeature.js @@ -2,7 +2,6 @@ var $ = require('jquery'); var inherit = require('./inherit'); var feature = require('./feature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class polygonFeature * @@ -41,7 +40,6 @@ var feature = require('./feature'); * color, and stroke opacity). Defaults to false. Can vary by polygon. * @returns {geo.polygonFeature} */ -////////////////////////////////////////////////////////////////////////////// var polygonFeature = function (arg) { 'use strict'; if (!(this instanceof polygonFeature)) { @@ -52,11 +50,9 @@ var polygonFeature = function (arg) { var util = require('./util'); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, m_lineFeature, s_init = this._init, @@ -79,7 +75,6 @@ var polygonFeature = function (arg) { strokeWidth: true }; - //////////////////////////////////////////////////////////////////////////// /** * Get/set data. * @@ -88,7 +83,6 @@ var polygonFeature = function (arg) { * feature. If not specified, return the current data. * @returns {geo.polygonFeature|Object} */ - //////////////////////////////////////////////////////////////////////////// this.data = function (arg) { var ret = s_data(arg); if (arg !== undefined) { @@ -98,7 +92,6 @@ var polygonFeature = function (arg) { return ret; }; - //////////////////////////////////////////////////////////////////////////// /** * Get the internal coordinates whenever the data changes. For now, we do * the computation in world coordinates, but we will need to work in GCS @@ -107,7 +100,6 @@ var polygonFeature = function (arg) { * @memberof geo.polygonFeature * @private */ - //////////////////////////////////////////////////////////////////////////// function getCoordinates() { var posFunc = m_this.style.get('position'), polyFunc = m_this.style.get('polygon'); @@ -149,7 +141,6 @@ var polygonFeature = function (arg) { }); } - //////////////////////////////////////////////////////////////////////////// /** * Get the style for the stroke of the polygon. Since polygons can have * holes, the number of stroke lines may not be the same as the number of @@ -164,7 +155,6 @@ var polygonFeature = function (arg) { * @returns {object|function} A style that can be used for the stroke. * @private */ - //////////////////////////////////////////////////////////////////////////// function linePolyStyle(styleValue) { if (util.isFunction(styleValue)) { return function (d) { @@ -175,7 +165,6 @@ var polygonFeature = function (arg) { } } - //////////////////////////////////////////////////////////////////////////// /** * Get/set polygon accessor. * @@ -184,7 +173,6 @@ var polygonFeature = function (arg) { * and return the feature. If not specified, return the current polygon. * @returns {geo.polygonFeature|Object} */ - //////////////////////////////////////////////////////////////////////////// this.polygon = function (val) { if (val === undefined) { return m_this.style('polygon'); @@ -197,7 +185,6 @@ var polygonFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set position accessor. * @@ -207,7 +194,6 @@ var polygonFeature = function (arg) { * position. * @returns {geo.polygonFeature|Object} */ - //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_this.style('position'); @@ -220,7 +206,6 @@ var polygonFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Point search method for selection api. Returns markers containing the * given point. @@ -229,7 +214,6 @@ var polygonFeature = function (arg) { * @argument {object} coordinate * @returns {object} */ - //////////////////////////////////////////////////////////////////////////// this.pointSearch = function (coordinate) { var found = [], indices = [], data = m_this.data(); m_coordinates.forEach(function (coord, i) { @@ -250,12 +234,10 @@ var polygonFeature = function (arg) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set style used by the feature. This calls the super function, then * checks if strokes are required. */ - //////////////////////////////////////////////////////////////////////////// this.style = function (arg1, arg2) { var result = s_style.apply(this, arguments); if (arg1 !== undefined && (typeof arg1 !== 'string' || arg2 !== undefined)) { @@ -285,12 +267,10 @@ var polygonFeature = function (arg) { return line; }; - //////////////////////////////////////////////////////////////////////////// /** * Check if we need to add a line feature to the layer, and update it as * necessary. */ - //////////////////////////////////////////////////////////////////////////// this._checkForStroke = function () { if (s_style('stroke') === false) { if (m_lineFeature && m_this.layer()) { @@ -354,11 +334,9 @@ var polygonFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Redraw the object. */ - //////////////////////////////////////////////////////////////////////////// this.draw = function () { var result = s_draw(); if (m_lineFeature) { @@ -367,12 +345,10 @@ var polygonFeature = function (arg) { return result; }; - //////////////////////////////////////////////////////////////////////////// /** * When the feature is marked as modified, mark our sub-feature as modified, * too. */ - //////////////////////////////////////////////////////////////////////////// this.modified = function () { var result = s_modified(); if (m_lineFeature) { @@ -381,12 +357,10 @@ var polygonFeature = function (arg) { return result; }; - //////////////////////////////////////////////////////////////////////////// /** * Destroy * @memberof geo.polygonFeature */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { if (m_lineFeature && m_this.layer()) { m_this.layer().deleteFeature(m_lineFeature); @@ -396,12 +370,10 @@ var polygonFeature = function (arg) { s_exit(); }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize * @memberof geo.polygonFeature */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { arg = arg || {}; s_init.call(m_this, arg); diff --git a/src/quadFeature.js b/src/quadFeature.js index 388ee9d754..2d0efd06af 100644 --- a/src/quadFeature.js +++ b/src/quadFeature.js @@ -2,7 +2,6 @@ var $ = require('jquery'); var inherit = require('./inherit'); var feature = require('./feature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class quadFeature * @@ -42,7 +41,6 @@ var feature = require('./feature'); * attribute of the data item. * @returns {geo.quadFeature} */ -////////////////////////////////////////////////////////////////////////////// var quadFeature = function (arg) { 'use strict'; @@ -55,11 +53,9 @@ var quadFeature = function (arg) { arg = arg || {}; feature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_init = this._init, m_cacheQuads, @@ -125,7 +121,6 @@ var quadFeature = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Point search method for selection api. Returns markers containing the * given point. @@ -136,7 +131,6 @@ var quadFeature = function (arg) { * @returns {Object} an object with 'index': a list of quad indices, and * 'found': a list of quads that contain the specified coordinate. */ - //////////////////////////////////////////////////////////////////////////// this.pointSearch = function (coordinate) { var found = [], indices = [], extra = {}, poly1 = [{}, {}, {}, {}], poly2 = [{}, {}, {}, {}], @@ -196,7 +190,6 @@ var quadFeature = function (arg) { }; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set position * @@ -205,7 +198,6 @@ var quadFeature = function (arg) { * position of each quad. * @returns {geo.quadFeature} */ - //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_this.style('position'); @@ -455,11 +447,9 @@ var quadFeature = function (arg) { return m_quads; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { arg = arg || {}; s_init.call(m_this, arg); diff --git a/src/registry.js b/src/registry.js index cb94a440cc..57379a4a83 100644 --- a/src/registry.js +++ b/src/registry.js @@ -12,20 +12,16 @@ var rendererLayerAdjustments = {}; var annotations = {}; var util = {}; -////////////////////////////////////////////////////////////////////////////// /** * Register a new file reader type */ -////////////////////////////////////////////////////////////////////////////// util.registerFileReader = function (name, func) { fileReaders[name] = func; }; -////////////////////////////////////////////////////////////////////////////// /** * Create a new file reader */ -////////////////////////////////////////////////////////////////////////////// util.createFileReader = function (name, opts) { if (fileReaders.hasOwnProperty(name)) { return fileReaders[name](opts); @@ -33,20 +29,16 @@ util.createFileReader = function (name, opts) { return null; }; -////////////////////////////////////////////////////////////////////////////// /** * Register a new renderer type */ -////////////////////////////////////////////////////////////////////////////// util.registerRenderer = function (name, func) { renderers[name] = func; }; -////////////////////////////////////////////////////////////////////////////// /** * Create new instance of the renderer */ -////////////////////////////////////////////////////////////////////////////// util.createRenderer = function (name, layer, canvas, options) { if (renderers.hasOwnProperty(name)) { var ren = renderers[name]( @@ -58,7 +50,6 @@ util.createRenderer = function (name, layer, canvas, options) { return null; }; -////////////////////////////////////////////////////////////////////////////// /** * Check if the named renderer is supported. If not, display a warning and get * the name of a fallback renderer. Ideally, we would pass a list of desired @@ -70,7 +61,6 @@ util.createRenderer = function (name, layer, canvas, options) { * @return {string|null|false} the name of the renderer that should be used * or false if no valid renderer can be determined. */ -////////////////////////////////////////////////////////////////////////////// util.checkRenderer = function (name, noFallback) { if (name === null) { return name; @@ -93,7 +83,6 @@ util.checkRenderer = function (name, noFallback) { return false; }; -////////////////////////////////////////////////////////////////////////////// /** * Check if there is a renderer that is supported and supports a list of * features. If not, display a warning. This picks the first renderer that @@ -111,7 +100,6 @@ util.checkRenderer = function (name, noFallback) { * @return {string|null|false} the name of the renderer that should be used * or false if no valid renderer can be determined. */ -////////////////////////////////////////////////////////////////////////////// util.rendererForFeatures = function (featureList) { var preferredRenderers = ['vgl', 'canvas', 'd3', null]; @@ -154,7 +142,6 @@ util.rendererForFeatures = function (featureList) { return false; }; -////////////////////////////////////////////////////////////////////////////// /** * Register a new feature type * @@ -172,7 +159,6 @@ util.rendererForFeatures = function (featureList) { * @returns {object} if this feature replaces an existing one, this was the * feature that was replaced. In this case, a warning is issued. */ -////////////////////////////////////////////////////////////////////////////// util.registerFeature = function (category, name, func, capabilities) { if (!(category in features)) { features[category] = {}; @@ -188,11 +174,9 @@ util.registerFeature = function (category, name, func, capabilities) { return old; }; -////////////////////////////////////////////////////////////////////////////// /** * Create new instance of a feature */ -////////////////////////////////////////////////////////////////////////////// util.createFeature = function (name, layer, renderer, arg) { var category = renderer.api(), options = {'layer': layer, 'renderer': renderer}; @@ -211,14 +195,12 @@ util.createFeature = function (name, layer, renderer, arg) { return null; }; -////////////////////////////////////////////////////////////////////////////// /** * Register a layer adjustment. * * @returns {object} if this layer adjustment replaces an existing one, this * was the value that was replaced. In this case, a warning is issued. */ -////////////////////////////////////////////////////////////////////////////// util.registerLayerAdjustment = function (category, name, func) { if (!(category in rendererLayerAdjustments)) { rendererLayerAdjustments[category] = {}; @@ -232,7 +214,6 @@ util.registerLayerAdjustment = function (category, name, func) { return old; }; -////////////////////////////////////////////////////////////////////////////// /** * If a layer needs to be adjusted based on the renderer, call the function * that adjusts it. @@ -240,7 +221,6 @@ util.registerLayerAdjustment = function (category, name, func) { * @param {string} name Name of the layer. * @param {object} layer Instantiated layer object. */ -////////////////////////////////////////////////////////////////////////////// util.adjustLayerForRenderer = function (name, layer) { var rendererName = layer.rendererName(); if (rendererName) { @@ -252,23 +232,19 @@ util.adjustLayerForRenderer = function (name, layer) { } }; -////////////////////////////////////////////////////////////////////////////// /** * Register a new layer type */ -////////////////////////////////////////////////////////////////////////////// util.registerLayer = function (name, func, defaultFeatures) { layers[name] = func; layerDefaultFeatures[name] = defaultFeatures; }; -////////////////////////////////////////////////////////////////////////////// /** * Create new instance of the layer */ -////////////////////////////////////////////////////////////////////////////// util.createLayer = function (name, map, arg) { - /// Default renderer is vgl + // Default renderer is vgl var options = {map: map}, layer = null; @@ -288,14 +264,12 @@ util.createLayer = function (name, map, arg) { } }; -////////////////////////////////////////////////////////////////////////////// /** * Register a new widget type * * @returns {object} if this widget replaces an existing one, this was the * value that was replaced. In this case, a warning is issued. */ -////////////////////////////////////////////////////////////////////////////// util.registerWidget = function (category, name, func) { if (!(category in widgets)) { widgets[category] = {}; @@ -309,11 +283,9 @@ util.registerWidget = function (category, name, func) { return old; }; -////////////////////////////////////////////////////////////////////////////// /** * Create new instance of the widget */ -////////////////////////////////////////////////////////////////////////////// util.createWidget = function (name, layer, arg) { var options = { layer: layer @@ -330,7 +302,6 @@ util.createWidget = function (name, layer, arg) { throw new Error('Cannot create unknown widget ' + name); }; -////////////////////////////////////////////////////////////////////////////// /** * Register a new annotation type * @@ -344,7 +315,6 @@ util.createWidget = function (name, layer, arg) { * @returns {object} if this annotation replaces an existing one, this was the * value that was replaced. In this case, a warning is issued. */ -////////////////////////////////////////////////////////////////////////////// util.registerAnnotation = function (name, func, features) { var old = annotations[name]; if (old) { @@ -354,7 +324,6 @@ util.registerAnnotation = function (name, func, features) { return old; }; -////////////////////////////////////////////////////////////////////////////// /** * Create an annotation based on a registered type. * @@ -362,7 +331,6 @@ util.registerAnnotation = function (name, func, features) { * @param {object} options The options for the annotation. * @returns {object} the new annotation. */ -////////////////////////////////////////////////////////////////////////////// util.createAnnotation = function (name, options) { if (!annotations[name]) { console.warn('The ' + name + ' annotation is not registered'); @@ -372,18 +340,15 @@ util.createAnnotation = function (name, options) { return annotation; }; -////////////////////////////////////////////////////////////////////////////// /** * Get a list of registered annotation types. * * @return {array} a list of registered annotations. */ -////////////////////////////////////////////////////////////////////////////// util.listAnnotations = function () { return Object.keys(annotations); }; -////////////////////////////////////////////////////////////////////////////// /** * Get a list of required features for a set of annotations. * @@ -397,7 +362,6 @@ util.listAnnotations = function () { * @return {array} a list of features needed for the specified annotations. * There may be duplicates in the list. */ -////////////////////////////////////////////////////////////////////////////// util.featuresForAnnotations = function (annotationList) { var features = []; @@ -422,7 +386,6 @@ util.featuresForAnnotations = function (annotationList) { return features; }; -////////////////////////////////////////////////////////////////////////////// /** * Check if there is a renderer that is supported and supports a list of * annotations. If not, display a warning. This generates a list of required @@ -436,7 +399,6 @@ util.featuresForAnnotations = function (annotationList) { * @return {string|null|false} the name of the renderer that should be used or * false if no valid renderer can be determined. */ -////////////////////////////////////////////////////////////////////////////// util.rendererForAnnotations = function (annotationList) { return util.rendererForFeatures(util.featuresForAnnotations(annotationList)); }; diff --git a/src/renderer.js b/src/renderer.js index 44416bd455..0a1ad8c4c9 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -1,7 +1,6 @@ var inherit = require('./inherit'); var object = require('./object'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class renderer * @@ -9,7 +8,6 @@ var object = require('./object'); * @extends geo.object * @returns {geo.renderer} */ -////////////////////////////////////////////////////////////////////////////// var renderer = function (arg) { 'use strict'; @@ -24,22 +22,18 @@ var renderer = function (arg) { m_canvas = arg.canvas === undefined ? null : arg.canvas, m_initialized = false; - //////////////////////////////////////////////////////////////////////////// /** * Get layer of the renderer * * @returns {*} */ - //////////////////////////////////////////////////////////////////////////// this.layer = function () { return m_layer; }; - //////////////////////////////////////////////////////////////////////////// /** * Get canvas for the renderer */ - //////////////////////////////////////////////////////////////////////////// this.canvas = function (val) { if (val === undefined) { return m_canvas; @@ -49,11 +43,9 @@ var renderer = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get map that this renderer belongs to */ - //////////////////////////////////////////////////////////////////////////// this.map = function () { if (m_layer) { return m_layer.map(); @@ -62,11 +54,9 @@ var renderer = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set if renderer has been initialized */ - //////////////////////////////////////////////////////////////////////////// this.initialized = function (val) { if (val === undefined) { return m_initialized; @@ -76,45 +66,35 @@ var renderer = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Get render API used by the renderer */ - //////////////////////////////////////////////////////////////////////////// this.api = function () { throw new Error('Should be implemented by derived classes'); }; - //////////////////////////////////////////////////////////////////////////// /** * Reset to default */ - //////////////////////////////////////////////////////////////////////////// this.reset = function () { return true; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { }; - //////////////////////////////////////////////////////////////////////////// /** * Handle resize event */ - //////////////////////////////////////////////////////////////////////////// this._resize = function () { }; - //////////////////////////////////////////////////////////////////////////// /** * Render */ - //////////////////////////////////////////////////////////////////////////// this._render = function () { }; diff --git a/src/sceneObject.js b/src/sceneObject.js index 94c91a2fa2..2d2fb6f417 100644 --- a/src/sceneObject.js +++ b/src/sceneObject.js @@ -1,7 +1,6 @@ var inherit = require('./inherit'); var object = require('./object'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class sceneObject, which extends the object's * event handling with a tree-based event propagation. @@ -11,7 +10,6 @@ var object = require('./object'); * @extends geo.object * @returns {geo.sceneObject} */ -////////////////////////////////////////////////////////////////////////////// var sceneObject = function (arg) { 'use strict'; if (!(this instanceof sceneObject)) { @@ -27,11 +25,9 @@ var sceneObject = function (arg) { s_addPromise = this.addPromise, s_onIdle = this.onIdle; - ////////////////////////////////////////////////////////////////////////////// /** * Override object.addPromise to propagate up the scene tree. */ - ////////////////////////////////////////////////////////////////////////////// this.addPromise = function (promise) { if (m_parent) { m_parent.addPromise(promise); @@ -40,11 +36,9 @@ var sceneObject = function (arg) { } }; - ////////////////////////////////////////////////////////////////////////////// /** * Override object.onIdle to propagate up the scene tree. */ - ////////////////////////////////////////////////////////////////////////////// this.onIdle = function (handler) { if (m_parent) { m_parent.onIdle(handler); @@ -53,12 +47,10 @@ var sceneObject = function (arg) { } }; - ////////////////////////////////////////////////////////////////////////////// /** * Get/set parent of the object * @param {geo.sceneObject} [parent] */ - ////////////////////////////////////////////////////////////////////////////// this.parent = function (arg) { if (arg === undefined) { return m_parent; @@ -67,11 +59,9 @@ var sceneObject = function (arg) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Add a child (or an array of children) to the object */ - ////////////////////////////////////////////////////////////////////////////// this.addChild = function (child) { if (Array.isArray(child)) { child.forEach(m_this.addChild); @@ -82,11 +72,9 @@ var sceneObject = function (arg) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Remove a child (or array of children) from the object */ - ////////////////////////////////////////////////////////////////////////////// this.removeChild = function (child) { if (Array.isArray(child)) { child.forEach(m_this.removeChild); @@ -96,21 +84,17 @@ var sceneObject = function (arg) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get an array of child objects */ - ////////////////////////////////////////////////////////////////////////////// this.children = function () { return m_children.slice(); }; - ////////////////////////////////////////////////////////////////////////////// /** * Force redraw of a scene object, to be implemented by subclasses. * Base class just calls draw of child objects. */ - ////////////////////////////////////////////////////////////////////////////// this.draw = function (arg) { m_this.children().forEach(function (child) { child.draw(arg); @@ -118,14 +102,12 @@ var sceneObject = function (arg) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Trigger an event (or events) on this object and call all handlers. * @param {String} event the event to trigger * @param {Object} args arbitrary argument to pass to the handler * @param {Boolean} childrenOnly if true, only propagate down the tree */ - ////////////////////////////////////////////////////////////////////////////// this.geoTrigger = function (event, args, childrenOnly) { var geoArgs; @@ -165,11 +147,9 @@ var sceneObject = function (arg) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Free all resources and destroy the object. */ - ////////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.children = []; delete m_this.parent; diff --git a/src/tile.js b/src/tile.js index 94954cd5ec..14fee110c8 100644 --- a/src/tile.js +++ b/src/tile.js @@ -3,7 +3,6 @@ module.exports = (function () { var $ = require('jquery'); - ////////////////////////////////////////////////////////////////////////////// /** * This class defines the raw interface for a "tile" on a map. A tile is * defined as a rectangular section of a map. The base implementation @@ -30,7 +29,6 @@ module.exports = (function () { * @param {Number} [spec.overlap.x=0] * @param {Number} [spec.overlap.y=0] */ - ////////////////////////////////////////////////////////////////////////////// var tile = function (spec) { if (!(this instanceof tile)) { return new tile(spec); diff --git a/src/tileCache.js b/src/tileCache.js index efd98276b4..ff93ebcd6a 100644 --- a/src/tileCache.js +++ b/src/tileCache.js @@ -1,7 +1,6 @@ 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 @@ -13,7 +12,6 @@ module.exports = (function () { * @param {object?} [options] A configuratoin object for the cache * @param {number} [options.size=64] The maximum number of tiles to store */ - ////////////////////////////////////////////////////////////////////////////// var tileCache = function (options) { if (!(this instanceof tileCache)) { return new tileCache(options); diff --git a/src/tileLayer.js b/src/tileLayer.js index 14fe593afa..a22f66dfa0 100644 --- a/src/tileLayer.js +++ b/src/tileLayer.js @@ -40,7 +40,6 @@ module.exports = (function () { }; } - ////////////////////////////////////////////////////////////////////////////// /** * This method defines a tileLayer, which is an abstract class defining a * layer divided into tiles of arbitrary data. Notably, this class provides @@ -136,7 +135,6 @@ module.exports = (function () { * local coordinates. * @returns {geo.tileLayer} */ - ////////////////////////////////////////////////////////////////////////////// var tileLayer = function (options) { 'use strict'; if (!(this instanceof tileLayer)) { @@ -764,7 +762,6 @@ module.exports = (function () { this._drawTile = function (tile) { // Make sure this method is not called when there is // a renderer attached. - // if (this.renderer() !== null) { throw new Error('This draw method is not valid on renderer managed layers.'); } @@ -1435,7 +1432,6 @@ module.exports = (function () { return m_tileOffsetValues[level]; }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set visibility of the layer * @@ -1444,7 +1440,6 @@ module.exports = (function () { * @return {boolean|object} either the visibility (if getting) or the layer * (if setting). */ - //////////////////////////////////////////////////////////////////////////// this.visible = function (val) { if (val === undefined) { return s_visible(); diff --git a/src/timestamp.js b/src/timestamp.js index a4e6e44169..022aaf5c59 100644 --- a/src/timestamp.js +++ b/src/timestamp.js @@ -1,7 +1,6 @@ var vgl = require('vgl'); var inherit = require('./inherit'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class timestamp * @@ -9,7 +8,6 @@ var inherit = require('./inherit'); * @extends vgl.timestamp * @returns {geo.timestamp} */ -////////////////////////////////////////////////////////////////////////////// var timestamp = function () { 'use strict'; if (!(this instanceof timestamp)) { diff --git a/src/transform.js b/src/transform.js index e32f7021c1..1888445410 100644 --- a/src/transform.js +++ b/src/transform.js @@ -1,6 +1,5 @@ var proj4 = require('proj4'); -////////////////////////////////////////////////////////////////////////////// /** * This purpose of this class is to provide a generic interface for computing * coordinate transformationss. The interface is taken from the proj4js, @@ -22,7 +21,6 @@ var proj4 = require('proj4'); * @param {string} options.target A proj4 string for the target projection * @returns {geo.transform} */ -////////////////////////////////////////////////////////////////////////////// var transformCache = {}; /* Up to maxTransformCacheSize squared might be cached. When the maximum cache @@ -281,12 +279,12 @@ transform.transformCoordinates = function ( transform.transformCoordinatesArray = function (trans, coordinates, numberOfComponents) { var i, count, offset, xAcc, yAcc, zAcc, writer, output, projPoint; - /// Default Z accessor + // Default Z accessor zAcc = function () { return 0.0; }; - /// Helper methods + // Helper methods function handleArrayCoordinates() { if (coordinates[0] instanceof Array) { if (coordinates[0].length === 2) { @@ -380,7 +378,7 @@ transform.transformCoordinatesArray = function (trans, coordinates, numberOfComp } } - /// Helper methods + // Helper methods function handleObjectCoordinates() { if (coordinates[0] && 'x' in coordinates[0] && diff --git a/src/typedef.js b/src/typedef.js index 6f0a0165ff..19b382e71c 100644 --- a/src/typedef.js +++ b/src/typedef.js @@ -1,8 +1,6 @@ -////////////////////////////////////////////////////////////////////////////// /* * Type definitions for jsdoc. */ -////////////////////////////////////////////////////////////////////////////// /** * General object specification for map types. Any additional values in the diff --git a/src/ui/domWidget.js b/src/ui/domWidget.js index 532dafbdb8..40c7b4eb83 100644 --- a/src/ui/domWidget.js +++ b/src/ui/domWidget.js @@ -13,13 +13,11 @@ var domWidget = function (arg) { var m_this = this, m_default_canvas = 'div'; - //////////////////////////////////////////////////////////////////////////// /** * Initializes DOM Widget. * Sets the canvas for the widget, does parent/child relationship management, * appends it to it's parent and handles any positioning logic. */ - //////////////////////////////////////////////////////////////////////////// this._init = function () { if (arg.hasOwnProperty('parent')) { arg.parent.addChild(m_this); @@ -35,12 +33,10 @@ var domWidget = function (arg) { m_this.reposition(); }; - //////////////////////////////////////////////////////////////////////////// /** * Creates the widget canvas. * This is just a simple DOM element (based on args.el, or defaults to a div) */ - //////////////////////////////////////////////////////////////////////////// this._createCanvas = function () { m_this.canvas(document.createElement(arg.el || m_default_canvas)); }; diff --git a/src/ui/legendWidget.js b/src/ui/legendWidget.js index 3cfb462f74..e6023ac8a6 100644 --- a/src/ui/legendWidget.js +++ b/src/ui/legendWidget.js @@ -2,7 +2,6 @@ var svgWidget = require('./svgWidget'); var inherit = require('../inherit'); var registerWidget = require('../registry').registerWidget; -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class legendWidget * @@ -10,7 +9,6 @@ var registerWidget = require('../registry').registerWidget; * @extends geo.gui.svgWidget * @returns {geo.gui.legendWidget} */ -////////////////////////////////////////////////////////////////////////////// var legendWidget = function (arg) { 'use strict'; if (!(this instanceof legendWidget)) { @@ -32,7 +30,6 @@ var legendWidget = function (arg) { s_createCanvas = this._createCanvas, s_appendChild = this._appendChild; - ////////////////////////////////////////////////////////////////////////////// /** * Get or set the category array associated with * the legend. Each element of this array is @@ -58,7 +55,6 @@ var legendWidget = function (arg) { * * @param {object[]?} categories The categories to display */ - ////////////////////////////////////////////////////////////////////////////// this.categories = function (arg) { if (arg === undefined) { return m_categories.slice(); @@ -74,12 +70,10 @@ var legendWidget = function (arg) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get the widget's size * @return {{width: number, height: number}} The size in pixels */ - ////////////////////////////////////////////////////////////////////////////// this.size = function () { var width = 1, height; var test = d3.select(m_this.canvas()).append('text') @@ -98,11 +92,9 @@ var legendWidget = function (arg) { }; }; - ////////////////////////////////////////////////////////////////////////////// /** * Redraw the legend */ - ////////////////////////////////////////////////////////////////////////////// this.draw = function () { m_this._init(); @@ -196,12 +188,10 @@ var legendWidget = function (arg) { return m_this; }; - ////////////////////////////////////////////////////////////////////////////// /** * Get scales for the x and y axis for the current size. * @private */ - ////////////////////////////////////////////////////////////////////////////// this._scale = function () { return { x: d3.scale.linear() @@ -213,13 +203,11 @@ var legendWidget = function (arg) { }; }; - ////////////////////////////////////////////////////////////////////////////// /** * Private initialization. Creates the widget's DOM container and internal * variables. * @private */ - ////////////////////////////////////////////////////////////////////////////// this._init = function () { // adding categories redraws the entire thing by calling _init, see // the m_top.remove() line below diff --git a/src/ui/sliderWidget.js b/src/ui/sliderWidget.js index f86ff8794d..7a90152ce7 100644 --- a/src/ui/sliderWidget.js +++ b/src/ui/sliderWidget.js @@ -2,7 +2,6 @@ var svgWidget = require('./svgWidget'); var inherit = require('../inherit'); var registerWidget = require('../registry').registerWidget; -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class sliderWidget * @@ -10,7 +9,6 @@ var registerWidget = require('../registry').registerWidget; * @extends {geo.gui.svgWidget} * @returns {geo.gui.sliderWidget} */ -////////////////////////////////////////////////////////////////////////////// var sliderWidget = function (arg) { 'use strict'; if (!(this instanceof sliderWidget)) { @@ -50,7 +48,6 @@ var sliderWidget = function (arg) { black: '#505050' }; - ////////////////////////////////////////////////////////////////////////////// /** * Add an icon from a path string. Returns a d3 group element. * @@ -63,7 +60,6 @@ var sliderWidget = function (arg) { * @returns {object} * @private */ - ////////////////////////////////////////////////////////////////////////////// function put_icon(icon, base, cx, cy, size) { var g = base.append('g'); @@ -87,7 +83,6 @@ var sliderWidget = function (arg) { return {width: m_width, height: m_height}; }; - ////////////////////////////////////////////////////////////////////////////// /** * Initialize the slider widget in the map. * @@ -95,7 +90,6 @@ var sliderWidget = function (arg) { * @returns {geo.gui.sliderWidget} * @private */ - ////////////////////////////////////////////////////////////////////////////// this._init = function () { s_createCanvas(); s_appendChild(); @@ -300,7 +294,6 @@ var sliderWidget = function (arg) { m_this._update(); }; - ////////////////////////////////////////////////////////////////////////////// /** * Removes the slider element from the map and unbinds all handlers. * @@ -308,14 +301,12 @@ var sliderWidget = function (arg) { * @returns {geo.gui.sliderWidget} * @private */ - ////////////////////////////////////////////////////////////////////////////// this._exit = function () { m_group.remove(); m_this.layer().geoOff(geo_event.zoom); s_exit(); }; - ////////////////////////////////////////////////////////////////////////////// /** * Update the slider widget state in reponse to map changes. I.e. zoom * range changes. @@ -324,7 +315,6 @@ var sliderWidget = function (arg) { * @returns {geo.gui.sliderWidget} * @private */ - ////////////////////////////////////////////////////////////////////////////// this._update = function (obj) { var map = m_this.layer().map(), zoomRange = map.zoomRange(), diff --git a/src/ui/svgWidget.js b/src/ui/svgWidget.js index a10a02ac5b..98f4bc6b4f 100644 --- a/src/ui/svgWidget.js +++ b/src/ui/svgWidget.js @@ -2,7 +2,6 @@ var domWidget = require('./domWidget'); var inherit = require('../inherit'); var registerWidget = require('../registry').registerWidget; -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class geo.gui.svgWidget * @@ -19,7 +18,6 @@ var registerWidget = require('../registry').registerWidget; * @returns {geo.gui.svgWidget} * */ -////////////////////////////////////////////////////////////////////////////// var svgWidget = function (arg) { 'use strict'; if (!(this instanceof svgWidget)) { @@ -51,13 +49,11 @@ var svgWidget = function (arg) { m_this.reposition(); }; - //////////////////////////////////////////////////////////////////////////// /** * Creates the canvas for the svg widget. * This directly uses the {@link geo.d3.d3Renderer} as a helper to do all of the heavy * lifting. */ - //////////////////////////////////////////////////////////////////////////// this._createCanvas = function (d3Parent) { var rendererOpts = { layer: m_this.layer(), diff --git a/src/ui/uiLayer.js b/src/ui/uiLayer.js index dfc9732b04..8bc2aa7e78 100644 --- a/src/ui/uiLayer.js +++ b/src/ui/uiLayer.js @@ -2,7 +2,6 @@ var inherit = require('../inherit'); var registerLayer = require('../registry').registerLayer; var layer = require('../layer'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class uiLayer * @@ -10,7 +9,6 @@ var layer = require('../layer'); * @extends {geo.layer} * @returns {geo.gui.uiLayer} */ -////////////////////////////////////////////////////////////////////////////// var uiLayer = function (arg) { 'use strict'; @@ -28,13 +26,11 @@ var uiLayer = function (arg) { var m_this = this, s_exit = this._exit; - //////////////////////////////////////////////////////////////////////////// /** * Create a new ui control * * @returns {geo.gui.Widget} Will return a new control widget */ - //////////////////////////////////////////////////////////////////////////// this.createWidget = function (widgetName, arg) { var newWidget = createWidget(widgetName, m_this, arg); @@ -48,11 +44,9 @@ var uiLayer = function (arg) { return newWidget; }; - //////////////////////////////////////////////////////////////////////////// /** * Delete a ui control */ - //////////////////////////////////////////////////////////////////////////// this.deleteWidget = function (widget) { widget._exit(); m_this.removeChild(widget); @@ -60,11 +54,9 @@ var uiLayer = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Free memory and destroy the layer. */ - //////////////////////////////////////////////////////////////////////////// this._exit = function () { m_this.children().forEach(function (child) { m_this.deleteWidget(child); diff --git a/src/ui/widget.js b/src/ui/widget.js index 0ce3911e1c..5a95a7ae65 100644 --- a/src/ui/widget.js +++ b/src/ui/widget.js @@ -1,7 +1,6 @@ var inherit = require('../inherit'); var sceneObject = require('../sceneObject'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class widget * @@ -9,7 +8,6 @@ var sceneObject = require('../sceneObject'); * @extends {geo.sceneObject} * @returns {geo.gui.widget} */ -////////////////////////////////////////////////////////////////////////////// var widget = function (arg) { 'use strict'; if (!(this instanceof widget)) { @@ -45,13 +43,11 @@ var widget = function (arg) { s_exit(); }; - //////////////////////////////////////////////////////////////////////////// /** * Create feature give a name * * @returns {geo.Feature} Will return a new feature */ - //////////////////////////////////////////////////////////////////////////// this._createFeature = function (featureName, arg) { var newFeature = createFeature( @@ -62,40 +58,32 @@ var widget = function (arg) { return newFeature; }; - //////////////////////////////////////////////////////////////////////////// /** * Delete feature */ - //////////////////////////////////////////////////////////////////////////// this._deleteFeature = function (feature) { m_this.removeChild(feature); feature._exit(); return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Return the layer associated with this widget. */ - //////////////////////////////////////////////////////////////////////////// this.layer = function () { return m_layer; }; - //////////////////////////////////////////////////////////////////////////// /** * Create the canvas this widget will operate on. */ - //////////////////////////////////////////////////////////////////////////// this._createCanvas = function () { throw new Error('Must be defined in derived classes'); }; - //////////////////////////////////////////////////////////////////////////// /** * Get/Set the canvas for the widget */ - //////////////////////////////////////////////////////////////////////////// this.canvas = function (val) { if (val === undefined) { return m_canvas; @@ -104,22 +92,18 @@ var widget = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Appends a child to the widget * The widget determines how to append itself to a parent, the parent can either * be another widget, or the UI Layer. */ - //////////////////////////////////////////////////////////////////////////// this._appendChild = function () { m_this.parentCanvas().appendChild(m_this.canvas()); }; - //////////////////////////////////////////////////////////////////////////// /** * Get the parent canvas (top level widgets define their layer as their parent canvas) */ - //////////////////////////////////////////////////////////////////////////// this.parentCanvas = function () { if (m_this.parent === undefined) { return m_this.layer().canvas(); @@ -128,12 +112,10 @@ var widget = function (arg) { } }; - //////////////////////////////////////////////////////////////////////////// /** * Gets the CSS positioning that a widget should be placed at. * { top: 0, left: 0 } by default. */ - //////////////////////////////////////////////////////////////////////////// this.position = function (pos) { if (pos !== undefined) { arg.position = pos; @@ -160,14 +142,12 @@ var widget = function (arg) { return arg.position; }; - //////////////////////////////////////////////////////////////////////////// /** * Repositions a widget based on the argument passed, or calling position on * the widget itself. * @param {object} position A position with the form: * { top: m, left: n } */ - //////////////////////////////////////////////////////////////////////////// this.reposition = function (position) { position = position || m_this.position(); m_this.canvas().style.position = 'absolute'; @@ -190,11 +170,9 @@ var widget = function (arg) { return m_this.reposition(); }; - //////////////////////////////////////////////////////////////////////////// /** * Determines whether or not the widget is completely within the viewport. */ - //////////////////////////////////////////////////////////////////////////// this.isInViewport = function () { var position = m_this.position(); var layer = m_this.layer(); diff --git a/src/util/clustering.js b/src/util/clustering.js index 2b44e09050..0d3d2a36b9 100644 --- a/src/util/clustering.js +++ b/src/util/clustering.js @@ -180,14 +180,14 @@ C.prototype._scaleAtLevel = function (zoom, width, height) { */ C.prototype.addPoint = function (point) { var zoom, closest, parent, newCluster, lastParent, z; - - // start at the maximum zoom level and search for nearby - // - // 1. existing clusters - // 2. unclustered points - // - // otherwise add the point as a new unclustered point - + /* + * start at the maximum zoom level and search for nearby + * + * 1. existing clusters + * 2. unclustered points + * + * otherwise add the point as a new unclustered point + */ for (zoom = this._opts.maxZoom; zoom >= 0; zoom -= 1) { // find near cluster diff --git a/src/util/index.js b/src/util/index.js index 68aadcb499..85739228eb 100644 --- a/src/util/index.js +++ b/src/util/index.js @@ -26,12 +26,10 @@ function setNumeric() { } } -////////////////////////////////////////////////////////////////////////////// /** * Contains utility classes and methods used by geojs. * @namespace geo.util */ -////////////////////////////////////////////////////////////////////////////// var util = module.exports = { DistanceGrid: DistanceGrid, ClusterGroup: ClusterGroup, diff --git a/src/util/throttle.js b/src/util/throttle.js index b7ee735dbe..0671657f1c 100644 --- a/src/util/throttle.js +++ b/src/util/throttle.js @@ -120,15 +120,17 @@ var throttle = function (delay, no_trailing, exec(); } else if (no_trailing !== true) { - // In trailing throttle mode, since `delay` time has not been - // exceeded, schedule `callback` to execute `delay` ms after most - // recent execution. - // - // If `debounce_mode` is true (at_begin), schedule `clear` to execute - // after `delay` ms. - // - // If `debounce_mode` is false (at end), schedule `callback` to - // execute after `delay` ms. + /* + * In trailing throttle mode, since `delay` time has not been + * exceeded, schedule `callback` to execute `delay` ms after most + * recent execution. + * + * If `debounce_mode` is true (at_begin), schedule `clear` to execute + * after `delay` ms. + * + * If `debounce_mode` is false (at end), schedule `callback` to + * execute after `delay` ms. + */ timeout_id = setTimeout( debounce_mode ? clear : diff --git a/src/vectorFeature.js b/src/vectorFeature.js index a9792b3090..ed5560d8ea 100644 --- a/src/vectorFeature.js +++ b/src/vectorFeature.js @@ -1,7 +1,6 @@ var inherit = require('./inherit'); var feature = require('./feature'); -////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class vectorFeature * @@ -9,7 +8,6 @@ var feature = require('./feature'); * @extends geo.feature * @returns {geo.vectorFeature} */ -////////////////////////////////////////////////////////////////////////////// var vectorFeature = function (arg) { 'use strict'; if (!(this instanceof vectorFeature)) { @@ -21,22 +19,18 @@ var vectorFeature = function (arg) { arg = arg || {}; feature.call(this, arg); - //////////////////////////////////////////////////////////////////////////// /** * @private */ - //////////////////////////////////////////////////////////////////////////// var m_this = this, s_init = this._init, s_style = this.style; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the accessor for the origin of the vector. This is the point * that the vector base resides at. Defaults to (0, 0, 0). * @param {geo.accessor|geo.geoPosition} [accessor] The origin accessor */ - //////////////////////////////////////////////////////////////////////////// this.origin = function (val) { if (val === undefined) { return s_style('origin'); @@ -48,12 +42,10 @@ var vectorFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Get or set the accessor for the displacement (coordinates) of the vector. * @param {geo.accessor|geo.geoPosition} [accessor] The accessor */ - //////////////////////////////////////////////////////////////////////////// this.delta = function (val) { if (val === undefined) { return s_style('delta'); @@ -65,12 +57,10 @@ var vectorFeature = function (arg) { return m_this; }; - //////////////////////////////////////////////////////////////////////////// /** * Initialize * @protected */ - //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg);