diff --git a/src/annotation.js b/src/annotation.js index ce52439e34..e9c7b5bd6c 100644 --- a/src/annotation.js +++ b/src/annotation.js @@ -307,7 +307,7 @@ var annotation = function (type, args) { m_state = arg; if (m_this.layer()) { m_this.layer().geoTrigger(geo_event.annotation.state, { - annotation: this + annotation: m_this }); } } @@ -481,7 +481,7 @@ var annotation = function (type, args) { annotation: m_this }); } - return this; + return m_this; }; /** diff --git a/src/annotationLayer.js b/src/annotationLayer.js index 51e5f25686..b50c709aed 100644 --- a/src/annotationLayer.js +++ b/src/annotationLayer.js @@ -577,7 +577,7 @@ var annotationLayer = function (arg) { if (createAnnotation) { m_this.currentAnnotation = createAnnotation({ state: geo_annotation.state.create, - layer: this + layer: m_this }); m_this.addAnnotation(m_this.currentAnnotation, null); actions = m_this.currentAnnotation.actions(geo_annotation.state.create); diff --git a/src/canvas/canvasRenderer.js b/src/canvas/canvasRenderer.js index f2e2debdc6..bd691607bb 100644 --- a/src/canvas/canvasRenderer.js +++ b/src/canvas/canvasRenderer.js @@ -103,7 +103,7 @@ var canvasRenderer = function (arg) { * @returns {this} */ this._render = function () { - m_this.layer().map().scheduleAnimationFrame(this._renderFrame); + m_this.layer().map().scheduleAnimationFrame(m_this._renderFrame); return m_this; }; diff --git a/src/canvas/quadFeature.js b/src/canvas/quadFeature.js index c775762625..62e497dd41 100644 --- a/src/canvas/quadFeature.js +++ b/src/canvas/quadFeature.js @@ -38,7 +38,7 @@ var canvas_quadFeature = function (arg) { if (!m_this.position()) { return; } - m_quads = this._generateQuads(); + m_quads = m_this._generateQuads(); if (m_quads.imgQuads) { m_quads.imgQuads.sort(function (a, b) { @@ -214,8 +214,8 @@ var canvas_quadFeature = function (arg) { */ this._renderOnCanvas = function (context, map) { if (m_quads) { - this._renderImageAndVideoQuads(context, map); - this._renderColorQuads(context, map); + m_this._renderImageAndVideoQuads(context, map); + m_this._renderColorQuads(context, map); } }; diff --git a/src/canvas/tileLayer.js b/src/canvas/tileLayer.js index 9659063d37..8109c30033 100644 --- a/src/canvas/tileLayer.js +++ b/src/canvas/tileLayer.js @@ -14,24 +14,24 @@ var canvas_tileLayer = function () { if (!m_quadFeature) { return; } - var bounds = this._tileBounds(tile), + var bounds = m_this._tileBounds(tile), level = tile.index.level || 0, - to = this._tileOffset(level), - crop = this.tileCropFromBounds(tile), + to = m_this._tileOffset(level), + crop = m_this.tileCropFromBounds(tile), quad = {}; if (crop) { quad.crop = crop; } - quad.ul = this.fromLocal(this.fromLevel({ + quad.ul = m_this.fromLocal(m_this.fromLevel({ x: bounds.left - to.x, y: bounds.top - to.y }, level), 0); - quad.ll = this.fromLocal(this.fromLevel({ + quad.ll = m_this.fromLocal(m_this.fromLevel({ x: bounds.left - to.x, y: bounds.bottom - to.y }, level), 0); - quad.ur = this.fromLocal(this.fromLevel({ + quad.ur = m_this.fromLocal(m_this.fromLevel({ x: bounds.right - to.x, y: bounds.top - to.y }, level), 0); - quad.lr = this.fromLocal(this.fromLevel({ + quad.lr = m_this.fromLocal(m_this.fromLevel({ x: bounds.right - to.x, y: bounds.bottom - to.y }, level), 0); quad.ul.z = quad.ll.z = quad.ur.z = quad.lr.z = level * m_this._levelZIncrement; @@ -75,7 +75,7 @@ var canvas_tileLayer = function () { */ this._init = function () { s_init.apply(m_this, arguments); - m_quadFeature = this.createFeature('quad', { + m_quadFeature = m_this.createFeature('quad', { previewColor: m_this._options.previewColor, previewImage: m_this._options.previewImage }); diff --git a/src/contourFeature.js b/src/contourFeature.js index 9d63ac42f2..f72989c2f9 100644 --- a/src/contourFeature.js +++ b/src/contourFeature.js @@ -128,7 +128,7 @@ var contourFeature = function (arg) { m_this.style.get('used') : function (d, i) { return util.isNonNullFinite(valueFunc(d, i)); }, minmax, val, range, i, k; - var result = this._createMesh({ + var result = m_this._createMesh({ used: usedFunc, opacity: m_this.style.get('opacity'), value: valueFunc diff --git a/src/featureLayer.js b/src/featureLayer.js index 4e46f677df..cc677bfbd4 100644 --- a/src/featureLayer.js +++ b/src/featureLayer.js @@ -44,7 +44,7 @@ var featureLayer = function (arg) { var newFeature = registry.createFeature( featureName, m_this, m_this.renderer(), arg); if (newFeature) { - this.addFeature(newFeature); + m_this.addFeature(newFeature); } else { console.warn('Layer renderer (' + m_this.rendererName() + ') does not support feature type "' + featureName + '"'); } @@ -59,7 +59,7 @@ var featureLayer = function (arg) { */ this.addFeature = function (feature) { /* try to remove the feature first so that we don't have two copies */ - this.removeFeature(feature); + m_this.removeFeature(feature); m_this.addChild(feature); m_features.push(feature); m_this.dataTime().modified(); @@ -100,7 +100,7 @@ var featureLayer = function (arg) { if (m_features.indexOf(feature) >= 0) { feature._exit(); } - this.removeFeature(feature); + m_this.removeFeature(feature); } return m_this; @@ -126,11 +126,11 @@ var featureLayer = function (arg) { var i; for (i = 0; i < existing.length; i += 1) { if (val.indexOf(existing[i]) < 0 && m_features.indexOf(existing[i]) >= 0) { - this.deleteFeature(existing[i]); + m_this.deleteFeature(existing[i]); } } for (i = 0; i < val.length; i += 1) { - this.addFeature(val[i]); + m_this.addFeature(val[i]); } return m_this; } diff --git a/src/fetchQueue.js b/src/fetchQueue.js index 3e39397eb9..eea599a75d 100644 --- a/src/fetchQueue.js +++ b/src/fetchQueue.js @@ -51,10 +51,10 @@ var fetchQueue = function (options) { * @name geo.fetchQueue#size */ Object.defineProperty(this, 'size', { - get: function () { return this._size; }, + get: function () { return m_this._size; }, set: function (n) { - this._size = n; - this.next_item(); + m_this._size = n; + m_this.next_item(); } }); @@ -64,7 +64,7 @@ var fetchQueue = function (options) { * @name geo.fetchQueue#length */ Object.defineProperty(this, 'length', { - get: function () { return this._queue.length; } + get: function () { return m_this._queue.length; } }); /** @@ -73,7 +73,7 @@ var fetchQueue = function (options) { * @name geo.fetchQueue#processing */ Object.defineProperty(this, 'processing', { - get: function () { return this._processing; } + get: function () { return m_this._processing; } }); /** @@ -82,9 +82,9 @@ var fetchQueue = function (options) { * @returns {this} */ this.clear = function () { - this._queue = []; - this._processing = 0; - return this; + m_this._queue = []; + m_this._processing = 0; + return m_this; }; /** @@ -101,10 +101,10 @@ var fetchQueue = function (options) { */ this.add = function (defer, callback, atEnd) { if (defer.__fetchQueue) { - var pos = $.inArray(defer, this._queue); + var pos = $.inArray(defer, m_this._queue); if (pos >= 0) { - this._queue.splice(pos, 1); - this._addToQueue(defer, atEnd); + m_this._queue.splice(pos, 1); + m_this._addToQueue(defer, atEnd); return defer; } } @@ -114,7 +114,7 @@ var fetchQueue = function (options) { $.when(callback.call(defer)).always(process.resolve); }).fail(process.resolve); defer.__fetchQueue = wait; - this._addToQueue(defer, atEnd); + m_this._addToQueue(defer, atEnd); $.when(wait, process).always(function () { if (m_this._processing > 0) { m_this._processing -= 1; @@ -135,18 +135,18 @@ var fetchQueue = function (options) { * turned on. If truthy, always add the item to the end of the queue. */ this._addToQueue = function (defer, atEnd) { - defer.__fetchQueue._batch = this._batch; + defer.__fetchQueue._batch = m_this._batch; if (atEnd) { - this._queue.push(defer); + m_this._queue.push(defer); } else if (!this._batch) { - this._queue.unshift(defer); + m_this._queue.unshift(defer); } else { - for (var i = 0; i < this._queue.length; i += 1) { - if (this._queue[i].__fetchQueue._batch !== this._batch) { + for (var i = 0; i < m_this._queue.length; i += 1) { + if (m_this._queue[i].__fetchQueue._batch !== m_this._batch) { break; } } - this._queue.splice(i, 0, defer); + m_this._queue.splice(i, 0, defer); } }; @@ -157,7 +157,7 @@ var fetchQueue = function (options) { * @returns {number} -1 if not in the queue, or the position in the queue. */ this.get = function (defer) { - return $.inArray(defer, this._queue); + return $.inArray(defer, m_this._queue); }; /** @@ -167,9 +167,9 @@ var fetchQueue = function (options) { * @returns {boolean} `true` if the object was removed. */ this.remove = function (defer) { - var pos = $.inArray(defer, this._queue); + var pos = $.inArray(defer, m_this._queue); if (pos >= 0) { - this._queue.splice(pos, 1); + m_this._queue.splice(pos, 1); return true; } return false; @@ -185,15 +185,15 @@ var fetchQueue = function (options) { */ this.batch = function (start) { if (start === undefined) { - return this._batch; + return m_this._batch; } if (!start) { - this._batch = false; + m_this._batch = false; } else { - this._batch = m_next_batch; + m_this._batch = m_next_batch; m_next_batch += 1; } - return this; + return m_this; }; /** @@ -207,7 +207,7 @@ var fetchQueue = function (options) { m_this._innextitem = true; /* if the queue is greater than the track size, check each item to see * if it is still needed. */ - if (m_this._queue.length > m_this._track && this._needed) { + if (m_this._queue.length > m_this._track && m_this._needed) { for (var i = m_this._queue.length - 1; i >= 0; i -= 1) { if (!m_this._needed(m_this._queue[i])) { var discard = m_this._queue.splice(i, 1)[0]; diff --git a/src/geojsonReader.js b/src/geojsonReader.js index 496cafa779..f770eb42f1 100644 --- a/src/geojsonReader.js +++ b/src/geojsonReader.js @@ -411,7 +411,7 @@ var geojsonReader = function (arg) { m_this._readObject(file, _done, progress); }); - this.addPromise(promise); + m_this.addPromise(promise); return promise; }; }; diff --git a/src/heatmapFeature.js b/src/heatmapFeature.js index 131ac03e81..1233454f62 100644 --- a/src/heatmapFeature.js +++ b/src/heatmapFeature.js @@ -191,7 +191,7 @@ var heatmapFeature = function (arg) { * @returns {geo.heatmap} */ this.gcsPosition = function () { - this._update(); + m_this._update(); return m_gcsPosition; }; diff --git a/src/isolineFeature.js b/src/isolineFeature.js index cb7f5d6c26..7d648afedd 100644 --- a/src/isolineFeature.js +++ b/src/isolineFeature.js @@ -231,11 +231,11 @@ var isolineFeature = function (arg) { values, hasLabels = false, lines = []; - var mesh = this._createMesh({ + var mesh = m_this._createMesh({ used: usedFunc, value: valueFunc }); - values = this._getValueList(mesh); + values = m_this._getValueList(mesh); if (!values.length) { return {}; } diff --git a/src/layer.js b/src/layer.js index 63c3759cd5..34c624c4db 100644 --- a/src/layer.js +++ b/src/layer.js @@ -144,7 +144,7 @@ var layer = function (arg) { // layers up. We do this in reverse order since, if two layers above // this one share a z-index, they will resolve to the layer insert order. _siblingLayers().reverse().forEach(function (child) { - if (child !== this && child.zIndex() === zIndex) { + if (child !== m_this && child.zIndex() === zIndex) { child.zIndex(zIndex + 1); } }); @@ -258,7 +258,7 @@ var layer = function (arg) { m_active = arg; m_node.toggleClass('active', m_active); } - return this; + return m_this; }; /** diff --git a/src/lineFeature.js b/src/lineFeature.js index 7cc3d5f649..12d91cd88b 100644 --- a/src/lineFeature.js +++ b/src/lineFeature.js @@ -206,7 +206,7 @@ var lineFeature = function (arg) { index: indices }; } - this._updatePointSearchInfo(); + m_this._updatePointSearchInfo(); var map = m_this.layer().map(), scale = map.unitsPerPixel(map.zoom()), scale2 = scale * scale, diff --git a/src/map.js b/src/map.js index a914327d69..5cdb981453 100644 --- a/src/map.js +++ b/src/map.js @@ -217,7 +217,7 @@ var map = function (arg) { } m_animationQueue = queue; } - return this; + return m_this; }; /** @@ -238,7 +238,7 @@ var map = function (arg) { $(window).on('resize', resizeSelf); } } - return this; + return m_this; }; /** @@ -719,7 +719,7 @@ var map = function (arg) { }; } var bds = rotate_bounds_center( - {x: 0, y: 0}, {width: m_width, height: m_height}, this.rotation()); + {x: 0, y: 0}, {width: m_width, height: m_height}, m_this.rotation()); return { width: Math.abs(bds.right - bds.left), height: Math.abs(bds.top - bds.bottom) @@ -1375,7 +1375,7 @@ var map = function (arg) { reset_minimum_zoom(); m_this.zoom(m_zoom); m_this.pan({x: 0, y: 0}); - return this; + return m_this; }; /** @@ -1814,7 +1814,7 @@ var map = function (arg) { /* The first entry is the reference to the window.requestAnimationFrame. */ for (var i = 1; i < queue.length; i += 1) { try { - queue[i].apply(this, arguments); + queue[i].apply(m_this, arguments); } catch (err) { console.error(err); } diff --git a/src/mapInteractor.js b/src/mapInteractor.js index 8d1a96e9c6..e850dfbc8f 100644 --- a/src/mapInteractor.js +++ b/src/mapInteractor.js @@ -805,7 +805,7 @@ var mapInteractor = function (args) { $.extend(m_options, opts); // reset event handlers for new options - this._connectEvents(); + m_this._connectEvents(); return m_this; }; diff --git a/src/meshFeature.js b/src/meshFeature.js index b61ccaf664..dfdbe72039 100644 --- a/src/meshFeature.js +++ b/src/meshFeature.js @@ -463,8 +463,8 @@ var meshFeature = function (arg) { } }, arg.style || {}); - this.mesh(arg.mesh || {}); - this.style(style); + m_this.mesh(arg.mesh || {}); + m_this.style(style); }; return this; diff --git a/src/pixelmapFeature.js b/src/pixelmapFeature.js index 9ef7da33eb..2bee447dcc 100644 --- a/src/pixelmapFeature.js +++ b/src/pixelmapFeature.js @@ -202,11 +202,11 @@ var pixelmapFeature = function (arg) { * this a second time. */ m_this.buildTime().modified(); if (!m_srcImage) { - var src = this.style.get('url')(); + var src = m_this.style.get('url')(); if (util.isReadyImage(src)) { /* we have an already loaded image, so we can just use it. */ m_srcImage = src; - this._computePixelmap(); + m_this._computePixelmap(); } else if (src) { var defer = $.Deferred(), prev_onload, prev_onerror; if (src instanceof Image) { @@ -221,12 +221,12 @@ var pixelmapFeature = function (arg) { // Only set the crossOrigin parameter if this is going across origins. if (src.indexOf(':') >= 0 && src.indexOf('/') === src.indexOf(':') + 1) { - m_srcImage.crossOrigin = this.style.get('crossDomain')() || 'anonymous'; + m_srcImage.crossOrigin = m_this.style.get('crossDomain')() || 'anonymous'; } } m_srcImage.onload = function () { if (prev_onload) { - prev_onload.apply(this, arguments); + prev_onload.apply(m_this, arguments); } /* Only use this image if our pixelmap hasn't changed since we * attached our handler */ @@ -238,18 +238,18 @@ var pixelmapFeature = function (arg) { }; m_srcImage.onerror = function () { if (prev_onerror) { - prev_onerror.apply(this, arguments); + prev_onerror.apply(m_this, arguments); } defer.reject(); }; - defer.promise(this); - this.layer().addPromise(this); + defer.promise(m_this); + m_this.layer().addPromise(m_this); if (!(src instanceof Image)) { m_srcImage.src = src; } } } else if (m_info) { - this._computePixelmap(); + m_this._computePixelmap(); } return m_this; }; diff --git a/src/polygonFeature.js b/src/polygonFeature.js index ae1d6cf476..7e0b029c57 100644 --- a/src/polygonFeature.js +++ b/src/polygonFeature.js @@ -87,7 +87,7 @@ var polygonFeature = function (arg) { var ret = s_data(arg); if (arg !== undefined) { m_coordinates = getCoordinates(); - this._checkForStroke(); + m_this._checkForStroke(); } return ret; }; @@ -285,9 +285,9 @@ var polygonFeature = function (arg) { * specific style, or the current class instance. */ this.style = function (arg1, arg2) { - var result = s_style.apply(this, arguments); + var result = s_style.apply(m_this, arguments); if (arg1 !== undefined && (typeof arg1 !== 'string' || arg2 !== undefined)) { - this._checkForStroke(); + m_this._checkForStroke(); } return result; }; @@ -354,12 +354,12 @@ var polygonFeature = function (arg) { } : linePolyStyle(polyStyle.strokeOpacity) }); - var data = this.data(), - posVal = this.style('position'); + var data = m_this.data(), + posVal = m_this.style('position'); if (data !== m_lineFeature._lastData || posVal !== m_lineFeature._lastPosVal) { var lineData = [], i, polygon, loop, - posFunc = this.style.get('position'), - polyFunc = this.style.get('polygon'); + posFunc = m_this.style.get('position'), + polyFunc = m_this.style.get('polygon'); for (i = 0; i < data.length; i += 1) { polygon = polyFunc(data[i], i); @@ -590,7 +590,7 @@ var polygonFeature = function (arg) { } m_this.style(style); - this._checkForStroke(); + m_this._checkForStroke(); }; /* Don't call _init here -- let subclasses call it */ diff --git a/src/quadFeature.js b/src/quadFeature.js index a50a64cf14..d48d23f288 100644 --- a/src/quadFeature.js +++ b/src/quadFeature.js @@ -158,7 +158,7 @@ var quadFeature = function (arg) { i, coordbasis; coordinate = transform.transformCoordinates(map.ingcs(), map.gcs(), coordinate); if (!m_quads) { - this._generateQuads(); + m_this._generateQuads(); } $.each([m_quads.clrQuads, m_quads.imgQuads, m_quads.vidQuads], function (idx, quadList) { quadList.forEach(function (quad, idx) { @@ -437,7 +437,7 @@ var quadFeature = function (arg) { defer.resolve(); } if (prev_onload) { - return prev_onload.apply(this, arguments); + return prev_onload.apply(m_this, arguments); } }; prev_onerror = image.onerror; @@ -446,7 +446,7 @@ var quadFeature = function (arg) { defer.reject(); } if (prev_onerror) { - return prev_onerror.apply(this, arguments); + return prev_onerror.apply(m_this, arguments); } }; if (defer) { @@ -515,7 +515,7 @@ var quadFeature = function (arg) { defer.resolve(); } if (prev_onload) { - return prev_onload.apply(this, arguments); + return prev_onload.apply(m_this, arguments); } }; prev_onerror = video.onerror; @@ -524,7 +524,7 @@ var quadFeature = function (arg) { defer.reject(); } if (prev_onerror) { - return prev_onerror.apply(this, arguments); + return prev_onerror.apply(m_this, arguments); } }; if (defer) { diff --git a/src/sceneObject.js b/src/sceneObject.js index eb9c3f4160..08fba061b2 100644 --- a/src/sceneObject.js +++ b/src/sceneObject.js @@ -38,7 +38,7 @@ var sceneObject = function (arg) { } else { s_addPromise(promise); } - return this; + return m_this; }; /** @@ -53,7 +53,7 @@ var sceneObject = function (arg) { } else { s_onIdle(handler); } - return this; + return m_this; }; /** diff --git a/src/svg/quadFeature.js b/src/svg/quadFeature.js index 688aac5ee6..4f523da949 100644 --- a/src/svg/quadFeature.js +++ b/src/svg/quadFeature.js @@ -37,10 +37,10 @@ var svg_quadFeature = function (arg) { if (!this.position()) { return; } - var renderer = this.renderer(), + var renderer = m_this.renderer(), map = renderer.layer().map(); - m_quads = this._generateQuads(); + m_quads = m_this._generateQuads(); var data = []; $.each(m_quads.clrQuads, function (idx, quad) { @@ -53,7 +53,7 @@ var svg_quadFeature = function (arg) { }); var feature = { - id: this._svgid(), + id: m_this._svgid(), data: data, dataIndex: function (d) { return d.quad.quadId; @@ -186,7 +186,7 @@ var svg_quadFeature = function (arg) { }; renderer._drawFeatures(feature); - this.buildTime().modified(); + m_this.buildTime().modified(); }; /** diff --git a/src/svg/tileLayer.js b/src/svg/tileLayer.js index b444dc33a7..5347e4d6a6 100644 --- a/src/svg/tileLayer.js +++ b/src/svg/tileLayer.js @@ -15,18 +15,18 @@ var svg_tileLayer = function () { } var bounds = m_this._tileBounds(tile), level = tile.index.level || 0, - to = this._tileOffset(level), + to = m_this._tileOffset(level), quad = {}; - quad.ul = this.fromLocal(this.fromLevel({ + quad.ul = m_this.fromLocal(m_this.fromLevel({ x: bounds.left - to.x, y: bounds.top - to.y }, level), 0); - quad.ll = this.fromLocal(this.fromLevel({ + quad.ll = m_this.fromLocal(m_this.fromLevel({ x: bounds.left - to.x, y: bounds.bottom - to.y }, level), 0); - quad.ur = this.fromLocal(this.fromLevel({ + quad.ur = m_this.fromLocal(m_this.fromLevel({ x: bounds.right - to.x, y: bounds.top - to.y }, level), 0); - quad.lr = this.fromLocal(this.fromLevel({ + quad.lr = m_this.fromLocal(m_this.fromLevel({ x: bounds.right - to.x, y: bounds.bottom - to.y }, level), 0); quad.ul.z = quad.ll.z = quad.ur.z = quad.lr.z = level * m_this._levelZIncrement; @@ -76,7 +76,7 @@ var svg_tileLayer = function () { */ this._init = function () { s_init.apply(m_this, arguments); - m_quadFeature = this.createFeature('quad', { + m_quadFeature = m_this.createFeature('quad', { previewColor: m_this._options.previewColor, previewImage: m_this._options.previewImage }); diff --git a/src/tileLayer.js b/src/tileLayer.js index e5da1a8e56..2a1333813d 100644 --- a/src/tileLayer.js +++ b/src/tileLayer.js @@ -198,7 +198,8 @@ var tileLayer = function (arg) { s_visible = this.visible, m_lastTileSet = [], m_maxBounds = [], - m_exited; + m_exited, + m_this = this; // Space tile levels this far apart in z-buffer space. This value doesn't // have any visual effect in parallel projections, but will slightly skew @@ -231,8 +232,8 @@ var tileLayer = function (arg) { // smaller values will do needless computations. track: arg.cacheSize, needed: function (tile) { - return tile === this.cache.get(tile.toString(), true); - }.bind(this) + return tile === m_this.cache.get(tile.toString(), true); + } }); var m_tileOffsetValues = {}; @@ -243,7 +244,7 @@ var tileLayer = function (arg) { * @name geo.tileLayer#options */ Object.defineProperty(this, 'options', {get: function () { - return $.extend({}, this._options); + return $.extend({}, m_this._options); }}); /** @@ -252,7 +253,7 @@ var tileLayer = function (arg) { * @name geo.tileLayer#cache */ Object.defineProperty(this, 'cache', {get: function () { - return this._cache; + return m_this._cache; }}); /** @@ -264,7 +265,7 @@ var tileLayer = function (arg) { * @name geo.tileLayer#activeTiles */ Object.defineProperty(this, 'activeTiles', {get: function () { - return $.extend({}, this._activeTiles); // copy on output + return $.extend({}, m_this._activeTiles); // copy on output }}); /** @@ -276,8 +277,8 @@ var tileLayer = function (arg) { * `{x: nx, y: ny}`. */ this.tilesAtZoom = function (level) { - if (this._options.tilesAtZoom) { - return this._options.tilesAtZoom.call(this, level); + if (m_this._options.tilesAtZoom) { + return m_this._options.tilesAtZoom.call(m_this, level); } var s = Math.pow(2, level); return {x: s, y: s}; @@ -292,8 +293,8 @@ var tileLayer = function (arg) { * level, or null if none specified (`{x: width, y: height}`). */ this.tilesMaxBounds = function (level) { - if (this._options.tilesMaxBounds) { - return this._options.tilesMaxBounds.call(this, level); + if (m_this._options.tilesMaxBounds) { + return m_this._options.tilesMaxBounds.call(m_this, level); } return null; }; @@ -307,13 +308,13 @@ var tileLayer = function (arg) { * which is the size in pixels for the tile. */ this.tileCropFromBounds = function (tile) { - if (!this._options.tilesMaxBounds) { + if (!m_this._options.tilesMaxBounds) { return; } var level = tile.index.level, - bounds = this._tileBounds(tile); + bounds = m_this._tileBounds(tile); if (m_maxBounds[level] === undefined) { - m_maxBounds[level] = this.tilesMaxBounds(level) || null; + m_maxBounds[level] = m_this.tilesMaxBounds(level) || null; } if (m_maxBounds[level] && (bounds.right > m_maxBounds[level].x || bounds.bottom > m_maxBounds[level].y)) { @@ -339,16 +340,16 @@ var tileLayer = function (arg) { * @returns {boolean} */ this.isValid = function (index) { - if (!(this._options.minLevel <= index.level && - index.level <= this._options.maxLevel)) { + if (!(m_this._options.minLevel <= index.level && + index.level <= m_this._options.maxLevel)) { return false; } - if (!(this._options.wrapX || ( - 0 <= index.x && index.x <= this.tilesAtZoom(index.level).x - 1))) { + if (!(m_this._options.wrapX || ( + 0 <= index.x && index.x <= m_this.tilesAtZoom(index.level).x - 1))) { return false; } - if (!(this._options.wrapY || ( - 0 <= index.y && index.y <= this.tilesAtZoom(index.level).y - 1))) { + if (!(m_this._options.wrapY || ( + 0 <= index.y && index.y <= m_this.tilesAtZoom(index.level).y - 1))) { return false; } return true; @@ -365,8 +366,8 @@ var tileLayer = function (arg) { * `{index: {x, y}, offset: {x, y}}`. */ this._origin = function (level) { - var origin = this.toLevel(this.toLocal(this.map().origin()), level), - o = this._options, + var origin = m_this.toLevel(m_this.toLocal(m_this.map().origin()), level), + o = m_this._options, index, offset; // get the tile index @@ -394,7 +395,7 @@ var tileLayer = function (arg) { * `bottom`. */ this._tileBounds = function (tile) { - var origin = this._origin(tile.index.level); + var origin = m_this._origin(tile.index.level); return tile.bounds(origin.index, origin.offset); }; @@ -409,22 +410,22 @@ var tileLayer = function (arg) { * @returns {object} The tile indices. This has `x` and `y` properties. */ this.tileAtPoint = function (point, level) { - var o = this._origin(level); - var map = this.map(); - point = this.displayToLevel(map.gcsToDisplay(point, null), level); + var o = m_this._origin(level); + var map = m_this.map(); + point = m_this.displayToLevel(map.gcsToDisplay(point, null), level); if (isNaN(point.x)) { point.x = 0; } if (isNaN(point.y)) { point.y = 0; } - var to = this._tileOffset(level); + var to = m_this._tileOffset(level); if (to) { point.x += to.x; point.y += to.y; } var tile = { x: Math.floor( - o.index.x + (o.offset.x + point.x) / this._options.tileWidth + o.index.x + (o.offset.x + point.x) / m_this._options.tileWidth ), y: Math.floor( - o.index.y + (o.offset.y + point.y) / this._options.tileHeight + o.index.y + (o.offset.y + point.y) / m_this._options.tileHeight ) }; return tile; @@ -442,17 +443,17 @@ var tileLayer = function (arg) { this.gcsTileBounds = function (indexOrTile, gcs) { var tile = (indexOrTile.index ? indexOrTile : Tile({ index: indexOrTile, - size: {x: this._options.tileWidth, y: this._options.tileHeight}, + size: {x: m_this._options.tileWidth, y: m_this._options.tileHeight}, url: '' })); - var to = this._tileOffset(tile.index.level), + var to = m_this._tileOffset(tile.index.level), bounds = tile.bounds({x: 0, y: 0}, to), - map = this.map(), + map = m_this.map(), unit = map.unitsPerPixel(tile.index.level); var coord = [{ - x: bounds.left * unit, y: this._topDown() * bounds.top * unit + x: bounds.left * unit, y: m_this._topDown() * bounds.top * unit }, { - x: bounds.right * unit, y: this._topDown() * bounds.bottom * unit + x: bounds.right * unit, y: m_this._topDown() * bounds.bottom * unit }]; gcs = (gcs === null ? map.gcs() : ( gcs === undefined ? map.ingcs() : gcs)); @@ -486,11 +487,11 @@ var tileLayer = function (arg) { var urlParams = source || index; return Tile({ index: index, - size: {x: this._options.tileWidth, y: this._options.tileHeight}, - queue: this._queue, - url: this._options.url.call( - this, urlParams.x, urlParams.y, urlParams.level || 0, - this._options.subdomains) + size: {x: m_this._options.tileWidth, y: m_this._options.tileHeight}, + queue: m_this._queue, + url: m_this._options.url.call( + m_this, urlParams.x, urlParams.y, urlParams.level || 0, + m_this._options.subdomains) }); }; @@ -511,10 +512,10 @@ var tileLayer = function (arg) { * @returns {geo.tile} */ this._getTileCached = function (index, source, delayPurge) { - var tile = this.cache.get(this._tileHash(index)); + var tile = m_this.cache.get(m_this._tileHash(index)); if (tile === null) { - tile = this._getTile(index, source); - this.cache.add(tile, this.remove.bind(this), delayPurge); + tile = m_this._getTile(index, source); + m_this.cache.add(tile, m_this.remove, delayPurge); } return tile; }; @@ -549,10 +550,10 @@ var tileLayer = function (arg) { */ this._getTileRange = function (level, bounds) { var corners = [ - this.tileAtPoint({x: bounds.left, y: bounds.top}, level), - this.tileAtPoint({x: bounds.right, y: bounds.top}, level), - this.tileAtPoint({x: bounds.left, y: bounds.bottom}, level), - this.tileAtPoint({x: bounds.right, y: bounds.bottom}, level) + m_this.tileAtPoint({x: bounds.left, y: bounds.top}, level), + m_this.tileAtPoint({x: bounds.right, y: bounds.top}, level), + m_this.tileAtPoint({x: bounds.left, y: bounds.bottom}, level), + m_this.tileAtPoint({x: bounds.right, y: bounds.bottom}, level) ]; return { start: { @@ -583,7 +584,7 @@ var tileLayer = function (arg) { this._getTiles = function (maxLevel, bounds, sorted, onlyIfChanged) { var i, j, tiles = [], index, nTilesLevel, start, end, indexRange, source, center, changed = false, old, level, - minLevel = (this._options.keepLower ? this._options.minLevel : maxLevel); + minLevel = (m_this._options.keepLower ? m_this._options.minLevel : maxLevel); if (maxLevel < minLevel) { maxLevel = minLevel; } @@ -593,35 +594,35 @@ var tileLayer = function (arg) { * the sort order. */ for (level = minLevel; level <= maxLevel; level += 1) { // get the tile range to fetch - indexRange = this._getTileRange(level, bounds); + indexRange = m_this._getTileRange(level, bounds); start = indexRange.start; end = indexRange.end; - // total number of tiles existing at this level - nTilesLevel = this.tilesAtZoom(level); + // total number of tiles existing at m_this level + nTilesLevel = m_this.tilesAtZoom(level); - if (!this._options.wrapX) { + if (!m_this._options.wrapX) { start.x = Math.min(Math.max(start.x, 0), nTilesLevel.x - 1); end.x = Math.min(Math.max(end.x, 0), nTilesLevel.x - 1); - if (level === minLevel && this._options.keepLower) { + if (level === minLevel && m_this._options.keepLower) { start.x = 0; end.x = nTilesLevel.x - 1; } } - if (!this._options.wrapY) { + if (!m_this._options.wrapY) { start.y = Math.min(Math.max(start.y, 0), nTilesLevel.y - 1); end.y = Math.min(Math.max(end.y, 0), nTilesLevel.y - 1); - if (level === minLevel && this._options.keepLower) { + if (level === minLevel && m_this._options.keepLower) { start.y = 0; end.y = nTilesLevel.y - 1; } } /* If we are reprojecting tiles, we need a check to not use all levels * if the number of tiles is excessive. */ - if (this._options.gcs && this._options.gcs !== this.map().gcs() && + if (m_this._options.gcs && m_this._options.gcs !== m_this.map().gcs() && level !== minLevel && (end.x + 1 - start.x) * (end.y + 1 - start.y) > - (this.map().size().width * this.map().size().height / - this._options.tileWidth / this._options.tileHeight) * 16) { + (m_this.map().size().width * m_this.map().size().height / + m_this._options.tileWidth / m_this._options.tileHeight) * 16) { break; } @@ -630,13 +631,13 @@ var tileLayer = function (arg) { for (j = start.y; j <= end.y; j += 1) { index = {level: level, x: i, y: j}; source = {level: level, x: i, y: j}; - if (this._options.wrapX) { + if (m_this._options.wrapX) { source.x = modulo(source.x, nTilesLevel.x); } - if (this._options.wrapY) { + if (m_this._options.wrapY) { source.y = modulo(source.y, nTilesLevel.y); } - if (this.isValid(source)) { + if (m_this.isValid(source)) { if (onlyIfChanged && tiles.length < m_lastTileSet.length) { old = m_lastTileSet[tiles.length]; changed = changed || (index.level !== old.level || @@ -669,21 +670,21 @@ var tileLayer = function (arg) { for (; numTiles >= 1; numTiles /= 2) { center.bottomLevel -= 1; } - tiles.sort(this._loadMetric(center)); + tiles.sort(m_this._loadMetric(center)); /* If we are using a fetch queue, start a new batch */ - if (this._queue) { - this._queue.batch(true); + if (m_this._queue) { + m_this._queue.batch(true); } } - if (this.cache.size < tiles.length) { + if (m_this.cache.size < tiles.length) { console.log('Increasing cache size to ' + tiles.length); - this.cache.size = tiles.length; + m_this.cache.size = tiles.length; } /* Actually get the tiles. */ for (i = 0; i < tiles.length; i += 1) { - tiles[i] = this._getTileCached(tiles[i].index, tiles[i].source, true); + tiles[i] = m_this._getTileCached(tiles[i].index, tiles[i].source, true); } - this.cache.purge(this.remove.bind(this)); + m_this.cache.purge(m_this.remove); return tiles; }; @@ -696,7 +697,7 @@ var tileLayer = function (arg) { */ this.prefetch = function (level, bounds) { var tiles; - tiles = this._getTiles(level, bounds, true); + tiles = m_this._getTiles(level, bounds, true); return $.when.apply($, tiles.map(function (tile) { return tile.fetch(); })); @@ -796,16 +797,16 @@ var tileLayer = function (arg) { this.drawTile = function (tile) { var hash = tile.toString(); - if (this._activeTiles.hasOwnProperty(hash)) { + if (m_this._activeTiles.hasOwnProperty(hash)) { // the tile is already drawn, move it to the top - this._moveToTop(tile); + m_this._moveToTop(tile); } else { // pass to the rendering implementation - this._drawTile(tile); + m_this._drawTile(tile); } // add the tile to the active cache - this._activeTiles[hash] = tile; + m_this._activeTiles[hash] = tile; }; /** @@ -819,15 +820,15 @@ var tileLayer = function (arg) { this._drawTile = function (tile) { // Make sure this method is not called when there is // a renderer attached. - if (this.renderer() !== null) { + if (m_this.renderer() !== null) { throw new Error('This draw method is not valid on renderer managed layers.'); } // get the layer node var level = tile.index.level, - div = $(this._getSubLayer(level)), - bounds = this._tileBounds(tile), - duration = this._options.animationDuration, + div = $(m_this._getSubLayer(level)), + bounds = m_this._tileBounds(tile), + duration = m_this._options.animationDuration, container = $('
').attr( 'tile-reference', tile.toString()), crop; @@ -839,7 +840,7 @@ var tileLayer = function (arg) { top: (bounds.top - parseInt(div.attr('offsety') || 0, 10)) + 'px' }); - crop = this.tileCropFromBounds(tile); + crop = m_this.tileCropFromBounds(tile); if (crop) { container.addClass('crop').css({ width: crop.x + 'px', @@ -859,8 +860,8 @@ var tileLayer = function (arg) { tile.catch(function () { // May want to do something special here later console.warn('Could not load tile at ' + tile.toString()); - this._remove(tile); - }.bind(this)); + m_this._remove(tile); + }); }; /** @@ -871,13 +872,13 @@ var tileLayer = function (arg) { */ this.remove = function (tile) { var hash = tile.toString(); - var value = this._activeTiles[hash]; + var value = m_this._activeTiles[hash]; if (value instanceof Tile) { - this._remove(value); + m_this._remove(value); } - delete this._activeTiles[hash]; + delete m_this._activeTiles[hash]; return value; }; @@ -920,15 +921,15 @@ var tileLayer = function (arg) { * `scale`, and `level` keys. */ this._getViewBounds = function () { - var map = this.map(), + var map = m_this.map(), mapZoom = map.zoom(), - zoom = this._options.tileRounding(mapZoom), + zoom = m_this._options.tileRounding(mapZoom), scale = Math.pow(2, mapZoom - zoom), size = map.size(); - var ul = this.displayToLevel({x: 0, y: 0}), - ur = this.displayToLevel({x: size.width, y: 0}), - ll = this.displayToLevel({x: 0, y: size.height}), - lr = this.displayToLevel({x: size.width, y: size.height}); + var ul = m_this.displayToLevel({x: 0, y: 0}), + ur = m_this.displayToLevel({x: size.width, y: 0}), + ll = m_this.displayToLevel({x: 0, y: size.height}), + lr = m_this.displayToLevel({x: size.width, y: size.height}); return { level: zoom, scale: scale, @@ -955,23 +956,23 @@ var tileLayer = function (arg) { var tile, hash; // Don't purge tiles in an active update - if (this._updating) { - return this; + if (m_this._updating) { + return m_this; } // get the view bounds if (!bounds) { - bounds = this._getViewBounds(); + bounds = m_this._getViewBounds(); } - for (hash in this._activeTiles) { + for (hash in m_this._activeTiles) { - tile = this._activeTiles[hash]; - if (this._canPurge(tile, bounds, zoom, doneLoading)) { - this.remove(tile); + tile = m_this._activeTiles[hash]; + if (m_this._canPurge(tile, bounds, zoom, doneLoading)) { + m_this.remove(tile); } } - return this; + return m_this; }; /** @@ -982,14 +983,14 @@ var tileLayer = function (arg) { this.clear = function () { var tiles = [], tile; - // ignoring the warning here because this is a privately + // ignoring the warning here because m_this is a privately // controlled object with simple keys - for (tile in this._activeTiles) { - tiles.push(this.remove(tile)); + for (tile in m_this._activeTiles) { + tiles.push(m_this.remove(tile)); } // clear out the tile coverage tree - this._tileTree = {}; + m_this._tileTree = {}; m_lastTileSet = []; @@ -1003,9 +1004,9 @@ var tileLayer = function (arg) { * @returns {this} */ this.reset = function () { - this.clear(); - this._cache.clear(); - return this; + m_this.clear(); + m_this._cache.clear(); + return m_this; }; /** @@ -1018,11 +1019,11 @@ var tileLayer = function (arg) { * @returns {object} Local coordinates with `x` and `y`. */ this.toLocal = function (pt, zoom) { - var map = this.map(), + var map = m_this.map(), unit = map.unitsPerPixel(zoom === undefined ? map.zoom() : zoom); return { x: pt.x / unit, - y: this._topDown() * pt.y / unit + y: m_this._topDown() * pt.y / unit }; }; @@ -1038,11 +1039,11 @@ var tileLayer = function (arg) { this.fromLocal = function (pt, zoom) { // these need to always use the *layer* unitsPerPixel, or possibly // convert tile space using a transform - var map = this.map(), + var map = m_this.map(), unit = map.unitsPerPixel(zoom === undefined ? map.zoom() : zoom); return { x: pt.x * unit, - y: this._topDown() * pt.y * unit + y: m_this._topDown() * pt.y * unit }; }; @@ -1052,7 +1053,7 @@ var tileLayer = function (arg) { * @returns {number} Either 1 to not invert y, or -1 to invert it. */ this._topDown = function () { - return this._options.topDown ? 1 : -1; + return m_this._options.topDown ? 1 : -1; }; /** @@ -1063,16 +1064,16 @@ var tileLayer = function (arg) { * @returns {DOM} The layer's DOM element. */ this._getSubLayer = function (level) { - if (!this.canvas()) { + if (!m_this.canvas()) { return; } - var node = this.canvas() + var node = m_this.canvas() .find('div[data-tile-layer=' + level.toFixed() + ']').get(0); if (!node) { node = $( '
' ).get(0); - this.canvas().append(node); + m_this.canvas().append(node); } return node; }; @@ -1086,7 +1087,7 @@ var tileLayer = function (arg) { * @returns {object} The `x` and `y` offsets for the current level. */ this._updateSubLayers = function (level, view) { - var canvas = this.canvas(), + var canvas = m_this.canvas(), lastlevel = parseInt(canvas.attr('lastlevel'), 10), lastx = parseInt(canvas.attr('lastoffsetx') || 0, 10), lasty = parseInt(canvas.attr('lastoffsety') || 0, 10); @@ -1094,8 +1095,8 @@ var tileLayer = function (arg) { Math.abs(lasty - view.top) < 65536) { return {x: lastx, y: lasty}; } - var map = this.map(), - to = this._tileOffset(level), + var map = m_this.map(), + to = m_this._tileOffset(level), x = parseInt((view.left + view.right - map.size().width) / 2 + to.x, 10), y = parseInt((view.top + view.bottom - map.size().height) / 2 + to.y, 10); canvas.find('.geo-tile-layer').each(function (idx, el) { @@ -1134,23 +1135,23 @@ var tileLayer = function (arg) { * event */ if (evt && evt.event && (evt.event.event === geo_event.zoom || evt.event.event === geo_event.rotate)) { - return this; + return m_this; } - if (!this.visible()) { - return this; + if (!m_this.visible()) { + return m_this; } - var map = this.map(), + var map = m_this.map(), bounds = map.bounds(undefined, null), mapZoom = map.zoom(), - zoom = this._options.tileRounding(mapZoom), + zoom = m_this._options.tileRounding(mapZoom), tiles; - if (this._updateSubLayers) { - var view = this._getViewBounds(); + if (m_this._updateSubLayers) { + var view = m_this._getViewBounds(); // Update the transform for the local layer coordinates - var offset = this._updateSubLayers(zoom, view) || {x: 0, y: 0}; + var offset = m_this._updateSubLayers(zoom, view) || {x: 0, y: 0}; - var to = this._tileOffset(zoom); - if (this.renderer() === null) { + var to = m_this._tileOffset(zoom); + if (m_this.renderer() === null) { var scale = Math.pow(2, mapZoom - zoom), rotation = map.rotation(), rx = -to.x + -(view.left + view.right) / 2 + offset.x, @@ -1158,7 +1159,7 @@ var tileLayer = function (arg) { dx = (rx + map.size().width / 2), dy = (ry + map.size().height / 2); - this.canvas().css({ + m_this.canvas().css({ 'transform-origin': '' + -rx + 'px ' + -ry + 'px' @@ -1168,12 +1169,12 @@ var tileLayer = function (arg) { if (rotation) { transform += 'rotate(' + (rotation * 180 / Math.PI) + 'deg)'; } - this.canvas().css('transform', transform); + m_this.canvas().css('transform', transform); } /* Set some attributes that can be used by non-css based viewers. This * doesn't include the map center, as that may need to be handled * differently from the view center. */ - this.canvas().attr({ + m_this.canvas().attr({ scale: Math.pow(2, mapZoom - zoom), dx: -to.x + -(view.left + view.right) / 2, dy: -to.y + -(view.bottom + view.top) / 2, @@ -1183,25 +1184,25 @@ var tileLayer = function (arg) { }); } - tiles = this._getTiles( + tiles = m_this._getTiles( zoom, bounds, true, true ); if (tiles === undefined) { - return this; + return m_this; } // reset the tile coverage tree - this._tileTree = {}; + m_this._tileTree = {}; tiles.forEach(function (tile) { if (tile.fetched()) { /* if we have already fetched the tile, we know we can just draw it, * as the bounds won't have changed since the call to _getTiles. */ - this.drawTile(tile); + m_this.drawTile(tile); // mark the tile as covered - this._setTileTree(tile); + m_this._setTileTree(tile); } else { if (!tile._queued) { tile.then(function () { @@ -1210,7 +1211,7 @@ var tileLayer = function (arg) { * happens when the layer is being deleted. */ return; } - if (tile !== this.cache.get(tile.toString())) { + if (tile !== m_this.cache.get(tile.toString())) { /* If the tile has fallen out of the cache, don't draw it -- it * is untracked. This may be an indication that a larger cache * should have been used. */ @@ -1219,42 +1220,42 @@ var tileLayer = function (arg) { /* Check if a tile is still desired. Don't draw it if it * isn't. */ var mapZoom = map.zoom(), - zoom = this._options.tileRounding(mapZoom), - view = this._getViewBounds(); - if (this._canPurge(tile, view, zoom)) { - this.remove(tile); + zoom = m_this._options.tileRounding(mapZoom), + view = m_this._getViewBounds(); + if (m_this._canPurge(tile, view, zoom)) { + m_this.remove(tile); return; } - this.drawTile(tile); + m_this.drawTile(tile); // mark the tile as covered - this._setTileTree(tile); - }.bind(this)); + m_this._setTileTree(tile); + }); - this.addPromise(tile); + m_this.addPromise(tile); tile._queued = true; } else { /* If we are using a fetch queue, tell the queue so this tile can * be reprioritized. */ - var pos = this._queue ? this._queue.get(tile) : -1; + var pos = m_this._queue ? m_this._queue.get(tile) : -1; if (pos >= 0) { - this._queue.add(tile); + m_this._queue.add(tile); } } } - }.bind(this)); + }); // purge all old tiles when the new tiles are loaded (successfully or not) $.when.apply($, tiles) .done(// called on success and failure function () { - var map = this.map(), + var map = m_this.map(), mapZoom = map.zoom(), - zoom = this._options.tileRounding(mapZoom); - this._purge(zoom, true); - }.bind(this) + zoom = m_this._options.tileRounding(mapZoom); + m_this._purge(zoom, true); + } ); - return this; + return m_this; }; /** @@ -1265,13 +1266,13 @@ var tileLayer = function (arg) { * @param {geo.tile} tile The tile to add. */ this._setTileTree = function (tile) { - if (this._options.keepLower) { + if (m_this._options.keepLower) { return; } var index = tile.index; - this._tileTree[index.level] = this._tileTree[index.level] || {}; - this._tileTree[index.level][index.x] = this._tileTree[index.level][index.x] || {}; - this._tileTree[index.level][index.x][index.y] = tile; + m_this._tileTree[index.level] = m_this._tileTree[index.level] || {}; + m_this._tileTree[index.level][index.x] = m_this._tileTree[index.level][index.x] || {}; + m_this._tileTree[index.level][index.x][index.y] = tile; }; /** @@ -1285,7 +1286,7 @@ var tileLayer = function (arg) { */ this._getTileTree = function (index) { return ( - (this._tileTree[index.level] || {})[index.x] || {} + (m_this._tileTree[index.level] || {})[index.x] || {} )[index.y] || null; }; @@ -1308,7 +1309,7 @@ var tileLayer = function (arg) { tiles = []; // Check one level up - tiles = this._getTileTree({ + tiles = m_this._getTileTree({ level: level - 1, x: Math.floor(x / 2), y: Math.floor(y / 2) @@ -1319,22 +1320,22 @@ var tileLayer = function (arg) { // Check one level down tiles = [ - this._getTileTree({ + m_this._getTileTree({ level: level + 1, x: 2 * x, y: 2 * y }), - this._getTileTree({ + m_this._getTileTree({ level: level + 1, x: 2 * x + 1, y: 2 * y }), - this._getTileTree({ + m_this._getTileTree({ level: level + 1, x: 2 * x, y: 2 * y + 1 }), - this._getTileTree({ + m_this._getTileTree({ level: level + 1, x: 2 * x + 1, y: 2 * y + 1 @@ -1358,7 +1359,7 @@ var tileLayer = function (arg) { this._outOfBounds = function (tile, bounds) { /* We may want to add an (n) tile edge buffer so we appear more * responsive */ - var to = this._tileOffset(tile.index.level); + var to = m_this._tileOffset(tile.index.level); var scale = 1; if (tile.index.level !== bounds.level) { scale = Math.pow(2, (bounds.level || 0) - (tile.index.level || 0)); @@ -1384,27 +1385,27 @@ var tileLayer = function (arg) { * @returns {boolean} */ this._canPurge = function (tile, bounds, zoom, doneLoading) { - if (this._options.keepLower) { + if (m_this._options.keepLower) { zoom = zoom || 0; if (zoom < tile.index.level && - tile.index.level !== this._options.minLevel) { + tile.index.level !== m_this._options.minLevel) { return true; } - if (tile.index.level === this._options.minLevel && - !this._options.wrapX && !this._options.wrapY) { + if (tile.index.level === m_this._options.minLevel && + !m_this._options.wrapX && !m_this._options.wrapY) { return false; } } else { /* For tile layers that should only keep one layer, if loading is * finished, purge all but the current layer. This is important for * semi-transparanet layers. */ - if ((doneLoading || this._isCovered(tile)) && + if ((doneLoading || m_this._isCovered(tile)) && zoom !== tile.index.level) { return true; } } if (bounds) { - return this._outOfBounds(tile, bounds); + return m_this._outOfBounds(tile, bounds); } return false; }; @@ -1421,9 +1422,9 @@ var tileLayer = function (arg) { * @returns {object} The point in level coordinates with `x` and `y`. */ this.displayToLevel = function (pt, zoom) { - var map = this.map(), + var map = m_this.map(), mapzoom = map.zoom(), - roundzoom = this._options.tileRounding(mapzoom), + roundzoom = m_this._options.tileRounding(mapzoom), unit = map.unitsPerPixel(zoom === undefined ? roundzoom : zoom), gcsPt; if (pt === undefined) { @@ -1433,14 +1434,14 @@ var tileLayer = function (arg) { /* displayToGcs can fail under certain projections. If this happens, * just return the origin. */ try { - gcsPt = map.displayToGcs(pt, this._options.gcs || null); + gcsPt = map.displayToGcs(pt, m_this._options.gcs || null); } catch (err) { gcsPt = {x: 0, y: 0}; } /* Reverse the y coordinate, since we expect the gcs coordinate system * to be right-handed and the level coordinate system to be * left-handed. */ - var lvlPt = {x: gcsPt.x / unit, y: this._topDown() * gcsPt.y / unit}; + var lvlPt = {x: gcsPt.x / unit, y: m_this._topDown() * gcsPt.y / unit}; return lvlPt; }; @@ -1453,19 +1454,19 @@ var tileLayer = function (arg) { */ this.url = function (url) { if (url === undefined) { - return this._options.originalUrl; + return m_this._options.originalUrl; } - if (url === this._options.originalUrl) { - return this; + if (url === m_this._options.originalUrl) { + return m_this; } - this._options.originalUrl = url; + m_this._options.originalUrl = url; if ($.type(url) === 'string') { url = m_tileUrlFromTemplate(url); } - this._options.url = url; - this.reset(); - this.map().draw(); - return this; + m_this._options.url = url; + m_this.reset(); + m_this.map().draw(); + return m_this; }; /** @@ -1477,7 +1478,7 @@ var tileLayer = function (arg) { */ this.subdomains = function (subdomains) { if (subdomains === undefined) { - return this._options.subdomains; + return m_this._options.subdomains; } if (subdomains) { if ($.type(subdomains) === 'string') { @@ -1487,11 +1488,11 @@ var tileLayer = function (arg) { subdomains = subdomains.split(''); } } - this._options.subdomains = subdomains; - this.reset(); - this.map().draw(); + m_this._options.subdomains = subdomains; + m_this.reset(); + m_this.map().draw(); } - return this; + return m_this; }; /** @@ -1503,7 +1504,7 @@ var tileLayer = function (arg) { */ this._tileOffset = function (level) { if (m_tileOffsetValues[level] === undefined) { - m_tileOffsetValues[level] = this._options.tileOffset(level); + m_tileOffsetValues[level] = m_this._options.tileOffset(level); } return m_tileOffsetValues[level]; }; @@ -1520,14 +1521,14 @@ var tileLayer = function (arg) { if (val === undefined) { return s_visible(); } - if (this.visible() !== val) { + if (m_this.visible() !== val) { s_visible(val); if (val) { - this._update(); + m_this._update(); } } - return this; + return m_this; }; /** @@ -1539,15 +1540,15 @@ var tileLayer = function (arg) { var sublayer; // call super method - s_init.apply(this, arguments); + s_init.apply(m_this, arguments); - if (this.renderer() === null) { + if (m_this.renderer() === null) { // Initialize sublayers in the correct order - for (sublayer = 0; sublayer <= this._options.maxLevel; sublayer += 1) { - this._getSubLayer(sublayer); + for (sublayer = 0; sublayer <= m_this._options.maxLevel; sublayer += 1) { + m_this._getSubLayer(sublayer); } } - return this; + return m_this; }; /** @@ -1556,11 +1557,11 @@ var tileLayer = function (arg) { * @returns {this} */ this._exit = function () { - this.reset(); + m_this.reset(); // call super method - s_exit.apply(this, arguments); + s_exit.apply(m_this, arguments); m_exited = true; - return this; + return m_this; }; adjustLayerForRenderer('tile', this); diff --git a/src/ui/colorLegendWidget.js b/src/ui/colorLegendWidget.js index 51f04f3579..ff3d29e7d7 100644 --- a/src/ui/colorLegendWidget.js +++ b/src/ui/colorLegendWidget.js @@ -72,7 +72,7 @@ var colorLegendWidget = function (arg) { .attr('class', 'color-legend-popup'); if (arg.categories) { - this.categories(arg.categories); + m_this.categories(arg.categories); } }; @@ -136,9 +136,9 @@ var colorLegendWidget = function (arg) { if (categories === undefined) { return m_categories; } - m_categories = this._prepareCategories(categories); - this._draw(); - return this; + m_categories = m_this._prepareCategories(categories); + m_this._draw(); + return m_this; }; /** @@ -148,9 +148,9 @@ var colorLegendWidget = function (arg) { * @returns {this} The current class instance. */ this.addCategories = function (categories) { - m_categories = m_categories.concat(this._prepareCategories(categories)); - this._draw(); - return this; + m_categories = m_categories.concat(m_this._prepareCategories(categories)); + m_this._draw(); + return m_this; }; /** @@ -165,8 +165,8 @@ var colorLegendWidget = function (arg) { m_categories = m_categories.filter(function (category) { return categories.indexOf(category) === -1; }); - this._draw(); - return this; + m_this._draw(); + return m_this; }; /** @@ -357,7 +357,7 @@ var colorLegendWidget = function (arg) { if (category.endAxisLabelOnly) { axis.tickValues([category.domain[0], category.domain[category.domain.length - 1]]); } - this._renderAxis(svg, axis); + m_this._renderAxis(svg, axis); }; /** diff --git a/src/ui/scaleWidget.js b/src/ui/scaleWidget.js index c6c47a7203..01a0f791aa 100644 --- a/src/ui/scaleWidget.js +++ b/src/ui/scaleWidget.js @@ -276,7 +276,7 @@ var scaleWidget = function (arg) { * Update the widget upon panning. */ this._update = function () { - this._render(); + m_this._render(); }; /** diff --git a/src/ui/widget.js b/src/ui/widget.js index 45185d050b..be53261719 100644 --- a/src/ui/widget.js +++ b/src/ui/widget.js @@ -153,7 +153,7 @@ var widget = function (arg) { */ this.position = function (pos, actualValue) { if (pos !== undefined) { - this.layer().geoOff(geo_event.pan, m_this.repositionEvent); + m_this.layer().geoOff(geo_event.pan, m_this.repositionEvent); var clearPosition = {}; for (var attr in m_position) { if (m_position.hasOwnProperty(attr)) { @@ -162,10 +162,10 @@ var widget = function (arg) { } m_position = pos; if (m_position.hasOwnProperty('x') && m_position.hasOwnProperty('y')) { - this.layer().geoOn(geo_event.pan, m_this.repositionEvent); + m_this.layer().geoOn(geo_event.pan, m_this.repositionEvent); } - this.reposition($.extend(clearPosition, m_this.position())); - return this; + m_this.reposition($.extend(clearPosition, m_this.position())); + return m_this; } if (m_position.hasOwnProperty('x') && m_position.hasOwnProperty('y') && !actualValue) { var position = m_this.layer().map().gcsToDisplay(m_position); diff --git a/src/vtkjs/pointFeature.js b/src/vtkjs/pointFeature.js index 7369964e39..87408c37c3 100644 --- a/src/vtkjs/pointFeature.js +++ b/src/vtkjs/pointFeature.js @@ -68,7 +68,7 @@ var vtkjs_pointFeature = function (arg) { m_actor = vtkActor.newInstance(); m_actor.setMapper(mapper); m_actor.getProperty().setAmbient(1); - this.renderer().contextRenderer().addActor(m_actor); + m_this.renderer().contextRenderer().addActor(m_actor); }; /** @@ -77,7 +77,7 @@ var vtkjs_pointFeature = function (arg) { this._init = function () { s_init.call(m_this, arg); m_this.renderer().contextRenderer().setLayer(1); - this._createPipeline(); + m_this._createPipeline(); }; /** diff --git a/src/vtkjs/vtkjsRenderer.js b/src/vtkjs/vtkjsRenderer.js index fc3965b6bd..3cd047867b 100644 --- a/src/vtkjs/vtkjsRenderer.js +++ b/src/vtkjs/vtkjsRenderer.js @@ -108,7 +108,7 @@ var vtkjsRenderer = function (arg) { * readding the animation frame request, but this doesn't work for if the * reschedule occurs during another animation frame callback (it then waits * until a subsequent frame). */ - m_this.layer().map().scheduleAnimationFrame(this._renderFrame, true); + m_this.layer().map().scheduleAnimationFrame(m_this._renderFrame, true); return m_this; }; diff --git a/src/webgl/quadFeature.js b/src/webgl/quadFeature.js index 6ed429a199..b6085f7fdb 100644 --- a/src/webgl/quadFeature.js +++ b/src/webgl/quadFeature.js @@ -177,7 +177,7 @@ var webgl_quadFeature = function (arg) { if (!m_this.position()) { return; } - m_quads = this._generateQuads(); + m_quads = m_this._generateQuads(); /* Create an actor to render image quads */ if (m_quads.imgQuads.length && !m_actor_image) { m_this.visible(false); diff --git a/src/webgl/tileLayer.js b/src/webgl/tileLayer.js index 3b1c354625..1f58375663 100644 --- a/src/webgl/tileLayer.js +++ b/src/webgl/tileLayer.js @@ -14,10 +14,10 @@ var webgl_tileLayer = function () { if (!m_quadFeature) { return; } - var bounds = this._tileBounds(tile), + var bounds = m_this._tileBounds(tile), level = tile.index.level || 0, - to = this._tileOffset(level), - crop = this.tileCropFromBounds(tile), + to = m_this._tileOffset(level), + crop = m_this.tileCropFromBounds(tile), quad = {}; if (crop) { quad.crop = { @@ -25,16 +25,16 @@ var webgl_tileLayer = function () { y: crop.y / m_this._options.tileHeight }; } - quad.ul = this.fromLocal(this.fromLevel({ + quad.ul = m_this.fromLocal(m_this.fromLevel({ x: bounds.left - to.x, y: bounds.top - to.y }, level), 0); - quad.ll = this.fromLocal(this.fromLevel({ + quad.ll = m_this.fromLocal(m_this.fromLevel({ x: bounds.left - to.x, y: bounds.bottom - to.y }, level), 0); - quad.ur = this.fromLocal(this.fromLevel({ + quad.ur = m_this.fromLocal(m_this.fromLevel({ x: bounds.right - to.x, y: bounds.top - to.y }, level), 0); - quad.lr = this.fromLocal(this.fromLevel({ + quad.lr = m_this.fromLocal(m_this.fromLevel({ x: bounds.right - to.x, y: bounds.bottom - to.y }, level), 0); /* Make sure our level increments are within the clipbounds and ordered so @@ -83,7 +83,7 @@ var webgl_tileLayer = function () { */ this._init = function () { s_init.apply(m_this, arguments); - m_quadFeature = this.createFeature('quad', { + m_quadFeature = m_this.createFeature('quad', { previewColor: m_this._options.previewColor, previewImage: m_this._options.previewImage }); diff --git a/src/webgl/webglRenderer.js b/src/webgl/webglRenderer.js index a95ab1944e..7ba97439d0 100644 --- a/src/webgl/webglRenderer.js +++ b/src/webgl/webglRenderer.js @@ -143,7 +143,7 @@ var webglRenderer = function (arg) { * readding the animation frame request, but this doesn't work for if the * reschedule occurs during another animation frame callback (it then waits * until a subsequent frame). */ - m_this.layer().map().scheduleAnimationFrame(this._renderFrame, true); + m_this.layer().map().scheduleAnimationFrame(m_this._renderFrame, true); return m_this; }; @@ -177,15 +177,15 @@ var webglRenderer = function (arg) { * Exit. */ this._exit = function () { - m_this.layer().map().scheduleAnimationFrame(this._renderFrame, 'remove'); + m_this.layer().map().scheduleAnimationFrame(m_this._renderFrame, 'remove'); m_this.canvas().remove(); if (m_viewer) { var renderState = new vgl.renderState(); renderState.m_renderer = m_viewer; - renderState.m_context = this._glContext(); + renderState.m_context = m_this._glContext(); m_viewer.exit(renderState); - if (this._glContext() !== vgl.GL && this._glContext().getExtension('WEBGL_lose_context') && this._glContext().getExtension('WEBGL_lose_context').loseContext) { - this._glContext().getExtension('WEBGL_lose_context').loseContext(); + if (m_this._glContext() !== vgl.GL && m_this._glContext().getExtension('WEBGL_lose_context') && m_this._glContext().getExtension('WEBGL_lose_context').loseContext) { + m_this._glContext().getExtension('WEBGL_lose_context').loseContext(); } } // make sure we clear shaders associated with the generate context, too