Skip to content

Commit

Permalink
Merge pull request #959 from fredj/rm_goog.array
Browse files Browse the repository at this point in the history
Get rid of goog.array.* functions
  • Loading branch information
fredj committed Mar 30, 2016
2 parents 8b6a8a3 + 0715698 commit 568e21f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion buildtools/mako_build.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ _ngeo_folder = '' if ngeo_folder is UNDEFINED else ngeo_folder
"${_ngeo_folder}externs/mapfish-print-v3.js"
],
"define": [
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
"goog.dom.ASSUME_STANDARDS_MODE=true",
"goog.DEBUG=false",
"ol.ENABLE_DOM=false",
Expand Down
13 changes: 9 additions & 4 deletions contribs/gmf/src/directives/layertree.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ goog.require('ngeo.CreatePopup');
goog.require('ngeo.LayerHelper');
goog.require('ngeo.LayertreeController');
goog.require('ol.Collection');
goog.require('ol.array');
goog.require('ol.layer.Tile');


Expand Down Expand Up @@ -556,11 +557,13 @@ gmf.LayertreeController.prototype.toggleActive = function(treeCtrl) {
source.getParams()['LAYERS'].split(',') : [];
if (isActive) {
for (i = 0; i < nodeNames.length; i++) {
goog.array.remove(layers, nodeNames[i]);
ol.array.remove(layers, nodeNames[i]);
}
} else {
for (i = 0; i < nodeNames.length; i++) {
goog.array.insert(layers, nodeNames[i]);
if (!ol.array.includes(layers, nodeNames[i])) {
layers.push(nodeNames[i]);
}
}
}
firstParentTreeLayer = /** @type {ol.layer.Image} */
Expand Down Expand Up @@ -621,9 +624,11 @@ gmf.LayertreeController.prototype.getNodeState = function(treeCtrl) {

// Update group state
if (style === 'on') {
goog.array.insert(currentLayersNames, node.name);
if (!ol.array.includes(currentLayersNames, node.name)) {
currentLayersNames.push(node.name);
}
} else {
goog.array.remove(currentLayersNames, node.name);
ol.array.remove(currentLayersNames, node.name);
}

break;
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/directives/themeselector.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ gmf.ThemeselectorController.prototype.setThemes_ = function() {
themeName = pathElements[pathElements.length - 1];
}
}
currentTheme = goog.array.find(this.themes, function(object) {
currentTheme = ol.array.find(this.themes, function(object) {
return object['name'] === themeName;
});

Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/services/themesservice.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
goog.provide('gmf.Themes');

goog.require('gmf');
goog.require('goog.array');
goog.require('ngeo.LayerHelper');
goog.require('ol.array');
goog.require('ol.events.EventTarget');
goog.require('ol.layer.Tile');

Expand Down Expand Up @@ -134,7 +134,7 @@ gmf.Themes.findGroupByName = function(themes, name) {
* @private
*/
gmf.Themes.findObjectByName_ = function(objects, objectName) {
return goog.array.find(objects, function(object) {
return ol.array.find(objects, function(object) {
return object['name'] === objectName;
});
};
Expand Down
3 changes: 2 additions & 1 deletion src/services/layerHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ goog.provide('ngeo.LayerHelper');

goog.require('ngeo');
goog.require('ol.Collection');
goog.require('ol.array');
goog.require('ol.format.WMTSCapabilities');
goog.require('ol.layer.Group');
goog.require('ol.layer.Image');
Expand Down Expand Up @@ -92,7 +93,7 @@ ngeo.LayerHelper.prototype.createWMTSLayerFromCapabilitites = function(

// Add styles from capabilities as param of the layer
var layers = result['Contents']['Layer'];
var l = goog.array.find(layers, function(elt, index, array) {
var l = ol.array.find(layers, function(elt, index, array) {
return elt['Identifier'] == layerName;
});
layer.set('capabilitiesStyles', l['Style']);
Expand Down

0 comments on commit 568e21f

Please sign in to comment.