-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Order by dewarping mode at output stage
- Loading branch information
1 parent
c3d7086
commit 42bf8ef
Showing
6 changed files
with
122 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
Scan Tailor - Interactive post-processing tool for scanned pages. | ||
Copyright (C) Joseph Artsimovich <[email protected]> | ||
Copyright (C) Alexander Trufanov <[email protected]> | ||
This program 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 3 of the License, or | ||
(at your option) any later version. | ||
This program 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 General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "OrderByDewarpingModeProvider.h" | ||
#include "Params.h" | ||
#include <QSizeF> | ||
#include <memory> | ||
#include <assert.h> | ||
|
||
namespace output | ||
{ | ||
|
||
OrderByDewarpingModeProvider::OrderByDewarpingModeProvider(IntrusivePtr<Settings> const& settings) | ||
: m_ptrSettings(settings) | ||
{ | ||
} | ||
|
||
bool | ||
OrderByDewarpingModeProvider::precedes( | ||
PageId const& lhs_page, bool const /*lhs_incomplete*/, | ||
PageId const& rhs_page, bool const /*rhs_incomplete*/) const | ||
{ | ||
DewarpingMode const l_param(m_ptrSettings->getParams(lhs_page).dewarpingMode()); | ||
DewarpingMode const r_param(m_ptrSettings->getParams(rhs_page).dewarpingMode()); | ||
|
||
if (l_param != r_param) { | ||
return l_param < r_param; | ||
} | ||
|
||
return lhs_page < rhs_page; | ||
} | ||
|
||
QString dewarpingMode2String(DewarpingMode const mode) | ||
{ | ||
switch (mode) { | ||
case DewarpingMode::OFF: return QObject::tr("off"); | ||
case DewarpingMode::MANUAL: return QObject::tr("manual"); | ||
case DewarpingMode::MARGINAL: return QObject::tr("marginal"); | ||
case DewarpingMode::AUTO: return QObject::tr("auto"); | ||
default: return QString(); | ||
} | ||
} | ||
|
||
QString | ||
OrderByDewarpingModeProvider::hint(PageId const& page) const | ||
{ | ||
DewarpingMode const param(m_ptrSettings->getParams(page).dewarpingMode()); | ||
return dewarpingMode2String(param); | ||
} | ||
|
||
} // namespace output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
Scan Tailor - Interactive post-processing tool for scanned pages. | ||
Copyright (C) Joseph Artsimovich <[email protected]> | ||
Copyright (C) Alexander Trufanov <[email protected]> | ||
This program 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 3 of the License, or | ||
(at your option) any later version. | ||
This program 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 General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef ORDER_BY_DEWARPING_MODE_PROVIDER_H_ | ||
#define ORDER_BY_DEWARPING_MODE_PROVIDER_H_ | ||
|
||
#include "Settings.h" | ||
#include "IntrusivePtr.h" | ||
#include "PageOrderProvider.h" | ||
|
||
namespace output | ||
{ | ||
|
||
class OrderByDewarpingModeProvider : public PageOrderProvider | ||
{ | ||
public: | ||
OrderByDewarpingModeProvider(IntrusivePtr<Settings> const& settings); | ||
|
||
virtual bool precedes( | ||
PageId const& lhs_page, bool lhs_incomplete, | ||
PageId const& rhs_page, bool rhs_incomplete) const; | ||
|
||
virtual QString hint(PageId const& page) const; | ||
private: | ||
IntrusivePtr<Settings> m_ptrSettings; | ||
}; | ||
|
||
} // namespace output | ||
|
||
#endif //ORDER_BY_DEWARPING_MODE_PROVIDER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters