All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Raster.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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/raster/Raster.cpp
22 
23  \brief An abstract class for raster data strucutures.
24 */
25 
26 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "../geometry/Coord2D.h"
29 #include "../geometry/Envelope.h"
30 #include "../geometry/Polygon.h"
31 #include "../srs/Converter.h"
32 #include "Band.h"
33 #include "BandProperty.h"
34 #include "Exception.h"
35 #include "Grid.h"
36 #include "Interpolator.h"
37 #include "PositionIterator.h"
38 #include "Raster.h"
39 #include "RasterFactory.h"
40 #include "RasterProperty.h"
41 #include "Reprojection.h"
42 
43 // STL
44 #include <cassert>
45 #include <cmath>
46 #include <limits>
47 #include <memory>
48 
50  : m_grid(0),
51  m_policy(te::common::RAccess)
52 {
53 }
54 
56  : m_grid(grid),
57  m_policy(p)
58 {
59 }
60 
62  : m_name(rhs.m_name),
63  m_grid(0),
64  m_policy(rhs.m_policy)
65 {
66  m_grid = rhs.m_grid ? new Grid(*rhs.m_grid) : 0;
67 }
68 
70 {
71  delete m_grid;
72 }
73 
74 void te::rst::Raster::setName(const std::string name)
75 {
76  m_name = name;
77 }
78 
79 const std::string& te::rst::Raster::getName() const
80 {
81  return m_name;
82 }
83 
85 {
86  m_policy = p;
87 }
88 
90 {
91  return m_policy;
92 }
93 
95 {
96  return m_grid;
97 }
98 
100 {
101  return m_grid;
102 }
103 
105 {
106  return m_grid->getExtent();
107 }
108 
110 {
111  return m_grid->getExtent();
112 }
113 
115 {
116  if (srid==getSRID())
117  return new te::gm::Envelope(*getExtent());
118 
119  std::auto_ptr<te::srs::Converter> converter(new te::srs::Converter());
120  converter->setSourceSRID(getSRID());
121  converter->setTargetSRID(srid);
122 
123  unsigned int li=0, lf=getNumberOfRows()-1;
124  unsigned int ci=0, cf=getNumberOfColumns()-1;
125 
126  te::gm::Coord2D aux;
127  if (roi)
128  {
129  aux=m_grid->geoToGrid(roi->getLowerLeftX(),roi->getLowerLeftY());
130  li=static_cast<unsigned int>(aux.y);
131  ci=static_cast<unsigned int>(aux.x);
132 
133  aux=m_grid->geoToGrid(roi->getUpperRightX(),roi->getUpperRightY());
134  lf=static_cast<unsigned int>(aux.y);
135  cf=static_cast<unsigned int>(aux.x);
136  }
137 
138  aux=m_grid->gridToGeo(ci,lf);
139  converter->convert(aux.x,aux.y);
140  double llx=aux.x,
141  lly=aux.y;
142 
143  aux=m_grid->gridToGeo(cf,li);
144  converter->convert(aux.x,aux.y);
145  double urx=aux.x,
146  ury=aux.y;
147 
148  // follow the upper horizontal edge
149  for (unsigned int c=ci; c<cf; ++c)
150  {
151  aux=m_grid->gridToGeo(c,li);
152  if (converter->convert(aux.x,aux.y))
153  {
154  if(llx > aux.x) llx = aux.x;
155  if(lly > aux.y) lly = aux.y;
156  if(urx < aux.x) urx = aux.x;
157  if(ury < aux.y) ury = aux.y;
158  }
159  }
160 
161  // follow the lower horizontal edge
162  for (unsigned int c=ci; c<cf; ++c)
163  {
164  aux=m_grid->gridToGeo(c,lf);
165  if (converter->convert(aux.x,aux.y))
166  {
167  if(llx > aux.x) llx = aux.x;
168  if(lly > aux.y) lly = aux.y;
169  if(urx < aux.x) urx = aux.x;
170  if(ury < aux.y) ury = aux.y;
171  }
172  }
173 
174  // follow the left vertical edge
175  for (unsigned int l=li; l<lf; ++l)
176  {
177  aux=m_grid->gridToGeo(ci,l);
178  if (converter->convert(aux.x,aux.y))
179  {
180  if(llx > aux.x) llx = aux.x;
181  if(lly > aux.y) lly = aux.y;
182  if(urx < aux.x) urx = aux.x;
183  if(ury < aux.y) ury = aux.y;
184  }
185  }
186 
187  // follow the right vertical edge
188  for (unsigned int l=li; l<lf; ++l)
189  {
190  aux=m_grid->gridToGeo(cf,l);
191  if (converter->convert(aux.x,aux.y))
192  {
193  if(llx > aux.x) llx = aux.x;
194  if(lly > aux.y) lly = aux.y;
195  if(urx < aux.x) urx = aux.x;
196  if(ury < aux.y) ury = aux.y;
197  }
198  }
199 
200  return new te::gm::Envelope(llx,lly,urx,ury);
201 }
202 
204 {
205  return m_grid->getSRID();
206 }
207 
209 {
210  return m_grid->getNumberOfRows();
211 }
212 
214 {
215  return m_grid->getNumberOfColumns();
216 }
217 
219 {
220  return m_grid->getResolutionX();
221 }
222 
224 {
225  return m_grid->getResolutionY();
226 }
227 
228 void te::rst::Raster::getValue(unsigned int c, unsigned int r, double& value, std::size_t b) const
229 {
230  getBand(b)->getValue(c, r, value);
231 }
232 
233 void te::rst::Raster::setValue(unsigned int c, unsigned int r, const double value, std::size_t b)
234 {
235  getBand(b)->setValue(c, r, value);
236 }
237 
238 void te::rst::Raster::getIValue(unsigned int c, unsigned int r, double& value, std::size_t b) const
239 {
240  getBand(b)->getIValue(c, r, value);
241 }
242 
243 void te::rst::Raster::setIValue(unsigned int c, unsigned int r, const double value, std::size_t b)
244 {
245  getBand(b)->setIValue(c, r, value);
246 }
247 
248 void te::rst::Raster::getValue(unsigned int c, unsigned int r, std::complex<double>& value, std::size_t b) const
249 {
250  getBand(b)->getValue(c, r, value);
251 }
252 
253 void te::rst::Raster::setValue(unsigned int c, unsigned int r, const std::complex<double>& value, std::size_t b)
254 {
255  getBand(b)->setValue(c, r, value);
256 }
257 
258 void te::rst::Raster::getValues(unsigned int c, unsigned int r, std::vector<double>& values) const
259 {
260  values.clear();
261 
262  double v;
263 
264  for(std::size_t b = 0; b < getNumberOfBands(); b++)
265  {
266  getBand(b)->getValue(c, r, v);
267 
268  values.push_back(v);
269  }
270 }
271 
272 void te::rst::Raster::getValues(unsigned int c, unsigned int r, std::vector<std::complex<double> >& values) const
273 {
274  values.clear();
275 
276  std::complex<double> v;
277 
278  for(std::size_t b = 0; b < getNumberOfBands(); b++)
279  {
280  getBand(b)->getValue(c, r, v);
281 
282  values.push_back(v);
283  }
284 }
285 
286 void te::rst::Raster::setValues(unsigned int c, unsigned int r, const std::vector<double>& values)
287 {
288  assert(values.size() == getNumberOfBands());
289 
290  for(std::size_t b = 0; b < getNumberOfBands(); b++)
291  getBand(b)->setValue(c, r, values[b]);
292 }
293 
294 void te::rst::Raster::setValues(unsigned int c, unsigned int r, const std::vector<std::complex<double> >& values)
295 {
296  assert(values.size() == getNumberOfBands());
297 
298  for(std::size_t b = 0; b < getNumberOfBands(); b++)
299  getBand(b)->setValue(c, r, values[b]);
300 }
301 
302 std::string te::rst::Raster::toString(void) const
303 {
304  std::ostringstream output;
305 
306  output << std::endl;
307  output << "Raster Name......: " << m_name << std::endl;
308  output << "Number of Columns: " << getNumberOfColumns() << std::endl;
309  output << "Number of Rows...: " << getNumberOfRows() << std::endl;
310  output << "Number of Bands..: " << getNumberOfBands() << std::endl;
311  output << "SRID.............: " << getSRID() << std::endl;
312  output << "Resolution in X..: " << getResolutionX() << std::endl;
313  output << "Resolution in Y..: " << getResolutionY() << std::endl;
314  output << "Extent UR........: " << m_grid->getExtent()->getUpperRightX() << ", " << m_grid->getExtent()->getUpperRightY() << std::endl;
315  output << "Extent LL........: " << m_grid->getExtent()->getLowerLeftX() << ", " << m_grid->getExtent()->getLowerLeftY() << std::endl;
316 
317  for (std::size_t b = 0; b < getNumberOfBands(); b++)
318  {
319  output << std::endl;
320  output << "Band: " << b << " " << getBand(b)->getProperty()->m_description << std::endl;
321  output << " Min Values...: " << getBand(b)->getMinValue() << std::endl;
322  output << " Max Values...: " << getBand(b)->getMaxValue() << std::endl;
323  output << " Mean Values..: " << getBand(b)->getMeanValue() << std::endl;
324  output << " Std Values...: " << getBand(b)->getStdValue() << std::endl;
325  output << " Gain values..: " << getBand(b)->getScaleValue() << std::endl;
326  output << " Offset values: " << getBand(b)->getOffsetValue() << std::endl;
327  }
328 
329  output << std::endl;
330 
331  return output.str();
332 }
333 
335 {
336  assert(getNumberOfBands() == rhs.getNumberOfBands());
337 
338  for (std::size_t b = 0; b < getNumberOfBands(); b++)
339  this->operator[](b) += rhs.operator[](b);
340 
341  return *this;
342 }
343 
345 {
346  assert(getNumberOfBands() == rhs.getNumberOfBands());
347 
348  for (std::size_t b = 0; b < getNumberOfBands(); b++)
349  this->operator[](b) -= rhs.operator[](b);
350 
351  return *this;
352 }
353 
355 {
356  assert(getNumberOfBands() == rhs.getNumberOfBands());
357 
358  for (std::size_t b = 0; b < getNumberOfBands(); b++)
359  this->operator[](b) *= rhs.operator[](b);
360 
361  return *this;
362 }
363 
365 {
366  assert(getNumberOfBands() == rhs.getNumberOfBands());
367 
368  for (std::size_t b = 0; b < getNumberOfBands(); b++)
369  this->operator[](b) /= rhs.operator[](b);
370 
371  return *this;
372 }
373 
375 {
376  assert(m_policy == te::common::RWAccess || m_policy == te::common::WAccess);
377 
378  if(this != &rhs)
379  {
380  m_name = rhs.m_name;
381 
382  delete m_grid;
383 
384  m_grid = rhs.m_grid ? new Grid(*rhs.m_grid) : 0;
385  }
386 
387  return *this;
388 }
389 
390 te::rst::Raster* te::rst::Raster::trim(const te::gm::Envelope* env, const std::map<std::string, std::string>& rinfo)
391 {
392 // get input properties
393  const te::gm::Envelope* inex = m_grid->getExtent();
394 
395 // calculate output properties
396  te::gm::Coord2D cllenv(m_grid->geoToGrid(env->getLowerLeftX(), env->getLowerLeftY()));
397 
398  te::gm::Coord2D curenv(m_grid->geoToGrid(env->getUpperRightX(), env->getUpperRightY()));
399 
400  te::gm::Coord2D cllimg(m_grid->geoToGrid(inex->getLowerLeftX(), inex->getLowerLeftY()));
401 
402  const unsigned height = static_cast<unsigned>(std::fabs(cllenv.y - curenv.y)) + 1;
403 
404  const unsigned width = static_cast<unsigned>(std::fabs(cllenv.x - curenv.x)) + 1;
405 
406  const unsigned dxoff = static_cast<unsigned>(std::fabs(cllenv.x - cllimg.x));
407 
408  const unsigned dyoff = static_cast<unsigned>(curenv.y);
409 
410 // create output parameters and raster
411  te::rst::Grid* grid = new te::rst::Grid();
412 
413  grid->setGeoreference(te::gm::Coord2D(env->getLowerLeftX(), env->getUpperRightY()), getSRID(), getResolutionX(), getResolutionY());
414 
415  grid->setNumberOfColumns(width);
416 
417  grid->setNumberOfRows(height);
418 
419  std::vector<te::rst::BandProperty*> bands;
420 
421  for (std::size_t b = 0; b < getNumberOfBands(); b++)
422  bands.push_back(new te::rst::BandProperty(*(getBand(b)->getProperty())));
423 
424  te::rst::Raster* rout = te::rst::RasterFactory::make(grid, bands, rinfo);
425 
426 // perform trim
427  std::vector<std::complex<double> > values;
428 
429  for (unsigned ri = dyoff, ro = 0; ro < height; ri++, ro++)
430  for (unsigned ci = dxoff, co = 0; co < width; ci++, co++)
431  {
432  getValues(ci, ri, values);
433 
434  rout->setValues(co, ro, values);
435  }
436 
437  return rout;
438 }
439 
440 te::rst::Raster* te::rst::Raster::resample(int method, int scale, const std::map<std::string, std::string>& rinfo)
441 {
442  assert(scale != 0);
443 
444 // create output parameters and raster
445  te::rst::Grid* grid = new te::rst::Grid(*getResampledGrid(scale));
446 
447  std::vector<te::rst::BandProperty*> bands;
448 
449  for (std::size_t b = 0; b < getNumberOfBands(); b++)
450  bands.push_back(new te::rst::BandProperty(*(getBand(b)->getProperty())));
451 
452  te::rst::Raster* rout = te::rst::RasterFactory::make(grid, bands, rinfo);
453 
454 // define variables for interpolation
455  std::vector<std::complex<double> > v;
456 
457  double ripp = applyScale(scale, 1.0);
458 
459  double cipp = applyScale(scale, 1.0);
460 
461  double ri = 0.0;
462 
463  double ci;
464 
465  te::rst::Interpolator* interp = new te::rst::Interpolator(this, method);
466 
467 // fill output raster
468  for (unsigned r = 0; r < rout->getNumberOfRows(); r++, ri+=ripp)
469  {
470  ci = 0.0;
471  for (unsigned c = 0; c < rout->getNumberOfColumns(); c++, ci+=cipp)
472  {
473  interp->getValues(ci, ri, v);
474 
475  rout->setValues(c, r, v);
476  }
477  }
478 
479  return rout;
480 }
481 
482 te::rst::Raster* te::rst::Raster::resample(int method, unsigned int drow, unsigned int dcolumn, unsigned int height, unsigned int width, unsigned int newheight, unsigned int newwidth, const std::map<std::string, std::string>& rinfo)
483 {
484  assert(drow + height <= getNumberOfRows());
485  assert(dcolumn + width <= getNumberOfColumns());
486 
487  te::gm::Coord2D ll = getGrid()->gridToGeo(dcolumn, drow + height);
488  te::gm::Coord2D ur = getGrid()->gridToGeo(dcolumn + width, drow);
489 
490  te::gm::Envelope* newbox = new te::gm::Envelope(ll.x, ll.y, ur.x, ur.y);
491 
492 // create output parameters and raster
493  te::rst::Grid* grid = new te::rst::Grid(newwidth, newheight, newbox, getSRID());
494 
495  std::vector<te::rst::BandProperty*> bands;
496 
497  for (std::size_t b = 0; b < getNumberOfBands(); b++)
498  bands.push_back(new te::rst::BandProperty(*(getBand(b)->getProperty())));
499 
500  te::rst::Raster* rout = te::rst::RasterFactory::make(grid, bands, rinfo);
501 
502 // define variables for interpolation
503  std::vector<std::complex<double> > v;
504 
505  te::rst::Interpolator* interp = new te::rst::Interpolator(this, method);
506 
507 // fill output raster
508  double ripp = (double) height / newheight;
509 
510  double cipp = (double) width / newwidth;
511 
512  double ri = drow;
513 
514  double ci;
515 
516  for (unsigned r = 0; r < newheight; r++, ri+=ripp)
517  {
518  ci = dcolumn;
519  for (unsigned c = 0; c < newwidth; c++, ci+=cipp)
520  {
521  interp->getValues(ci, ri, v);
522 
523  rout->setValues(c, r, v);
524  }
525  }
526 
527  return rout;
528 }
529 
531 {
532  assert(scale != 0);
533 
534  te::gm::Coord2D* ulc = new te::gm::Coord2D(getExtent()->getLowerLeftX(), getExtent()->getUpperRightY());
535 
536  return new te::rst::Grid((unsigned) std::ceil(applyScale(-scale, getNumberOfColumns())),
537  (unsigned) std::ceil(applyScale(-scale, getNumberOfRows())),
538  applyScale(scale, getResolutionX()), applyScale(scale, getResolutionY()),
539  ulc, getSRID());
540 }
541 
542 double te::rst::Raster::applyScale(int i, const double& v)
543 {
544  if (i > 0)
545  return (v / i);
546 
547  return (v * -i);
548 }
549 
550 te::rst::Raster* te::rst::Raster::transform(int srid, const std::map<std::string, std::string>& rinfo, int m) const
551 {
552  return this->transform(srid, 1, 1, -1, -1, 0, 0, rinfo, m);
553 }
554 
555 te::rst::Raster* te::rst::Raster::transform(int srid, double llx, double lly, double urx, double ury, const std::map<std::string, std::string>& rinfo, int m) const
556 {
557  return this->transform(srid, llx, lly, urx, ury, 0, 0, rinfo, m);
558 }
559 
560 te::rst::Raster* te::rst::Raster::transform(int srid, double llx, double lly, double urx, double ury, double resx, double resy, const std::map<std::string, std::string>& rinfo, int m) const
561 {
562  return te::rst::Reproject(this, srid, llx, lly, urx, ury, resx, resy, rinfo, m);
563 }
564 
565 void te::rst::Raster::rasterize(std::vector<te::gm::Geometry*> g, std::vector<double> vp, std::size_t b)
566 {
567  assert(b < getNumberOfBands());
568 
569  te::rst::Band* band = getBand(b);
570 
571 // if vp is empty, create a vector of contrastand pixel values for neighboring polygons
572  if (vp.size() == 0)
573  {
574  int bvalue = 254;
575  for (unsigned int i = 0; i < g.size(); i++)
576  {
577  vp.push_back(bvalue % 255);
578 
579  bvalue = bvalue >= 127? bvalue - 126: bvalue > 255? 0: bvalue + 127;
580  }
581  }
582 
583  for (unsigned int i = 0; i < g.size(); i++)
584  {
585  te::gm::Polygon* polygon = static_cast<te::gm::Polygon*> (g[i]);
586 
589 
590  while (it != itend)
591  {
592  setValue(it.getColumn(), it.getRow(), vp[i]);
593 
594  ++it;
595  }
596  }
597 }
const std::string & getName() const
Returns the raster name.
Definition: Raster.cpp:79
It gives access to values in one band (dimension) of a raster.
virtual Raster & operator*=(Raster &rhs)
It returns the raster product (pixel by pixel).
Definition: Raster.cpp:354
virtual ~Raster()
Virtual destructor.
Definition: Raster.cpp:69
virtual void setValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the attribute value in a band of a cell.
Definition: Raster.cpp:233
std::string toString(void) const
It returns the data value in a string notation.
Definition: Raster.cpp:302
unsigned int getNumberOfRows() const
Returns the raster number of rows.
Definition: Raster.cpp:208
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
Grid * getResampledGrid(int scale)
Return the raster grid for a specific scale.
Definition: Raster.cpp:530
double getResolutionX() const
Returns the raster horizontal (x-axis) resolution.
Definition: Raster.cpp:218
unsigned int getRow() const
Returns the current row in iterator.
virtual void getIValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the imaginary attribute value in a complex band of a cell.
Definition: Raster.cpp:238
It describes one band (or dimension) of a raster.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
Definition: Envelope.h:400
double y
y-coordinate.
Definition: Coord2D.h:87
Grid * getGrid()
It returns the raster grid.
Definition: Raster.cpp:94
std::string m_name
The raster name.
Definition: Raster.h:594
void setNumberOfColumns(unsigned int nCols)
Sets the grid number of columns.
Definition: Grid.cpp:200
static Raster * make()
It creates and returns an empty raster with default raster driver.
Grid * m_grid
The spatial support for raster data.
Definition: Raster.h:595
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
virtual void rasterize(std::vector< te::gm::Geometry * > g, std::vector< double > vp, std::size_t b=0)
Rasterizes a given vector of geometries.
Definition: Raster.cpp:565
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.
Definition: Raster.cpp:228
A rectified grid is the spatial support for raster data.
It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neig...
Definition: Interpolator.h:51
void setGeoreference(const te::gm::Coord2D &ulLocation, int srid, double resX, double resY)
Sets the information needed to georeference the grid.
Definition: Grid.cpp:220
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
Definition: Envelope.h:390
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
static PolygonIterator begin(const te::rst::Raster *r, const te::gm::Polygon *p)
Returns an iterator referring to the first value of the band.
An exception class for the Raster module.
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data.
Definition: Raster.cpp:104
A raster band description.
Definition: Band.h:63
A rectified grid is the spatial support for raster data.
Definition: Grid.h:55
virtual Raster & operator+=(Raster &rhs)
It returns the raster sum (pixel by pixel).
Definition: Raster.cpp:334
int getSRID() const
Returns the raster spatial reference system identifier.
Definition: Raster.cpp:203
virtual Raster * getRaster() const =0
Returns the associated raster.
virtual void setIValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the imaginary attribute value in a complex band of a cell.
Definition: Raster.cpp:243
double applyScale(int i, const double &v)
Scales a value according to a specific resampling scale.
Definition: Raster.cpp:542
It contains the algorithm to reproject raster data.
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
virtual Raster & operator-=(Raster &rhs)
It returns the raster subtraction (pixel by pixel).
Definition: Raster.cpp:344
unsigned int getColumn() const
Returns the current column in iterator.
Raster property.
TERASTEREXPORT te::rst::Raster * Reproject(te::rst::Raster const *const rin, int srid, const std::map< std::string, std::string > &routinfo, int m=te::rst::Interpolator::NearestNeighbor)
Reprojects a raster to another SRS.
virtual Raster & operator=(const Raster &rhs)
Assignment operator.
Definition: Raster.cpp:374
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
Definition: Raster.cpp:213
A raster band description.
Definition: BandProperty.h:61
This is the abstract factory for Rasters.
virtual Raster * trim(const te::gm::Envelope *env, const std::map< std::string, std::string > &rinfo)
Subsetting operation for trimming (cropping) the raster.
Definition: Raster.cpp:390
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
Definition: Converter.h:53
void getValues(const double &c, const double &r, std::vector< std::complex< double > > &values)
Get the interpolated value for all bands.
virtual void setValues(unsigned int c, unsigned int r, const std::vector< double > &values)
Sets the imaginary attribute values in all complex bands of a cell.
Definition: Raster.cpp:286
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
Definition: Envelope.h:410
It interpolates one pixel based on a selected algorithm.
An abstract class for raster data strucutures.
Definition: Raster.h:70
virtual Raster * resample(int method, unsigned int drow, unsigned int dcolumn, unsigned int height, unsigned int width, unsigned int newheight, unsigned int newwidth, const std::map< std::string, std::string > &rinfo)
Resample a subset of the raster, given a box.
Definition: Raster.cpp:482
double getResolutionY() const
Returns the raster vertical (y-axis) resolution.
Definition: Raster.cpp:223
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 double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
Definition: Envelope.h:420
double x
x-coordinate.
Definition: Coord2D.h:86
void setAccessPolicy(te::common::AccessPolicy p)
Sets the raster access policy.
Definition: Raster.cpp:84
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
Raster()
Default constructor.
Definition: Raster.cpp:49
virtual void getValues(unsigned int c, unsigned int r, std::vector< double > &values) const
Returns the imaginary attribute values in all complex bands of a cell.
Definition: Raster.cpp:258
virtual Raster & operator/=(Raster &rhs)
It returns the raster division (pixel by pixel).
Definition: Raster.cpp:364
virtual Raster * transform(int srid, const std::map< std::string, std::string > &rinfo, int m=1) const
Reprojects this raster to a distinct SRS. This method reprojects this raster to a distinct SRS...
Definition: Raster.cpp:550
An abstract class for raster data strucutures.
void setNumberOfRows(unsigned int nRows)
Sets the grid number of rows.
Definition: Grid.cpp:210
void setName(const std::string name)
Sets the raster name.
Definition: Raster.cpp:74
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
Definition: Raster.cpp:89