Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions middlewares/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@
const arrArgsS = ['-s'];
const arrArgsG = ['-g'];
const arrArgsO = ['-or'];
const arrArgsRc = ['-rc'];
const arrArgsSc = ['-sc'];
const arrArgsOc = ['-orc'];
patches.forEach((patch) => {
arrArgsR.push(patch.withRgb ? patch.urlOpiRefRgb : patch.urlOpiRefIr);
arrArgsS.push(patch.withRgb ? patch.urlOpiSecRgb : patch.urlOpiSecIr);
Expand All @@ -246,8 +249,14 @@
} else {
arrArgsO.push(patch.withOrig ? patch.urlOrthoIrOrig : patch.urlOrthoIr);
}
if (patch.withRgb && patch.withIr) {
arrArgsRc.push(patch.urlOpiRefIr);
arrArgsSc.push(patch.urlOpiSecIr);
arrArgsOc.push(patch.withOrig ? patch.urlOrthoIrOrig : patch.urlOrthoIr);
}
});
const arrArgs = [...arrArgsR, ...arrArgsS, ...arrArgsG, ...arrArgsO, '-p', geojsonPath];
const arrArgs = [...arrArgsR, ...arrArgsRc, ...arrArgsS, ...arrArgsSc,
...arrArgsG, ...arrArgsO, ...arrArgsOc, '-p', geojsonPath];
const options = {
weightDiffCost: 0.95,
weightTransition: 10,
Expand All @@ -270,7 +279,7 @@
(err, stdout) => {
debugOzcpp(stdout);
if (err) {
console.warn(err);

Check warning on line 282 in middlewares/patch.js

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement
rej(err);
} else {
res(`${stdout} OK`);
Expand All @@ -279,19 +288,6 @@
});
}

// Maybe move that function to a specifique file.js file
// duplicate in regress\test-API\3_branch
function copyFileSync(source, target) {
let targetFile = target;
// If target is a directory, the copy will have the same name as the source
if (fs.existsSync(target)) {
if (fs.lstatSync(target).isDirectory()) {
targetFile = path.join(target, path.basename(source));
}
}
fs.writeFileSync(targetFile, fs.readFileSync(source));
}

async function applyPatch(pgClient, overviews, dirCache, idBranch, geojson) {
const feature = geojson.features[0];
debug('applyPatch', feature);
Expand Down Expand Up @@ -364,18 +360,9 @@
'out_ortho',
`out_${filename}_georef.tif`);
}
if (patch.withIr && patch.withRgb) {
debug(' >>>> RGB + IR');
console.warn('WARNING: Cache RGB + IR : le nouveau patch ne sera pas appliqué aux images IR');
patch.urlOrthoIrOutput = path.join(dirCache,
'ortho', patch.cogPath.dirPath,
`${idBranch}_${patch.cogPath.filename}_${newPatchNum}i.tif`);

const urlOrthoIr = patch.withOrig ? patch.urlOrthoIrOrig : patch.urlOrthoIr;
copyFileSync(urlOrthoIr, patch.urlOrthoIrOutput);
Comment thread
ftoromanoff marked this conversation as resolved.
}
if (patch.withIr && !patch.withRgb) {
debug(' >>>> IR seul');
if (patch.withIr) {
debug(' >>>> IR');
patch.urlOrthoIrOutput = path.join(urlOutputData,
'out_ortho',
`out_${filename}i_georef.tif`);
Expand Down Expand Up @@ -461,7 +448,7 @@
debug(' historique :', history);
fs.writeFileSync(`${urlHistory}`, history);
} else {
debug('history n\'existe pas encore');
debug('le fichier \'history\' n\'existe pas encore');
const history = `orig;${newPatchNum}`;
fs.writeFileSync(`${urlHistory}`, history);
// On a pas besoin de renommer l'image d'origine
Expand Down
3 changes: 2 additions & 1 deletion regress/data/ozcpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ mkdir -p ./cache_test/cache_test_RGBIR/result_ozcpp_idBr10/out_graph
mkdir -p ./cache_test/cache_test_RGBIR/result_ozcpp_idBr10/out_ortho

cp ./cache_test/cache_test_RGBIR/graph/21/00/00/01/VN/6_AQ.tif ./cache_test/cache_test_RGBIR/result_ozcpp_idBr10/out_graph/out_10_AQ_georef.tif
cp ./cache_test/cache_test_RGBIR/ortho/21/00/00/01/VN/6_AQ.tif ./cache_test/cache_test_RGBIR/result_ozcpp_idBr10/out_ortho/out_10_AQ_georef.tif
cp ./cache_test/cache_test_RGBIR/ortho/21/00/00/01/VN/6_AQ.tif ./cache_test/cache_test_RGBIR/result_ozcpp_idBr10/out_ortho/out_10_AQ_georef.tif
cp ./cache_test/cache_test_RGBIR/ortho/21/00/00/01/VN/6_AQi.tif ./cache_test/cache_test_RGBIR/result_ozcpp_idBr10/out_ortho/out_10_AQi_georef.tif
Loading