[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kipi-plugins] panorama: Panorama: Bugfixes
From: Benjamin Girault <benjamin.girault () gmail ! com>
Date: 2012-03-25 15:57:54
Message-ID: 20120325155754.64841A60A9 () git ! kde ! org
[Download RAW message or body]
Git commit abde7e736d6ea0d9750a1f9518b1a0de99281128 by Benjamin Girault.
Committed on 25/03/2012 at 17:52.
Pushed by girault into branch 'master'.
Panorama: Bugfixes
- CMakeLists.txt: cleanup (no need for OpenMP anymore)
- Code preparation for the PTO generator
- Bugfix in common.h / boost_adapt.h
M +10 -11 panorama/CMakeLists.txt
M +54 -150 panorama/ptoparser/common.h
M +1 -1 panorama/ptoparser/controlpointline.h
M +1 -1 panorama/ptoparser/imageline.h
M +1 -1 panorama/ptoparser/optimisationline.h
M +1 -1 panorama/ptoparser/projectline.h
M +6 -1 panorama/ptoparser/ptoparser.h
M +1 -1 panorama/ptoparser/variousgrammar.h
C +12 -90 panorama/ptotype/boost_adapt.h [from: panorama/ptoparser/common.h - \
063% similarity] R +0 -0 panorama/ptotype/ptotype.cpp [from: \
panorama/ptoparser/ptotype.cpp - 100% similarity] R +0 -0 \
panorama/ptotype/ptotype.h [from: panorama/ptoparser/ptotype.h - 100% similarity]
http://commits.kde.org/kipi-plugins/abde7e736d6ea0d9750a1f9518b1a0de99281128
diff --git a/panorama/CMakeLists.txt b/panorama/CMakeLists.txt
index 3ff1b85..aa29ef2 100644
--- a/panorama/CMakeLists.txt
+++ b/panorama/CMakeLists.txt
@@ -3,21 +3,20 @@ ADD_SUBDIRECTORY(icons)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/importwizard
${CMAKE_CURRENT_SOURCE_DIR}/manager
${CMAKE_CURRENT_SOURCE_DIR}/plugin
+# ${CMAKE_CURRENT_SOURCE_DIR}/ptogenerator
${CMAKE_CURRENT_SOURCE_DIR}/ptoparser
+ ${CMAKE_CURRENT_SOURCE_DIR}/ptotype
${CMAKE_CURRENT_SOURCE_DIR}/tasks
${Boost_INCLUDE_DIR}/boost # NOTICE: this is the \
only way for my system to compile it # ${Boost_INCLUDE_DIRS}
)
-IF(OPENMP_FOUND AND NOT APPLE)
- ADD_DEFINITIONS(${OpenMP_CXX_FLAGS})
- IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL GNU )
- SET(OPENMP_LDFLAGS "-lgomp")
- ENDIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL GNU )
- IF("${CMAKE_C_COMPILER_ID}" STREQUAL SunPro )
- SET(OPENMP_LDFLAGS "-xopenmp")
- ENDIF("${CMAKE_C_COMPILER_ID}" STREQUAL SunPro )
-ENDIF(OPENMP_FOUND AND NOT APPLE)
+# Enable exceptions for boost::spirit::karma, because of a bug in
+# boost/numeric/conversion/converter_policies.hpp
+# that prevent us from karma without exceptions
+# Note that adding -fexceptions is not enough because -DQT_NO_EXCEPTIONS
+# should be unset at the same time, hence the following line:
+ADD_DEFINITIONS(${KDE4_ENABLE_EXCEPTIONS})
INSTALL(DIRECTORY pics
DESTINATION ${DATA_INSTALL_DIR}/kipiplugin_panorama)
@@ -26,14 +25,15 @@ INSTALL(DIRECTORY pics
# Common source code
SET(panorama_common_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/ptotype/ptotype.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptoparser/common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptoparser/controlpointline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptoparser/imageline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptoparser/optimisationline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptoparser/projectline.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptoparser/ptoparser.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/ptoparser/ptotype.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptoparser/variousgrammar.cpp
+# ${CMAKE_CURRENT_SOURCE_DIR}/ptogenerator/ptogenerator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/manager/actionthread.cpp
${CMAKE_CURRENT_SOURCE_DIR}/manager/cpfindbinary.cpp
${CMAKE_CURRENT_SOURCE_DIR}/manager/manager.cpp
@@ -73,7 +73,6 @@ TARGET_LINK_LIBRARIES(libpanorama
${KIPI_LIBRARIES}
${KEXIV2_LIBRARIES}
${KDCRAW_LIBRARIES}
- ${OPENMP_LDFLAGS}
kipiplugins
)
diff --git a/panorama/ptoparser/common.h b/panorama/ptoparser/common.h
index 4b6e9bf..86beb63 100644
--- a/panorama/ptoparser/common.h
+++ b/panorama/ptoparser/common.h
@@ -1,5 +1,5 @@
/* ============================================================
- *
+ *
* This file is a part of kipi-plugins project
* http://www.digikam.org
*
@@ -36,186 +36,90 @@
#endif
#endif
+// Qt includes
+
#include <QString>
#include <QRect>
+// Boost includes
+
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_stl.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-#include <boost/spirit/home/phoenix/bind/bind_function.hpp>
-#include <boost/spirit/home/phoenix/bind/bind_member_function.hpp>
-#include <boost/spirit/home/phoenix/bind/bind_member_variable.hpp>
-#include <boost/spirit/home/phoenix/object/construct.hpp>
-#include <boost/fusion/include/adapt_struct.hpp>
+#include <boost/spirit/include/phoenix.hpp>
+// #include <boost/spirit/home/phoenix/bind/bind_function.hpp>
+// #include <boost/spirit/home/phoenix/bind/bind_member_function.hpp>
+// #include <boost/spirit/home/phoenix/bind/bind_member_variable.hpp>
+// #include <boost/spirit/home/phoenix/object/construct.hpp>
// #include <boost/spirit/iterator/file_iterator.hpp>
#include "ptotype.h"
-
-
-// ----------------------------------------------------
-// ------ Declaring our structures for boost::qi ------
-// ----------------------------------------------------
-
-BOOST_FUSION_ADAPT_STRUCT(
- KIPIPanoramaPlugin::PTOType::Project::FileFormat,
- (KIPIPanoramaPlugin::PTOType::Project::FileFormat::FileType, fileType)
- (unsigned char, quality)
- (KIPIPanoramaPlugin::PTOType::Project::FileFormat::CompressionMethod, \
compressionMethod)
- (bool, cropped)
- (bool, savePositions)
-)
-
-BOOST_FUSION_ADAPT_STRUCT(
- KIPIPanoramaPlugin::PTOType::Project,
- (QStringList, previousComments)
- (QSize, size)
- (KIPIPanoramaPlugin::PTOType::Project::ProjectionType, projection)
- (unsigned int, fieldOfView)
- (KIPIPanoramaPlugin::PTOType::Project::FileFormat, fileFormat)
- (double, exposure)
- (bool, hdr)
- (KIPIPanoramaPlugin::PTOType::Project::BitDepth, bitDepth)
- (QRect, crop)
- (int, photometricReferenceId)
- (QStringList, unmatchedParameters)
-)
-
-BOOST_FUSION_ADAPT_STRUCT(
- KIPIPanoramaPlugin::PTOType::Stitcher,
- (QStringList, previousComments)
- (double, gamma)
- (KIPIPanoramaPlugin::PTOType::Stitcher::Interpolator, interpolator)
- (QStringList, unmatchedParameters)
-)
-
-BOOST_FUSION_ADAPT_STRUCT(
- KIPIPanoramaPlugin::PTOType::Optimisation,
- (QStringList, previousComments)
- (KIPIPanoramaPlugin::PTOType::Optimisation::Parameter, parameter)
-)
-
-BOOST_FUSION_ADAPT_STRUCT(
- KIPIPanoramaPlugin::PTOType::ControlPoint,
- (QStringList, previousComments)
- (int, image1Id)
- (int, image2Id)
- (QPoint, p1)
- (QPoint, p2)
- (int, t)
- (QStringList, unmatchedParameters)
-)
-
-BOOST_FUSION_ADAPT_STRUCT(
- KIPIPanoramaPlugin::PTOType::Image,
- (QStringList, previousComments)
- (QSize, size)
- (int, id)
- (QList<KIPIPanoramaPlugin::PTOType::Mask>, masks)
- (QList<KIPIPanoramaPlugin::PTOType::Optimisation>, optimisationParameters)
- (KIPIPanoramaPlugin::PTOType::Image::LensProjection, lensProjection)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, fieldOfView)
- (double, yaw)
- (double, pitch)
- (double, roll)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, \
lensBarrelCoefficientA)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, \
lensBarrelCoefficientB)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, \
lensBarrelCoefficientC)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<int>, lensCenterOffsetX)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<int>, lensCenterOffsetY)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<int>, lensShearX)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<int>, lensShearY)
- (double, exposure)
- (double, whiteBalanceRed)
- (double, whiteBalanceBlue)
- (KIPIPanoramaPlugin::PTOType::Image::VignettingMode, vignettingMode)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, \
vignettingCorrectionI)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, \
vignettingCorrectionJ)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, \
vignettingCorrectionK)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, \
vignettingCorrectionL)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<int>, vignettingOffsetX)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<int>, vignettingOffsetY)
- (QString, vignettingFlatfieldImageName)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, photometricEMoRA)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, photometricEMoRB)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, photometricEMoRC)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, photometricEMoRD)
- (KIPIPanoramaPlugin::PTOType::Image::LensParameter<double>, photometricEMoRE)
- (int, mosaicModeOffsetX)
- (int, mosaicModeOffsetY)
- (int, mosaicModeOffsetZ)
- (QRect, crop)
- (int, stackNumber)
- (QString, fileName)
- (QStringList, unmatchedParameters)
-)
-
-BOOST_FUSION_ADAPT_STRUCT(
- KIPIPanoramaPlugin::PTOType,
- (KIPIPanoramaPlugin::PTOType::Project, project)
- (KIPIPanoramaPlugin::PTOType::Stitcher, stitcher)
- (QVector<KIPIPanoramaPlugin::PTOType::Image>, images)
- (QList<KIPIPanoramaPlugin::PTOType::ControlPoint>, controlPoints)
- (QStringList, lastComments)
-)
+#include "boost_adapt.h"
// ----------------------------------------------------------------------------------
// ------ Declaring QString as a suitable container for parsing with boost::qi \
------ // ----------------------------------------------------------------------------------
// Found here: http://www.boost.org/doc/libs/1_48_0/libs/spirit/example/qi/custom_string.cpp
-namespace boost { namespace spirit { namespace traits
+namespace boost
+{
+namespace spirit
+{
+namespace traits
{
- // Make Qi recognize QString as a container
- template <> struct is_container<QString> : mpl::true_ {};
+// Make Qi recognize QString as a container
+template <> struct is_container<QString> : mpl::true_ {};
- // Expose the container's (QString's) value_type
- template <> struct container_value<QString> : mpl::identity<QChar> {};
+// Expose the container's (QString's) value_type
+template <> struct container_value<QString> : mpl::identity<QChar> {};
- // Define how to insert a new element at the end of the container (QString)
- template <>
- struct push_back_container<QString, QChar>
+// Define how to insert a new element at the end of the container (QString)
+template <>
+struct push_back_container<QString, QChar>
+{
+ static bool call ( QString& c, QChar const& val )
{
- static bool call(QString& c, QChar const& val)
- {
- c.append(val);
- return true;
- }
- };
-}}} /* namespace boost::spirit::traits */
+ c.append ( val );
+ return true;
+ }
+};
+}
+}
+} /* namespace boost::spirit::traits */
// ------------------------------------------------
// ------ Some useful aliases and grammar(s) ------
// ------------------------------------------------
-namespace KIPIPanoramaPlugin { namespace PtoParser
+namespace KIPIPanoramaPlugin
+{
+namespace PtoParser
{
- namespace phoenix = boost::phoenix;
- namespace qi = boost::spirit::qi;
- namespace ascii = boost::spirit::ascii;
- typedef std::string::const_iterator iterator_type;
+namespace phoenix = boost::phoenix;
+namespace qi = boost::spirit::qi;
+namespace ascii = boost::spirit::ascii;
+typedef std::string::const_iterator iterator_type;
- // QString without space
- template <typename Iterator>
- struct stringGrammar : qi::grammar<Iterator, QString()>
- {
- stringGrammar();
+// QString without space
+template <typename Iterator>
+struct stringGrammar : qi::grammar<Iterator, QString() >
+{
+ stringGrammar();
- qi::rule<Iterator, QString()> base;
- };
+ qi::rule<Iterator, QString() > base;
+};
- template <typename Iterator>
- struct rectangleGrammar : qi::grammar<Iterator, QRect()>
- {
- rectangleGrammar();
+template <typename Iterator>
+struct rectangleGrammar : qi::grammar<Iterator, QRect() >
+{
+ rectangleGrammar();
- qi::rule<Iterator, QRect()> base;
- };
+ qi::rule<Iterator, QRect() > base;
+};
-}} /* namespace KIPIPanoramaPlugin::PtoParser */
+}
+} /* namespace KIPIPanoramaPlugin::PtoParser */
#endif /* PTOPARSER_COMMON_H */
diff --git a/panorama/ptoparser/controlpointline.h \
b/panorama/ptoparser/controlpointline.h index 2f3ac4c..40b2c7a 100644
--- a/panorama/ptoparser/controlpointline.h
+++ b/panorama/ptoparser/controlpointline.h
@@ -26,7 +26,7 @@
#ifndef CONTROLPOINTLINE_H
#define CONTROLPOINTLINE_H
-#include "common.h"
+#include "ptoparser/common.h"
namespace KIPIPanoramaPlugin { namespace PtoParser
{
diff --git a/panorama/ptoparser/imageline.h b/panorama/ptoparser/imageline.h
index 320593e..3a0a28a 100644
--- a/panorama/ptoparser/imageline.h
+++ b/panorama/ptoparser/imageline.h
@@ -26,7 +26,7 @@
#ifndef IMAGELINE_H
#define IMAGELINE_H
-#include "common.h"
+#include "ptoparser/common.h"
namespace KIPIPanoramaPlugin { namespace PtoParser
{
diff --git a/panorama/ptoparser/optimisationline.h \
b/panorama/ptoparser/optimisationline.h index 6485071..ce4440f 100644
--- a/panorama/ptoparser/optimisationline.h
+++ b/panorama/ptoparser/optimisationline.h
@@ -26,7 +26,7 @@
#ifndef OPTIMISATIONLINE_H
#define OPTIMISATIONLINE_H
-#include "common.h"
+#include "ptoparser/common.h"
namespace KIPIPanoramaPlugin { namespace PtoParser
{
diff --git a/panorama/ptoparser/projectline.h b/panorama/ptoparser/projectline.h
index 83acd79..0970dff 100644
--- a/panorama/ptoparser/projectline.h
+++ b/panorama/ptoparser/projectline.h
@@ -26,7 +26,7 @@
#ifndef PROJECTLINE_H
#define PROJECTLINE_H
-#include "common.h"
+#include "ptoparser/common.h"
namespace KIPIPanoramaPlugin { namespace PtoParser
{
diff --git a/panorama/ptoparser/ptoparser.h b/panorama/ptoparser/ptoparser.h
index 0855a01..64199fc 100644
--- a/panorama/ptoparser/ptoparser.h
+++ b/panorama/ptoparser/ptoparser.h
@@ -26,8 +26,13 @@
#ifndef PTOPARSER_H
#define PTOPARSER_H
+// Qt includes
+
#include <QString>
-#include "ptotype.h"
+
+// Local includes
+
+#include "ptoparser/common.h"
namespace KIPIPanoramaPlugin
{
diff --git a/panorama/ptoparser/variousgrammar.h \
b/panorama/ptoparser/variousgrammar.h index dd40588..c5ba295 100644
--- a/panorama/ptoparser/variousgrammar.h
+++ b/panorama/ptoparser/variousgrammar.h
@@ -26,7 +26,7 @@
#ifndef VARIOUSGRAMMAR_H
#define VARIOUSGRAMMAR_H
-#include "common.h"
+#include "ptoparser/common.h"
// ----------------------------------
// ------ Some useful grammars ------
diff --git a/panorama/ptoparser/common.h b/panorama/ptotype/boost_adapt.h
similarity index 63%
copy from panorama/ptoparser/common.h
copy to panorama/ptotype/boost_adapt.h
index 4b6e9bf..6a91329 100644
--- a/panorama/ptoparser/common.h
+++ b/panorama/ptotype/boost_adapt.h
@@ -3,11 +3,8 @@
* This file is a part of kipi-plugins project
* http://www.digikam.org
*
- * Date : 2012-02-04
+ * Date : 2012-03-19
* Description : a plugin to create panorama by fusion of several images.
- * This parser is based on pto file format described here:
- * http://hugin.sourceforge.net/docs/nona/nona.txt, and
- * on pto files produced by Hugin's tools.
*
* Copyright (C) 2012 by Benjamin Girault <benjamin dot girault at gmail dot com>
*
@@ -23,34 +20,11 @@
*
* ============================================================ */
-#ifndef PTOPARSER_COMMON_H
-#define PTOPARSER_COMMON_H
+// Boost includes
-// Fixes building with MSVC on Windows by disabling internal
-// KDE_isspace function mapping. Otherwise, compilation with
-// boost spirit will error stating that the isspace function
-// is not a member of namespace std
-#ifdef _MSC_VER
-#ifndef KDEWIN_CTYPE_H
-#define KDEWIN_CTYPE_H
-#endif
-#endif
-
-#include <QString>
-#include <QRect>
-
-#include <boost/config/warning_disable.hpp>
-#include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_stl.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-#include <boost/spirit/home/phoenix/bind/bind_function.hpp>
-#include <boost/spirit/home/phoenix/bind/bind_member_function.hpp>
-#include <boost/spirit/home/phoenix/bind/bind_member_variable.hpp>
-#include <boost/spirit/home/phoenix/object/construct.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
-// #include <boost/spirit/iterator/file_iterator.hpp>
+// Local includes
#include "ptotype.h"
@@ -73,7 +47,7 @@ BOOST_FUSION_ADAPT_STRUCT(
(QStringList, previousComments)
(QSize, size)
(KIPIPanoramaPlugin::PTOType::Project::ProjectionType, projection)
- (unsigned int, fieldOfView)
+ (double, fieldOfView)
(KIPIPanoramaPlugin::PTOType::Project::FileFormat, fileFormat)
(double, exposure)
(bool, hdr)
@@ -92,6 +66,13 @@ BOOST_FUSION_ADAPT_STRUCT(
)
BOOST_FUSION_ADAPT_STRUCT(
+ KIPIPanoramaPlugin::PTOType::Mask,
+ (QStringList, previousComments)
+ (KIPIPanoramaPlugin::PTOType::Mask::MaskType, type)
+ (QList<QPoint>, hull)
+)
+
+BOOST_FUSION_ADAPT_STRUCT(
KIPIPanoramaPlugin::PTOType::Optimisation,
(QStringList, previousComments)
(KIPIPanoramaPlugin::PTOType::Optimisation::Parameter, parameter)
@@ -159,63 +140,4 @@ BOOST_FUSION_ADAPT_STRUCT(
(QVector<KIPIPanoramaPlugin::PTOType::Image>, images)
(QList<KIPIPanoramaPlugin::PTOType::ControlPoint>, controlPoints)
(QStringList, lastComments)
-)
-
-// ----------------------------------------------------------------------------------
-// ------ Declaring QString as a suitable container for parsing with boost::qi \
------
-// ----------------------------------------------------------------------------------
-// Found here: http://www.boost.org/doc/libs/1_48_0/libs/spirit/example/qi/custom_string.cpp
-
-namespace boost { namespace spirit { namespace traits
-{
- // Make Qi recognize QString as a container
- template <> struct is_container<QString> : mpl::true_ {};
-
- // Expose the container's (QString's) value_type
- template <> struct container_value<QString> : mpl::identity<QChar> {};
-
- // Define how to insert a new element at the end of the container (QString)
- template <>
- struct push_back_container<QString, QChar>
- {
- static bool call(QString& c, QChar const& val)
- {
- c.append(val);
- return true;
- }
- };
-}}} /* namespace boost::spirit::traits */
-
-
-// ------------------------------------------------
-// ------ Some useful aliases and grammar(s) ------
-// ------------------------------------------------
-
-namespace KIPIPanoramaPlugin { namespace PtoParser
-{
-
- namespace phoenix = boost::phoenix;
- namespace qi = boost::spirit::qi;
- namespace ascii = boost::spirit::ascii;
- typedef std::string::const_iterator iterator_type;
-
- // QString without space
- template <typename Iterator>
- struct stringGrammar : qi::grammar<Iterator, QString()>
- {
- stringGrammar();
-
- qi::rule<Iterator, QString()> base;
- };
-
- template <typename Iterator>
- struct rectangleGrammar : qi::grammar<Iterator, QRect()>
- {
- rectangleGrammar();
-
- qi::rule<Iterator, QRect()> base;
- };
-
-}} /* namespace KIPIPanoramaPlugin::PtoParser */
-
-#endif /* PTOPARSER_COMMON_H */
+)
\ No newline at end of file
diff --git a/panorama/ptoparser/ptotype.cpp b/panorama/ptotype/ptotype.cpp
similarity index 100%
rename from panorama/ptoparser/ptotype.cpp
rename to panorama/ptotype/ptotype.cpp
diff --git a/panorama/ptoparser/ptotype.h b/panorama/ptotype/ptotype.h
similarity index 100%
rename from panorama/ptoparser/ptotype.h
rename to panorama/ptotype/ptotype.h
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic