[f96f56]: src / hugin1 / hugin / wxPanoCommand.h Maximize Restore History

Download this file

wxPanoCommand.h    200 lines (163 with data), 5.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// -*- c-basic-offset: 4 -*-
/** @file wxPanoCommand.h
*
* wxwindows specific panorama commands
*
* @author Pablo d'Angelo <pablo.dangelo@web.de>
*
* $Id$
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _WXPANOCOMMAND__H
#define _WXPANOCOMMAND__H
#include "PT/PanoToolsUtils.h"
#include "PT/PanoCommand.h"
#include "vigra/impex.hxx"
#include "hugin/LensPanel.h"
#include "hugin/config_defaults.h"
#include "base_wx/platform.h"
namespace PT {
struct FileIsNewer: public std::binary_function<const std::string &, const std::string &, bool>
{
bool operator()(const std::string & file1, const std::string & file2)
{
// lets hope the operating system caches files stats.
return wxFileModificationTime(wxString(file1.c_str(),HUGIN_CONV_FILENAME)) < wxFileModificationTime(wxString(file2.c_str(),HUGIN_CONV_FILENAME));
};
};
/** add image(s) to a panorama */
class wxAddImagesCmd : public PanoCommand
{
public:
wxAddImagesCmd(Panorama & pano, const std::vector<std::string> & newfiles)
: PanoCommand(pano), files(newfiles)
{ };
virtual void execute();
virtual std::string getName() const
{
return "add images";
}
private:
std::vector<std::string> files;
};
/** dump the current project and load a new one.
*
*/
class wxLoadPTProjectCmd : public PanoCommand
{
public:
wxLoadPTProjectCmd(Panorama & p, const std::string filename, const std::string prefix = "", const bool markAsOptimized=false)
: PanoCommand(p),
filename(filename),
prefix(prefix),
markAsOptimized(markAsOptimized)
{ };
virtual void execute();
virtual std::string getName() const
{
return "load project";
}
private:
const std::string filename;
const std::string prefix;
const bool markAsOptimized;
};
/** start a new project, reset options to values in preferences
*
*/
class wxNewProjectCmd : public PanoCommand
{
public:
wxNewProjectCmd(Panorama & p) : PanoCommand(p){};
virtual void execute();
virtual std::string getName() const
{
return "new project";
}
};
/** dump the current project and load a new one.
*
*/
class wxApplyTemplateCmd : public PanoCommand
{
public:
wxApplyTemplateCmd(Panorama & p, std::istream & i)
: PanoCommand(p),
in(i)
{ };
virtual void execute();
virtual std::string getName() const
{
return "apply template";
}
private:
std::istream & in;
};
//=========================================================================
//=========================================================================
/** add a control point */
class wxAddCtrlPointGridCmd : public PanoCommand
{
public:
wxAddCtrlPointGridCmd(Panorama & p, unsigned int i1,
unsigned int i2, double scale, double threshold)
: PanoCommand(p), img1(i1), img2(i2), scale(scale), cornerThreshold(threshold)
{ }
virtual void execute();
virtual std::string getName() const
{
return "add control point";
}
private:
unsigned int img1,img2,dx,dy;
double scale;
double cornerThreshold;
};
/** run a python script */
#ifdef HUGIN_HSI
class PythonScriptPanoCmd : public PanoCommand
{
public:
PythonScriptPanoCmd(Panorama & pano, const std::string & scriptFile)
: PanoCommand(pano), m_scriptFile(scriptFile)
{ };
virtual bool processPanorama(Panorama& pano);
virtual std::string getName() const
{
return "python script";
}
private:
std::string m_scriptFile;
};
class PythonScriptWithImagesPanoCmd : public PanoCommand
{
public:
PythonScriptWithImagesPanoCmd(Panorama & pano, const std::string & scriptFile, const UIntSet images)
: PanoCommand(pano), m_scriptFile(scriptFile), m_images(images)
{ };
virtual bool processPanorama(Panorama& pano);
virtual std::string getName() const
{
return "python script";
}
private:
std::string m_scriptFile;
UIntSet m_images;
};
#endif
} // namespace PT
#endif // _WXPANOCOMMAND__H