Commit 11701a0c authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

io/xml/save_text_lines.hh: Fix XML output.

parent 53a98117
2010-04-13 Guillaume Lazzara <z@lrde.epita.fr>
* io/xml/save_text_lines.hh: Fix XML output.
2010-04-13 Guillaume Lazzara <z@lrde.epita.fr>
* debug/decision_image.hh: Add the anchor::Type as argument.
......
......@@ -84,56 +84,60 @@ namespace scribo
file << "<PcGts xmlns=\"http://schema.primaresearch.org/PAGE/gts/pagecontent/2009-03-16\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://schema.primaresearch.org/PAGE/gts/pagecontent/2009-03-16 http://schema.primaresearch.org/PAGE/gts/pagecontent/2009-03-16/pagecontent.xsd\" pcGtsId=\"" << input_name << "\">" << std::endl;
file << " <Metadata>" << std::endl;
file << " <Creator>LRDE</pcCreator>" << std::endl;
file << " <Created/>" << std::endl;
file << " <LastChange/>" << std::endl;
file << " <Comments>Generated by Scribo from Olena.</pcComments>" << std::endl;
file << " </Metadata>" << std::endl;
file << " <Page image_filename=\"" << input_name
<< "\" image_width=\"" << lines.component_set_().labeled_image().ncols()
<< "\" image_height=\"" << lines.component_set_().labeled_image().nrows()
file << " <PcMetadata>" << std::endl;
file << " <PcCreator>LRDE</PcCreator>" << std::endl;
file << " <PcCreated/>" << std::endl;
file << " <PcLastChange/>" << std::endl;
file << " <PcComments>Generated by Scribo from Olena.</PcComments>" << std::endl;
file << " </PcMetadata>" << std::endl;
file << " <page image_filename=\"" << input_name
<< "\" image_width=\"" << lines.components().labeled_image().ncols()
<< "\" image_height=\"" << lines.components().labeled_image().nrows()
<< "\">" << std::endl;
for_all_lines(l, lines)
{
file << " <text_region id=\"" << lines(l).id()
<< "\" txt_orientation=\"" << lines(l).orientation()
<< "\" txt_reading_orientation=\"" << lines(l).reading_orientation()
<< "\" txt_reading_direction=\"" << lines(l).reading_direction()
<< "\" txt_reverse_video=\"" << (lines(l).reverse_video() ? "true" : "false")
<< "\" txt_indented=\"" << (lines(l).indented() ? "true" : "false")
// EXTENSIONS - Not officially supported
<< "\" baseline=\"" << lines(l).baseline()
<< "\" median=\"" << lines(l).median()
<< "\" x_height=\"" << lines(l).x_height()
<< "\" d_height=\"" << lines(l).d_height()
<< "\" a_height=\"" << lines(l).a_height()
<< "\" char_space=\"" << lines(l).char_space()
<< "\" char_width=\"" << lines(l).char_width()
// End of EXTENSIONS
<< "\">"
<< std::endl;
file << " <coords>" << std::endl
<< " <point x=\"" << lines(l).bbox().pmin().row()
<< "\" y=\"" << lines(l).bbox().pmin().col() << "\"/>"
<< std::endl
<< " <point x=\"" << lines(l).bbox().pmin().row()
<< "\" y=\"" << lines(l).bbox().pmax().col() << "\"/>"
<< std::endl
<< " <point x=\"" << lines(l).bbox().pmax().row()
<< "\" y=\"" << lines(l).bbox().pmin().col() << "\"/>"
<< std::endl
<< " <point x=\"" << lines(l).bbox().pmax().row()
<< "\" y=\"" << lines(l).bbox().pmax().col() << "\"/>"
<< std::endl
<< " </coords>" << std::endl;
}
file << " </text_region>" << std::endl;
file << " </Page>" << std::endl;
if (lines(l).tag() != line::Merged
&& lines(l).tag() != line::Ignored)
{
file << " <text_region id=\"" << lines(l).id()
<< "\" txt_orientation=\"" << lines(l).orientation()
<< "\" txt_reading_orientation=\"" << lines(l).reading_orientation()
<< "\" txt_reading_direction=\"" << lines(l).reading_direction()
<< "\" txt_reverse_video=\"" << (lines(l).reverse_video() ? "true" : "false")
<< "\" txt_indented=\"" << (lines(l).indented() ? "true" : "false")
<< "\" kerning=\"" << lines(l).char_space()
// EXTENSIONS - Not officially supported
<< "\" baseline=\"" << lines(l).baseline()
<< "\" meanline=\"" << lines(l).meanline()
<< "\" x_height=\"" << lines(l).x_height()
<< "\" d_height=\"" << lines(l).d_height()
<< "\" a_height=\"" << lines(l).a_height()
<< "\" char_width=\"" << lines(l).char_width()
// End of EXTENSIONS
<< "\">"
<< std::endl;
file << " <coords>" << std::endl
<< " <point x=\"" << lines(l).bbox().pmin().col()
<< "\" y=\"" << lines(l).bbox().pmin().row() << "\"/>"
<< std::endl
<< " <point x=\"" << lines(l).bbox().pmax().col()
<< "\" y=\"" << lines(l).bbox().pmin().row() << "\"/>"
<< std::endl
<< " <point x=\"" << lines(l).bbox().pmax().col()
<< "\" y=\"" << lines(l).bbox().pmax().row() << "\"/>"
<< std::endl
<< " <point x=\"" << lines(l).bbox().pmin().col()
<< "\" y=\"" << lines(l).bbox().pmax().row() << "\"/>"
<< std::endl
<< " </coords>" << std::endl;
file << " </text_region>" << std::endl;
}
file << " </page>" << std::endl;
file << "</PcGts>" << std::endl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment