Skip to content

Commit

Permalink
Merge pull request #175 from VCityTeam/dev
Browse files Browse the repository at this point in the history
2.31.9
  • Loading branch information
EricBoix authored May 31, 2021
2 parents 2f3cd1e + 9e0a947 commit 77d6b5c
Show file tree
Hide file tree
Showing 21 changed files with 883 additions and 307 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# @format

branches:
only:
- master

os: linux
dist: focal
language: node_js
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ud-viz",
"version": "2.31.6",
"version": "2.31.9",
"description": "A collection of itowns plugins",
"main": "src",
"scripts": {
Expand All @@ -23,12 +23,12 @@
"homepage": "https://github.com/VCityTeam/UD-Viz/",
"peerDependencies": {},
"dependencies": {
"proj4": "^2.7.0",
"three": "0.126.1",
"detect-collisions": "^2.5.2",
"itowns": "^2.31.0",
"itowns": "^2.32.0",
"jquery": "^3.6.0",
"proj4": "^2.7.0",
"socket.io-client": "^4.0.0",
"three": "0.126.1",
"vis-data": "^7.1.2",
"vis-network": "^9.0.3"
},
Expand Down
18 changes: 18 additions & 0 deletions src/Components/SystemUtils/File.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/** @format */

const jquery = require('jquery');

module.exports = {
downloadObjectAsJson: function (exportObj, exportName) {
const dataStr =
Expand All @@ -12,4 +14,20 @@ module.exports = {
downloadAnchorNode.click();
downloadAnchorNode.remove();
},
loadJSON(filePath) {
return new Promise((resolve, reject) => {
jquery.ajax({
type: 'GET',
url: filePath,
datatype: 'json',
success: (data) => {
resolve(data);
},
error: (e) => {
console.error(e);
reject();
},
});
});
},
};
29 changes: 16 additions & 13 deletions src/Components/SystemUtils/JSONUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
} else {
if (json2[key] != undefined) {
json1[key] = json2[key];
console.log('overwrite ', json1);
// console.log('overwrite ', json1);
}
}
}
Expand All @@ -20,19 +20,22 @@ module.exports = {
traverse(jsonOverWrited, jsonModel);
},

parseNumeric(json) {
const parse = function (j) {
for (let key in j) {
if (j[key] instanceof Object) {
parse(j[key]);
} else if (Type.isNumeric(j[key])) {
//console.log(j[key]);
j[key] = parseFloat(j[key]);
//console.log(j[key]);
}
parse(json, cb) {
for (let key in json) {
if (json[key] instanceof Object) {
this.parse(json[key], cb);
} else {
cb(json, key);
}
};
}
return json;
},

return parse(json);
parseNumeric(json) {
return this.parse(json, function (j, key) {
if (Type.isNumeric(j[key])) {
j[key] = parseFloat(j[key]);
}
});
},
};
Loading

0 comments on commit 77d6b5c

Please sign in to comment.