File indexing completed on 2025-01-05 03:53:10
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2012-03-15 0007 * Description : a tool to create panorama by fusion of several images. 0008 * 0009 * SPDX-FileCopyrightText: 2012-2016 by Benjamin Girault <benjamin dot girault at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "cpfindtask.h" 0016 0017 // Qt includes 0018 0019 #include <QFile> 0020 0021 namespace DigikamGenericPanoramaPlugin 0022 { 0023 0024 CpFindTask::CpFindTask(const QString& workDirPath, 0025 const QUrl& input, 0026 QUrl& cpFindUrl, 0027 bool celeste, 0028 const QString& cpFindPath) 0029 : CommandTask (PANO_CPFIND, workDirPath, cpFindPath), 0030 cpFindPtoUrl (cpFindUrl), 0031 celeste (celeste), 0032 ptoUrl (input) 0033 { 0034 } 0035 0036 void CpFindTask::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*) 0037 { 0038 // Run CPFind to get control points and order the images 0039 0040 cpFindPtoUrl = tmpDir; 0041 cpFindPtoUrl.setPath(cpFindPtoUrl.path() + QLatin1String("cp_pano.pto")); 0042 0043 QStringList args; 0044 0045 if (celeste) 0046 { 0047 args << QLatin1String("--celeste"); 0048 } 0049 0050 args << QLatin1String("-o"); 0051 args << cpFindPtoUrl.toLocalFile(); 0052 args << ptoUrl.toLocalFile(); 0053 0054 runProcess(args); 0055 0056 // CPFind does not return an error code when something went wrong... 0057 0058 QFile ptoOutput(cpFindPtoUrl.toLocalFile()); 0059 0060 if (!ptoOutput.exists()) 0061 { 0062 successFlag = false; 0063 errString = getProcessError(); 0064 } 0065 0066 printDebug(QLatin1String("cpfind")); 0067 } 0068 0069 } // namespace DigikamGenericPanoramaPlugin