Hugin trunk 0.1
Loading...
Searching...
No Matches
RunStitchFrame.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
2
27#include "RunStitchFrame.h"
28
29RunStitchFrame::RunStitchFrame(wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size) //ProjectArray projList, wxListBox *projListBox)
30 : wxFrame(parent, -1, title, pos, size, wxRESIZE_BORDER | wxCAPTION | wxCLIP_CHILDREN), m_isStitching(false)
31{
32
34 m_stitchPanel = new RunStitchPanel(this);
35
36 topsizer->Add(m_stitchPanel, 1, wxEXPAND | wxALL, 2);
37
38 topsizer->Add( new wxButton(this, wxID_CANCEL, _("Cancel")),
39 0, wxALL | wxALIGN_RIGHT, 10);
40
42#ifdef __WXMSW__
43 // wxFrame does have a strange background color on Windows..
44 SetBackgroundColour(m_stitchPanel->GetBackgroundColour());
45#endif
46
49}
50
52{
53 if(m_projectId<0) //if a fake stitchframe is used (for a command), it doesn't have a stitch panel
54 {
55 return m_pid;
56 }
57 else
58 {
59 return m_stitchPanel->GetPid();
60 }
61}
62
67
69{
70 if(m_projectId<0) //if a fake stitchframe is used (for a command), it doesn't have a stitch panel
71 {
72 m_pid = pid;
73 }
74 else
75 {
77 }
78}
79
81{
82 m_projectId=id;
83}
84
85void RunStitchFrame::OnCancel(wxCommandEvent& WXUNUSED(event))
86{
87 DEBUG_TRACE("");
88 if (m_isStitching)
89 {
91 m_isStitching = false;
92 }
93 else
94 {
95 Close();
96 }
97}
98
100{
101 if (! m_isStitching)
102 {
103 event.SetEventObject( this );
104 event.m_exitcode = 1;
105 event.SetId(m_projectId);
106 DEBUG_TRACE("Sending wxProcess event");
107 this->GetParent()->GetEventHandler()->ProcessEvent( event );
108 // TODO: Cleanup files?
109 Close();
110 }
111 else
112 {
113 m_isStitching = false;
114 if (event.GetExitCode() != 0)
115 {
116 event.SetEventObject( this );
117 event.SetId(m_projectId);
118 this->GetParent()->GetEventHandler()->ProcessEvent( event );
119 Close();
120 }
121 else
122 {
123 event.SetEventObject( this );
124 event.SetId(m_projectId);
125 DEBUG_TRACE("Sending wxProcess event");
126 this->GetParent()->GetEventHandler()->ProcessEvent( event );
127 Close();
128 }
129 }
130}
131
133{
135 {
136 return false;
137 }
138 m_isStitching = true;
139 m_isDetecting = false;
140 return true;
141}
142
144{
146 {
147 return false;
148 }
149 m_isStitching = true;
150 m_isDetecting = true;
151 return true;
152}
153
155{
156 return m_stitchPanel->SaveLog(filename);
157};
Stitch a pto project file, with GUI output etc.
int GetProcessId()
Returns process ID of running process.
void OnCancel(wxCommandEvent &event)
Cancels project execution - kills process.
void SetProjectId(int id)
Sets project id from batch.
RunStitchFrame(wxWindow *parent, const wxString &title, const wxPoint &pos, const wxSize &size)
void OnProcessTerminate(wxProcessEvent &event)
RunStitchPanel * m_stitchPanel
int GetProjectId()
Gets project id from batch.
void SetProcessId(int pid)
Sets process ID of running process (if running process from outside)
bool SaveLog(const wxString &filename)
save the content of the window into a given log file
bool StitchProject(wxString scriptFile, wxString outname, wxString userDefinedOutput=wxEmptyString)
Starts stitching of project file.
bool DetectProject(wxString scriptFile, wxString userDefinedAssistant=wxEmptyString)
starts assistant of project file
bool DetectProject(const wxString &scriptFile, const wxString &userDefinedAssistant=wxEmptyString)
bool SaveLog(const wxString &filename)
save the content of the window into a given log file
bool StitchProject(const wxString &scriptFile, const wxString &outname, const wxString &userDefinedOutput=wxEmptyString)
#define DEBUG_TRACE(msg)
Definition utils.h:67
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