Rev 1221 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1221 | Rev 1222 | ||
---|---|---|---|
1 | Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/griditerator.h': |
1 | Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/griditerator.h': |
2 | #ifndef GRIDITERATOR_H
|
2 | #ifndef GRIDITERATOR_H
|
3 | #define GRIDITERATOR_H
|
3 | #define GRIDITERATOR_H
|
4 | 4 | ||
5 | #include "grid.h"
|
5 | #include "grid.h"
|
6 | 6 | ||
7 | /** GridIterator is a iterator used to navigate over grids with different size.
|
7 | /** GridIterator is a iterator used to navigate over grids with different size.
|
8 | Usage:
|
8 | Usage:
|
9 | GridIterator<float> gi(HeightGrid); // create the iterator and link to a grid of type float
|
9 | GridIterator<float> gi(HeightGrid); // create the iterator and link to a grid of type float
|
10 | gi.setRect(QRect(10., 10., 1120., 120.));
|
10 | gi.setRect(QRect(10., 10., 1120., 120.));
|
11 | while (float *p=gi.next()) {
|
11 | while (float *p=gi.next()) {
|
12 | // do something with *p
|
12 | // do something with *p
|
13 | }
|
13 | }
|
14 | // usage (2)
|
14 | // usage (2)
|
15 | gi.targetSize(targetGrid.size());
|
15 | gi.targetSize(targetGrid.size());
|
16 | gi.setTargetIndex(targetGrid.indexOf(coord));
|
16 | gi.setTargetIndex(targetGrid.indexOf(coord));
|
17 | while (float *p=gi.next())
|
17 | while (float *p=gi.next())
|
18 | *p++;
|
18 | *p++;
|
19 | // usage(3)
|
19 | // usage(3)
|
20 | gi.neighboursOf(index); // 8-neighbourhood
|
20 | gi.neighboursOf(index); // 8-neighbourhood
|
21 | gi.neighboursOf(index, 2); // 2 rings, ..24 neighbours
|
21 | gi.neighboursOf(index, 2); // 2 rings, ..24 neighbours
|
22 | while (float *p=gi.next())
|
22 | while (float *p=gi.next())
|
23 | *p=0.;
|
23 | *p=0.;
|
24 | */
|
24 | */
|
25 | template <class T> |
25 | template <class T> |
26 | class GridIterator { |
26 | class GridIterator { |
27 | public: |
27 | public: |
28 | GridIterator(); |
28 | GridIterator(); |
29 | GridIterator(const Grid<T> &targetGrid); |
29 | GridIterator(const Grid<T> &targetGrid); |
30 | private: |
30 | private: |
31 | 31 | ||
32 | }
|
32 | }
|
33 | #endif // GRIDITERATOR_H
|
33 | #endif // GRIDITERATOR_H
|
34 | 34 |