https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Nicolas Ballas <ballas(a)lrde.epita.fr>
Fix bug in pixter_dpoint2d.
* tests/pixter_dpoint2d.cc: Update.
* mln/core/dpoints_piter.hh: Update.
* mln/core/concept/doc/fast_iterator.hh: New documentation.
* mln/core/image2d_b.hh: Change offset method.
mln/core/concept/doc/fast_iterator.hh | 57 ++++++++++++++++++++++++++++++++++
mln/core/dpoints_piter.hh | 2 -
mln/core/image2d_b.hh | 4 +-
tests/pixter_dpoint2d.cc | 16 +++++----
4 files changed, 70 insertions(+), 9 deletions(-)
Index: tests/pixter_dpoint2d.cc
--- tests/pixter_dpoint2d.cc (revision 1008)
+++ tests/pixter_dpoint2d.cc (working copy)
@@ -1,7 +1,7 @@
#include <cassert>
#include <iostream>
-#include <mln/core/image2d.hh>
-#include <mln/core/internal/set_of.hh>
+#include <mln/core/image2d_b.hh>
+#include <mln/core/window.hh>
#include <mln/level/fill.hh>
#include <mln/core/dpoints_pixter.hh>
@@ -9,27 +9,29 @@
main()
{
using namespace mln;
- typedef image2d<int> I;
+ typedef image2d_b<int> I;
I ima(20, 20);
level::fill(ima, 5);
I::piter f(ima.domain());
- internal::set_of_<I::dpoint> set;
+ window_<I::dpoint> set;
- set.insert(mk_dpoint2d(-1, -1));
set.insert(mk_dpoint2d(0, -1));
+ set.insert(mk_dpoint2d(0, -1));
+ set.insert(mk_dpoint2d(1, 0));
set.insert(mk_dpoint2d(1, 0));
- set.insert(mk_dpoint2d(1, 1));
for_all(f)
{
+ if (f[0] > 0 && f[1] > 0 && f[0] < 19 && f[1] <
19)
+ {
I::qixter dit(set, f, ima);
- if (f[0] > 0 && f[1] > 0 && f[0] < 19 && f[1] <
19)
for_all(dit)
{
assert(*dit == 5);
}
}
}
+}
Index: mln/core/dpoints_piter.hh
--- mln/core/dpoints_piter.hh (revision 1008)
+++ mln/core/dpoints_piter.hh (working copy)
@@ -88,7 +88,7 @@
/// Start an iteration.
void start();
-xb
+
/// Go to the next point.
void next_();
Index: mln/core/concept/doc/fast_iterator.hh
--- mln/core/concept/doc/fast_iterator.hh (revision 0)
+++ mln/core/concept/doc/fast_iterator.hh (revision 0)
@@ -0,0 +1,57 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library 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 this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library 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.
+
+/*! \file mln/core/concept/doc/fast_iterator.hh
+ * \brief This file documents the concept of mln::Fast_Iterator.
+ */
+
+namespace mln
+{
+
+ namespace doc
+ {
+ /*! \brief Documentation class for mln::Iterator.
+ * \see mln::Fast_Iterator
+ */
+ template <typename E>
+ struct Fast_Iterator : public Iterator<E>
+ {
+ /*! \brief Dereference operator.
+ * return the current pixel
+ */
+ rvalue operator* ();
+
+ /*! \brief Dereference operator.
+ * return the current pixel
+ */
+ lvalue operator* () const;
+ protected:
+ Fast_Iterator();
+ };
+ } // end of namespace doc
+
+} // end of namespace mln
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1008)
+++ mln/core/image2d_b.hh (working copy)
@@ -61,6 +61,7 @@
typedef box2d pset;
typedef point2d psite;
typedef point2d point;
+ typedef dpoint2d dpoint;
typedef mln_fwd_piter(box2d) fwd_piter;
typedef mln_bkd_piter(box2d) bkd_piter;
typedef fwd_piter piter;
@@ -72,6 +73,7 @@
/// Foward pixel iterator on dpoints assoicated to image 2d
typedef dpoints_pixter< image2d_b<T> > fwd_qixter;
+
typedef fwd_pixter pixter;
typedef fwd_qixter qixter;
@@ -368,7 +370,7 @@
int
image2d_b<T>::offset(const dpoint2d& dp)
{
- return dp[0] * vb_.pmax()[1] + dp[1];
+ return dp[0] * vb_.len(1) + dp[1];
}
# endif // ! MLN_INCLUDE_ONLY