kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Start on Windows, post-process logic
rodzic
f986888e67
commit
e30718c567
|
@ -0,0 +1,8 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
call %ODM_PATH%\win32env.bat
|
||||||
|
python %*
|
||||||
|
|
||||||
|
endlocal
|
32
libs/Task.js
32
libs/Task.js
|
@ -19,12 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const config = require('../config');
|
const config = require('../config');
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
const os = require('os');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const logger = require('./logger');
|
const logger = require('./logger');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const rmdir = require('rimraf');
|
const rmdir = require('rimraf');
|
||||||
const odmRunner = require('./odmRunner');
|
const odmRunner = require('./odmRunner');
|
||||||
|
const odmInfo = require('./odmInfo');
|
||||||
const processRunner = require('./processRunner');
|
const processRunner = require('./processRunner');
|
||||||
const Directories = require('./Directories');
|
const Directories = require('./Directories');
|
||||||
const kill = require('tree-kill');
|
const kill = require('tree-kill');
|
||||||
|
@ -58,6 +60,26 @@ module.exports = class Task{
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
|
// Handle post-processing options logic
|
||||||
|
cb => {
|
||||||
|
// If we need to post process results
|
||||||
|
// if pc-ept is supported (build entwine point cloud)
|
||||||
|
// we automatically add the pc-ept option to the task options by default
|
||||||
|
if (skipPostProcessing) cb();
|
||||||
|
else{
|
||||||
|
odmInfo.supportsOption("pc-ept", (err, supported) => {
|
||||||
|
if (err){
|
||||||
|
console.warn(`Cannot check for supported option pc-ept: ${err}`);
|
||||||
|
}else if (supported){
|
||||||
|
if (!this.options.find(opt => opt.name === "pc-ept")){
|
||||||
|
this.options.push({ name: 'pc-ept', value: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Read images info
|
// Read images info
|
||||||
cb => {
|
cb => {
|
||||||
fs.readdir(this.getImagesFolderPath(), (err, files) => {
|
fs.readdir(this.getImagesFolderPath(), (err, files) => {
|
||||||
|
@ -432,7 +454,15 @@ module.exports = class Task{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.skipPostProcessing) tasks.push(runPostProcessingScript());
|
// postprocess.sh is still here for legacy/backward compatibility
|
||||||
|
// purposes, but we might remove it in the future. The new logic
|
||||||
|
// instructs the processing engine to do the necessary processing
|
||||||
|
// of outputs without post processing steps (build EPT).
|
||||||
|
// We're leaving it here only for Linux/docker setups, but will not
|
||||||
|
// be triggered on Windows.
|
||||||
|
if (os.platform() !== "win32" && !this.skipPostProcessing){
|
||||||
|
tasks.push(runPostProcessingScript());
|
||||||
|
}
|
||||||
|
|
||||||
const taskOutputFile = path.join(this.getProjectFolderPath(), 'task_output.txt');
|
const taskOutputFile = path.join(this.getProjectFolderPath(), 'task_output.txt');
|
||||||
tasks.push(saveTaskOutput(taskOutputFile));
|
tasks.push(saveTaskOutput(taskOutputFile));
|
||||||
|
|
|
@ -58,6 +58,15 @@ module.exports = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
supportsOption: function(optName, cb){
|
||||||
|
this.getOptions((err, json) => {
|
||||||
|
if (err) cb(err);
|
||||||
|
else{
|
||||||
|
cb(null, !!json.find(opt => opt.name === optName));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getOptions: function(done){
|
getOptions: function(done){
|
||||||
if (odmOptions){
|
if (odmOptions){
|
||||||
done(null, odmOptions);
|
done(null, odmOptions);
|
||||||
|
|
|
@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
"use strict";
|
"use strict";
|
||||||
let fs = require('fs');
|
let fs = require('fs');
|
||||||
|
let os = require('os');
|
||||||
let path = require('path');
|
let path = require('path');
|
||||||
let assert = require('assert');
|
let assert = require('assert');
|
||||||
let spawn = require('child_process').spawn;
|
let spawn = require('child_process').spawn;
|
||||||
|
@ -28,8 +29,8 @@ module.exports = {
|
||||||
run: function(options, projectName, done, outputReceived){
|
run: function(options, projectName, done, outputReceived){
|
||||||
assert(projectName !== undefined, "projectName must be specified");
|
assert(projectName !== undefined, "projectName must be specified");
|
||||||
assert(options["project-path"] !== undefined, "project-path must be defined");
|
assert(options["project-path"] !== undefined, "project-path must be defined");
|
||||||
|
|
||||||
const command = path.join(config.odm_path, "run.sh"),
|
const command = path.join(config.odm_path, os.platform() === "win32" ? "run.bat" : "run.sh"),
|
||||||
params = [];
|
params = [];
|
||||||
|
|
||||||
for (var name in options){
|
for (var name in options){
|
||||||
|
@ -123,6 +124,7 @@ module.exports = {
|
||||||
// Launch
|
// Launch
|
||||||
const env = utils.clone(process.env);
|
const env = utils.clone(process.env);
|
||||||
env.ODM_OPTIONS_TMP_FILE = utils.tmpPath(".json");
|
env.ODM_OPTIONS_TMP_FILE = utils.tmpPath(".json");
|
||||||
|
env.ODM_PATH = config.odm_path;
|
||||||
let childProcess = spawn(pythonExe, [path.join(__dirname, "..", "helpers", "odmOptionsToJson.py"),
|
let childProcess = spawn(pythonExe, [path.join(__dirname, "..", "helpers", "odmOptionsToJson.py"),
|
||||||
"--project-path", config.odm_path, "bogusname"], { env });
|
"--project-path", config.odm_path, "bogusname"], { env });
|
||||||
|
|
||||||
|
@ -154,11 +156,15 @@ module.exports = {
|
||||||
})
|
})
|
||||||
.on('error', handleResult);
|
.on('error', handleResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try Python3 first
|
if (os.platform() === "win32"){
|
||||||
getOdmOptions("python3", (err, result) => {
|
getOdmOptions("helpers\\odm_python.bat", done);
|
||||||
if (err) getOdmOptions("python", done);
|
}else{
|
||||||
else done(null, result);
|
// Try Python3 first
|
||||||
});
|
getOdmOptions("python3", (err, result) => {
|
||||||
|
if (err) getOdmOptions("python", done);
|
||||||
|
else done(null, result);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
background-color: #3d74d4;
|
background-color: #3d74d4;
|
||||||
border-color: #4582ec;
|
border-color: #4582ec;
|
||||||
}
|
}
|
||||||
|
.task{
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="css/main.css?t=1">
|
<link rel="stylesheet" href="css/main.css?t=1">
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue