* scribo/core/paragraph_info.hh: Add validity information.
* scribo/core/tag/line.hh: Fix guard.
* scribo/debug/line_info_image.hh: Use is_textline().
* scribo/io/xml/internal/extended_page_xml_visitor.hh,
* scribo/io/xml/internal/full_xml_visitor.hh,
* scribo/io/xml/internal/page_xml_visitor.hh: Check paragraph
validity.
* scribo/primitive/extract/alignments.hh,
* scribo/primitive/extract/lines_pattern.hh,
* scribo/primitive/extract/separators_nonvisible.hh,
* scribo/primitive/group/from_double_link_any.hh,
* scribo/text/link_lines.hh,
* scribo/text/paragraphs.hh: Fix namespace ambiguity.
* scribo/text/merging.hh: Add missing SCRIBO_NDEBUG guards.
* src/primitive/extract/lines_h_thick_and_thin.cc: Add a missing
include.
* tests/primitive/extract/Makefile.am: Do not override an existing
variable.
---
scribo/ChangeLog | 30 +++++++
scribo/scribo/core/paragraph_info.hh | 15 +++-
scribo/scribo/core/tag/line.hh | 2 +-
scribo/scribo/debug/line_info_image.hh | 5 +-
.../io/xml/internal/extended_page_xml_visitor.hh | 81 ++++++++++----------
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 79 ++++++++++----------
scribo/scribo/io/xml/internal/page_xml_visitor.hh | 51 ++++++------
scribo/scribo/primitive/extract/alignments.hh | 12 +---
scribo/scribo/primitive/extract/lines_pattern.hh | 2 +-
.../primitive/extract/separators_nonvisible.hh | 6 +-
.../scribo/primitive/group/from_double_link_any.hh | 7 +-
scribo/scribo/text/link_lines.hh | 2 +-
scribo/scribo/text/merging.hh | 37 +++++++--
scribo/scribo/text/paragraphs.hh | 18 ++--
.../primitive/extract/lines_h_thick_and_thin.cc | 1 +
scribo/tests/primitive/extract/Makefile.am | 2 +-
16 files changed, 204 insertions(+), 146 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index c1e1ff8..3c70e89 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,35 @@
2011-05-26 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Various small fixes in Scribo.
+
+ * scribo/core/paragraph_info.hh: Add validity information.
+
+ * scribo/core/tag/line.hh: Fix guard.
+
+ * scribo/debug/line_info_image.hh: Use is_textline().
+
+ * scribo/io/xml/internal/extended_page_xml_visitor.hh,
+ * scribo/io/xml/internal/full_xml_visitor.hh,
+ * scribo/io/xml/internal/page_xml_visitor.hh: Check paragraph
+ validity.
+
+ * scribo/primitive/extract/alignments.hh,
+ * scribo/primitive/extract/lines_pattern.hh,
+ * scribo/primitive/extract/separators_nonvisible.hh,
+ * scribo/primitive/group/from_double_link_any.hh,
+ * scribo/text/link_lines.hh,
+ * scribo/text/paragraphs.hh: Fix namespace ambiguity.
+
+ * scribo/text/merging.hh: Add missing SCRIBO_NDEBUG guards.
+
+ * src/primitive/extract/lines_h_thick_and_thin.cc: Add a missing
+ include.
+
+ * tests/primitive/extract/Makefile.am: Do not override an existing
+ variable.
+
+2011-05-26 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Introduce paragraph_id_t type.
* scribo/core/paragraph_set.hh: Make use of this new type.
diff --git a/scribo/scribo/core/paragraph_info.hh b/scribo/scribo/core/paragraph_info.hh
index 52068a7..af619dd 100644
--- a/scribo/scribo/core/paragraph_info.hh
+++ b/scribo/scribo/core/paragraph_info.hh
@@ -71,6 +71,7 @@ namespace scribo
void set_color_reliability_(float v);
bool is_valid() const;
+ void invalidate();
bool needs_stats_update() const;
void force_stats_update();
@@ -84,6 +85,7 @@ namespace scribo
float color_reliability_;
bool needs_stats_update_;
+ bool is_valid_;
};
template <typename L>
@@ -97,13 +99,13 @@ namespace scribo
template <typename L>
paragraph_info<L>::paragraph_info()
- : needs_stats_update_(false)
+ : needs_stats_update_(false), is_valid_(false)
{
}
template <typename L>
paragraph_info<L>::paragraph_info(const line_links<L>& llinks)
- : llinks_(llinks), needs_stats_update_(false)
+ : llinks_(llinks), needs_stats_update_(false), is_valid_(true)
{
}
@@ -186,7 +188,14 @@ namespace scribo
bool
paragraph_info<L>::is_valid() const
{
- return llinks_.is_valid();
+ return llinks_.is_valid() && is_valid_;
+ }
+
+ template <typename L>
+ void
+ paragraph_info<L>::invalidate()
+ {
+ is_valid_ = false;
}
template <typename L>
diff --git a/scribo/scribo/core/tag/line.hh b/scribo/scribo/core/tag/line.hh
index 12b3246..d8972a7 100644
--- a/scribo/scribo/core/tag/line.hh
+++ b/scribo/scribo/core/tag/line.hh
@@ -255,4 +255,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_CORE_TAG_COMP_HH
+#endif // ! SCRIBO_CORE_TAG_LINE_HH
diff --git a/scribo/scribo/debug/line_info_image.hh
b/scribo/scribo/debug/line_info_image.hh
index 1b6532b..f3d7ddf 100644
--- a/scribo/scribo/debug/line_info_image.hh
+++ b/scribo/scribo/debug/line_info_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -70,7 +71,7 @@ namespace scribo
for_all_lines(l, line)
{
- if (! line(l).is_valid() || line(l).is_hidden())
+ if (! line(l).is_textline())
continue;
// Bounding box.
diff --git a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
index 2611d4a..d109827 100644
--- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
@@ -255,48 +255,49 @@ namespace scribo
const line_set<L>& lines = parset.lines();
for_all_paragraphs(p, parset)
- {
- const mln::util::array<line_id_t>& line_ids = parset(p).line_ids();
-
- // FIXME: compute that information on the whole paragraph
- // and use them here.
- line_id_t fid = line_ids(0);
- output << " <text_region id=\"" << p
- << "\" txt_orientation=\"" <<
lines(fid).orientation()
- << "\" txt_reading_orientation=\"" <<
lines(fid).reading_orientation()
- << "\" txt_reading_direction=\"" <<
lines(fid).reading_direction()
- << "\" txt_text_type=\"" << lines(fid).type()
- << "\" txt_reverse_video=\"" <<
(lines(fid).reverse_video() ? "true" : "false")
- << "\" txt_indented=\"" << (lines(fid).indented() ?
"true" : "false")
- << "\" txt_text_colour=\"" <<
internal::compute_text_colour(parset(p).color())
- << "\" kerning=\"" << lines(fid).char_space();
-
- // EXTENSIONS - Not officially supported
- // FIXME: add boldness?
- output << "\" color=\"" <<
scribo::util::color_to_hex(parset(p).color())
- << "\" color_reliability=\"" <<
parset(p).color_reliability()
- << "\" baseline=\"" << lines(fid).baseline()
- << "\" meanline=\"" << lines(fid).meanline()
- << "\" x_height=\"" << lines(fid).x_height()
- << "\" d_height=\"" << lines(fid).d_height()
- << "\" a_height=\"" << lines(fid).a_height()
- << "\" char_width=\"" << lines(fid).char_width();
- // End of EXTENSIONS
- output << "\">"
- << std::endl;
-
- internal::print_box_coords(output, parset(p).bbox(), " ");
-
- // EXTENSIONS - Not officially supported
- for_all_paragraph_lines(lid, line_ids)
+ if (parset(p).is_valid())
{
- line_id_t l = line_ids(lid);
- lines(l).accept(*this);
+ const mln::util::array<line_id_t>& line_ids = parset(p).line_ids();
+
+ // FIXME: compute that information on the whole paragraph
+ // and use them here.
+ line_id_t fid = line_ids(0);
+ output << " <text_region id=\"" << p
+ << "\" txt_orientation=\"" <<
lines(fid).orientation()
+ << "\" txt_reading_orientation=\"" <<
lines(fid).reading_orientation()
+ << "\" txt_reading_direction=\"" <<
lines(fid).reading_direction()
+ << "\" txt_text_type=\"" << lines(fid).type()
+ << "\" txt_reverse_video=\"" <<
(lines(fid).reverse_video() ? "true" : "false")
+ << "\" txt_indented=\"" << (lines(fid).indented()
? "true" : "false")
+ << "\" txt_text_colour=\"" <<
internal::compute_text_colour(parset(p).color())
+ << "\" kerning=\"" << lines(fid).char_space();
+
+ // EXTENSIONS - Not officially supported
+ // FIXME: add boldness?
+ output << "\" color=\"" <<
scribo::util::color_to_hex(parset(p).color())
+ << "\" color_reliability=\"" <<
parset(p).color_reliability()
+ << "\" baseline=\"" << lines(fid).baseline()
+ << "\" meanline=\"" << lines(fid).meanline()
+ << "\" x_height=\"" << lines(fid).x_height()
+ << "\" d_height=\"" << lines(fid).d_height()
+ << "\" a_height=\"" << lines(fid).a_height()
+ << "\" char_width=\"" << lines(fid).char_width();
+ // End of EXTENSIONS
+ output << "\">"
+ << std::endl;
+
+ internal::print_box_coords(output, parset(p).bbox(), " ");
+
+ // EXTENSIONS - Not officially supported
+ for_all_paragraph_lines(lid, line_ids)
+ {
+ line_id_t l = line_ids(lid);
+ lines(l).accept(*this);
+ }
+ // End of EXTENSIONS
+
+ output << " </text_region>" << std::endl;
}
- // End of EXTENSIONS
-
- output << " </text_region>" << std::endl;
- }
}
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 614c473..c6109ee 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -441,48 +441,49 @@ namespace scribo
const line_set<L>& lines = parset.lines();
for_all_paragraphs(p, parset)
- {
- const mln::util::array<line_id_t>& line_ids = parset(p).line_ids();
-
- // FIXME: compute that information on the whole paragraph
- // and use them here.
- line_id_t fid = line_ids(0);
- output << " <text_region id=\"" << p
- << "\" txt_orientation=\"" <<
lines(fid).orientation()
- << "\" txt_reading_orientation=\"" <<
lines(fid).reading_orientation()
- << "\" txt_reading_direction=\"" <<
lines(fid).reading_direction()
- << "\" txt_text_type=\"" << lines(fid).type()
- << "\" txt_reverse_video=\"" <<
(lines(fid).reverse_video() ? "true" : "false")
- << "\" txt_indented=\"" << (lines(fid).indented() ?
"true" : "false")
- << "\" txt_text_colour=\"" <<
internal::compute_text_colour(parset(p).color())
- << "\" kerning=\"" << lines(fid).char_space();
-
- // EXTENSIONS - Not officially supported
- output << "\" baseline=\"" << lines(fid).baseline()
- << "\" meanline=\"" << lines(fid).meanline()
- << "\" x_height=\"" << lines(fid).x_height()
- << "\" d_height=\"" << lines(fid).d_height()
- << "\" a_height=\"" << lines(fid).a_height()
- << "\" char_width=\"" << lines(fid).char_width()
- << "\" color=\"" <<
scribo::util::color_to_hex(parset(p).color())
- << "\" color_reliability=\"" <<
parset(p).color_reliability();
- // End of EXTENSIONS
- output << "\">"
- << std::endl;
-
- internal::print_box_coords(output, parset(p).bbox(), " ");
-
-
- // EXTENSIONS - Not officially supported
- for_all_paragraph_lines(lid, line_ids)
+ if (parset(p).is_valid())
{
- line_id_t l = line_ids(lid);
+ const mln::util::array<line_id_t>& line_ids = parset(p).line_ids();
+
+ // FIXME: compute that information on the whole paragraph
+ // and use them here.
+ line_id_t fid = line_ids(0);
+ output << " <text_region id=\"" << p
+ << "\" txt_orientation=\"" <<
lines(fid).orientation()
+ << "\" txt_reading_orientation=\"" <<
lines(fid).reading_orientation()
+ << "\" txt_reading_direction=\"" <<
lines(fid).reading_direction()
+ << "\" txt_text_type=\"" << lines(fid).type()
+ << "\" txt_reverse_video=\"" <<
(lines(fid).reverse_video() ? "true" : "false")
+ << "\" txt_indented=\"" << (lines(fid).indented()
? "true" : "false")
+ << "\" txt_text_colour=\"" <<
internal::compute_text_colour(parset(p).color())
+ << "\" kerning=\"" << lines(fid).char_space();
+
+ // EXTENSIONS - Not officially supported
+ output << "\" baseline=\"" <<
lines(fid).baseline()
+ << "\" meanline=\"" << lines(fid).meanline()
+ << "\" x_height=\"" << lines(fid).x_height()
+ << "\" d_height=\"" << lines(fid).d_height()
+ << "\" a_height=\"" << lines(fid).a_height()
+ << "\" char_width=\"" << lines(fid).char_width()
+ << "\" color=\"" <<
scribo::util::color_to_hex(parset(p).color())
+ << "\" color_reliability=\"" <<
parset(p).color_reliability();
+ // End of EXTENSIONS
+ output << "\">"
+ << std::endl;
+
+ internal::print_box_coords(output, parset(p).bbox(), " ");
+
+
+ // EXTENSIONS - Not officially supported
+ for_all_paragraph_lines(lid, line_ids)
+ {
+ line_id_t l = line_ids(lid);
- lines(l).accept(*this);
- }
+ lines(l).accept(*this);
+ }
- output << " </text_region>" << std::endl;
- }
+ output << " </text_region>" << std::endl;
+ }
}
diff --git a/scribo/scribo/io/xml/internal/page_xml_visitor.hh
b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
index b807dbb..66ba21f 100644
--- a/scribo/scribo/io/xml/internal/page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
@@ -218,37 +218,38 @@ namespace scribo
const line_set<L>& lines = parset.lines();
for_all_paragraphs(p, parset)
- {
- const mln::util::array<line_id_t>& line_ids = parset(p).line_ids();
-
- // FIXME: compute that information on the whole paragraph
- // and use them here.
- line_id_t fid = line_ids(0);
- output << " <TextRegion id=\"r" << p
- << "\" orientation=\"" << lines(fid).orientation()
- << "\" readingOrientation=\"" <<
lines(fid).reading_orientation()
- << "\" readingDirection=\"" <<
lines(fid).reading_direction()
- << "\" type=\"" << ((lines(fid).type() ==
line::Text) ? "paragraph" : line::type2str(lines(fid).type()))
- << "\" reverseVideo=\"" <<
(lines(fid).reverse_video() ? "true" : "false")
- << "\" indented=\"" << (lines(fid).indented() ?
"true" : "false")
- << "\" kerning=\"" << lines(fid).char_space()
- << "\" textColour=\"" <<
compute_text_colour(lines(fid).color())
+ if (parset(p).is_valid())
+ {
+ const mln::util::array<line_id_t>& line_ids = parset(p).line_ids();
+
+ // FIXME: compute that information on the whole paragraph
+ // and use them here.
+ line_id_t fid = line_ids(0);
+ output << " <TextRegion id=\"r" << p
+ << "\" orientation=\"" <<
lines(fid).orientation()
+ << "\" readingOrientation=\"" <<
lines(fid).reading_orientation()
+ << "\" readingDirection=\"" <<
lines(fid).reading_direction()
+ << "\" type=\"" << ((lines(fid).type() ==
line::Text) ? "paragraph" : line::type2str(lines(fid).type()))
+ << "\" reverseVideo=\"" <<
(lines(fid).reverse_video() ? "true" : "false")
+ << "\" indented=\"" << (lines(fid).indented() ?
"true" : "false")
+ << "\" kerning=\"" << lines(fid).char_space()
+ << "\" textColour=\"" <<
compute_text_colour(lines(fid).color())
// << "\" bgColour=\"" <<
compute_text_color(lines(fid).bgcolor())
// << "\" fontSize=\"" <<
compute_text_color(lines(fid).x_height())
// << "\" leading=\"" <<
compute_text_color(lines(fid).leading())
- << "\">"
- << std::endl;
+ << "\">"
+ << std::endl;
- // Add support for text recognition
- // <TextEquiv>
- // <PlainText></PlainText>
- // <Unicode></Unicode>
- // </TextEquiv>
+ // Add support for text recognition
+ // <TextEquiv>
+ // <PlainText></PlainText>
+ // <Unicode></Unicode>
+ // </TextEquiv>
- internal::print_box_coords(output, parset(p).bbox(), " ");
+ internal::print_box_coords(output, parset(p).bbox(), " ");
- output << " </TextRegion>" << std::endl;
- }
+ output << " </TextRegion>" << std::endl;
+ }
}
diff --git a/scribo/scribo/primitive/extract/alignments.hh
b/scribo/scribo/primitive/extract/alignments.hh
index 7dbf683..b2c7c0c 100644
--- a/scribo/scribo/primitive/extract/alignments.hh
+++ b/scribo/scribo/primitive/extract/alignments.hh
@@ -43,8 +43,6 @@
# include <mln/io/pbm/load.hh>
-# include <mln/labeling/colorize.hh>
-
# include <mln/util/couple.hh>
# include <scribo/core/def/lbl_type.hh>
@@ -61,7 +59,6 @@
# include <scribo/debug/usage.hh>
# include <scribo/debug/links_image.hh>
-
# include <scribo/core/document.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/line_set.hh>
@@ -76,11 +73,6 @@
# include <scribo/preprocessing/rotate_90.hh>
# include <scribo/filter/object_links_bbox_h_ratio.hh>
-# include <scribo/primitive/extract/separators.hh>
-# include <scribo/primitive/extract/vertical_separators.hh>
-# include <scribo/primitive/extract/horizontal_separators.hh>
-# include <scribo/primitive/extract/separators_nonvisible.hh>
-
namespace scribo
{
@@ -710,7 +702,7 @@ namespace scribo
// 2.1.2. Check TOP whitespaces
{
- util::array<accu::shape::bbox<point2d> >
+ mln::util::array<accu::shape::bbox<point2d> >
group_bbox(top_groups.nelements());
// Compute group bboxes
@@ -941,7 +933,7 @@ namespace scribo
// 2.2.2. Check BOTTOM whitespaces
{
- util::array<accu::shape::bbox<point2d> >
+ mln::util::array<accu::shape::bbox<point2d> >
group_bbox(bot_groups.nelements());
// Compute group bboxes
diff --git a/scribo/scribo/primitive/extract/lines_pattern.hh
b/scribo/scribo/primitive/extract/lines_pattern.hh
index 85bdbe4..ec24d4f 100644
--- a/scribo/scribo/primitive/extract/lines_pattern.hh
+++ b/scribo/scribo/primitive/extract/lines_pattern.hh
@@ -166,7 +166,7 @@ namespace scribo
mln_concrete(I) output;
initialize(output, input);
- util::array<int>
+ mln::util::array<int>
q_arr = offsets_wrt(output, win);
bool is_foreground;
diff --git a/scribo/scribo/primitive/extract/separators_nonvisible.hh
b/scribo/scribo/primitive/extract/separators_nonvisible.hh
index 5c26285..3f36880 100644
--- a/scribo/scribo/primitive/extract/separators_nonvisible.hh
+++ b/scribo/scribo/primitive/extract/separators_nonvisible.hh
@@ -124,8 +124,8 @@ namespace scribo
max_angle = 5,
min_card = 3;
- util::timer t;
- util::timer gt;
+ mln::util::timer t;
+ mln::util::timer gt;
gt.start();
@@ -395,7 +395,7 @@ namespace scribo
t.restart();
- util::array<bool> relbl(unsigned(nlabels) + 1, true);
+ mln::util::array<bool> relbl(unsigned(nlabels) + 1, true);
relbl(0) = false;
unsigned invalid_ratio = unsigned(length * 0.30f);
diff --git a/scribo/scribo/primitive/group/from_double_link_any.hh
b/scribo/scribo/primitive/group/from_double_link_any.hh
index 7ed15e2..9e315a3 100644
--- a/scribo/scribo/primitive/group/from_double_link_any.hh
+++ b/scribo/scribo/primitive/group/from_double_link_any.hh
@@ -79,7 +79,7 @@ namespace scribo
{
template <typename L>
- util::array<unsigned> make_parent(const object_links<L>& link)
+ mln::util::array<unsigned> make_parent(const object_links<L>& link)
{
mln::util::array<unsigned> parent = link.comp_to_link();
for_all_links(l, link)
@@ -102,8 +102,9 @@ namespace scribo
object_links<L> merged_link(left_link.components());
merged_link.init();
- util::array<unsigned> lparent = internal::make_parent(left_link);
- util::array<unsigned> rparent = internal::make_parent(right_link);
+ mln::util::array<unsigned>
+ lparent = internal::make_parent(left_link),
+ rparent = internal::make_parent(right_link);
for_all_links(i, merged_link)
{
diff --git a/scribo/scribo/text/link_lines.hh b/scribo/scribo/text/link_lines.hh
index 6c985f5..4eab43d 100644
--- a/scribo/scribo/text/link_lines.hh
+++ b/scribo/scribo/text/link_lines.hh
@@ -72,7 +72,7 @@ namespace scribo
mln::data::fill(blocks, literal::zero);
// Construct a list of rotated bboxes for each lines.
- util::array<mln_box(L)> rbbox(1);
+ mln::util::array<mln_box(L)> rbbox(1);
rbbox.reserve(lines.nelements());
for_all_lines(l, lines)
diff --git a/scribo/scribo/text/merging.hh b/scribo/scribo/text/merging.hh
index 2763882..f1135ed 100644
--- a/scribo/scribo/text/merging.hh
+++ b/scribo/scribo/text/merging.hh
@@ -181,10 +181,7 @@ namespace scribo
l1 = my_find_root(parent, l1);
l2 = my_find_root(parent, l2);
if (l1 == l2)
- {
- std::cerr << "what! in'do_union': already merged!!!"
<< std::endl;
- return l1;
- }
+ return l1;
swap_ordering(l1, l2);
parent[l2] = l1; // The smallest label value is root.
@@ -625,8 +622,10 @@ namespace scribo
image2d<unsigned> billboard(domain);
data::fill(billboard, 0);
+# ifndef SCRIBO_NDEBUG
image2d<value::int_u8> log(domain);
data::fill(log, 0);
+# endif // ! SCRIBO_NDEBUG
const unsigned n = v.size();
unsigned l_;
@@ -765,9 +764,10 @@ namespace scribo
// l_ = do_union(lines, mc, l, parent);
// draw_box(billboard, lines(l_).ebbox(), l_);
+# ifndef SCRIBO_NDEBUG
// Log:
draw_box(log, b, 126);
-
+# endif // ! SCRIBO_NDEBUG
}
else // FIXME: Remove! since included in a non-text-line, so not drawn, so inclusion
impossible!!!!!!!!!!
@@ -777,8 +777,11 @@ namespace scribo
// a non-text-line (probably a drawing or a frame) includes a text line
draw_box(billboard, lines(l).ebbox(), l);
+
+# ifndef SCRIBO_NDEBUG
// Log:
draw_box(log, b, 100);
+# endif // ! SCRIBO_NDEBUG
}
}
@@ -817,8 +820,10 @@ namespace scribo
// it may change of label (take the one of the included line).
draw_box(billboard, lines(l_).ebbox(), l_);
+# ifndef SCRIBO_NDEBUG
// Log:
draw_box(log, b, 128);
+# endif // ! SCRIBO_NDEBUG
}
}
}
@@ -831,11 +836,15 @@ namespace scribo
{
++count_new_txtline;
draw_box(billboard, lines(l).ebbox(), l);
+# ifndef SCRIBO_NDEBUG
// Log:
draw_box(log, b, 127);
+# endif // ! SCRIBO_NDEBUG
}
+# ifndef SCRIBO_NDEBUG
else
- draw_box(log, b, 1);
+ draw_box(log, b, 1);
+# endif // ! SCRIBO_NDEBUG
}
}
else
@@ -852,8 +861,8 @@ namespace scribo
if (lcand == 0) // Skip background.
continue;
- if (lines(lcand).type() != line::Text)
- std::cerr << "again!" << std::endl;
+ // if (lines(lcand).type() != line::Text)
+ // std::cerr << "again!" << std::endl;
if (lines(l_).type() == line::Text)
@@ -865,15 +874,22 @@ namespace scribo
l_ = do_union(lines, l_, lcand, parent);
draw_box(billboard, lines(l_).ebbox(), l_);
+
+# ifndef SCRIBO_NDEBUG
// Log:
draw_box(log, b, 151);
+# endif // ! SCRIBO_NDEBUG
+
continue;
}
else
{
++count_WTF;
+
+# ifndef SCRIBO_NDEBUG
// Log:
draw_box(log, b, 255);
+# endif // ! SCRIBO_NDEBUG
// (*) SEE BELOW
draw_box(billboard, lines(l_).ebbox(), l_);
@@ -890,15 +906,20 @@ namespace scribo
l_ = do_union(lines, l_, lcand, parent);
draw_box(billboard, lines(l_).ebbox(), l_);
+# ifndef SCRIBO_NDEBUG
// Log:
draw_box(log, b, 169);
+# endif // ! SCRIBO_NDEBUG
+
continue;
}
+# ifndef SCRIBO_NDEBUG
else
{
// Log:
draw_box(log, b, 254);
}
+# endif // ! SCRIBO_NDEBUG
}
diff --git a/scribo/scribo/text/paragraphs.hh b/scribo/scribo/text/paragraphs.hh
index af01581..37817af 100644
--- a/scribo/scribo/text/paragraphs.hh
+++ b/scribo/scribo/text/paragraphs.hh
@@ -864,7 +864,7 @@ namespace scribo
void prepare_lines(const box2d& domain,
const line_set<L>& lines,
L& blocks,
- util::array<box2d>& rbbox)
+ mln::util::array<box2d>& rbbox)
{
std::map< int, std::vector< const box2d* > > drawn_lines;
// const unsigned nlines = lines.nelements();
@@ -989,7 +989,7 @@ namespace scribo
inline
void
process_left_link(L& blocks,
- const util::array<box2d>& rbbox,
+ const mln::util::array<box2d>& rbbox,
const line_set<L>& lines,
line_links<L>& left)
{
@@ -1133,7 +1133,7 @@ namespace scribo
inline
void
process_right_link(L& blocks,
- const util::array<box2d>& rbbox,
+ const mln::util::array<box2d>& rbbox,
const line_set<L>& lines,
line_links<L>& right)
{
@@ -1328,7 +1328,7 @@ namespace scribo
// }
/// const unsigned nlines = lines_info.nelemnts();
- util::array<box2d> rbbox;
+ mln::util::array<box2d> rbbox;
line_links<L> left(lines);
left(0) = 0;
line_links<L> right(lines);
@@ -1338,18 +1338,18 @@ namespace scribo
rbbox.resize(lines.nelements() + 1);
- std::cout << "Preparing lines" << std::endl;
+// std::cout << "Preparing lines" << std::endl;
prepare_lines(input.domain(), lines , blocks, rbbox);
// io::pgm::save(blocks, "blocks.pgm");
- std::cout << "Linking left" << std::endl;
+// std::cout << "Linking left" << std::endl;
process_left_link(blocks, rbbox, lines , left);
- std::cout << "Linking right" << std::endl;
+// std::cout << "Linking right" << std::endl;
process_right_link(blocks, rbbox, lines , right);
- std::cout << "Finalizing links" << std::endl;
+// std::cout << "Finalizing links" << std::endl;
finalize_links(left, right, lines );
// std::cout << "Finalizing merging" << std::endl;
// finalize_line_merging(left, right, lines);
- std::cout << "Extracting paragraphs" << std::endl;
+// std::cout << "Extracting paragraphs" << std::endl;
filter::paragraph_links(left, right, output, lines);
paragraph_set<L> par_set = make::paragraph(output);
diff --git a/scribo/src/primitive/extract/lines_h_thick_and_thin.cc
b/scribo/src/primitive/extract/lines_h_thick_and_thin.cc
index 2942002..1161f2a 100644
--- a/scribo/src/primitive/extract/lines_h_thick_and_thin.cc
+++ b/scribo/src/primitive/extract/lines_h_thick_and_thin.cc
@@ -25,6 +25,7 @@
#include <scribo/primitive/extract/lines_h_thick_and_thin.hh>
+#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
{
diff --git a/scribo/tests/primitive/extract/Makefile.am
b/scribo/tests/primitive/extract/Makefile.am
index 33d3a96..b622b15 100644
--- a/scribo/tests/primitive/extract/Makefile.am
+++ b/scribo/tests/primitive/extract/Makefile.am
@@ -26,7 +26,7 @@ check_PROGRAMS =
if HAVE_MAGICKXX
-check_PROGRAMS = alignments
+check_PROGRAMS += alignments
alignments_SOURCES = alignments.cc
alignments_CPPFLAGS = $(AM_CPPFLAGS) \
$(MAGICKXX_CPPFLAGS) \
--
1.5.6.5