comparison framework/Align.h @ 423:f32a64149602 alignment_view

Make alignment using an external program asynchronous
author Chris Cannam
date Thu, 20 Nov 2014 15:46:19 +0000
parents 33fae747db7e
children b23db4cef02f
comparison
equal deleted inserted replaced
422:33fae747db7e 423:f32a64149602
15 15
16 #ifndef ALIGN_H 16 #ifndef ALIGN_H
17 #define ALIGN_H 17 #define ALIGN_H
18 18
19 #include <QString> 19 #include <QString>
20 #include <QObject>
21 #include <QProcess>
22 #include <set>
20 23
21 class Model; 24 class Model;
25 class AlignmentModel;
22 26
23 class Align 27 class Align : public QObject
24 { 28 {
29 Q_OBJECT
30
25 public: 31 public:
26 Align() : m_error("") { } 32 Align() : m_error("") { }
27 33
34 /**
35 * Align the "other" model to the reference, attaching an
36 * AlignmentModel to it. Alignment is carried out by the method
37 * configured in the user preferences (either a plugin transform
38 * or an external process) and is done asynchronously.
39 *
40 * A single Align object may carry out many simultanous alignment
41 * calls -- you do not need to create a new Align object each
42 * time, nor to wait for an alignment to be complete before
43 * starting a new one.
44 *
45 * The Align object must survive after this call, for at least as
46 * long as the alignment takes. There is currently no way in this
47 * API to discover when an alignment is complete -- the
48 * expectation is that the Align object will simply share the
49 * process or document lifespan.
50 */
28 bool alignModel(Model *reference, Model *other); // via user preference 51 bool alignModel(Model *reference, Model *other); // via user preference
29 52
30 bool alignModelViaTransform(Model *reference, Model *other); 53 bool alignModelViaTransform(Model *reference, Model *other);
31 bool alignModelViaProgram(Model *reference, Model *other, QString program); 54 bool alignModelViaProgram(Model *reference, Model *other, QString program);
32 55
33 QString getError() const { return m_error; } 56 QString getError() const { return m_error; }
34 57
58 private slots:
59 void alignmentProgramFinished(int, QProcess::ExitStatus);
60
35 private: 61 private:
36 QString m_error; 62 QString m_error;
63 std::map<QProcess *, AlignmentModel *> m_processModels;
37 }; 64 };
38 65
39 #endif 66 #endif
40 67