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 async = require('async');
|
||||
const os = require('os');
|
||||
const assert = require('assert');
|
||||
const logger = require('./logger');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const rmdir = require('rimraf');
|
||||
const odmRunner = require('./odmRunner');
|
||||
const odmInfo = require('./odmInfo');
|
||||
const processRunner = require('./processRunner');
|
||||
const Directories = require('./Directories');
|
||||
const kill = require('tree-kill');
|
||||
|
@ -58,6 +60,26 @@ module.exports = class Task{
|
|||
this.progress = 0;
|
||||
|
||||
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
|
||||
cb => {
|
||||
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');
|
||||
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){
|
||||
if (odmOptions){
|
||||
done(null, odmOptions);
|
||||
|
|
|
@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
"use strict";
|
||||
let fs = require('fs');
|
||||
let os = require('os');
|
||||
let path = require('path');
|
||||
let assert = require('assert');
|
||||
let spawn = require('child_process').spawn;
|
||||
|
@ -29,7 +30,7 @@ module.exports = {
|
|||
assert(projectName !== undefined, "projectName must be specified");
|
||||
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 = [];
|
||||
|
||||
for (var name in options){
|
||||
|
@ -123,6 +124,7 @@ module.exports = {
|
|||
// Launch
|
||||
const env = utils.clone(process.env);
|
||||
env.ODM_OPTIONS_TMP_FILE = utils.tmpPath(".json");
|
||||
env.ODM_PATH = config.odm_path;
|
||||
let childProcess = spawn(pythonExe, [path.join(__dirname, "..", "helpers", "odmOptionsToJson.py"),
|
||||
"--project-path", config.odm_path, "bogusname"], { env });
|
||||
|
||||
|
@ -155,10 +157,14 @@ module.exports = {
|
|||
.on('error', handleResult);
|
||||
}
|
||||
|
||||
// Try Python3 first
|
||||
getOdmOptions("python3", (err, result) => {
|
||||
if (err) getOdmOptions("python", done);
|
||||
else done(null, result);
|
||||
});
|
||||
if (os.platform() === "win32"){
|
||||
getOdmOptions("helpers\\odm_python.bat", done);
|
||||
}else{
|
||||
// Try Python3 first
|
||||
getOdmOptions("python3", (err, result) => {
|
||||
if (err) getOdmOptions("python", done);
|
||||
else done(null, result);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
background-color: #3d74d4;
|
||||
border-color: #4582ec;
|
||||
}
|
||||
.task{
|
||||
background: white;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="css/main.css?t=1">
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue