29 #include <wx/xml/xml.h>
30 #include <wx/msgdlg.h>
31 #include <wx/stdpaths.h>
72 for (
size_t i = 0; i <
images.size(); ++i)
86 wxXmlNode* child = root->GetChildren();
90 if (child->GetName().CmpNoCase(wxT(
"camera")) == 0)
92 wxXmlNode* camChild = child->GetChildren();
96 if (camChild->GetName().CmpNoCase(wxT(
"sensor")) == 0)
99 if (camChild->GetAttribute(wxT(
"coef"), &number))
107 camChild = camChild->GetNext();
111 if (child->GetName().CmpNoCase(wxT(
"lens")) == 0)
114 wxString projection = child->GetAttribute(wxT(
"type"), wxEmptyString).Trim().Trim(
false);
115 if (!projection.empty())
117 if (projection.CmpNoCase(wxT(
"rectilinear")) == 0)
123 if (projection.CmpNoCase(wxT(
"fisheye")) == 0)
134 wxXmlNode* lensChild = child->GetChildren();
137 if (lensChild->GetName().CmpNoCase(wxT(
"focal")) == 0)
139 wxString focallength = lensChild->GetNodeContent().Trim().Trim(
false);
145 lensChild = lensChild->GetNext();
148 child = child->GetNext();
156 wxXmlNode* child = root->GetChildren();
160 if (child->GetName().CmpNoCase(wxT(
"pict")) == 0)
165 #ifdef PAPYWIZARD_USE_ID_CHECK
172 if (!child->GetAttribute(wxT(
"id"), &s))
176 if (!s.ToLong(&longVal))
191 if(!child->GetAttribute(wxT(
"bracket"), &s))
195 if (!s.ToLong(&longVal))
201 wxXmlNode* posChild = child->GetChildren();
204 if (posChild->GetName().CmpNoCase(wxT(
"position")) == 0)
206 if (!posChild->GetAttribute(wxT(
"yaw"), &s))
214 if (!posChild->GetAttribute(wxT(
"pitch"), &s))
222 if (!posChild->GetAttribute(wxT(
"roll"), &s))
230 images.
images.push_back(image);
234 posChild = posChild->GetNext();
237 child = child->GetNext();
244 wxXmlDocument xmlFile;
245 if (!xmlFile.Load(filename))
249 if (xmlFile.GetRoot()->GetName().CmpNoCase(wxT(
"papywizard")) != 0)
255 wxXmlNode* child = xmlFile.GetRoot()->GetChildren();
258 if (child->GetName().CmpNoCase(wxT(
"header")) == 0)
265 if (child->GetName().CmpNoCase(wxT(
"shoot")) == 0)
272 child = child->GetNext();
283 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"papywizard_import_dialog"));
285 m_linkPos = XRCCTRL(*
this,
"papywizard_link_positions", wxCheckBox);
286 m_cpfind = XRCCTRL(*
this,
"papywizard_cpfind", wxCheckBox);
288 m_cpfindParams = XRCCTRL(*
this,
"papywizard_cpfind_parameters", wxTextCtrl);
289 m_geocpset = XRCCTRL(*
this,
"papywizard_geocpset", wxCheckBox);
290 const wxString cpfindParams = wxConfig::Get()->Read(wxT(
"/PapywizardImportCpfind"), wxEmptyString);
300 wxConfig::Get()->Write(wxT(
"/PapywizardImportCpfind"),
m_cpfindParams->GetValue());
327 const bool cpfindActive =
m_cpfind->IsChecked();
343 wxMessageBox(wxString::Format(_(
"Could not parse file %s as Papywizard XML file."), filename.c_str()),
355 wxMessageBox(wxString::Format(_(
"The current project does not match with the Papywizard xml file.\nThe Papywizard file \"%s\" contains %lu images, but the Hugin project contains %lu images."), filename.c_str(),
static_cast<unsigned long>(papyImages.
images.size()), static_cast<unsigned long>(pano.
getNrOfImages())),
366 if(dialog.ShowModal()!=wxID_OK)
371 std::vector<PanoCommand::PanoCommand *> commands;
376 commands.push_back(
new PanoCommand::ChangeImageProjectionCmd(pano, images, papyImages.
projection));
408 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables;
409 variables.insert(HuginBase::ImageVariableGroup::IVE_Yaw);
410 variables.insert(HuginBase::ImageVariableGroup::IVE_Pitch);
411 variables.insert(HuginBase::ImageVariableGroup::IVE_Roll);
412 variables.insert(HuginBase::ImageVariableGroup::IVE_X);
413 variables.insert(HuginBase::ImageVariableGroup::IVE_Y);
414 variables.insert(HuginBase::ImageVariableGroup::IVE_Z);
415 variables.insert(HuginBase::ImageVariableGroup::IVE_TranslationPlaneYaw);
416 variables.insert(HuginBase::ImageVariableGroup::IVE_TranslationPlanePitch);
422 for (
size_t i = 0; i < papyImages.
images.size(); ++i)
424 map_get(variables[i],
"y").setValue(papyImages.
images[i].yaw);
425 map_get(variables[i],
"p").setValue(papyImages.
images[i].pitch);
426 map_get(variables[i],
"r").setValue(papyImages.
images[i].roll);
427 map_get(variables[i],
"TrX").setValue(0);
428 map_get(variables[i],
"TrY").setValue(0);
429 map_get(variables[i],
"TrZ").setValue(0);
430 map_get(variables[i],
"Tpy").setValue(0);
431 map_get(variables[i],
"Tpp").setValue(0);
435 variables[i].erase(
"v");
444 wxString tempDir = wxConfig::Get()->Read(wxT(
"tempDir"), wxT(
""));
445 if (!tempDir.IsEmpty())
447 if (tempDir.Last() != wxFileName::GetPathSeparator())
449 tempDir.Append(wxFileName::GetPathSeparator());
452 wxFileName scriptFileName(wxFileName::CreateTempFileName(tempDir + wxT(
"hp")));
456 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
460 dialog.
GetCPFindParam() + wxT(
" --prealigned -o ") + quotedProject + wxT(
" ") + quotedProject, _(
"Searching for control points...")));
464 wxT(
"-o ") + quotedProject + wxT(
" ") + quotedProject, _(
"Connecting overlapping images")));
471 (
const char *)scriptFileName.GetPath(wxPATH_NATIVE | wxPATH_GET_SEPARATOR).mb_str(
HUGIN_CONV_FILENAME),
474 wxRemoveFile(scriptFileName.GetFullPath());
bool HasBracketImages() const
int MyExecuteCommandQueue(HuginQueue::CommandQueue *queue, wxWindow *parent, const wxString &title, const wxString &comment)
execute all commands in queue with redirection of output to frame and allow canceling the queue will ...
bool ImportPapywizardFile(const wxString &filename, HuginBase::Panorama &pano)
import the settings from given filename into pano
normal command for queue, processing is stopped if an error occurred in program
static const std::set< ConstImageVariableGroup::ImageVariableEnum > & getLensVariables()
Get the set of lens image variables.
PapywizardImportDialog(wxWindow *parent)
Constructor, read from xrc ressource.
Change the linking of some variables across parts of an ImageVariableGroup containing some specified ...
read settings from papywizard xml file
wxString GetInternalProgram(const wxString &bindir, const wxString &name)
return path and name of external program, which comes bundled with Hugin
const bool LinkStacks() const
PapywizardSettings()
constructor, initialize some values
std::vector< PapywizardImage > images
PanoCommand to combine other PanoCommands.
bool ParseShoot(wxXmlNode *root, PapywizardSettings &images)
parse shoot section of papywizard file
std::set< unsigned int > UIntSet
const bool RunCpfind() const
std::vector< VariableMap > VariableMapVector
std::string getPathPrefix(const std::string &filename)
Get the path to a filename.
HuginBase::SrcPanoImage::Projection projection
VariableMapVector getVariables() const
get variables of this panorama
Make a new part in a ImageVariableGroup for a set of images, given the variables that make up the gro...
bool ParsePapywizardFile(const wxString &filename, PapywizardSettings &images)
void OnCpfindCheck(wxCommandEvent &e)
std::size_t getNrOfImages() const
number of images.
Map::mapped_type & map_get(Map &m, const typename Map::key_type &key)
get a map element.
Switch the part number of an image.
wxwindows specific panorama commands
~PapywizardImportDialog()
destructor, save settings
static GlobalCmdHist & getInstance()
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
bool stringToDouble(const STR &str_, double &dest)
convert a string to a double, ignore localisation.
include file for the hugin project
str wxEscapeFilename(const str &arg)
special escaping routine for CommandQueues
wxTextCtrl * m_cpfindParams
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
bool ParseHeader(wxXmlNode *root, PapywizardSettings &images)
parse header of papywizard file
dump the current project and load a new one.
const bool RunGeocpset() const
class which holds all read settings from a Papywizard xml file
static const std::set< ConstImageVariableGroup::ImageVariableEnum > & getStackVariables()
Get the set of stack image variables.
std::vector< NormalCommand * > CommandQueue
const wxString GetCPFindParam() const
void EnableStack(const bool hasStacks)
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Restore window size and position from configfile/registry.