LRE
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
List overview
Download
Olena-patches
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
olena-patches@lrde.epita.fr
9625 discussions
Start a n
N
ew thread
last-svn-commit-801-g1a5cc61 Spread anchor value to more methods in link functors.
by Guillaume Lazzara
* scribo/primitive/link/internal/find_link.hh, * scribo/primitive/link/internal/link_functor_base.hh, * scribo/primitive/link/internal/link_single_dmax_ratio_base.hh: Here. --- scribo/ChangeLog | 8 +++++ scribo/scribo/primitive/link/internal/find_link.hh | 5 ++- .../primitive/link/internal/link_functor_base.hh | 31 +++++++++++++------- .../link/internal/link_single_dmax_ratio_base.hh | 7 +++- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index bd7b036..fc78930 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,13 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Spread anchor value to more methods in link functors. + + * scribo/primitive/link/internal/find_link.hh, + * scribo/primitive/link/internal/link_functor_base.hh, + * scribo/primitive/link/internal/link_single_dmax_ratio_base.hh: Here. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce a logger class. * scribo/debug/logger.hh: New. diff --git a/scribo/scribo/primitive/link/internal/find_link.hh b/scribo/scribo/primitive/link/internal/find_link.hh index dd0b308..7220b0c 100644 --- a/scribo/scribo/primitive/link/internal/find_link.hh +++ b/scribo/scribo/primitive/link/internal/find_link.hh @@ -87,10 +87,11 @@ namespace scribo while (functor.components().labeled_image().domain().has(p) && ! functor.is_potential_link(current_object, start_point, p) - && functor.verify_link_criterion(current_object, start_point, p)) + && functor.verify_link_criterion(current_object, start_point, + p, anchor)) functor.compute_next_site(p); // <-- compute_next_site - if (functor.valid_link(current_object, start_point, p)) // <-- valid_link + if (functor.valid_link(current_object, start_point, p, anchor)) // <-- valid_link functor.validate_link(current_object, start_point, p, anchor); // <-- validate_link else functor.invalidate_link(current_object, start_point, p, anchor); // <-- invalidate_link diff --git a/scribo/scribo/primitive/link/internal/link_functor_base.hh b/scribo/scribo/primitive/link/internal/link_functor_base.hh index ad3d71b..d214c91 100644 --- a/scribo/scribo/primitive/link/internal/link_functor_base.hh +++ b/scribo/scribo/primitive/link/internal/link_functor_base.hh @@ -88,13 +88,15 @@ namespace scribo bool verify_link_criterion(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; bool is_potential_link(unsigned current_object, const P& start_point, const P& p) const; bool valid_link(unsigned current_object, - const P& start_point, const P& p); + const P& start_point, const P& p, + anchor::Type anchor); @@ -147,10 +149,12 @@ namespace scribo const P& start_point, const P& p) const; bool verify_link_criterion_(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; bool valid_link_(unsigned current_object, - const P& start_point, const P& p); + const P& start_point, const P& p, + anchor::Type anchor); void validate_link_(unsigned current_object, const P& start_point, const P& p, @@ -263,14 +267,15 @@ namespace scribo bool link_functor_base<L,E>::verify_link_criterion(unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { return // Do not link with separators... ! this->components_.separators()(p) // ... and perform custom checks. && exact(this)->verify_link_criterion_(current_object, - start_point, p); + start_point, p, anchor); } template <typename L, typename E> @@ -278,10 +283,11 @@ namespace scribo bool link_functor_base<L,E>::valid_link(unsigned current_object, const P& start_point, - const P& p) + const P& p, + anchor::Type anchor) { return this->labeled_image_.domain().has(p) - && exact(this)->valid_link_(current_object, start_point, p); + && exact(this)->valid_link_(current_object, start_point, p, anchor); } @@ -428,11 +434,13 @@ namespace scribo bool link_functor_base<L,E>::verify_link_criterion_(unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { (void) current_object; (void) start_point; (void) p; + (void) anchor; // No-Op return true; } @@ -443,10 +451,11 @@ namespace scribo bool link_functor_base<L,E>::valid_link_(unsigned current_object, const P& start_point, - const P& p) + const P& p, + anchor::Type anchor) { return is_potential_link(current_object, start_point, p) - && verify_link_criterion(current_object, start_point, p); + && verify_link_criterion(current_object, start_point, p, anchor); } diff --git a/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh b/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh index d3aba42..3abe663 100644 --- a/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh +++ b/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh @@ -86,7 +86,8 @@ namespace scribo bool verify_link_criterion_(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; mln_site(L) start_point_(unsigned current_object, anchor::Type anchor); @@ -123,9 +124,11 @@ namespace scribo link_single_dmax_ratio_base<L, F, E>::verify_link_criterion_( unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { (void) current_object; + (void) anchor; float dist = math::abs(p[direction_] - start_point[direction_]); return dist <= dmax_; // Not too far -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-801-g1d1a977 Spread anchor value to more methods in link functors.
by Guillaume Lazzara
* scribo/primitive/link/internal/find_link.hh, * scribo/primitive/link/internal/link_functor_base.hh, * scribo/primitive/link/internal/link_single_dmax_ratio_base.hh: Here. --- scribo/ChangeLog | 8 +++++ scribo/scribo/primitive/link/internal/find_link.hh | 5 ++- .../primitive/link/internal/link_functor_base.hh | 31 +++++++++++++------- .../link/internal/link_single_dmax_ratio_base.hh | 7 +++- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index bd7b036..fc78930 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,13 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Spread anchor value to more methods in link functors. + + * scribo/primitive/link/internal/find_link.hh, + * scribo/primitive/link/internal/link_functor_base.hh, + * scribo/primitive/link/internal/link_single_dmax_ratio_base.hh: Here. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce a logger class. * scribo/debug/logger.hh: New. diff --git a/scribo/scribo/primitive/link/internal/find_link.hh b/scribo/scribo/primitive/link/internal/find_link.hh index dd0b308..7220b0c 100644 --- a/scribo/scribo/primitive/link/internal/find_link.hh +++ b/scribo/scribo/primitive/link/internal/find_link.hh @@ -87,10 +87,11 @@ namespace scribo while (functor.components().labeled_image().domain().has(p) && ! functor.is_potential_link(current_object, start_point, p) - && functor.verify_link_criterion(current_object, start_point, p)) + && functor.verify_link_criterion(current_object, start_point, + p, anchor)) functor.compute_next_site(p); // <-- compute_next_site - if (functor.valid_link(current_object, start_point, p)) // <-- valid_link + if (functor.valid_link(current_object, start_point, p, anchor)) // <-- valid_link functor.validate_link(current_object, start_point, p, anchor); // <-- validate_link else functor.invalidate_link(current_object, start_point, p, anchor); // <-- invalidate_link diff --git a/scribo/scribo/primitive/link/internal/link_functor_base.hh b/scribo/scribo/primitive/link/internal/link_functor_base.hh index ad3d71b..d214c91 100644 --- a/scribo/scribo/primitive/link/internal/link_functor_base.hh +++ b/scribo/scribo/primitive/link/internal/link_functor_base.hh @@ -88,13 +88,15 @@ namespace scribo bool verify_link_criterion(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; bool is_potential_link(unsigned current_object, const P& start_point, const P& p) const; bool valid_link(unsigned current_object, - const P& start_point, const P& p); + const P& start_point, const P& p, + anchor::Type anchor); @@ -147,10 +149,12 @@ namespace scribo const P& start_point, const P& p) const; bool verify_link_criterion_(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; bool valid_link_(unsigned current_object, - const P& start_point, const P& p); + const P& start_point, const P& p, + anchor::Type anchor); void validate_link_(unsigned current_object, const P& start_point, const P& p, @@ -263,14 +267,15 @@ namespace scribo bool link_functor_base<L,E>::verify_link_criterion(unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { return // Do not link with separators... ! this->components_.separators()(p) // ... and perform custom checks. && exact(this)->verify_link_criterion_(current_object, - start_point, p); + start_point, p, anchor); } template <typename L, typename E> @@ -278,10 +283,11 @@ namespace scribo bool link_functor_base<L,E>::valid_link(unsigned current_object, const P& start_point, - const P& p) + const P& p, + anchor::Type anchor) { return this->labeled_image_.domain().has(p) - && exact(this)->valid_link_(current_object, start_point, p); + && exact(this)->valid_link_(current_object, start_point, p, anchor); } @@ -428,11 +434,13 @@ namespace scribo bool link_functor_base<L,E>::verify_link_criterion_(unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { (void) current_object; (void) start_point; (void) p; + (void) anchor; // No-Op return true; } @@ -443,10 +451,11 @@ namespace scribo bool link_functor_base<L,E>::valid_link_(unsigned current_object, const P& start_point, - const P& p) + const P& p, + anchor::Type anchor) { return is_potential_link(current_object, start_point, p) - && verify_link_criterion(current_object, start_point, p); + && verify_link_criterion(current_object, start_point, p, anchor); } diff --git a/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh b/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh index d3aba42..3abe663 100644 --- a/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh +++ b/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh @@ -86,7 +86,8 @@ namespace scribo bool verify_link_criterion_(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; mln_site(L) start_point_(unsigned current_object, anchor::Type anchor); @@ -123,9 +124,11 @@ namespace scribo link_single_dmax_ratio_base<L, F, E>::verify_link_criterion_( unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { (void) current_object; + (void) anchor; float dist = math::abs(p[direction_] - start_point[direction_]); return dist <= dmax_; // Not too far -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-802-g742d012 Spread anchor value to more methods in link functors.
by Guillaume Lazzara
* scribo/primitive/link/internal/find_link.hh, * scribo/primitive/link/internal/link_functor_base.hh, * scribo/primitive/link/internal/link_single_dmax_ratio_base.hh: Here. --- scribo/ChangeLog | 8 +++++ scribo/scribo/primitive/link/internal/find_link.hh | 5 ++- .../primitive/link/internal/link_functor_base.hh | 31 +++++++++++++------- .../link/internal/link_single_dmax_ratio_base.hh | 7 +++- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 1e9b57e..10a8269 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,13 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Spread anchor value to more methods in link functors. + + * scribo/primitive/link/internal/find_link.hh, + * scribo/primitive/link/internal/link_functor_base.hh, + * scribo/primitive/link/internal/link_single_dmax_ratio_base.hh: Here. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce a logger class. * scribo/debug/logger.hh: New. diff --git a/scribo/scribo/primitive/link/internal/find_link.hh b/scribo/scribo/primitive/link/internal/find_link.hh index dd0b308..7220b0c 100644 --- a/scribo/scribo/primitive/link/internal/find_link.hh +++ b/scribo/scribo/primitive/link/internal/find_link.hh @@ -87,10 +87,11 @@ namespace scribo while (functor.components().labeled_image().domain().has(p) && ! functor.is_potential_link(current_object, start_point, p) - && functor.verify_link_criterion(current_object, start_point, p)) + && functor.verify_link_criterion(current_object, start_point, + p, anchor)) functor.compute_next_site(p); // <-- compute_next_site - if (functor.valid_link(current_object, start_point, p)) // <-- valid_link + if (functor.valid_link(current_object, start_point, p, anchor)) // <-- valid_link functor.validate_link(current_object, start_point, p, anchor); // <-- validate_link else functor.invalidate_link(current_object, start_point, p, anchor); // <-- invalidate_link diff --git a/scribo/scribo/primitive/link/internal/link_functor_base.hh b/scribo/scribo/primitive/link/internal/link_functor_base.hh index ad3d71b..d214c91 100644 --- a/scribo/scribo/primitive/link/internal/link_functor_base.hh +++ b/scribo/scribo/primitive/link/internal/link_functor_base.hh @@ -88,13 +88,15 @@ namespace scribo bool verify_link_criterion(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; bool is_potential_link(unsigned current_object, const P& start_point, const P& p) const; bool valid_link(unsigned current_object, - const P& start_point, const P& p); + const P& start_point, const P& p, + anchor::Type anchor); @@ -147,10 +149,12 @@ namespace scribo const P& start_point, const P& p) const; bool verify_link_criterion_(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; bool valid_link_(unsigned current_object, - const P& start_point, const P& p); + const P& start_point, const P& p, + anchor::Type anchor); void validate_link_(unsigned current_object, const P& start_point, const P& p, @@ -263,14 +267,15 @@ namespace scribo bool link_functor_base<L,E>::verify_link_criterion(unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { return // Do not link with separators... ! this->components_.separators()(p) // ... and perform custom checks. && exact(this)->verify_link_criterion_(current_object, - start_point, p); + start_point, p, anchor); } template <typename L, typename E> @@ -278,10 +283,11 @@ namespace scribo bool link_functor_base<L,E>::valid_link(unsigned current_object, const P& start_point, - const P& p) + const P& p, + anchor::Type anchor) { return this->labeled_image_.domain().has(p) - && exact(this)->valid_link_(current_object, start_point, p); + && exact(this)->valid_link_(current_object, start_point, p, anchor); } @@ -428,11 +434,13 @@ namespace scribo bool link_functor_base<L,E>::verify_link_criterion_(unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { (void) current_object; (void) start_point; (void) p; + (void) anchor; // No-Op return true; } @@ -443,10 +451,11 @@ namespace scribo bool link_functor_base<L,E>::valid_link_(unsigned current_object, const P& start_point, - const P& p) + const P& p, + anchor::Type anchor) { return is_potential_link(current_object, start_point, p) - && verify_link_criterion(current_object, start_point, p); + && verify_link_criterion(current_object, start_point, p, anchor); } diff --git a/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh b/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh index d3aba42..3abe663 100644 --- a/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh +++ b/scribo/scribo/primitive/link/internal/link_single_dmax_ratio_base.hh @@ -86,7 +86,8 @@ namespace scribo bool verify_link_criterion_(unsigned current_object, - const P& start_point, const P& p) const; + const P& start_point, const P& p, + anchor::Type anchor) const; mln_site(L) start_point_(unsigned current_object, anchor::Type anchor); @@ -123,9 +124,11 @@ namespace scribo link_single_dmax_ratio_base<L, F, E>::verify_link_criterion_( unsigned current_object, const P& start_point, - const P& p) const + const P& p, + anchor::Type anchor) const { (void) current_object; + (void) anchor; float dist = math::abs(p[direction_] - start_point[direction_]); return dist <= dmax_; // Not too far -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-799-g3f06d28 Introduce a logger class.
by Guillaume Lazzara
* scribo/debug/logger.hh: New. --- scribo/ChangeLog | 6 + scribo/scribo/debug/logger.hh | 293 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 299 insertions(+), 0 deletions(-) create mode 100644 scribo/scribo/debug/logger.hh diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 58685f6..50c49e7 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,11 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce a logger class. + + * scribo/debug/logger.hh: New. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce new anchors. * scribo/core/tag/anchor.hh: New anchors. diff --git a/scribo/scribo/debug/logger.hh b/scribo/scribo/debug/logger.hh new file mode 100644 index 0000000..d955f08 --- /dev/null +++ b/scribo/scribo/debug/logger.hh @@ -0,0 +1,293 @@ +// Copyright (C) 2011 EPITA Research and Development Laboratory +// (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <
http://www.gnu.org/licenses/
>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef SCRIBO_CORE_LOGGER_HH +# define SCRIBO_CORE_LOGGER_HH + +# include <mln/core/concept/image.hh> +# include <mln/data/wrap.hh> +# include <mln/value/int_u8.hh> +# include <mln/debug/filename.hh> +# include <mln/io/pbm/save.hh> +# include <mln/io/pgm/save.hh> +# include <mln/io/ppm/save.hh> + +namespace scribo +{ + + namespace debug + { + + enum Level + { + None = 0, + Special, // Reserved + Results, + AuxiliaryResults, + All + }; + + + namespace internal + { + using namespace mln; + + class logger_ + { + public: + static logger_& instance(); + + bool is_enabled() const; + bool is_at_level(Level level) const; + + void set_level(Level level); + Level level() const; + + void set_filename_prefix(const char *name); + const char *filename_prefix() const; + + template <typename I> + void log_image(Level dbg_level, + const Image<I>& ima, const char *name); + + private: // Methods + logger_(); + logger_(const logger_&); + + template <unsigned n, typename I> + void log_image_dispatch(const value::int_u<n>&, + const Image<I>& ima, const char *name); + + template <unsigned n, typename I> + void + log_image_dispatch(const value::label<n>&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const mln_value(I)&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const value::rgb8&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const bool&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_rgb(const I& ima, const std::string& name); + + template <typename I> + void log_image_bool(const I& ima, const std::string& name); + + template <typename I> + void log_image_grayscale(const I& ima, const std::string& name); + + private: // Attributes + Level level_; + + }; + + } // end of namespace scribo::debug::internal + + + // Return a reference to the logger. + scribo::debug::internal::logger_& logger(); + + +# ifndef MLN_INCLUDE_ONLY + + namespace internal + { + + inline + logger_& + logger_::instance() + { + static logger_ log; + return log; + } + + + inline + logger_::logger_() + : level_(None) + { + // Magick::InitializeMagick(0); + } + + + inline + logger_::logger_(const logger_&) + { + abort(); + } + + + inline + bool + logger_::is_enabled() const + { + return level_ != None; + } + + + inline + bool + logger_::is_at_level(Level level) const + { + return level_ >= level; + } + + + inline + void + logger_::set_filename_prefix(const char *name) + { + mln::debug::internal::filename_prefix = name; + } + + + inline + const char * + logger_::filename_prefix() const + { + return mln::debug::internal::filename_prefix.c_str(); + } + + + inline + void logger_::set_level(Level level) + { + level_ = level; + } + + + inline + Level logger_::level() const + { + return level_; + } + + + template <typename I> + void + logger_::log_image(Level dbg_level, + const Image<I>& ima, const char *name) + { +# ifndef SCRIBO_NDEBUG + if (level_ < dbg_level) + return; + + std::cerr << "Logger - Saving image " << name << std::endl; + mln_assertion(exact(ima).is_valid()); + + typedef mln_value(I) V; + log_image_dispatch(V(), ima, name); +# endif // ! SCRIBO_NDEBUG + } + + + template <unsigned n, typename I> + void + logger_::log_image_dispatch(const value::int_u<n>&, const Image<I>& ima, const char *name) + { + log_image_grayscale(exact(ima), name); + } + + template <unsigned n, typename I> + void + logger_::log_image_dispatch(const value::label<n>&, const Image<I>& ima, const char *name) + { + log_image_grayscale(exact(ima), name); + } + + + template <typename I> + void + logger_::log_image_dispatch(const value::rgb8&, const Image<I>& ima, const char *name) + { + log_image_rgb(exact(ima), name); + } + + template <typename I> + void + logger_::log_image_dispatch(const bool&, const Image<I>& ima, const char *name) + { + log_image_bool(exact(ima), name); + } + + + // template <typename I> + // void + // logger_::log_image_generic(const I& ima, const std::string& name) + // { + // io::magick::save(ima, mln::debug::filename(name + ".png")); + // } + + template <typename I> + void + logger_::log_image_rgb(const I& ima, const std::string& name) + { + io::ppm::save(ima, mln::debug::filename(name + ".ppm")); + } + + + template <typename I> + void + logger_::log_image_bool(const I& ima, const std::string& name) + { + io::pbm::save(ima, mln::debug::filename(name + ".pbm")); + } + + + template <typename I> + void + logger_::log_image_grayscale(const I& ima, const std::string& name) + { + io::pgm::save(data::wrap(value::int_u8(), ima), + mln::debug::filename(name + ".pgm")); + } + + } // end of namespace scribo::debug::internal + + + inline + scribo::debug::internal::logger_& + logger() + { + return scribo::debug::internal::logger_::instance(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace scribo::debug + +} // end of namespace scribo + +#endif // ! SCRIBO_CORE_LOGGER_HH -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-799-gfe898e7 Introduce a logger class.
by Guillaume Lazzara
* scribo/debug/logger.hh: New. --- scribo/ChangeLog | 6 + scribo/scribo/debug/logger.hh | 293 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 299 insertions(+), 0 deletions(-) create mode 100644 scribo/scribo/debug/logger.hh diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 58685f6..50c49e7 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,11 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce a logger class. + + * scribo/debug/logger.hh: New. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce new anchors. * scribo/core/tag/anchor.hh: New anchors. diff --git a/scribo/scribo/debug/logger.hh b/scribo/scribo/debug/logger.hh new file mode 100644 index 0000000..d955f08 --- /dev/null +++ b/scribo/scribo/debug/logger.hh @@ -0,0 +1,293 @@ +// Copyright (C) 2011 EPITA Research and Development Laboratory +// (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <
http://www.gnu.org/licenses/
>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef SCRIBO_CORE_LOGGER_HH +# define SCRIBO_CORE_LOGGER_HH + +# include <mln/core/concept/image.hh> +# include <mln/data/wrap.hh> +# include <mln/value/int_u8.hh> +# include <mln/debug/filename.hh> +# include <mln/io/pbm/save.hh> +# include <mln/io/pgm/save.hh> +# include <mln/io/ppm/save.hh> + +namespace scribo +{ + + namespace debug + { + + enum Level + { + None = 0, + Special, // Reserved + Results, + AuxiliaryResults, + All + }; + + + namespace internal + { + using namespace mln; + + class logger_ + { + public: + static logger_& instance(); + + bool is_enabled() const; + bool is_at_level(Level level) const; + + void set_level(Level level); + Level level() const; + + void set_filename_prefix(const char *name); + const char *filename_prefix() const; + + template <typename I> + void log_image(Level dbg_level, + const Image<I>& ima, const char *name); + + private: // Methods + logger_(); + logger_(const logger_&); + + template <unsigned n, typename I> + void log_image_dispatch(const value::int_u<n>&, + const Image<I>& ima, const char *name); + + template <unsigned n, typename I> + void + log_image_dispatch(const value::label<n>&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const mln_value(I)&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const value::rgb8&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const bool&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_rgb(const I& ima, const std::string& name); + + template <typename I> + void log_image_bool(const I& ima, const std::string& name); + + template <typename I> + void log_image_grayscale(const I& ima, const std::string& name); + + private: // Attributes + Level level_; + + }; + + } // end of namespace scribo::debug::internal + + + // Return a reference to the logger. + scribo::debug::internal::logger_& logger(); + + +# ifndef MLN_INCLUDE_ONLY + + namespace internal + { + + inline + logger_& + logger_::instance() + { + static logger_ log; + return log; + } + + + inline + logger_::logger_() + : level_(None) + { + // Magick::InitializeMagick(0); + } + + + inline + logger_::logger_(const logger_&) + { + abort(); + } + + + inline + bool + logger_::is_enabled() const + { + return level_ != None; + } + + + inline + bool + logger_::is_at_level(Level level) const + { + return level_ >= level; + } + + + inline + void + logger_::set_filename_prefix(const char *name) + { + mln::debug::internal::filename_prefix = name; + } + + + inline + const char * + logger_::filename_prefix() const + { + return mln::debug::internal::filename_prefix.c_str(); + } + + + inline + void logger_::set_level(Level level) + { + level_ = level; + } + + + inline + Level logger_::level() const + { + return level_; + } + + + template <typename I> + void + logger_::log_image(Level dbg_level, + const Image<I>& ima, const char *name) + { +# ifndef SCRIBO_NDEBUG + if (level_ < dbg_level) + return; + + std::cerr << "Logger - Saving image " << name << std::endl; + mln_assertion(exact(ima).is_valid()); + + typedef mln_value(I) V; + log_image_dispatch(V(), ima, name); +# endif // ! SCRIBO_NDEBUG + } + + + template <unsigned n, typename I> + void + logger_::log_image_dispatch(const value::int_u<n>&, const Image<I>& ima, const char *name) + { + log_image_grayscale(exact(ima), name); + } + + template <unsigned n, typename I> + void + logger_::log_image_dispatch(const value::label<n>&, const Image<I>& ima, const char *name) + { + log_image_grayscale(exact(ima), name); + } + + + template <typename I> + void + logger_::log_image_dispatch(const value::rgb8&, const Image<I>& ima, const char *name) + { + log_image_rgb(exact(ima), name); + } + + template <typename I> + void + logger_::log_image_dispatch(const bool&, const Image<I>& ima, const char *name) + { + log_image_bool(exact(ima), name); + } + + + // template <typename I> + // void + // logger_::log_image_generic(const I& ima, const std::string& name) + // { + // io::magick::save(ima, mln::debug::filename(name + ".png")); + // } + + template <typename I> + void + logger_::log_image_rgb(const I& ima, const std::string& name) + { + io::ppm::save(ima, mln::debug::filename(name + ".ppm")); + } + + + template <typename I> + void + logger_::log_image_bool(const I& ima, const std::string& name) + { + io::pbm::save(ima, mln::debug::filename(name + ".pbm")); + } + + + template <typename I> + void + logger_::log_image_grayscale(const I& ima, const std::string& name) + { + io::pgm::save(data::wrap(value::int_u8(), ima), + mln::debug::filename(name + ".pgm")); + } + + } // end of namespace scribo::debug::internal + + + inline + scribo::debug::internal::logger_& + logger() + { + return scribo::debug::internal::logger_::instance(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace scribo::debug + +} // end of namespace scribo + +#endif // ! SCRIBO_CORE_LOGGER_HH -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-800-g303e38d Introduce a logger class.
by Guillaume Lazzara
* scribo/debug/logger.hh: New. --- scribo/ChangeLog | 6 + scribo/scribo/debug/logger.hh | 293 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 299 insertions(+), 0 deletions(-) create mode 100644 scribo/scribo/debug/logger.hh diff --git a/scribo/ChangeLog b/scribo/ChangeLog index d28a95b..a377ba0 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,11 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce a logger class. + + * scribo/debug/logger.hh: New. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce new anchors. * scribo/core/tag/anchor.hh: New anchors. diff --git a/scribo/scribo/debug/logger.hh b/scribo/scribo/debug/logger.hh new file mode 100644 index 0000000..d955f08 --- /dev/null +++ b/scribo/scribo/debug/logger.hh @@ -0,0 +1,293 @@ +// Copyright (C) 2011 EPITA Research and Development Laboratory +// (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <
http://www.gnu.org/licenses/
>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef SCRIBO_CORE_LOGGER_HH +# define SCRIBO_CORE_LOGGER_HH + +# include <mln/core/concept/image.hh> +# include <mln/data/wrap.hh> +# include <mln/value/int_u8.hh> +# include <mln/debug/filename.hh> +# include <mln/io/pbm/save.hh> +# include <mln/io/pgm/save.hh> +# include <mln/io/ppm/save.hh> + +namespace scribo +{ + + namespace debug + { + + enum Level + { + None = 0, + Special, // Reserved + Results, + AuxiliaryResults, + All + }; + + + namespace internal + { + using namespace mln; + + class logger_ + { + public: + static logger_& instance(); + + bool is_enabled() const; + bool is_at_level(Level level) const; + + void set_level(Level level); + Level level() const; + + void set_filename_prefix(const char *name); + const char *filename_prefix() const; + + template <typename I> + void log_image(Level dbg_level, + const Image<I>& ima, const char *name); + + private: // Methods + logger_(); + logger_(const logger_&); + + template <unsigned n, typename I> + void log_image_dispatch(const value::int_u<n>&, + const Image<I>& ima, const char *name); + + template <unsigned n, typename I> + void + log_image_dispatch(const value::label<n>&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const mln_value(I)&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const value::rgb8&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_dispatch(const bool&, + const Image<I>& ima, const char *name); + + template <typename I> + void log_image_rgb(const I& ima, const std::string& name); + + template <typename I> + void log_image_bool(const I& ima, const std::string& name); + + template <typename I> + void log_image_grayscale(const I& ima, const std::string& name); + + private: // Attributes + Level level_; + + }; + + } // end of namespace scribo::debug::internal + + + // Return a reference to the logger. + scribo::debug::internal::logger_& logger(); + + +# ifndef MLN_INCLUDE_ONLY + + namespace internal + { + + inline + logger_& + logger_::instance() + { + static logger_ log; + return log; + } + + + inline + logger_::logger_() + : level_(None) + { + // Magick::InitializeMagick(0); + } + + + inline + logger_::logger_(const logger_&) + { + abort(); + } + + + inline + bool + logger_::is_enabled() const + { + return level_ != None; + } + + + inline + bool + logger_::is_at_level(Level level) const + { + return level_ >= level; + } + + + inline + void + logger_::set_filename_prefix(const char *name) + { + mln::debug::internal::filename_prefix = name; + } + + + inline + const char * + logger_::filename_prefix() const + { + return mln::debug::internal::filename_prefix.c_str(); + } + + + inline + void logger_::set_level(Level level) + { + level_ = level; + } + + + inline + Level logger_::level() const + { + return level_; + } + + + template <typename I> + void + logger_::log_image(Level dbg_level, + const Image<I>& ima, const char *name) + { +# ifndef SCRIBO_NDEBUG + if (level_ < dbg_level) + return; + + std::cerr << "Logger - Saving image " << name << std::endl; + mln_assertion(exact(ima).is_valid()); + + typedef mln_value(I) V; + log_image_dispatch(V(), ima, name); +# endif // ! SCRIBO_NDEBUG + } + + + template <unsigned n, typename I> + void + logger_::log_image_dispatch(const value::int_u<n>&, const Image<I>& ima, const char *name) + { + log_image_grayscale(exact(ima), name); + } + + template <unsigned n, typename I> + void + logger_::log_image_dispatch(const value::label<n>&, const Image<I>& ima, const char *name) + { + log_image_grayscale(exact(ima), name); + } + + + template <typename I> + void + logger_::log_image_dispatch(const value::rgb8&, const Image<I>& ima, const char *name) + { + log_image_rgb(exact(ima), name); + } + + template <typename I> + void + logger_::log_image_dispatch(const bool&, const Image<I>& ima, const char *name) + { + log_image_bool(exact(ima), name); + } + + + // template <typename I> + // void + // logger_::log_image_generic(const I& ima, const std::string& name) + // { + // io::magick::save(ima, mln::debug::filename(name + ".png")); + // } + + template <typename I> + void + logger_::log_image_rgb(const I& ima, const std::string& name) + { + io::ppm::save(ima, mln::debug::filename(name + ".ppm")); + } + + + template <typename I> + void + logger_::log_image_bool(const I& ima, const std::string& name) + { + io::pbm::save(ima, mln::debug::filename(name + ".pbm")); + } + + + template <typename I> + void + logger_::log_image_grayscale(const I& ima, const std::string& name) + { + io::pgm::save(data::wrap(value::int_u8(), ima), + mln::debug::filename(name + ".pgm")); + } + + } // end of namespace scribo::debug::internal + + + inline + scribo::debug::internal::logger_& + logger() + { + return scribo::debug::internal::logger_::instance(); + } + + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace scribo::debug + +} // end of namespace scribo + +#endif // ! SCRIBO_CORE_LOGGER_HH -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-798-g07b076c Introduce new anchors.
by Guillaume Lazzara
* scribo/core/tag/anchor.hh: New anchors. * scribo/filter/internal/alignment_angle.hh, * scribo/primitive/link/internal/compute_anchor.hh: Make use of that new anchors. --- scribo/ChangeLog | 10 ++++++++++ scribo/scribo/core/tag/anchor.hh | 6 ++++-- scribo/scribo/filter/internal/alignment_angle.hh | 2 ++ .../primitive/link/internal/compute_anchor.hh | 16 ++++++++++++++-- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 1de58fe..58685f6 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,15 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce new anchors. + + * scribo/core/tag/anchor.hh: New anchors. + + * scribo/filter/internal/alignment_angle.hh, + * scribo/primitive/link/internal/compute_anchor.hh: Make use of + that new anchors. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Rename document serializer base class. * scribo/core/internal/doc_xml_serializer.hh: Rename as... diff --git a/scribo/scribo/core/tag/anchor.hh b/scribo/scribo/core/tag/anchor.hh index bb6780c..7ce8ddc 100644 --- a/scribo/scribo/core/tag/anchor.hh +++ b/scribo/scribo/core/tag/anchor.hh @@ -37,11 +37,13 @@ namespace scribo { MassCenter = 0, Top, + StrictTopCenter, Bottom, + StrictBottomCenter, Center, - ActualLeft, + StrictLeft, Left, - ActualRight, + StrictRight, Right, TopLeft, TopStrictLeft, diff --git a/scribo/scribo/filter/internal/alignment_angle.hh b/scribo/scribo/filter/internal/alignment_angle.hh index 33855a8..035dec7 100644 --- a/scribo/scribo/filter/internal/alignment_angle.hh +++ b/scribo/scribo/filter/internal/alignment_angle.hh @@ -109,6 +109,7 @@ namespace scribo break; // Top + case anchor::StrictTopCenter: case anchor::TopStrictLeft: case anchor::Top: { @@ -122,6 +123,7 @@ namespace scribo break; // Bottom + case anchor::StrictBottomCenter: case anchor::BottomStrictRight: case anchor::Bottom: { diff --git a/scribo/scribo/primitive/link/internal/compute_anchor.hh b/scribo/scribo/primitive/link/internal/compute_anchor.hh index c1a9106..9afc33f 100644 --- a/scribo/scribo/primitive/link/internal/compute_anchor.hh +++ b/scribo/scribo/primitive/link/internal/compute_anchor.hh @@ -111,6 +111,12 @@ namespace scribo break; + // Bounding box Strict top center + case anchor::StrictTopCenter: + sp.row() = components(current_object).bbox().pmin().row(); + break; + + // Bounding box top left case anchor::TopStrictLeft: sp.col() = components(current_object).bbox().pmin().col(); @@ -138,13 +144,19 @@ namespace scribo break; + // Bounding box strict bottom center. + case anchor::StrictBottomCenter: + sp.row() = components(current_object).bbox().pmax().row(); + break; + + // Bounding box center case anchor::Center: return components(current_object).bbox().pcenter(); // Bounding box actual left center - case anchor::ActualLeft: + case anchor::StrictLeft: return P(components(current_object).bbox().pcenter().row(), components(current_object).bbox().pmin().col()); @@ -161,7 +173,7 @@ namespace scribo // Bounding box actual right center - case anchor::ActualRight: + case anchor::StrictRight: return P(components(current_object).bbox().pcenter().row(), components(current_object).bbox().pmax().col()); -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-798-g5b25a55 Introduce new anchors.
by Guillaume Lazzara
* scribo/core/tag/anchor.hh: New anchors. * scribo/filter/internal/alignment_angle.hh, * scribo/primitive/link/internal/compute_anchor.hh: Make use of that new anchors. --- scribo/ChangeLog | 10 ++++++++++ scribo/scribo/core/tag/anchor.hh | 6 ++++-- scribo/scribo/filter/internal/alignment_angle.hh | 2 ++ .../primitive/link/internal/compute_anchor.hh | 16 ++++++++++++++-- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 1de58fe..58685f6 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,15 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce new anchors. + + * scribo/core/tag/anchor.hh: New anchors. + + * scribo/filter/internal/alignment_angle.hh, + * scribo/primitive/link/internal/compute_anchor.hh: Make use of + that new anchors. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Rename document serializer base class. * scribo/core/internal/doc_xml_serializer.hh: Rename as... diff --git a/scribo/scribo/core/tag/anchor.hh b/scribo/scribo/core/tag/anchor.hh index bb6780c..7ce8ddc 100644 --- a/scribo/scribo/core/tag/anchor.hh +++ b/scribo/scribo/core/tag/anchor.hh @@ -37,11 +37,13 @@ namespace scribo { MassCenter = 0, Top, + StrictTopCenter, Bottom, + StrictBottomCenter, Center, - ActualLeft, + StrictLeft, Left, - ActualRight, + StrictRight, Right, TopLeft, TopStrictLeft, diff --git a/scribo/scribo/filter/internal/alignment_angle.hh b/scribo/scribo/filter/internal/alignment_angle.hh index 33855a8..035dec7 100644 --- a/scribo/scribo/filter/internal/alignment_angle.hh +++ b/scribo/scribo/filter/internal/alignment_angle.hh @@ -109,6 +109,7 @@ namespace scribo break; // Top + case anchor::StrictTopCenter: case anchor::TopStrictLeft: case anchor::Top: { @@ -122,6 +123,7 @@ namespace scribo break; // Bottom + case anchor::StrictBottomCenter: case anchor::BottomStrictRight: case anchor::Bottom: { diff --git a/scribo/scribo/primitive/link/internal/compute_anchor.hh b/scribo/scribo/primitive/link/internal/compute_anchor.hh index c1a9106..9afc33f 100644 --- a/scribo/scribo/primitive/link/internal/compute_anchor.hh +++ b/scribo/scribo/primitive/link/internal/compute_anchor.hh @@ -111,6 +111,12 @@ namespace scribo break; + // Bounding box Strict top center + case anchor::StrictTopCenter: + sp.row() = components(current_object).bbox().pmin().row(); + break; + + // Bounding box top left case anchor::TopStrictLeft: sp.col() = components(current_object).bbox().pmin().col(); @@ -138,13 +144,19 @@ namespace scribo break; + // Bounding box strict bottom center. + case anchor::StrictBottomCenter: + sp.row() = components(current_object).bbox().pmax().row(); + break; + + // Bounding box center case anchor::Center: return components(current_object).bbox().pcenter(); // Bounding box actual left center - case anchor::ActualLeft: + case anchor::StrictLeft: return P(components(current_object).bbox().pcenter().row(), components(current_object).bbox().pmin().col()); @@ -161,7 +173,7 @@ namespace scribo // Bounding box actual right center - case anchor::ActualRight: + case anchor::StrictRight: return P(components(current_object).bbox().pcenter().row(), components(current_object).bbox().pmax().col()); -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-799-g257be9e Introduce new anchors.
by Guillaume Lazzara
* scribo/core/tag/anchor.hh: New anchors. * scribo/filter/internal/alignment_angle.hh, * scribo/primitive/link/internal/compute_anchor.hh: Make use of that new anchors. --- scribo/ChangeLog | 10 ++++++++++ scribo/scribo/core/tag/anchor.hh | 6 ++++-- scribo/scribo/filter/internal/alignment_angle.hh | 2 ++ .../primitive/link/internal/compute_anchor.hh | 16 ++++++++++++++-- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index f0bff06..d28a95b 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,15 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Introduce new anchors. + + * scribo/core/tag/anchor.hh: New anchors. + + * scribo/filter/internal/alignment_angle.hh, + * scribo/primitive/link/internal/compute_anchor.hh: Make use of + that new anchors. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Rename document serializer base class. * scribo/core/internal/doc_xml_serializer.hh: Rename as... diff --git a/scribo/scribo/core/tag/anchor.hh b/scribo/scribo/core/tag/anchor.hh index bb6780c..7ce8ddc 100644 --- a/scribo/scribo/core/tag/anchor.hh +++ b/scribo/scribo/core/tag/anchor.hh @@ -37,11 +37,13 @@ namespace scribo { MassCenter = 0, Top, + StrictTopCenter, Bottom, + StrictBottomCenter, Center, - ActualLeft, + StrictLeft, Left, - ActualRight, + StrictRight, Right, TopLeft, TopStrictLeft, diff --git a/scribo/scribo/filter/internal/alignment_angle.hh b/scribo/scribo/filter/internal/alignment_angle.hh index 33855a8..035dec7 100644 --- a/scribo/scribo/filter/internal/alignment_angle.hh +++ b/scribo/scribo/filter/internal/alignment_angle.hh @@ -109,6 +109,7 @@ namespace scribo break; // Top + case anchor::StrictTopCenter: case anchor::TopStrictLeft: case anchor::Top: { @@ -122,6 +123,7 @@ namespace scribo break; // Bottom + case anchor::StrictBottomCenter: case anchor::BottomStrictRight: case anchor::Bottom: { diff --git a/scribo/scribo/primitive/link/internal/compute_anchor.hh b/scribo/scribo/primitive/link/internal/compute_anchor.hh index c1a9106..9afc33f 100644 --- a/scribo/scribo/primitive/link/internal/compute_anchor.hh +++ b/scribo/scribo/primitive/link/internal/compute_anchor.hh @@ -111,6 +111,12 @@ namespace scribo break; + // Bounding box Strict top center + case anchor::StrictTopCenter: + sp.row() = components(current_object).bbox().pmin().row(); + break; + + // Bounding box top left case anchor::TopStrictLeft: sp.col() = components(current_object).bbox().pmin().col(); @@ -138,13 +144,19 @@ namespace scribo break; + // Bounding box strict bottom center. + case anchor::StrictBottomCenter: + sp.row() = components(current_object).bbox().pmax().row(); + break; + + // Bounding box center case anchor::Center: return components(current_object).bbox().pcenter(); // Bounding box actual left center - case anchor::ActualLeft: + case anchor::StrictLeft: return P(components(current_object).bbox().pcenter().row(), components(current_object).bbox().pmin().col()); @@ -161,7 +173,7 @@ namespace scribo // Bounding box actual right center - case anchor::ActualRight: + case anchor::StrictRight: return P(components(current_object).bbox().pcenter().row(), components(current_object).bbox().pmax().col()); -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
last-svn-commit-797-gd045991 Rename document serializer base class.
by Guillaume Lazzara
* scribo/core/internal/doc_xml_serializer.hh: Rename as... * scribo/core/internal/doc_serializer.hh: ... this. * 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: Update inheritance. --- scribo/ChangeLog | 11 +++++++++ .../{doc_xml_serializer.hh => doc_serializer.hh} | 24 ++++++++++---------- .../io/xml/internal/extended_page_xml_visitor.hh | 3 +- scribo/scribo/io/xml/internal/full_xml_visitor.hh | 4 +- scribo/scribo/io/xml/internal/page_xml_visitor.hh | 4 +- 5 files changed, 29 insertions(+), 17 deletions(-) rename scribo/scribo/core/internal/{doc_xml_serializer.hh => doc_serializer.hh} (80%) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 33b036a..1de58fe 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,16 @@ 2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Rename document serializer base class. + + * scribo/core/internal/doc_xml_serializer.hh: Rename as... + * scribo/core/internal/doc_serializer.hh: ... this. + + * 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: Update inheritance. + +2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr> + Store more information in scribo::document. * scribo/core/document.hh: Make a distinction between horizontal diff --git a/scribo/scribo/core/internal/doc_xml_serializer.hh b/scribo/scribo/core/internal/doc_serializer.hh similarity index 80% rename from scribo/scribo/core/internal/doc_xml_serializer.hh rename to scribo/scribo/core/internal/doc_serializer.hh index b64c9d4..2655100 100644 --- a/scribo/scribo/core/internal/doc_xml_serializer.hh +++ b/scribo/scribo/core/internal/doc_serializer.hh @@ -23,8 +23,8 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH -# define SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH +#ifndef SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH +# define SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH /// \file /// @@ -46,7 +46,7 @@ namespace scribo /// \brief Link functor concept. template <typename E> - class doc_xml_serializer : public SerializeVisitor<E> + class doc_serializer : public SerializeVisitor<E> { public: // Visit overloads @@ -80,55 +80,55 @@ namespace scribo template <typename E> template <typename L> void - doc_xml_serializer<E>::visit(const document<L>& doc) const + doc_serializer<E>::visit(const document<L>& doc) const { } template <typename E> template <typename L> void - doc_xml_serializer<E>::visit(const line_links<L>& llinks) const + doc_serializer<E>::visit(const line_links<L>& llinks) const { } template <typename E> template <typename L> void - doc_xml_serializer<E>::visit(const object_groups<L>& groups) const + doc_serializer<E>::visit(const object_groups<L>& groups) const { } template <typename E> template <typename L> void - doc_xml_serializer<E>::visit(const object_links<L>& links) const + doc_serializer<E>::visit(const object_links<L>& links) const { } template <typename E> template <typename L> void - doc_xml_serializer<E>::visit(const component_set<L>& comp_set) const + doc_serializer<E>::visit(const component_set<L>& comp_set) const { } template <typename E> void - doc_xml_serializer<E>::visit(const component_info& info) const + doc_serializer<E>::visit(const component_info& info) const { } template <typename E> template <typename L> void - doc_xml_serializer<E>::visit(const paragraph_set<L>& parset) const + doc_serializer<E>::visit(const paragraph_set<L>& parset) const { } template <typename E> template <typename L> void - doc_xml_serializer<E>::visit(const line_info<L>& line) const + doc_serializer<E>::visit(const line_info<L>& line) const { } @@ -137,4 +137,4 @@ namespace scribo } // end of namespace scribo -#endif // SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH +#endif // SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH 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 51e7ad3..e8c7689 100644 --- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh +++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh @@ -32,6 +32,7 @@ # include <fstream> # include <scribo/core/internal/doc_xml_serializer.hh> +# include <scribo/core/internal/doc_serializer.hh> # include <scribo/core/document.hh> # include <scribo/core/component_set.hh> # include <scribo/core/paragraph_set.hh> @@ -57,7 +58,7 @@ namespace scribo { - class extended_page_xml_visitor : public doc_xml_serializer<extended_page_xml_visitor> + class extended_page_xml_visitor : public doc_serializer<extended_page_xml_visitor> { public: // Constructor diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh index d466b34..28f43e9 100644 --- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh +++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh @@ -34,7 +34,7 @@ # include <QByteArray> -# include <scribo/core/internal/doc_xml_serializer.hh> +# include <scribo/core/internal/doc_serializer.hh> # include <scribo/core/document.hh> # include <scribo/core/component_set.hh> # include <scribo/core/paragraph_set.hh> @@ -63,7 +63,7 @@ namespace scribo { - class full_xml_visitor : public doc_xml_serializer<full_xml_visitor> + class full_xml_visitor : public doc_serializer<full_xml_visitor> { public: // Constructor diff --git a/scribo/scribo/io/xml/internal/page_xml_visitor.hh b/scribo/scribo/io/xml/internal/page_xml_visitor.hh index 9dec1e7..19665d6 100644 --- a/scribo/scribo/io/xml/internal/page_xml_visitor.hh +++ b/scribo/scribo/io/xml/internal/page_xml_visitor.hh @@ -32,7 +32,7 @@ # include <fstream> -# include <scribo/core/internal/doc_xml_serializer.hh> +# include <scribo/core/internal/doc_serializer.hh> # include <scribo/convert/to_base64.hh> # include <scribo/io/xml/internal/print_box_coords.hh> @@ -63,7 +63,7 @@ namespace scribo
http://schema.primaresearch.org/PAGE/gts/pagecontent/2009-03-16/pagecontent…
*/ - class page_xml_visitor : public doc_xml_serializer<page_xml_visitor> + class page_xml_visitor : public doc_serializer<page_xml_visitor> { public: // Constructor -- 1.5.6.5
13Â years, 10Â months
1
0
0
0
← Newer
1
...
298
299
300
301
302
303
304
...
963
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
Results per page:
10
25
50
100
200