PositionIterator.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/rp/PositionIterator.h
22 
23  \brief It implements several ways to retrieve positions inside a band with spatial restriction,
24  e.g. through a line, inside a bounding box or polygon, etc.
25 */
26 
27 #ifndef __TERRALIB_RASTER_INTERNAL_POSITIONITERATOR_H
28 #define __TERRALIB_RASTER_INTERNAL_POSITIONITERATOR_H
29 
30 // Terralib
31 #include "../common/STLUtils.h"
32 #include "../common/MathUtils.h"
33 #include "../core/logger/Logger.h"
34 #include "../geometry.h"
35 #include "Band.h"
36 #include "BandProperty.h"
37 #include "BlockUtils.h"
38 #include "Grid.h"
39 #include "Exception.h"
40 
41 // STL
42 #include <iostream>
43 #include <cmath>
44 
45 namespace te
46 {
47  namespace rst
48  {
49 // Forward declaration.
50  class Band;
51 
53  {
54  return *p1 < *p2;
55  }
56 
57  /*!
58  \class AbstractPositionIterator
59 
60  \brief This class is the base for implementing ways to navigate over the band with spatial restriction,
61  e.g. through a line, inside a bounding box or polygon, etc.
62 
63  \ingroup rst
64  */
65  template<typename T> class AbstractPositionIterator
66  {
67  public:
68 
69  /*! \brief Destructor. */
70  virtual ~AbstractPositionIterator();
71 
72  /*! \brief Returns a vector of the values in current position (column, row) from iterator. */
73  virtual const std::vector<T> operator*() const = 0;
74 
75  /*!
76  \brief Returns the real value in current position (column, row, band) from iterator.
77 
78  \param i The band index.
79 
80  \return The pixel real value in current position.
81 
82  \note For complex values use operator()
83  */
84  virtual T operator[](const unsigned int i) const = 0;
85 
86  /*!
87  \brief Returns the complex value in current position (column, row, band) from iterator.
88 
89  \param i The band index.
90 
91  \return The pixel comples value in current position.
92 
93  \note For real values use operator[]
94  */
95  virtual std::complex< T > operator()(const unsigned int i) const = 0;
96 
97  /*! \brief Returns the current row in iterator. */
98  virtual unsigned int getRow() const = 0;
99 
100  /*! \brief Returns the current column in iterator. */
101  virtual unsigned int getColumn() const = 0;
102 
103  /*! \brief Advances to the next position. */
104  virtual void operator++() = 0;
105 
106  /*! \brief Returns to the previous position. */
107  virtual void operator--() = 0;
108 
109  /*!
110  \brief Assignment operator.
111 
112  \param rhs The right-hand-side copy used to copy from.
113 
114  \return A reference to this object.
115  */
117 
118  /*!
119  \brief Difference operator.
120 
121  \param rhs The right-hand side to compare.
122 
123  \return Returns true if the iterators are at different positions, or false otherwise.
124  */
125  virtual bool operator!=(const AbstractPositionIterator<T>& rhs) const = 0;
126 
127  /*!
128  \brief Sets the iterator position to the end of the current band.
129 
130  \param b The band to retrieve the end information.
131  */
132  virtual void setEnd() = 0;
133 
134  protected:
135 
136  /*! \brief Constructor. */
138 
139  /*!
140  \brief Copy constructor.
141 
142  \param rhs The right-hand-side copy used to copy from.
143  */
145 
146  };
147 
148  /*!
149  \class PolygonIterator
150 
151  \brief This class implements the strategy to iterate with spatial restriction,
152  the iteration occurs inside a polygon.
153 
154  \ingroup rst
155  */
156  template<typename T> class PolygonIterator: public AbstractPositionIterator<T>
157  {
158  public:
159 
160  PolygonIterator();
161 
162  /*!
163  \brief Constructor.
164 
165  \param b The band to iterate.
166  \param p The polygon from where the iteration will navigate.
167  \note Both raster and polygon must have the same SRID.
168  */
169  PolygonIterator(const te::rst::Raster* r, const te::gm::Polygon* p);
170 
171  /*!
172  \brief Copy constructor.
173 
174  \param rhs The right-hand-side copy used to copy from.
175  */
176  PolygonIterator(const PolygonIterator& rhs);
177 
178  ~PolygonIterator();
179 
180  void setNextLine(bool updatecurrline = true);
181 
182  const std::vector<T> operator*() const;
183 
184  T operator[](const unsigned int i) const;
185 
186  std::complex< T > operator()(const unsigned int i) const;
187 
188  unsigned int getRow() const;
189 
190  unsigned int getColumn() const;
191 
192  void operator++();
193 
194  void operator--();
195 
197 
199 
200  void setEnd();
201 
202  /*! \brief Returns an iterator referring to the first value of the band.*/
203  static PolygonIterator begin(const te::rst::Raster* r, const te::gm::Polygon* p);
204 
205  /*! \brief Returns an iterator referring to after the end of the iterator. */
206  static PolygonIterator end(const te::rst::Raster* r, const te::gm::Polygon* p);
207 
208  bool operator!=(const PolygonIterator<T>& rhs) const;
209 
210  bool operator!=(const AbstractPositionIterator<T>& rhs) const;
211 
212  protected:
213 
214  const te::rst::Raster* m_raster; //!< The band from where to get the values.
215  const te::gm::Polygon* m_polygon; //!< The spatial restriction to be applied in the iterator.
216  te::gm::Line* m_currline; //!< The current line in the iterator.
217  int m_column; //!< The current column of the iterator.
218  int m_row; //!< The current row of the iterator.
219  int m_startingcolumn; //!< The starting column (in current line) to initialize the iteration.
220  int m_endingcolumn; //!< The column (in current line) to finalize the iteration.
221  int m_startingrow; //!< The starting row of the iteration.
222  int m_endingrow; //!< The ending row of the iteration.
223  int m_maxcolumns; //!< The number of columns in band.
224  int m_maxrows; //!< The number of rows in band.
225  int m_actualintersection; //!< The actual line of the iterator.
226  int m_nintersections; //!< The number number of intersected lines in current line of the iterator.
227  std::unique_ptr<te::rst::TileIndexer> m_tileIndexer; //!< Tile indexer used to optimize the geometric operations
228  std::vector<std::pair<int, int> > m_columns; //!< Coordinates of the columns to be transversed
229 
230  // Variables used by the operator[] method.
231  mutable double m_operatorBrackets_value;
232  mutable std::complex< double > m_operatorParenthesis_value;
233 
234 
235  /*! \brief Clear all internal allocated objects and reset back to the initial state. */
236  void clear();
237 
238  };
239 
240  /*!
241  \class LineIterator
242 
243  \brief This class implements the strategy to iterate with spatial restriction,
244  the iteration occurs inside a line.
245 
246  \ingroup rst
247  */
248  template<typename T> class LineIterator: public AbstractPositionIterator<T>
249  {
250  public:
251 
252  LineIterator();
253 
254  /*!
255  \brief Constructor.
256 
257  \param b The band to iterate.
258  \param l The line from where the iteration will navigate.
259  */
260  LineIterator(const te::rst::Raster* r, const te::gm::Line* l);
261 
262  /*!
263  \brief Copy constructor.
264 
265  \param rhs The right-hand-side copy used to copy from.
266  */
267  LineIterator(const LineIterator& rhs);
268 
269  ~LineIterator();
270 
271  const std::vector<T> operator*() const;
272 
273  T operator[](const unsigned int i) const;
274 
275  std::complex< T > operator()(const unsigned int i) const;
276 
277  unsigned int getRow() const;
278 
279  unsigned int getColumn() const;
280 
281  void operator++();
282 
283  void operator--();
284 
285  LineIterator& operator=(const LineIterator& rhs);
286 
288 
289  void setEnd();
290 
291  /*! \brief Returns an iterator referring to the first value of the band.*/
292  static LineIterator begin(const te::rst::Raster* r, const te::gm::Line* l);
293 
294  /*! \brief Returns an iterator referring to after the end of the iterator. */
295  static LineIterator end(const te::rst::Raster* r, const te::gm::Line* l);
296 
297  bool operator!=(const LineIterator<T>& rhs) const;
298 
299  bool operator!=(const AbstractPositionIterator<T>& rhs) const;
300 
301  protected:
302 
303  const te::rst::Raster* m_raster; //!< The band from where to get the values.
304  const te::gm::Line* m_line; //!< The spatial restriction to be applied in the iterator.
305  int m_currentpixelindex; //!< The index of the current pixel location.
306  std::vector<te::gm::Point*> m_pixelsinline; //!< A vector of pixel locations that intersects the line.
307  mutable double m_operatorBrackets_value; //!< Used by the operator[] method.
308  mutable std::complex< double > m_operatorParenthesis_value; //!< Used by the operator() method.
309 
310 
311  };
312 
313  /*!
314  \class PointSetIterator
315 
316  \brief This class implements the strategy to iterate with spatial restriction,
317  the iteration occurs inside a vector of points.
318 
319  \ingroup rst
320  */
321  template<typename T> class PointSetIterator: public AbstractPositionIterator<T>
322  {
323  public:
324 
326 
327  /*!
328  \brief Constructor.
329 
330  \param b The band to iterate.
331  \param p The vector of points where the iteration will navigate.
332  */
333  PointSetIterator(const te::rst::Raster* r, const std::vector<te::gm::Point*> p);
334 
335  /*!
336  \brief Copy constructor.
337 
338  \param rhs The right-hand-side copy used to copy from.
339  */
341 
342  ~PointSetIterator();
343 
344  const std::vector<T> operator*() const;
345 
346  T operator[](const unsigned int i) const;
347 
348  std::complex< T > operator()(const unsigned int i) const;
349 
350  unsigned int getRow() const;
351 
352  unsigned int getColumn() const;
353 
354  void operator++();
355 
356  void operator--();
357 
359 
361 
362  void setEnd();
363 
364  /*! \brief Returns an iterator referring to the first value of the band.*/
365  static PointSetIterator begin(const te::rst::Raster* r, const std::vector<te::gm::Point*> p);
366 
367  /*! \brief Returns an iterator referring to after the end of the iterator. */
368  static PointSetIterator end(const te::rst::Raster* r, const std::vector<te::gm::Point*> p);
369 
370  bool operator!=(const PointSetIterator<T>& rhs) const;
371 
372  bool operator!=(const AbstractPositionIterator<T>& rhs) const;
373 
374  protected:
375 
376  const te::rst::Raster* m_raster; //!< The band from where to get the values.
377  std::vector<te::gm::Point*> m_pixelsinpointset; //!< The spatial restriction to be applied in the iterator.
378  int m_currentpixelindex; //!< The index of the current pixel location.
379  mutable double m_operatorBrackets_value; //!< Used by the operator[] method.
380  mutable std::complex< double > m_operatorParenthesis_value; //!< Used by the operator() method.
381 
382 
383  };
384 
385 // implementation of abstract position iterator
386 
388  {
389  }
390 
392  {
393  }
394 
396  {
397  }
398 
399  template<typename T>
402  {
403  return *this;
404  }
405 
406 // implementation of iteration strategy bounded by a polygon
408  : m_raster(0),
409  m_polygon(0),
410  m_currline(0),
411  m_column(-1),
412  m_row(-1),
413  m_startingcolumn(0),
414  m_endingcolumn(0),
415  m_startingrow(0),
416  m_endingrow(0),
417  m_maxcolumns(0),
418  m_maxrows(0),
419  m_actualintersection(-1),
420  m_nintersections(0)
421  {
422  }
423 
425  : m_raster(r),
426  m_polygon(p),
427  m_currline(0),
428  m_column(-1),
429  m_row(-1),
430  m_startingcolumn(0),
431  m_endingcolumn(0),
432  m_startingrow(0),
433  m_endingrow(0),
434  m_maxcolumns(r->getNumberOfColumns()),
435  m_maxrows(r->getNumberOfRows()),
438  {
439  if( r->getSRID() != p->getSRID() )
440  {
441  throw te::rst::Exception( TE_TR("Invalid polygon SRID") );
442  }
443 
444  const te::rst::Grid& rasterGrid = *r->getGrid();
445  const te::gm::Envelope& rasterEnvelope = *rasterGrid.getExtent();
446 
449 
450  // Is the polygon extent is outside the current raster area
451 
452  if(
453  ( ll.x > rasterEnvelope.m_urx )
454  ||
455  ( ur.x < rasterEnvelope.m_llx )
456  ||
457  ( ur.y < rasterEnvelope.m_lly )
458  ||
459  ( ll.y > rasterEnvelope.m_ury )
460  )
461  {
462  setEnd();
463  }
464  else
465  {
466  // defining starting/ending rows
467 
468  te::gm::Coord2D llIndexed;
469  rasterGrid.geoToGrid(ll.x, ll.y, llIndexed.x, llIndexed.y);
470  te::gm::Coord2D urIndexed;
471  rasterGrid.geoToGrid(ur.x, ur.y, urIndexed.x, urIndexed.y);
472 
473  m_startingrow = (int)std::ceil( urIndexed.y );
474  m_startingrow = std::max( 0, m_startingrow );
475  m_startingrow = std::min( m_startingrow, ((int)rasterGrid.getNumberOfRows()) - 1 );
476 
477  m_endingrow = (int)std::floor( llIndexed.y );
478  m_endingrow = std::max( 0, m_endingrow );
479  m_endingrow = std::min( m_endingrow, ((int)rasterGrid.getNumberOfRows()) - 1 );
480 
481  if( m_endingrow < m_startingrow )
482  {
483  setEnd();
484  }
485  else
486  {
487  // initialize the TileIndexer
488 
489  m_tileIndexer = std::unique_ptr<te::rst::TileIndexer>(new te::rst::TileIndexer(*m_polygon, rasterGrid.getResolutionY()));
490 
491  // defining initial state
492 
495  m_polygon->getSRID());
496 
498 
499  setNextLine(true);
500 
502  }
503  }
504  }
505 
507  : m_raster(rhs.m_raster),
508  m_polygon(0),
509  m_currline(0),
510  m_column(-1),
511  m_row(-1),
512  m_startingcolumn(0),
513  m_endingcolumn(0),
514  m_startingrow(0),
515  m_endingrow(0),
516  m_maxcolumns(0),
517  m_maxrows(0),
520  {
521  operator=( rhs );
522  }
523 
525  {
526  clear();
527  }
528 
529  template<typename T> void te::rst::PolygonIterator<T>::setNextLine(bool updatecurrline)
530  {
532  {
533  // Globals
534 
535  const double& rasterEnvelopeLLX =
537  const double& rasterEnvelopeURX =
539 
540  // Updates the line corresponding to the current line of the iterator
541 
542  if (updatecurrline)
543  {
544  double nexty = this->m_raster->getGrid()->gridToGeo(0, m_row).y;
545 
546  m_currline->setX(0, std::min(
547  rasterEnvelopeLLX,
548  m_polygon->getMBR()->getLowerLeft().x) );
549  m_currline->setY(0, nexty);
550 
551  m_currline->setX(1, std::max(
552  rasterEnvelopeURX,
553  m_polygon->getMBR()->getUpperRight().x ) );
554  m_currline->setY(1, nexty);
555  }
556 
557  // Initialize Tile Indexer and structures used to retrieve the points where the current line
558  // intersects the polygon
559 
560  m_columns.clear();
561 
562 
563  // Vector to store the points where the current line intersects the current tile of the polygon
564  std::vector<te::gm::Point*> intersectionPoints;
565 
566  // Retrieve the tile corresponding to the current line and store the points where the line
567  // intersects the tile
568 
569  te::rst::TileIndexer::TileSegIndex* currentTilePtr = 0;
570 
571  if (m_tileIndexer->getTile(m_currline->getY(0), &currentTilePtr))
572  {
573  assert(currentTilePtr);
574 
575  te::gm::LinearRing const* ringTile;
576  std::unique_ptr<te::gm::Line> tileSeg;
577  std::unique_ptr< te::gm::Geometry > interResultPtr;
578  std::vector< te::gm::Geometry * > singleGeomsPtrs;
579  std::size_t singleGeomsPtrsIdx = 0;
580 
581  try
582  {
583  // in some cases the intersection presents an unhandled exception, in this case we do not paint the current line
584  // Transverse the segments of the tile retrieving the intersection between them and the current line
585 
586  te::gm::LineString* lineStrPtr = 0;
587 
588  for (std::size_t i = 0; i < currentTilePtr->size(); i++)
589  {
590  assert((*currentTilePtr)[i].first < m_polygon->getNumRings());
591 
592  // Retrieve the current ring of the current tile
593  assert(dynamic_cast<te::gm::LinearRing const*>((*m_polygon)[(*currentTilePtr)[i].first]));
594  ringTile = (te::gm::LinearRing const*)(*m_polygon)[(*currentTilePtr)[i].first];
595 
596  assert((*currentTilePtr)[i].second < m_polygon->getNPoints());
597 
598  // Retrieve the current segment of the current tile
599  tileSeg.reset(new te::gm::Line(te::gm::Point(ringTile->getX((*currentTilePtr)[i].second),
600  ringTile->getY((*currentTilePtr)[i].second),
601  ringTile->getSRID()),
602  te::gm::Point(ringTile->getX((*currentTilePtr)[i].second + 1),
603  ringTile->getY((*currentTilePtr)[i].second + 1),
604  ringTile->getSRID()),
605  te::gm::LineStringType, ringTile->getSRID()));
606 
607  // Computes the intersection point between the current segment and the current line
608 
609  interResultPtr.reset( tileSeg->intersection( m_currline ) );
610 
611  if( interResultPtr.get() != 0 )
612  {
613  for(auto p : singleGeomsPtrs)
614  delete p;
615  singleGeomsPtrs.clear();
616  te::gm::Multi2Single( interResultPtr.get(), singleGeomsPtrs );
617 
618  for( singleGeomsPtrsIdx = 0 ; singleGeomsPtrsIdx < singleGeomsPtrs.size() ;
619  ++singleGeomsPtrsIdx )
620  {
621  if( singleGeomsPtrs[ singleGeomsPtrsIdx ]->getGeomTypeId() ==
623  {
624  intersectionPoints.push_back( (te::gm::Point*)(
625  singleGeomsPtrs[ singleGeomsPtrsIdx ]->clone() ) );
626  }
627  else if( singleGeomsPtrs[ singleGeomsPtrsIdx ]->getGeomTypeId() ==
629  {
630  lineStrPtr = ((te::gm::LineString*) singleGeomsPtrs[
631  singleGeomsPtrsIdx ]);
632  intersectionPoints.push_back( lineStrPtr->getStartPoint().release() );
633  intersectionPoints.push_back( lineStrPtr->getEndPoint().release() );
634  }
635  }
636  }
637  }
638  }
639  catch(const std::exception& e)
640  {
641  TE_LOG_WARN( "Geometry intersection error:" + e.what() );
642 
643  // deleting the intersections points
644 
645  for( std::size_t intersectionPointsIdx = 0; intersectionPointsIdx <
646  intersectionPoints.size() ; ++intersectionPointsIdx )
647  {
648  delete intersectionPoints[intersectionPointsIdx];
649  }
650 
651  intersectionPoints.clear();
652  }
653  catch(...)
654  {
655  TE_LOG_WARN( "Geometry intersection error" );
656 
657  // deleting the intersections points
658 
659  for( std::size_t intersectionPointsIdx = 0; intersectionPointsIdx <
660  intersectionPoints.size() ; ++intersectionPointsIdx )
661  {
662  delete intersectionPoints[intersectionPointsIdx];
663  }
664 
665  intersectionPoints.clear();
666  }
667 
668  for(auto p : singleGeomsPtrs)
669  delete p;
670  singleGeomsPtrs.clear();
671  }
672 
673  // Removing duplicated points
674 
675  {
676  std::size_t positionBegin = 0;
677  std::size_t positionEnd = 0;
678  std::vector<te::gm::Point*> intersectionPointsAux = intersectionPoints;
679 
680  intersectionPoints.clear();
681 
682  while( positionBegin < intersectionPointsAux.size() )
683  {
684  if( intersectionPointsAux[positionBegin] )
685  {
686  positionEnd = positionBegin + 1;
687 
688  while( positionEnd < intersectionPointsAux.size() )
689  {
690  if(
691  ( intersectionPointsAux[positionEnd] != 0 )
692  &&
693  intersectionPointsAux[positionBegin]->equals(
694  intersectionPointsAux[positionEnd], true)
695  )
696  {
697  delete intersectionPointsAux[positionEnd];
698  intersectionPointsAux[positionEnd] = 0;
699  }
700 
701  positionEnd++;
702  }
703 
704  intersectionPoints.push_back( intersectionPointsAux[positionBegin] );
705  }
706 
707  ++positionBegin;
708  }
709  }
710 
711  // Sort the intersection points through its Y coordinates (column)
712  std::sort(intersectionPoints.begin(), intersectionPoints.end(),
714 
715  // Using the intersection points, build a vector of coordinates (columns) with the start and
716  // end column of the current line for each stretch
717 
718  std::size_t positionBegin = 0;
719  std::size_t positionEnd = 0;
720  int startingCol = 0;
721  int endingCol = 0;
722  double startingX = 0;
723  double startingY = 0;
724  double endingX = 0;
725  double endingY = 0;
726 
727  while( ( positionBegin + 1 ) < intersectionPoints.size() )
728  {
729  positionEnd = positionBegin + 1;
730 
731  startingX = intersectionPoints[positionBegin]->getX();
732  startingX = std::max( startingX, rasterEnvelopeLLX );
733 
734  startingY = intersectionPoints[positionBegin]->getY();
735 
736  endingX = intersectionPoints[positionEnd]->getX();
737  endingX = std::min( endingX, rasterEnvelopeURX );
738 
739  endingY = intersectionPoints[positionEnd]->getY();
740 
741  // Build the vector of coordinates with the folowing structure:
742  // vector<pair<startcolumn, endcolumn>>;
743  // where each pair represents a stretch to be transversed
744 
745  if(
746  ( startingX != endingX )
747  &&
748  (
749  m_tileIndexer->withinOrTouches(te::gm::Point(
750  (startingX + (endingX - startingX) / 2.0 ),
751  (startingY +(endingY - startingY) / 2.0 ),
752  m_polygon->getSRID()))
753  )
754  )
755  {
756  // The middle-point (between the start end end point)
757  // inside the current polygon
758 
759  startingCol = (int)std::ceil( m_raster->getGrid()->geoToGrid(startingX, startingY).x );
760  startingCol = std::max( 0, startingCol );
761  startingCol = std::min( m_maxcolumns - 1, startingCol );
762 
763  endingCol = (int)std::floor( m_raster->getGrid()->geoToGrid(endingX, endingY).x );
764  endingCol = std::max( 0, endingCol );
765  endingCol = std::min( m_maxcolumns - 1, endingCol );
766 
767  if( endingCol >= startingCol )
768  {
769  m_columns.push_back(std::pair<int, int>(startingCol, endingCol));
770  }
771  }
772 
773  positionBegin = positionEnd;
774  }
775 
776  // deleting the intersections points
777 
778  positionBegin = 0;
779 
780  while ( positionBegin < intersectionPoints.size() )
781  {
782  delete intersectionPoints[positionBegin];
783  ++positionBegin;
784  }
785 
786  if (m_columns.empty())
787  {
788  m_row++;
789  if (m_row > m_endingrow)
790  {
791  setEnd();
792 
793  return;
794  }
795 
796  setNextLine();
797 
798  return;
799  }
800 
802 
803  m_nintersections = static_cast<int>(m_columns.size());
804  }
805 
808 
809  int tmp;
811  {
812  tmp = m_startingcolumn;
814  m_endingcolumn = tmp;
815  }
816 
817 // // avoiding bad access
818 // m_startingcolumn = m_startingcolumn < 0? 0: m_startingcolumn;
819 // m_startingcolumn = m_startingcolumn >= m_maxcolumns? m_maxcolumns - 1: m_startingcolumn;
820 //
821 // m_endingcolumn = m_endingcolumn < 0? 0: m_endingcolumn;
822 // m_endingcolumn = m_endingcolumn >= m_maxcolumns? m_maxcolumns - 1: m_endingcolumn;
823  }
824 
825  template<typename T> const std::vector<T> te::rst::PolygonIterator<T>::operator*() const
826  {
827  std::vector<T> values(this->m_raster->getNumberOfBands());
828  double value;
829 
830  for (unsigned int b = 0; b < this->m_raster->getNumberOfBands(); b++)
831  {
832  this->m_raster->getValue(getColumn(), getRow(), value, b);
833  values[b] = ((T) value);
834  }
835 
836  return values;
837  }
838 
839  template<typename T> T te::rst::PolygonIterator<T>::operator[](const unsigned int i) const
840  {
842 
843  return (T) m_operatorBrackets_value;
844  }
845 
846  template<typename T> std::complex< T > te::rst::PolygonIterator<T>::operator()(const unsigned int i) const
847  {
849 
850  return (std::complex< T >) m_operatorParenthesis_value;
851  }
852 
853  template<typename T> unsigned int te::rst::PolygonIterator<T>::getRow() const
854  {
855  return m_row;
856  }
857 
858  template<typename T> unsigned int te::rst::PolygonIterator<T>::getColumn() const
859  {
860  return m_column;
861  }
862 
863  template<typename T> void te::rst::PolygonIterator<T>::operator++()
864  {
865  m_column++;
866 
867  if (m_column > m_endingcolumn)
868  {
870 
872  m_row++;
873 
874  if (m_row > m_endingrow)
875  {
876  setEnd();
877 
878  return;
879  }
880 
881  setNextLine();
882 
884  }
885  }
886 
887  template<typename T> void te::rst::PolygonIterator<T>::operator--()
888  {
889  if (m_row == -1)
890  throw te::rst::Exception(TE_TR("This operation is not supported!"));
891  m_column--;
892 
894  {
896 
897  if (m_actualintersection < 0)
898  m_row--;
899 
900  if (m_row < m_startingrow)
901  {
902  setEnd();
903 
904  return;
905  }
906 
907  setNextLine();
908 
910  }
911  }
912 
913  template<typename T>
915  const te::rst::PolygonIterator<T>& rhs)
916  {
917  clear();
918 
919  if (this != &rhs)
920  {
922 
923  m_raster = rhs.m_raster;
924  m_polygon = rhs.m_polygon;
925 
926  if( rhs.m_currline )
927  {
929  }
930 
931  m_column = rhs.m_column;
932  m_row = rhs.m_row;
936  m_endingrow = rhs.m_endingrow;
938  m_maxrows = rhs.m_maxrows;
941  if (rhs.m_tileIndexer)
942  m_tileIndexer.reset( rhs.m_tileIndexer->clone() );
943  m_columns = rhs.m_columns;
944  }
945 
946  return *this;
947  }
948 
949  template<typename T>
952  {
953  return operator=( *((te::rst::PolygonIterator<T>*)&rhs) );
954  }
955 
956  template<typename T> void te::rst::PolygonIterator<T>::setEnd()
957  {
958  m_column = -1;
959  m_row = -1;
960  }
961 
963  {
964  return te::rst::PolygonIterator<T>(r, p);
965  }
966 
968  {
970 
971  it.setEnd();
972 
973  return it;
974  }
975 
976  template<typename T> bool te::rst::PolygonIterator<T>::operator!=(const te::rst::PolygonIterator<T>& rhs) const
977  {
978  return ( (this->m_row != rhs.m_row) && (this->m_column != rhs.m_column));
979  }
980 
981  template<typename T>
983  const AbstractPositionIterator<T>& rhs) const
984  {
985  return operator!=( *((te::rst::PolygonIterator<T>*)&rhs) );
986  }
987 
988  template<typename T> void te::rst::PolygonIterator<T>::clear()
989  {
990  m_raster = 0;
991  m_polygon = 0;
992 
993  if( m_currline )
994  {
995  delete m_currline;
996  m_currline = 0;
997  }
998 
999  m_column = -1;
1000  m_row = -1;
1001  m_startingcolumn = 0;
1002  m_endingcolumn = 0;
1003  m_startingrow = 0;
1004  m_endingrow = 0;
1005  m_maxcolumns = 0;
1006  m_maxrows = 0;
1007  m_actualintersection = -1;
1008  m_nintersections = 0;
1009  m_tileIndexer.reset();
1010  m_columns.clear();
1011  }
1012 
1013 // implementation of iteration strategy bounded by a line
1015  : m_raster(0),
1016  m_line(0),
1017  m_currentpixelindex(0),
1018  m_pixelsinline(0)
1019  {
1020  }
1021 
1023  : m_raster(r),
1024  m_line(l),
1026  m_pixelsinline(0)
1027  {
1028  if( r->getSRID() != l->getSRID() )
1029  {
1030  throw te::rst::Exception( TE_TR("Invalid line SRID") );
1031  }
1032 
1033  int srid = this->m_raster->getSRID();
1034 
1035 // make intersection between line and band's envelope
1036  te::gm::Geometry* bandEnvelope = te::gm::GetGeomFromEnvelope(this->m_raster->getExtent(), srid);
1037  te::gm::Geometry* inter = bandEnvelope->intersection(m_line);
1038 
1039  if (inter->isEmpty())
1040  {
1041  setEnd();
1042 
1043  return;
1044  }
1045 
1046 // create line that intersects only band's envelope
1047  te::gm::Line* inrasterline = (te::gm::Line*) inter;
1048 
1049 // find starting and ending points
1050  double startingcolumn;
1051  double startingrow;
1052  std::unique_ptr<te::gm::Point> startpoint = inrasterline->getStartPoint();
1053  this->m_raster->getGrid()->geoToGrid(startpoint->getX(), startpoint->getY(),
1054  startingcolumn, startingrow);
1055 
1056  double endingcolumn;
1057  double endingrow;
1058  std::unique_ptr<te::gm::Point> endpoint = inrasterline->getEndPoint();
1059  this->m_raster->getGrid()->geoToGrid(endpoint->getX(), endpoint->getY(),
1060  endingcolumn, endingrow);
1061 
1062 // creating one envelope per pixel, and intersects with line
1063  const double resXdiv2 = this->m_raster->getResolutionX() / 2;
1064  const double resYdiv2 = this->m_raster->getResolutionY() / 2;
1065  double x1, x2, y1, y2, geoX, geoY;
1066  for(int r = (int)startingrow; r <= (int)endingrow; r++)
1067  for(int c = (int)startingcolumn; c <= (int)endingcolumn; c++)
1068  {
1069 // define envelope of pixel
1070  this->m_raster->getGrid()->gridToGeo(c, r, geoX, geoY);
1071  x1 = geoX - resXdiv2; y1 = geoY - resYdiv2;
1072  x2 = geoX + resXdiv2; y2 = geoY + resYdiv2;
1073 
1074  te::gm::Envelope* pixelbox = new te::gm::Envelope(x1, y1, x2, y2);
1075  te::gm::Geometry* pixelboxgeometry = GetGeomFromEnvelope(pixelbox, srid);
1076 
1077  if (te::gm::SatisfySpatialRelation(inrasterline, pixelboxgeometry, te::gm::INTERSECTS))
1078  m_pixelsinline.push_back(new te::gm::Point(c, r, srid));
1079  }
1080 
1081  if (m_pixelsinline.empty())
1082  setEnd();
1083  }
1084 
1086  : m_raster(rhs.m_raster),
1089  {
1090  }
1091 
1093  {
1094  m_pixelsinline.clear();
1095  }
1096 
1097  template<typename T> const std::vector<T> te::rst::LineIterator<T>::operator*() const
1098  {
1099  std::vector<T> values(this->m_raster->getNumberOfBands());
1100  double value;
1101 
1102  for (unsigned int b = 0; b < this->m_raster->getNumberOfBands(); b++)
1103  {
1104  this->m_raster->getValue(getColumn(), getRow(), value, b);
1105  values[b] = ((T) value);
1106  }
1107 
1108  return values;
1109  }
1110 
1111  template<typename T> T te::rst::LineIterator<T>::operator[](const unsigned int i) const
1112  {
1114 
1115  return (T) m_operatorBrackets_value;
1116  }
1117 
1118  template<typename T> std::complex< T > te::rst::LineIterator<T>::operator()(const unsigned int i) const
1119  {
1121 
1122  return (std::complex< T >) m_operatorParenthesis_value;
1123  }
1124 
1125  template<typename T> unsigned int te::rst::LineIterator<T>::getRow() const
1126  {
1127  return (unsigned int)(m_pixelsinline[m_currentpixelindex]->getY());
1128  }
1129 
1130  template<typename T> unsigned int te::rst::LineIterator<T>::getColumn() const
1131  {
1132  return (unsigned int)(m_pixelsinline[m_currentpixelindex]->getX());
1133  }
1134 
1135  template<typename T> void te::rst::LineIterator<T>::operator++()
1136  {
1138 
1139  if (m_currentpixelindex >= (int)(m_pixelsinline.size()))
1140  setEnd();
1141  }
1142 
1143  template<typename T> void te::rst::LineIterator<T>::operator--()
1144  {
1146 
1147  if (m_currentpixelindex < 0)
1148  setEnd();
1149  }
1150 
1152  {
1153  if (this != &rhs)
1154  {
1156 
1157  m_line = rhs.m_line;
1160  }
1161 
1162  return *this;
1163  }
1164 
1165  template<typename T>
1167  const AbstractPositionIterator<T>& rhs)
1168  {
1169  return operator=( *((LineIterator<T>*)&rhs) );
1170  }
1171 
1172  template<typename T> void te::rst::LineIterator<T>::setEnd()
1173  {
1174  this->m_currentpixelindex = -1;
1175  }
1176 
1178  {
1179  return te::rst::LineIterator<T>(r, l);
1180  }
1181 
1183  {
1184  te::rst::LineIterator<T> it(r, l);
1185 
1186  it.setEnd();
1187 
1188  return it;
1189  }
1190 
1191  template<typename T> bool te::rst::LineIterator<T>::operator!=(const te::rst::LineIterator<T>& rhs) const
1192  {
1193  return ( (this->m_currentpixelindex != rhs.m_currentpixelindex) );
1194  }
1195 
1196  template<typename T>
1198  const AbstractPositionIterator<T>& rhs) const
1199  {
1200  return operator!=( *((te::rst::LineIterator<T>*)&rhs) );
1201  }
1202 
1203 // implementation of iteration strategy bounded by a vector of points
1205  : m_raster(0),
1206  m_pixelsinpointset(0),
1208  {
1209  }
1210 
1211  template<typename T> te::rst::PointSetIterator<T>::PointSetIterator(const te::rst::Raster* r, const std::vector<te::gm::Point*> p)
1212  : m_raster(r),
1213  m_pixelsinpointset(p),
1215  {
1216  const int rasterSRID = this->m_raster->getSRID();
1217 
1218  const te::gm::Envelope* rasterbox = r->getExtent();
1219  te::gm::Geometry* rasterboxgeometry = GetGeomFromEnvelope(rasterbox, rasterSRID);
1220 
1221 // remove points that are not inside the band's envelope
1222  std::vector<te::gm::Point*> inside_points;
1223  double column;
1224  double row;
1225  for (unsigned int i = 0; i < m_pixelsinpointset.size(); i++)
1226  {
1227  if( rasterSRID != m_pixelsinpointset[i]->getSRID() )
1228  {
1229  throw te::rst::Exception( TE_TR("Invalid point SRID") );
1230  }
1231 
1233  {
1234  this->m_raster->getGrid()->geoToGrid(m_pixelsinpointset[i]->getX(), m_pixelsinpointset[i]->getY(), column, row);
1235 
1236  inside_points.push_back(new te::gm::Point(column, row));
1237  }
1238  }
1239 
1240  m_pixelsinpointset.clear();
1241  m_pixelsinpointset = inside_points;
1242 
1243  if (m_pixelsinpointset.empty())
1244  setEnd();
1245  }
1246 
1248  : m_raster(rhs.m_raster),
1251  {
1252  }
1253 
1255  {
1256  m_pixelsinpointset.clear();
1257  }
1258 
1259  template<typename T> const std::vector<T> te::rst::PointSetIterator<T>::operator*() const
1260  {
1261  std::vector<T> values(this->m_raster->getNumberOfBands());
1262  double value;
1263 
1264  for (unsigned int b = 0; b < this->m_raster->getNumberOfBands(); b++)
1265  {
1266  this->m_raster->getValue(getColumn(), getRow(), value, b);
1267  values[b] = ((T) value);
1268  }
1269 
1270  return values;
1271  }
1272 
1273  template<typename T> T te::rst::PointSetIterator<T>::operator[](const unsigned int i) const
1274  {
1276 
1277  return (T) m_operatorBrackets_value;
1278  }
1279 
1280  template<typename T> std::complex< T > te::rst::PointSetIterator<T>::operator()(const unsigned int i) const
1281  {
1283 
1284  return (std::complex< T >) m_operatorParenthesis_value;
1285  }
1286 
1287  template<typename T> unsigned int te::rst::PointSetIterator<T>::getRow() const
1288  {
1289  return (unsigned int)(m_pixelsinpointset[m_currentpixelindex]->getY());
1290  }
1291 
1292  template<typename T> unsigned int te::rst::PointSetIterator<T>::getColumn() const
1293  {
1294  return (unsigned int)(m_pixelsinpointset[m_currentpixelindex]->getX());
1295  }
1296 
1297  template<typename T> void te::rst::PointSetIterator<T>::operator++()
1298  {
1300 
1301  if (m_currentpixelindex >= (int) m_pixelsinpointset.size())
1302  setEnd();
1303  }
1304 
1305  template<typename T> void te::rst::PointSetIterator<T>::operator--()
1306  {
1308 
1309  if (m_currentpixelindex < 0)
1310  setEnd();
1311  }
1312 
1314  {
1315  if (this != &rhs)
1316  {
1318 
1321  }
1322 
1323  return *this;
1324  }
1325 
1326  template<typename T>
1328  const AbstractPositionIterator<T>& rhs)
1329  {
1330  return operator=( *((te::rst::PointSetIterator<T>*)&rhs) );
1331  }
1332 
1333  template<typename T> void te::rst::PointSetIterator<T>::setEnd()
1334  {
1335  this->m_currentpixelindex = -1;
1336  }
1337 
1338  template<typename T> te::rst::PointSetIterator<T> te::rst::PointSetIterator<T>::begin(const te::rst::Raster* r, const std::vector<te::gm::Point*> p)
1339  {
1340  return te::rst::PointSetIterator<T>(r, p);
1341  }
1342 
1343  template<typename T> te::rst::PointSetIterator<T> te::rst::PointSetIterator<T>::end(const te::rst::Raster* r, const std::vector<te::gm::Point*> p)
1344  {
1346 
1347  it.setEnd();
1348 
1349  return it;
1350  }
1351 
1353  {
1354  return ( (this->m_currentpixelindex != rhs.m_currentpixelindex) );
1355  }
1356 
1357  template<typename T>
1359  const AbstractPositionIterator<T>& rhs) const
1360  {
1361  return operator!=( *((te::rst::PointSetIterator<T>*)&rhs) );
1362  }
1363 
1364  } // end namespace rst
1365 } // end namespace te
1366 
1367 #endif // __TERRALIB_RASTER_INTERNAL_POSITIONITERATOR_H
unsigned int getNumberOfRows() const
Returns the grid number of rows.
int m_row
The current row of the iterator.
void setEnd()
Sets the iterator position to the end of the current band.
virtual T operator[](const unsigned int i) const =0
Returns the real value in current position (column, row, band) from iterator.
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.
int m_startingcolumn
The starting column (in current line) to initialize the iteration.
int m_startingrow
The starting row of the iteration.
Polygon tile indexing class for optmized geometrical relational tests.
Definition: TileIndexer.h:54
A Line is LineString with 2 points.
Definition: Line.h:50
double y
y-coordinate.
Definition: Coord2D.h:114
It describes one band (or dimension) of a raster.
Coord2D getLowerLeft() const
It returns the lower left coordinate of the envelope.
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator.
void setX(std::size_t i, const double &x)
It sets the n-th x coordinate value.
virtual bool operator!=(const AbstractPositionIterator< T > &rhs) const =0
Difference operator.
const te::gm::Line * m_line
The spatial restriction to be applied in the iterator.
int m_nintersections
The number number of intersected lines in current line of the iterator.
void setEnd()
Sets the iterator position to the end of the current band.
double x
x-coordinate.
Definition: Coord2D.h:113
std::complex< double > m_operatorParenthesis_value
Used by the operator() method.
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
te::gm::Line * m_currline
The current line in the iterator.
double m_operatorBrackets_value
Used by the operator[] method.
virtual void operator--()=0
Returns to the previous position.
int m_maxcolumns
The number of columns in band.
bool operator!=(const PolygonIterator< T > &rhs) const
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator.
unsigned int getColumn() const
Returns the current column in iterator.
int m_currentpixelindex
The index of the current pixel location.
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
double m_urx
Upper right corner x-coordinate.
Definition: Envelope.h:346
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
double m_operatorBrackets_value
Used by the operator[] method.
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid.
static PointSetIterator end(const te::rst::Raster *r, const std::vector< te::gm::Point * > p)
Returns an iterator referring to after the end of the iterator.
bool StdSortPointPointerComparison(te::gm::Point *p1, te::gm::Point *p2)
This class is the base for implementing ways to navigate over the band with spatial restriction...
unsigned int getRow() const
Returns the current row in iterator.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
bool operator!=(const PointSetIterator< T > &rhs) const
void operator++()
Advances to the next position.
int m_actualintersection
The actual line of the iterator.
const te::gm::Polygon * m_polygon
The spatial restriction to be applied in the iterator.
bool operator!=(const LineIterator< T > &rhs) const
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:242
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator.
virtual std::complex< T > operator()(const unsigned int i) const =0
Returns the complex value in current position (column, row, band) from iterator.
PolygonIterator & operator=(const PolygonIterator &rhs)
PointSetIterator & operator=(const PointSetIterator &rhs)
void geoToGrid(const double &x, const double &y, double &col, double &row) const
Get the grid point associated to a spatial location.
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data.
int m_endingrow
The ending row of the iteration.
Grid * getGrid()
It returns the raster grid.
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
double getResolutionY() const
Returns the grid vertical (y-axis) resolution.
int m_endingcolumn
The column (in current line) to finalize the iteration.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
Utility functions for dealing with raster data blocks.
void setNextLine(bool updatecurrline=true)
virtual void operator++()=0
Advances to the next position.
void operator++()
Advances to the next position.
std::complex< T > operator()(const unsigned int i) const
Returns the complex value in current position (column, row, band) from iterator.
std::unique_ptr< Point > getStartPoint() const
The length of this Curve in its associated spatial reference.
A LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:53
An exception class for the Raster module.
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
Definition: Geometry.h:240
Coord2D getUpperRight() const
It returns the upper right coordinate of the envelope.
std::vector< te::gm::Point * > m_pixelsinline
A vector of pixel locations that intersects the line.
double m_llx
Lower left corner x-coordinate.
Definition: Envelope.h:344
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
const te::rst::Raster * m_raster
The band from where to get the values.
static PolygonIterator end(const te::rst::Raster *r, const te::gm::Polygon *p)
Returns an iterator referring to after the end of the iterator.
const te::rst::Raster * m_raster
The band from where to get the values.
A point with x and y coordinate values.
Definition: Point.h:50
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
An abstract class for raster data strucutures.
Definition: Raster.h:71
const te::rst::Raster * m_raster
The band from where to get the values.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
URI C++ Library.
int m_currentpixelindex
The index of the current pixel location.
TEGEOMEXPORT bool SatisfySpatialRelation(const Geometry *g1, const Geometry *g2, SpatialRelation relation)
It returns if two geometries satisfy a given spatial relation.
double getResolutionX() const
Returns the raster horizontal (x-axis) resolution.
std::complex< double > m_operatorParenthesis_value
Used by the operator() method.
int m_maxrows
The number of rows in band.
std::complex< T > operator()(const unsigned int i) const
Returns the complex value in current position (column, row, band) from iterator.
TEGEOMEXPORT void Multi2Single(const te::gm::Geometry *g, std::vector< te::gm::Geometry * > &geoms)
It will get a GeometryCollection and distribute in a vector.
void setEnd()
Sets the iterator position to the end of the current band.
It gives access to values in one band (dimension) of a raster.
void clear()
Clear all internal allocated objects and reset back to the initial state.
virtual void setEnd()=0
Sets the iterator position to the end of the current band.
virtual const std::vector< T > operator*() const =0
Returns a vector of the values in current position (column, row) from iterator.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:75
void operator--()
Returns to the previous position.
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
double m_lly
Lower left corner y-coordinate.
Definition: Envelope.h:345
te::dt::AbstractData * clone() const
It clones the line.
int getSRID() const
Returns the raster spatial reference system identifier.
virtual Geometry * intersection(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set intersection with another geometry...
std::vector< te::gm::Point * > m_pixelsinpointset
The spatial restriction to be applied in the iterator.
virtual ~AbstractPositionIterator()
Destructor.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
void operator--()
Returns to the previous position.
A rectified grid is the spatial support for raster data.
static PolygonIterator begin(const te::rst::Raster *r, const te::gm::Polygon *p)
Returns an iterator referring to the first value of the band.
double m_ury
Upper right corner y-coordinate.
Definition: Envelope.h:347
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator.
int m_column
The current column of the iterator.
unsigned int getColumn() const
Returns the current column in iterator.
std::complex< double > m_operatorParenthesis_value
static LineIterator end(const te::rst::Raster *r, const te::gm::Line *l)
Returns an iterator referring to after the end of the iterator.
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator.
void gridToGeo(const double &col, const double &row, double &x, double &y) const
Get the spatial location of a grid point.
unsigned int getRow() const
Returns the current row in iterator.
double getResolutionY() const
Returns the raster vertical (y-axis) resolution.
std::vector< std::pair< int, int > > m_columns
Coordinates of the columns to be transversed.
virtual unsigned int getRow() const =0
Returns the current row in iterator.
std::vector< std::pair< unsigned int, unsigned int > > TileSegIndex
Definition: TileIndexer.h:58
void setY(std::size_t i, const double &y)
It sets the n-th y coordinate value.
#define TE_LOG_WARN(message)
Use this tag in order to log a message to the TerraLib default logger with the WARN level...
Definition: Logger.h:326
std::complex< T > operator()(const unsigned int i) const
Returns the complex value in current position (column, row, band) from iterator.
void operator++()
Advances to the next position.
virtual unsigned int getColumn() const =0
Returns the current column in iterator.
void operator--()
Returns to the previous position.
unsigned int getColumn() const
Returns the current column in iterator.
A rectified grid is the spatial support for raster data.
Definition: Grid.h:68
std::unique_ptr< Point > getEndPoint() const
It returns the curve end point.
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator.
virtual AbstractPositionIterator< T > & operator=(const AbstractPositionIterator< T > &rhs)
Assignment operator.
LineIterator & operator=(const LineIterator &rhs)
unsigned int getRow() const
Returns the current row in iterator.
std::unique_ptr< te::rst::TileIndexer > m_tileIndexer
Tile indexer used to optimize the geometric operations.
static PointSetIterator begin(const te::rst::Raster *r, const std::vector< te::gm::Point * > p)
Returns an iterator referring to the first value of the band.
static LineIterator begin(const te::rst::Raster *r, const te::gm::Line *l)
Returns an iterator referring to the first value of the band.