mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
DocDiff application: draw differences onto pages
This commit is contained in:
@@ -1180,6 +1180,42 @@ PDFInteger PDFDiffResult::getRightPage(size_t index) const
|
||||
return m_differences[index].pageIndex2;
|
||||
}
|
||||
|
||||
std::pair<PDFDiffResult::RectInfosIt, PDFDiffResult::RectInfosIt> PDFDiffResult::getLeftRectangles(size_t index) const
|
||||
{
|
||||
if (index >= m_differences.size())
|
||||
{
|
||||
return std::make_pair(m_rects.cend(), m_rects.cend());
|
||||
}
|
||||
|
||||
const Difference& difference = m_differences[index];
|
||||
if (difference.leftRectCount > 0)
|
||||
{
|
||||
auto it = std::next(m_rects.cbegin(), difference.leftRectIndex);
|
||||
auto itEnd = std::next(it, difference.leftRectCount);
|
||||
return std::make_pair(it, itEnd);
|
||||
}
|
||||
|
||||
return std::make_pair(m_rects.cend(), m_rects.cend());
|
||||
}
|
||||
|
||||
std::pair<PDFDiffResult::RectInfosIt, PDFDiffResult::RectInfosIt> PDFDiffResult::getRightRectangles(size_t index) const
|
||||
{
|
||||
if (index >= m_differences.size())
|
||||
{
|
||||
return std::make_pair(m_rects.cend(), m_rects.cend());
|
||||
}
|
||||
|
||||
const Difference& difference = m_differences[index];
|
||||
if (difference.rightRectCount > 0)
|
||||
{
|
||||
auto it = std::next(m_rects.cbegin(), difference.rightRectIndex);
|
||||
auto itEnd = std::next(it, difference.rightRectCount);
|
||||
return std::make_pair(it, itEnd);
|
||||
}
|
||||
|
||||
return std::make_pair(m_rects.cend(), m_rects.cend());
|
||||
}
|
||||
|
||||
bool PDFDiffResult::isPageMoveDifference(size_t index) const
|
||||
{
|
||||
return getTypeFlags(index) & FLAGS_TYPE_PAGE_MOVE;
|
||||
|
@@ -68,6 +68,7 @@ public:
|
||||
using PageSequence = std::vector<PageSequenceItem>;
|
||||
|
||||
using RectInfos = std::vector<std::pair<PDFInteger, QRectF>>;
|
||||
using RectInfosIt = typename RectInfos::const_iterator;
|
||||
|
||||
void setResult(PDFOperationResult result) { m_result = std::move(result); }
|
||||
const PDFOperationResult& getResult() const { return m_result; }
|
||||
@@ -95,6 +96,12 @@ public:
|
||||
/// \param index Index
|
||||
PDFInteger getRightPage(size_t index) const;
|
||||
|
||||
/// Returns iterator range for rectangles of "left" pages of an item
|
||||
std::pair<RectInfosIt, RectInfosIt> getLeftRectangles(size_t index) const;
|
||||
|
||||
/// Returns iterator range for rectangles of "right" pages of an item
|
||||
std::pair<RectInfosIt, RectInfosIt> getRightRectangles(size_t index) const;
|
||||
|
||||
bool isPageMoveDifference(size_t index) const;
|
||||
bool isAddDifference(size_t index) const;
|
||||
bool isRemoveDifference(size_t index) const;
|
||||
|
Reference in New Issue
Block a user