Skip to content

Commit

Permalink
Merge pull request #968 from OpenGeoscience/more-m-this
Browse files Browse the repository at this point in the history
Shift many this references to m_this.
  • Loading branch information
manthey authored Dec 4, 2018
2 parents 664ca5d + f6a2d83 commit 42d1d39
Show file tree
Hide file tree
Showing 31 changed files with 322 additions and 321 deletions.
4 changes: 2 additions & 2 deletions src/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
}
Expand Down Expand Up @@ -481,7 +481,7 @@ var annotation = function (type, args) {
annotation: m_this
});
}
return this;
return m_this;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/annotationLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/canvas/canvasRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
6 changes: 3 additions & 3 deletions src/canvas/quadFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
};

Expand Down
16 changes: 8 additions & 8 deletions src/canvas/tileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
});
Expand Down
2 changes: 1 addition & 1 deletion src/contourFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/featureLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + '"');
}
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
52 changes: 26 additions & 26 deletions src/fetchQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});

Expand All @@ -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; }
});

/**
Expand All @@ -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; }
});

/**
Expand All @@ -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;
};

/**
Expand All @@ -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;
}
}
Expand All @@ -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;
Expand All @@ -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);
}
};

Expand All @@ -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);
};

/**
Expand All @@ -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;
Expand All @@ -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;
};

/**
Expand All @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/geojsonReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ var geojsonReader = function (arg) {

m_this._readObject(file, _done, progress);
});
this.addPromise(promise);
m_this.addPromise(promise);
return promise;
};
};
Expand Down
2 changes: 1 addition & 1 deletion src/heatmapFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ var heatmapFeature = function (arg) {
* @returns {geo.heatmap}
*/
this.gcsPosition = function () {
this._update();
m_this._update();
return m_gcsPosition;
};

Expand Down
4 changes: 2 additions & 2 deletions src/isolineFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
}
Expand Down
4 changes: 2 additions & 2 deletions src/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down Expand Up @@ -258,7 +258,7 @@ var layer = function (arg) {
m_active = arg;
m_node.toggleClass('active', m_active);
}
return this;
return m_this;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lineFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ var map = function (arg) {
}
m_animationQueue = queue;
}
return this;
return m_this;
};

/**
Expand All @@ -238,7 +238,7 @@ var map = function (arg) {
$(window).on('resize', resizeSelf);
}
}
return this;
return m_this;
};

/**
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
};

/**
Expand Down Expand Up @@ -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);
}
Expand Down
Loading

0 comments on commit 42d1d39

Please sign in to comment.