Hugin trunk 0.1
Loading...
Searching...
No Matches
Batch.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
2
27#ifndef BATCH_H
28#define BATCH_H
29
30#include <string>
31#include "ProjectArray.h"
32#include "RunStitchFrame.h"
33#include <wx/power.h>
34
35#ifndef FRAMEARRAY
36#define FRAMEARRAY
38#endif
39
45
46class Batch : public wxFrame
47{
48public:
50 {
53 SHUTDOWN = 2, // only implemented for GTK and Window in wxWidgets
54 SUSPEND = 3, // only implemented for Windows
55 HIBERNATE = 4 // only implemented for Windows
56 };
60 bool verbose;
63 bool saveLog;
64
66 explicit Batch(wxFrame* parent);
68 ~Batch();
69
75 bool AllDone();
77 void AppendBatchFile(wxString file);
79 void CancelBatch();
81 void CancelProject(int index);
83 void ChangePrefix(int index, wxString newPrefix);
87 int ClearBatch();
93 int GetIndex(int id);
95 Project* GetProject(int index);
97 int GetProjectCount();
101 int GetRunningCount();
103 Project::Status GetStatus(int index);
105 bool IsRunning();
107 bool IsPaused();
109 int LoadBatchFile(wxString file);
111 int LoadTemp();
113 bool NoErrors();
121 void PauseBatch();
123 void RemoveProject(int id);
127 void RunBatch();
129 void RunNextInBatch();
131 void SaveBatchFile(wxString file);
135 void SaveTemp();
137 void SetStatus(int index,Project::Status status);
139 void SwapProject(int index);
143 void ShowOutput(bool isVisible=true);
146 {
147 return m_failedProjects.size();
148 };
150 wxString GetFailedProjectName(unsigned int i);
152 wxString GetFailedProjectLog(unsigned int i);
153
154private:
155 // environment config objects
157 //internal list of projects in batch
159 //list of projects in progress
161
162 //batch state flags
167
168 //vector, which stores the failed projects and filename of saved logfile
169 std::vector<FailedProject> m_failedProjects;
171};
172
176
177#endif //BATCH_H
wxDECLARE_EVENT(EVT_BATCH_FAILED, wxCommandEvent)
WX_DEFINE_ARRAY_PTR(RunStitchFrame *, FrameArray)
Batch processor for Hugin.
Stitch a pto project file, with GUI output etc.
Definition Batch.h:47
void RemoveProject(int id)
Removes project with id from batch list.
Definition Batch.cpp:729
int ClearBatch()
Clears batch list and returns 0 if succesful.
Definition Batch.cpp:221
bool deleteFiles
Definition Batch.h:57
void RunBatch()
Starts batch execution.
Definition Batch.cpp:764
EndTask
Definition Batch.h:50
@ SUSPEND
Definition Batch.h:54
@ CLOSE_PTBATCHERGUI
Definition Batch.h:52
@ HIBERNATE
Definition Batch.h:55
@ SHUTDOWN
Definition Batch.h:53
@ DO_NOTHING
Definition Batch.h:51
void ChangeUserDefined(int index, wxString newUserDefined)
Changes user defined sequence for project at index.
Definition Batch.cpp:216
int GetRunningCount()
Returns number of projects currently in progress.
Definition Batch.cpp:313
void SaveBatchFile(wxString file)
Saves batch list to file.
Definition Batch.cpp:851
std::vector< FailedProject > m_failedProjects
Definition Batch.h:169
void RemoveProjectAtIndex(int selIndex)
Removes project at index from batch list.
Definition Batch.cpp:741
bool CompareProjectsInLists(int stitchListIndex, int batchListIndex)
Compares two project at indexes in both lists and returns true if they have identical project ids.
Definition Batch.cpp:248
wxString GetFailedProjectLog(unsigned int i)
returns log file name of failed project with index i
Definition Batch.cpp:943
bool AllDone()
Returns true if there are no more projects pending execution.
Definition Batch.cpp:100
void AddProjectToBatch(wxString projectFile, wxString outputFile=wxEmptyString, wxString userDefinedSequence=wxEmptyString, Project::Target target=Project::STITCHING)
Adds a project entry in the batch list.
Definition Batch.cpp:80
bool IsPaused()
Returns true if batch execution is currently paused.
Definition Batch.cpp:336
bool m_clearedInProgress
Definition Batch.h:166
void OnProcessTerminate(wxProcessEvent &event)
Called internally when all running processes have completed and need to be removed from running list.
Definition Batch.cpp:384
void PauseBatch()
Pauses and continues batch execution.
Definition Batch.cpp:695
void AddAppToBatch(wxString app)
Adds an application entry in the batch list.
Definition Batch.cpp:74
wxConfigBase * m_config
Definition Batch.h:156
Project * GetProject(int index)
Returns project at index.
Definition Batch.cpp:290
bool IsRunning()
return true, if batch is running
Definition Batch.cpp:331
wxString GetBatchFilename()
returns the filename of the default queue file
Definition Batch.cpp:888
Project::Status GetStatus(int index)
Returns current status of project at index.
Definition Batch.cpp:318
wxPowerResourceBlocker * m_resBlocker
Definition Batch.h:170
bool OnDetect(wxString scriptFile, wxString userDefinedAssistant, int id)
called to start detecting
Definition Batch.cpp:667
void ChangePrefix(int index, wxString newPrefix)
Changes output prefix for project at index.
Definition Batch.cpp:211
bool verbose
Definition Batch.h:60
int GetFirstAvailable()
Returns index of first waiting project in batch.
Definition Batch.cpp:253
bool overwrite
Definition Batch.h:59
bool m_running
Definition Batch.h:165
void RunNextInBatch()
Starts execution of next waiting project in batch.
Definition Batch.cpp:780
bool autoremove
Definition Batch.h:62
EndTask atEnd
Definition Batch.h:58
void CancelProject(int index)
Cancels project at index in batch, failing it.
Definition Batch.cpp:198
FrameArray m_stitchFrames
Definition Batch.h:160
~Batch()
destructor
Definition Batch.cpp:66
bool OnStitch(wxString scriptFile, wxString outname, wxString userDefinedOutput, int id)
Called to start stitch of project with input scriptFile.
Definition Batch.cpp:584
void SwapProject(int index)
Swaps position in batch of project at index with project at index+1.
Definition Batch.cpp:917
void SetStatus(int index, Project::Status status)
Used internally to set status of selected project.
Definition Batch.cpp:905
bool NoErrors()
Returns true if there are no failed projects in batch.
Definition Batch.cpp:372
int LoadBatchFile(wxString file)
Clears current batch list and loads projects from batch file.
Definition Batch.cpp:341
void SaveTemp()
Saves batch list to temporary file.
Definition Batch.cpp:900
void AppendBatchFile(wxString file)
Appends projects from file to batch list.
Definition Batch.cpp:114
wxString GetFailedProjectName(unsigned int i)
returns project file name of failed project with index i
Definition Batch.cpp:931
int GetProjectCountByPath(wxString path)
Returns number of projects in batch list with the input file path.
Definition Batch.cpp:300
int GetIndex(int id)
Returns index of project with selected id.
Definition Batch.cpp:278
int LoadTemp()
Loads temporary batch file.
Definition Batch.cpp:361
ProjectArray m_projList
Definition Batch.h:158
int GetProjectCount()
Returns number of projects in batch list.
Definition Batch.cpp:295
bool saveLog
Definition Batch.h:63
bool autostitch
Definition Batch.h:61
bool m_paused
Definition Batch.h:164
bool m_cancelled
Definition Batch.h:163
void ShowOutput(bool isVisible=true)
Set visibility of all running projects.
Definition Batch.cpp:923
void CancelBatch()
Stops batch run, failing projects in progress.
Definition Batch.cpp:184
size_t GetFailedProjectsCount()
returns number of failed projects
Definition Batch.h:145
wxString project
Definition Batch.h:42
wxString logfile
Definition Batch.h:43
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41