29 #include <wx/xml/xml.h>
30 #include <wx/msgdlg.h>
31 #include <wx/stdpaths.h>
71 for (
size_t i = 0; i <
images.size(); ++i)
85 wxXmlNode* child = root->GetChildren();
89 if (child->GetName().CmpNoCase(wxT(
"camera")) == 0)
91 wxXmlNode* camChild = child->GetChildren();
95 if (camChild->GetName().CmpNoCase(wxT(
"sensor")) == 0)
98 if (camChild->GetAttribute(wxT(
"coef"), &number))
106 camChild = camChild->GetNext();
110 if (child->GetName().CmpNoCase(wxT(
"lens")) == 0)
113 wxString projection = child->GetAttribute(wxT(
"type"), wxEmptyString).Trim().Trim(
false);
114 if (!projection.empty())
116 if (projection.CmpNoCase(wxT(
"rectilinear")) == 0)
122 if (projection.CmpNoCase(wxT(
"fisheye")) == 0)
133 wxXmlNode* lensChild = child->GetChildren();
136 if (lensChild->GetName().CmpNoCase(wxT(
"focal")) == 0)
138 wxString focallength = lensChild->GetNodeContent().Trim().Trim(
false);
144 lensChild = lensChild->GetNext();
147 child = child->GetNext();
155 wxXmlNode* child = root->GetChildren();
159 if (child->GetName().CmpNoCase(wxT(
"pict")) == 0)
164 #ifdef PAPYWIZARD_USE_ID_CHECK
171 if (!child->GetAttribute(wxT(
"id"), &s))
175 if (!s.ToLong(&longVal))
190 if(!child->GetAttribute(wxT(
"bracket"), &s))
194 if (!s.ToLong(&longVal))
200 wxXmlNode* posChild = child->GetChildren();
203 if (posChild->GetName().CmpNoCase(wxT(
"position")) == 0)
205 if (!posChild->GetAttribute(wxT(
"yaw"), &s))
213 if (!posChild->GetAttribute(wxT(
"pitch"), &s))
221 if (!posChild->GetAttribute(wxT(
"roll"), &s))
229 images.
images.push_back(image);
233 posChild = posChild->GetNext();
236 child = child->GetNext();
243 wxXmlDocument xmlFile;
244 if (!xmlFile.Load(filename))
248 if (xmlFile.GetRoot()->GetName().CmpNoCase(wxT(
"papywizard")) != 0)
254 wxXmlNode* child = xmlFile.GetRoot()->GetChildren();
257 if (child->GetName().CmpNoCase(wxT(
"header")) == 0)
264 if (child->GetName().CmpNoCase(wxT(
"shoot")) == 0)
271 child = child->GetNext();
282 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"papywizard_import_dialog"));
284 wxIconBundle myIcons(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.ico"), wxBITMAP_TYPE_ICO);
287 wxIcon myIcon(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.png"), wxBITMAP_TYPE_PNG);
291 m_linkPos = XRCCTRL(*
this,
"papywizard_link_positions", wxCheckBox);
292 m_cpfind = XRCCTRL(*
this,
"papywizard_cpfind", wxCheckBox);
293 m_cpfindParams = XRCCTRL(*
this,
"papywizard_cpfind_parameters", wxTextCtrl);
294 m_geocpset = XRCCTRL(*
this,
"papywizard_geocpset", wxCheckBox);
295 const wxString cpfindParams = wxConfig::Get()->Read(wxT(
"/PapywizardImportCpfind"), wxEmptyString);
305 wxConfig::Get()->Write(wxT(
"/PapywizardImportCpfind"),
m_cpfindParams->GetValue());
332 const bool cpfindActive =
m_cpfind->IsChecked();
341 DECLARE_EVENT_TABLE()
353 wxMessageBox(wxString::Format(_(
"Could not parse file %s as Papywizard XML file."), filename.c_str()),
363 if(papyImages.
images.size()!=pano.getNrOfImages())
365 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())),
376 if(dialog.ShowModal()!=wxID_OK)
381 std::vector<PanoCommand::PanoCommand *> commands;
383 fill_set(images, 0, pano.getNrOfImages() - 1);
386 commands.push_back(
new PanoCommand::ChangeImageProjectionCmd(pano, images, papyImages.
projection));
393 for (
size_t i = 1; i < pano.getNrOfImages(); i++)
404 while (imgNr < pano.getNrOfImages())
411 }
while (imgNr < pano.getNrOfImages() && papyImages.
images[imgNr].bracket != 1);
418 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables;
419 variables.insert(HuginBase::ImageVariableGroup::IVE_Yaw);
420 variables.insert(HuginBase::ImageVariableGroup::IVE_Pitch);
421 variables.insert(HuginBase::ImageVariableGroup::IVE_Roll);
422 variables.insert(HuginBase::ImageVariableGroup::IVE_X);
423 variables.insert(HuginBase::ImageVariableGroup::IVE_Y);
424 variables.insert(HuginBase::ImageVariableGroup::IVE_Z);
425 variables.insert(HuginBase::ImageVariableGroup::IVE_TranslationPlaneYaw);
426 variables.insert(HuginBase::ImageVariableGroup::IVE_TranslationPlanePitch);
432 for (
size_t i = 0; i < papyImages.
images.size(); ++i)
434 map_get(variables[i],
"y").setValue(papyImages.
images[i].yaw);
435 map_get(variables[i],
"p").setValue(papyImages.
images[i].pitch);
436 map_get(variables[i],
"r").setValue(papyImages.
images[i].roll);
437 map_get(variables[i],
"TrX").setValue(0);
438 map_get(variables[i],
"TrY").setValue(0);
439 map_get(variables[i],
"TrZ").setValue(0);
440 map_get(variables[i],
"Tpy").setValue(0);
441 map_get(variables[i],
"Tpp").setValue(0);
445 variables[i].erase(
"v");
454 wxString tempDir = wxConfig::Get()->Read(wxT(
"tempDir"), wxT(
""));
455 if (!tempDir.IsEmpty())
457 if (tempDir.Last() != wxFileName::GetPathSeparator())
459 tempDir.Append(wxFileName::GetPathSeparator());
462 wxFileName scriptFileName(wxFileName::CreateTempFileName(tempDir + wxT(
"hp")));
466 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
470 dialog.
GetCPFindParam() + wxT(
" --prealigned -o ") + quotedProject + wxT(
" ") + quotedProject, _(
"Searching for control points...")));
474 wxT(
"-o ") + quotedProject + wxT(
" ") + quotedProject, _(
"Connecting overlapping images")));
481 (
const char *)scriptFileName.GetPath(wxPATH_NATIVE | wxPATH_GET_SEPARATOR).mb_str(
HUGIN_CONV_FILENAME),
484 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
static huginApp * Get()
hack.. kind of a pseudo singleton...
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
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)
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
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
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Restore window size and position from configfile/registry.
static GlobalCmdHist & getInstance()
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
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)