26 #ifndef SCRIBO_IO_TEXT_BOXES_SAVE_HH
27 # define SCRIBO_IO_TEXT_BOXES_SAVE_HH
37 # include <scribo/core/line_set.hh>
50 save(
const line_set<L>& lines,
51 const std::string& output_name,
52 const mln_site(L)& crop_shift = literal::origin);
55 # ifndef MLN_INCLUDE_ONLY
60 save(
const line_set<L>& lines,
61 const std::string& output_name,
62 const mln_site(L)& crop_shift)
64 mln_trace(
"scribo::io::text_boxes:save");
65 mln_precondition(lines.is_valid());
67 std::ofstream
file(output_name.c_str());
70 std::cerr <<
"error: cannot open file '" << output_name <<
"'!";
74 for_all_lines(l, lines)
76 if (! lines(l).is_valid() || lines(l).tag() != line::None || lines(l).type() != line::Text || lines(l).text().empty())
79 file << lines(l).bbox().pmin().row() + crop_shift.row()<<
" "
80 << lines(l).bbox().pmin().col() + crop_shift.col()<<
" "
81 << lines(l).bbox().pmax().row() + crop_shift.row() <<
" "
82 << lines(l).bbox().pmax().col() + crop_shift.col()<<
" "
83 << lines(l).text() << std::endl;
92 # endif // ! MLN_INCLUDE_ONLY
101 #endif // ! SCRIBO_IO_TEXT_BOXES_SAVE_HH