---
scribo/sandbox/raphael/code/my/document/clean.hh | 63 ++++++++++---------
.../sandbox/raphael/code/my/document/separator.hh | 53 ++++++++++-------
scribo/sandbox/raphael/code/my/runtime/runtime.hh | 4 +-
scribo/sandbox/raphael/code/test.cc | 2 +-
4 files changed, 68 insertions(+), 54 deletions(-)
diff --git a/scribo/sandbox/raphael/code/my/document/clean.hh
b/scribo/sandbox/raphael/code/my/document/clean.hh
index 0f5276d..023ac1f 100644
--- a/scribo/sandbox/raphael/code/my/document/clean.hh
+++ b/scribo/sandbox/raphael/code/my/document/clean.hh
@@ -401,21 +401,23 @@ namespace mymln
mln_niter_(nbh_t) q(nbh, v);
for_all(v)
{
- if(doc.contain_line(v))
+ L lv = doc[v];
+ if(doc.contain_line(lv))
{
for_all(q)
{
+ L lq = doc[q];
if(
- doc.contain_line(q) &&
- !doc.same_line(q,v) &&
- doc.get_line_length(q) == 1 &&
- doc.line_influence_has(v,q) &&
- !doc.align_H_large(v,q) &&
- (doc.align_base_line_strict(v,q) || doc.align_V(v,q))
+ doc.contain_line(lq) &&
+ !doc.same_line(lq,lv) &&
+ doc.get_line_length(lq) == 1 &&
+ doc.line_influence_has(lv,q) &&
+ !doc.align_H_large(lv,lq) &&
+ (doc.align_base_line_strict(lv,lq) || doc.align_V(lv,lq))
)
{
doc.debug_draw_line_green_buffer(q,v);
- doc.add_to_line_link(q,v);
+ doc.add_to_line_link(lq,lv);
}
}
}
@@ -436,63 +438,64 @@ namespace mymln
mln_niter_(nbh_t) q(nbh, v);
for_all(v)
{
+ L lv = doc[v];
if(doc.contain_line(v))
{
for_all(q)
{
+ L lq = doc[q];
+ if(doc.same_line(lq,lv)){ continue;}
- if(doc.same_line(q,v)){ continue;}
-
- if(doc.contain_alone_letter(q))
+ if(doc.contain_alone_letter(lq))
{
- if(doc.align_V(q,v) && doc.align_proximity_strict(q, v) &&
doc.align_size_height(q, v))
+ if(doc.align_V(lq,lv) && doc.align_proximity_strict(lq, lv) &&
doc.align_size_height(lq, lv))
{
- doc.add_to_line_link(v, q);
+ doc.add_to_line_link(lv, lq);
}
}
- else if(doc.contain_line(q))
+ else if(doc.contain_line(lq))
{
- if(doc.align_V(q,v) && doc.align_size_height_line_strict(q, v) &&
doc.align_proximity_strict(q,v))
+ if(doc.align_V(lq,lv) && doc.align_size_height_line_strict(lq, lv) &&
doc.align_proximity_strict(lq,lv))
{
- doc.add_to_line_link(v, q);
+ doc.add_to_line_link(lv, lq);
}
- else if(doc.align_size_height_line(q,v))
+ else if(doc.align_size_height_line(lq,lv))
{
- if(doc.align_proximity_line(q,v) && doc.align_V_line_strict(q, v))
+ if(doc.align_proximity_line(lq,lv) && doc.align_V_line_strict(lq, lv))
{
- doc.add_to_line_link(v, q);
+ doc.add_to_line_link(lv, lq);
doc.debug_draw_line_green_buffer(v,q);
}
- else if(doc.line_influence_reciprocal(q, v) && doc.align_V_line_strict(q,
v) && doc.align_size_height_line(q,v))
+ else if(doc.line_influence_reciprocal(lq, lv) &&
doc.align_V_line_strict(lq, lv) && doc.align_size_height_line(lq,lv))
{
- doc.add_to_line_link(v, q);
+ doc.add_to_line_link(lv, lq);
doc.debug_draw_line_red_buffer(v,q);
}
else if(
- doc.line_influence_reciprocal(q, v) &&
- !doc.same_line(q,v) &&
- doc.align_V(q,v) &&
- doc.align_size_x_height(v,q) &&
- doc.get_line_length(v) > 4 &&
- doc.align_proximity_line(v,q)
+ doc.line_influence_reciprocal(lq, lv) &&
+ !doc.same_line(lq,lv) &&
+ doc.align_V(lq,lv) &&
+ doc.align_size_x_height(lv,lq) &&
+ doc.get_line_length(lv) > 4 &&
+ doc.align_proximity_line(lv,lq)
)
{
doc.debug_draw_box_red_buffer(v);
doc.debug_draw_box_green_buffer(q);
- doc.add_to_line_link(v, q);
+ doc.add_to_line_link(lv, lq);
}
- else if(doc.align_V(q,v) && doc.align_proximity_strict(q,v))
+ else if(doc.align_V(lq,lv) && doc.align_proximity_strict(lq,lv))
{
doc.debug_draw_line_orange_buffer(q,v);
- doc.add_to_line_link(v, q);
+ doc.add_to_line_link(lv, lq);
}
}
diff --git a/scribo/sandbox/raphael/code/my/document/separator.hh
b/scribo/sandbox/raphael/code/my/document/separator.hh
index be33d38..b7ddc27 100644
--- a/scribo/sandbox/raphael/code/my/document/separator.hh
+++ b/scribo/sandbox/raphael/code/my/document/separator.hh
@@ -52,50 +52,59 @@ namespace mymln
nbh_t nbh(mask);
mln_niter_(nbh_t) q(nbh, v);
mymln::util::union_find<L> sep_union(doc.size());
+ bool Change = false;
for_all(v)
{
- if(!doc[v]){continue;}
- if(doc.contain_Vseparator(doc[v]) && !sep_union[doc[v]])
+ L lv = doc[v];
+ if(!lv){continue;}
+ if(doc.contain_Vseparator(lv) && !sep_union[lv])
{
- sep_union[doc[v]] = sep_union.new_set();
- sep_union.add_self_link(doc[v]);
- if(doc.is_very_big_element_V(v))
+ sep_union[lv] = sep_union.new_set();
+ sep_union.add_self_link(lv);
+ Change = true;
+ if(doc.is_very_big_element_V(lv))
{ continue; }
}
for_all(q)
{
- if(doc.contain_Vseparator(doc[q])){continue;}
- if(doc.contain_Vseparator(doc[v]) &&
- doc.separator_has(v, q))
+ L lq = doc[q];
+ if(doc.contain_Vseparator(lq)){continue;}
+ if(doc.contain_Vseparator(lv) &&
+ doc.separator_has(lv, lq))
{
- doc.add_Vseparator(doc[q]);
- doc.debug_draw_box_red_buffer(doc[q]);
- sep_union[doc[q]] = sep_union[doc[v]];
- sep_union.add_link(doc[v], doc[q]);
+ doc.add_Vseparator(lq);
+ doc.debug_draw_box_red_buffer(lq);
+ sep_union[lq] = sep_union[lv];
+ sep_union.add_link(lv, lq);
+ Change = true;
}
else if(
- doc.letter_ratio_XY (q) <= 1 &&
- doc.align_H_large_one(q, v) &&
- doc.align_proximity_top_strict(q,v)
+ doc.letter_ratio_XY (lq) <= 1 &&
+ doc.align_H_large_one(lq, lv) &&
+ doc.align_proximity_top_strict(lq,lv)
)
{
- sep_union.add_link(doc[v], doc[q]);
+ sep_union.add_link(lv, lq);
+ Change = true;
}
}
}
- doc.debug_union(sep_union);
- sep_union.propage_links();
- for(int N = 0; N < doc.size(); N++)
+ //doc.debug_union(sep_union);
+ if(Change)
{
- if(sep_union[N])
+ sep_union.propage_links();
+ for(int N = 0; N < doc.size(); N++)
{
- if(!doc.contain_Vseparator(N))
+ if(sep_union[N])
{
- doc.add_Vseparator(N);
+ if(!doc.contain_Vseparator(N))
+ {
+ doc.add_Vseparator(N);
+ }
}
}
}
diff --git a/scribo/sandbox/raphael/code/my/runtime/runtime.hh
b/scribo/sandbox/raphael/code/my/runtime/runtime.hh
index 110283a..7c3d41d 100644
--- a/scribo/sandbox/raphael/code/my/runtime/runtime.hh
+++ b/scribo/sandbox/raphael/code/my/runtime/runtime.hh
@@ -108,7 +108,9 @@ namespace mymln
{
float time = timer.stop() ;
if(time < 0.001f){time = 0.0f;}
- std::cout << program_instruction[CP] << " : " << time
<< std::endl; timer.restart();
+ if(time > 0.035f)
+ {std::cout << program_instruction[CP] << " : " << time
<< std::endl; }
+ timer.restart();
}
}
}
diff --git a/scribo/sandbox/raphael/code/test.cc b/scribo/sandbox/raphael/code/test.cc
index 00acd1c..a3d94a6 100644
--- a/scribo/sandbox/raphael/code/test.cc
+++ b/scribo/sandbox/raphael/code/test.cc
@@ -148,7 +148,7 @@ void Process(std::string File, std::string Dir,
mymln::runtime::runtime< value::
}
- runtime.run_debug();
+ runtime.run();
std::cout << "WORK ON GRAPH : " << timer.stop() <<
endl;
//mymln::data::page<uint16,float,short> page(doc);
// page.export_HTML(Dir + "/debug_" + File + ".html");
--
1.7.2.5