From: <jl...@us...> - 2009-07-21 16:19:37
|
Revision: 4077 http://hugin.svn.sourceforge.net/hugin/?rev=4077&view=rev Author: jlegg Date: 2009-07-21 16:19:33 +0000 (Tue, 21 Jul 2009) Log Message: ----------- Fix crashes when loading project, and remove excessive debug output. Modified Paths: -------------- hugin/branches/gsoc2009_layout/src/hugin1/hugin/OptimizePanel.cpp hugin/branches/gsoc2009_layout/src/hugin1/hugin/OptimizePhotometricPanel.cpp hugin/branches/gsoc2009_layout/src/hugin_base/panodata/ImageVariableGroup.cpp hugin/branches/gsoc2009_layout/src/hugin_base/panodata/ImageVariableTranslate.h hugin/branches/gsoc2009_layout/src/hugin_base/panodata/StandardImageVariableGroups.cpp hugin/branches/gsoc2009_layout/src/hugin_base/panodata/StandardImageVariableGroups.h Modified: hugin/branches/gsoc2009_layout/src/hugin1/hugin/OptimizePanel.cpp =================================================================== --- hugin/branches/gsoc2009_layout/src/hugin1/hugin/OptimizePanel.cpp 2009-07-20 15:41:36 UTC (rev 4076) +++ hugin/branches/gsoc2009_layout/src/hugin1/hugin/OptimizePanel.cpp 2009-07-21 16:19:33 UTC (rev 4077) @@ -299,6 +299,8 @@ void OptimizePanel::panoramaImagesChanged(PT::Panorama &pano, const PT::UIntSet & imgNr) { + // make sure all the lens numbers are correct. + variable_groups->update(); DEBUG_TRACE("nr of changed images: " << imgNr.size()); if (pano.getNrOfImages() == 0) { Modified: hugin/branches/gsoc2009_layout/src/hugin1/hugin/OptimizePhotometricPanel.cpp =================================================================== --- hugin/branches/gsoc2009_layout/src/hugin1/hugin/OptimizePhotometricPanel.cpp 2009-07-20 15:41:36 UTC (rev 4076) +++ hugin/branches/gsoc2009_layout/src/hugin1/hugin/OptimizePhotometricPanel.cpp 2009-07-21 16:19:33 UTC (rev 4077) @@ -263,6 +263,7 @@ const PT::UIntSet & imgNr) { DEBUG_TRACE("nr of changed images: " << imgNr.size()); + variable_groups->update(); if (pano.getNrOfImages() <= 1) { XRCCTRL(*this, "optimize_photo_frame_optimize", wxButton)->Disable(); Modified: hugin/branches/gsoc2009_layout/src/hugin_base/panodata/ImageVariableGroup.cpp =================================================================== --- hugin/branches/gsoc2009_layout/src/hugin_base/panodata/ImageVariableGroup.cpp 2009-07-20 15:41:36 UTC (rev 4076) +++ hugin/branches/gsoc2009_layout/src/hugin_base/panodata/ImageVariableGroup.cpp 2009-07-21 16:19:33 UTC (rev 4077) @@ -256,18 +256,20 @@ std::vector<std::size_t> parts_first_image; // image 0 always has part 0 parts_first_image.push_back(0); + m_image_part_numbers.push_back(0); for (std::size_t i = 1; i < m_pano.getNrOfImages(); i++) { // find a part for this image. + std::size_t part_number; for (std::size_t j = 0; j < parts_first_image.size(); j++) { /* we use parts_first_image.size() as a flag to determine when the * images is not linked to any part we have previously found, as it - * is will be the part number when we are done.. */ - std::size_t part_number = parts_first_image.size(); + * will be the part number when we are done. */ + part_number = parts_first_image.size(); // check each variable in the group for (std::set<ImageVariableEnum>::const_iterator k = m_variables.begin(); - k != m_variables.end(); k++) + (k != m_variables.end()) || (part_number == j); k++) { switch (*k) { @@ -283,14 +285,14 @@ #undef image_variable } } - // We should have a suitable part number for now. - m_image_part_numbers.push_back(part_number); - // If this is a new part, keep this image number to check links. - if (part_number == parts_first_image.size()) - { - parts_first_image.push_back(i); - } } + // We should have a suitable part number for now. + m_image_part_numbers.push_back(part_number); + // If this is a new part, keep this image number to check links. + if (part_number == parts_first_image.size()) + { + parts_first_image.push_back(i); + } } // set the number of parts m_num_parts = parts_first_image.size(); Modified: hugin/branches/gsoc2009_layout/src/hugin_base/panodata/ImageVariableTranslate.h =================================================================== --- hugin/branches/gsoc2009_layout/src/hugin_base/panodata/ImageVariableTranslate.h 2009-07-20 15:41:36 UTC (rev 4076) +++ hugin/branches/gsoc2009_layout/src/hugin_base/panodata/ImageVariableTranslate.h 2009-07-21 16:19:33 UTC (rev 4077) @@ -124,27 +124,23 @@ public: inline static bool checkApplicability(const std::string name) { - DEBUG_TRACE(name); static const char code[] = {code1, code2, code3, '\0'}; return ((std::string)code) == name; } inline static double getValueFromVariable(const std::string name, const ImageVariable<T> & var) { - DEBUG_TRACE(name); return var.getData(); } inline static void setValueFromVariable(const std::string name, ImageVariable<T> & var, const double value) { - DEBUG_TRACE(name); var.setData((T)value); } inline static void addToVariableMap(const ImageVariable<T> & var, VariableMap & map) { static const char code[] = {code1, code2, code3, '\0'}; - DEBUG_TRACE(code) map.insert(std::make_pair(code, Variable(code, (double)var.getData()))); } }; @@ -168,19 +164,16 @@ public: inline static bool checkApplicability(const std::string name) { - DEBUG_TRACE(name); return name.size() == 2 && name[0] == base_code && name[1] >= 'a' && name[1] < 'a' + char(size); } inline static double getValueFromVariable(const std::string name, const ImageVariable<std::vector<T> > & var) { - DEBUG_TRACE(name); return var.getData()[name[1]-'a']; } inline static void setValueFromVariable(const std::string name, ImageVariable<std::vector<T> > & var, const double value) { - DEBUG_TRACE(name); std::vector<T> temp = var.getData(); temp[name[1]-'a'] = value; var.setData(temp); @@ -192,7 +185,6 @@ for (size_t index = 0; index < size; index++, s[1]++) { map.insert(std::make_pair(s, Variable(s, (double)var.getData()[index]))); - DEBUG_TRACE(s) } } }; @@ -218,7 +210,6 @@ inline static double getValueFromVariable(const std::string name, const ImageVariable<std::vector<T> > & var) { - DEBUG_TRACE(name); return var.getData()[name[0]-'a']; } @@ -227,7 +218,6 @@ std::vector<T> temp = var.getData(); temp[name[0]-'a'] = value; var.setData(temp); - DEBUG_TRACE(name); } inline static void addToVariableMap(const ImageVariable<std::vector<T> > & var, VariableMap & map) @@ -236,7 +226,6 @@ for (size_t index = 0; index < size; index++, s[0]++) { map.insert(std::make_pair(s, Variable(s, (double)var.getData()[index]))); - DEBUG_TRACE(s) } } }; @@ -279,8 +268,6 @@ static const char s_y[] = {code_y1, code_y2, '\0'}; map.insert(std::make_pair(s_x, Variable(s_x, var.getData().x))); map.insert(std::make_pair(s_y, Variable(s_y, var.getData().y))); - DEBUG_TRACE(s_x) - DEBUG_TRACE(s_y) } }; @@ -291,7 +278,8 @@ /// @todo This could be n, but it is a string, not a double. typedef PTOVariableConverterNoOp PTOVariableConverterForFilename; typedef PTOVariableConverterNoOp PTOVariableConverterForSize; -typedef PTOVariableConverterSingle<'f','\0', '\0', SrcPanoImage::Projection> PTOVariableConverterForProjection; +//typedef PTOVariableConverterSingle<'f','\0', '\0', SrcPanoImage::Projection> PTOVariableConverterForProjection; +typedef PTOVariableConverterNoOp PTOVariableConverterForProjection; typedef PTOVariableConverterSingle<'v'> PTOVariableConverterForHFOV; typedef PTOVariableConverterNoOp PTOVariableConverterForResponseType; @@ -318,7 +306,8 @@ /// @todo This could be Vf, but it is a string, not a double. typedef PTOVariableConverterNoOp PTOVariableConverterForFlatfieldFilename; -typedef PTOVariableConverterSingle<'V', 'm', '\0', int> PTOVariableConverterForVigCorrMode; +//typedef PTOVariableConverterSingle<'V', 'm', '\0', int> PTOVariableConverterForVigCorrMode; +typedef PTOVariableConverterNoOp PTOVariableConverterForVigCorrMode; typedef PTOVariableConverterVectorChar<'V', double, 4> PTOVariableConverterForRadialVigCorrCoeff; typedef PTOVariableConverterFDiff2D<'V','V', 'x','y'> PTOVariableConverterForRadialVigCorrCenterShift; Modified: hugin/branches/gsoc2009_layout/src/hugin_base/panodata/StandardImageVariableGroups.cpp =================================================================== --- hugin/branches/gsoc2009_layout/src/hugin_base/panodata/StandardImageVariableGroups.cpp 2009-07-20 15:41:36 UTC (rev 4076) +++ hugin/branches/gsoc2009_layout/src/hugin_base/panodata/StandardImageVariableGroups.cpp 2009-07-21 16:19:33 UTC (rev 4077) @@ -132,7 +132,18 @@ m_lenses.updatePartNumbers(); } +void StandardImageVariableGroups::update() +{ + // update all the ImageVariablesGroup object's part numbers. + m_lenses.updatePartNumbers(); + /* There are two m_lenses objects, one ConstImageVariablesGroup and one + * ImageVariableGroup. We should update both of them so the inherited + * functions can continue using Const version. + */ + ConstStandardImageVariableGroups::update(); +} + StandardImageVariableGroups::StandardImageVariableGroups(PanoramaData &pano) : ConstStandardImageVariableGroups(pano), m_lenses (lens_variables_set, pano), // initialise lenses. Modified: hugin/branches/gsoc2009_layout/src/hugin_base/panodata/StandardImageVariableGroups.h =================================================================== --- hugin/branches/gsoc2009_layout/src/hugin_base/panodata/StandardImageVariableGroups.h 2009-07-20 15:41:36 UTC (rev 4076) +++ hugin/branches/gsoc2009_layout/src/hugin_base/panodata/StandardImageVariableGroups.h 2009-07-21 16:19:33 UTC (rev 4077) @@ -118,6 +118,7 @@ ImageVariableGroup & getLenses() { return m_lenses; } + void update(); protected: ImageVariableGroup m_lenses; PanoramaData & m_pano; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |