KernelFunctions.cpp
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/sa/core/KernelFunctions.cpp
22 
23  \brief This file contains a functions used by the kernel operation.
24 
25  \reference Adapted from TerraLib4.
26 */
27 
28 #define M_PI 3.14159265358979323846
29 
30 //TerraLib
31 #include "../../common/Exception.h"
32 #include "../../common/Translator.h"
33 #include "../../common/progress/TaskProgress.h"
34 #include "../../memory/DataSet.h"
35 #include "../../raster/Grid.h"
36 #include "../../raster/Raster.h"
37 #include "KernelFunctions.h"
38 #include "StatisticsFunctions.h"
39 #include "Utils.h"
40 
42 {
43  assert(params);
44  assert(raster);
45 
46  double totKernel = 0.;
47 
48  //create task
50 
51  task.setTotalSteps(raster->getNumberOfRows());
52  task.setMessage(TE_TR("Calculating Kernel."));
53 
54  //fill raster
55  for(unsigned int i = 0; i < raster->getNumberOfRows(); ++i)
56  {
57  for(unsigned int j = 0; j < raster->getNumberOfColumns(); ++j)
58  {
59  te::gm::Coord2D coord = raster->getGrid()->gridToGeo(j, i);
60 
61  //calculate box to search
62  te::gm::Envelope ext(coord.x, coord.y, coord.x, coord.y);
63 
64  ext.m_llx -= radius;
65  ext.m_lly -= radius;
66  ext.m_urx += radius;
67  ext.m_ury += radius;
68 
69  //get all elements
70  if(params->m_functionType == te::sa::Normal)
71  {
72  ext = kTree.getMBR();
73  }
74 
75  //search
76  std::vector<int> results;
77  kTree.search(ext, results);
78 
79  //calculate kernel value
80  double val = KernelValue(params, kMap, radius, coord, results);
81 
82  totKernel += val;
83 
84  //set value
85  raster->setValue(j, i, val, 0);
86  }
87 
88  if(!task.isActive())
89  {
90  throw te::common::Exception(TE_TR("Operation canceled by the user."));
91  }
92 
93  task.pulse();
94  }
95 
96  //normalize output raster
97  GridKernelNormalize(params, kMap, raster, totKernel);
98 }
99 
101 {
102  assert(params);
103  assert(raster);
104 
105  //Evaluate kernel with a fixed radius, based on formula...
106  double radius = 0.68*pow((double)kMap.size(),-0.2)*sqrt(kTree.getMBR().getArea());
107  double sqArea = sqrt(kTree.getMBR().getArea());
108 
109  te::sa::GridStatRadiusKernel(params, kTree, kMap, raster, radius);
110 
111  //Evaluate geometric mean of kernel values, to adjust radius
112  double meanKernel = KernelGeometricMean(kMap);
113 
114  if(meanKernel <= 0.)
115  throw;
116 
117  //create task
119 
120  task.setTotalSteps(raster->getNumberOfRows());
121  task.setMessage(TE_TR("Calculating Adaptative Kernel."));
122 
123  //Reassign radius, evaluating final value for kernel
124  double totKernel = 0.;
125 
126  for(unsigned int i = 0; i < raster->getNumberOfRows(); ++i)
127  {
128  for(unsigned int j = 0; j < raster->getNumberOfColumns(); ++j)
129  {
130  te::gm::Coord2D coord = raster->getGrid()->gridToGeo(j, i);
131 
132  //calculate box to search
133  te::gm::Envelope ext(coord.x, coord.y, coord.x, coord.y);
134 
135  ext.m_llx -= radius;
136  ext.m_lly -= radius;
137  ext.m_urx += radius;
138  ext.m_ury += radius;
139 
140  //get all elements
141  if(params->m_functionType == te::sa::Normal)
142  {
143  ext = kTree.getMBR();
144  }
145 
146  //search
147  std::vector<int> results;
148  kTree.search(ext, results);
149 
150  //calculate new kernel valeu from old kernel value
151  double newKernel = 0.;
152  double prevKernel;
153  raster->getValue(j, i, prevKernel);
154 
155  if(prevKernel > 0.)
156  {
157  //set new radius value
158  double newRadius = radius * pow((meanKernel / prevKernel), 0.5);
159 
160  //limit the radius
161  if(newRadius > sqArea / 4.)
162  newRadius = sqArea / 4.;
163 
164  //calculate kernel value
165  newKernel = KernelValue(params, kMap, newRadius, coord, results);
166  }
167 
168  totKernel += newKernel;
169 
170  //set value
171  raster->setValue(j, i, newKernel, 0);
172  }
173 
174  if(!task.isActive())
175  {
176  throw te::common::Exception(TE_TR("Operation canceled by the user."));
177  }
178 
179  task.pulse();
180  }
181 
182  //normalize output raster
183  GridKernelNormalize(params, kMap, raster, totKernel);
184 }
185 
187 {
188  double area = rasterOut->getResolutionX() * rasterOut->getResolutionY();
189 
190  //create task
192 
193  task.setTotalSteps(rasterOut->getNumberOfRows());
194  task.setMessage(TE_TR("Calculating Kernel Ratio."));
195 
196  for(unsigned int i = 0; i < rasterOut->getNumberOfRows(); ++i)
197  {
198  for(unsigned int j = 0; j < rasterOut->getNumberOfColumns(); ++j)
199  {
200  double kernelA = 0.;
201  rasterA->getValue(j, i, kernelA);
202 
203  double kernelB = 0.;
204  rasterB->getValue(j, i, kernelB);
205 
206  //calculate kernel ratio value
207  double kernelValue = KernelRatioValue(params, area, kernelA, kernelB);
208 
209  rasterOut->setValue(j, i, kernelValue);
210  }
211 
212  if(!task.isActive())
213  {
214  throw te::common::Exception(TE_TR("Operation canceled by the user."));
215  }
216 
217  task.pulse();
218  }
219 }
220 
221 void te::sa::DataSetStatRadiusKernel(te::sa::KernelInputParams* params, te::sa::KernelTree& kTree, te::sa::KernelMap& kMap, te::mem::DataSet* ds, int kernelIdx, int geomIdx, double radius)
222 {
223  assert(params);
224  assert(ds);
225 
226  double totKernel = 0.;
227 
228  //create task
230 
231  task.setTotalSteps(ds->size());
232  task.setMessage(TE_TR("Calculating Kernel."));
233 
234  //calculate kernel attribute value
235  ds->moveBeforeFirst();
236 
237  while(ds->moveNext())
238  {
239  std::auto_ptr<te::gm::Geometry> geom = ds->getGeometry(geomIdx);
240 
241  te::gm::Coord2D coord = te::sa::GetCentroidCoord(geom.get());
242 
243  //calculate box to search
244  te::gm::Envelope ext(coord.x, coord.y, coord.x, coord.y);
245 
246  ext.m_llx -= radius;
247  ext.m_lly -= radius;
248  ext.m_urx += radius;
249  ext.m_ury += radius;
250 
251  //get all elements
252  if(params->m_functionType == te::sa::Normal)
253  {
254  ext = kTree.getMBR();
255  }
256 
257  //search
258  std::vector<int> results;
259  kTree.search(ext, results);
260 
261  //calculate kernel value
262  double val = KernelValue(params, kMap, radius, coord, results);
263 
264  totKernel += val;
265 
266  //set value
267  ds->setDouble(kernelIdx, val);
268 
269  if(!task.isActive())
270  {
271  throw te::common::Exception(TE_TR("Operation canceled by the user."));
272  }
273 
274  task.pulse();
275  }
276 
277  //normalize output raster
278  DataSetKernelNormalize(params, kMap, ds, kernelIdx, geomIdx, totKernel);
279 }
280 
282 {
283  assert(params);
284  assert(ds);
285 
286  //Evaluate kernel with a fixed radius, based on formula...
287  double radius = 0.68*pow((double)kMap.size(),-0.2)*sqrt(kTree.getMBR().getArea());
288  double sqArea = sqrt(kTree.getMBR().getArea());
289 
290  te::sa::DataSetStatRadiusKernel(params, kTree, kMap, ds, kernelIdx, geomIdx, radius);
291 
292  //Evaluate geometric mean of kernel values, to adjust radius
293  double meanKernel = KernelGeometricMean(kMap);
294 
295  if(meanKernel <= 0.)
296  throw;
297 
298  //create task
300 
301  task.setTotalSteps(ds->size());
302  task.setMessage(TE_TR("Calculating Adaptative Kernel."));
303 
304  //Reassign radius, evaluating final value for kernel
305  double totKernel = 0.;
306 
307  ds->moveBeforeFirst();
308 
309  while(ds->moveNext())
310  {
311  std::auto_ptr<te::gm::Geometry> geom = ds->getGeometry(geomIdx);
312 
313  te::gm::Coord2D coord = te::sa::GetCentroidCoord(geom.get());
314 
315  //calculate box to search
316  te::gm::Envelope ext(coord.x, coord.y, coord.x, coord.y);
317 
318  ext.m_llx -= radius;
319  ext.m_lly -= radius;
320  ext.m_urx += radius;
321  ext.m_ury += radius;
322 
323  //get all elements
324  if(params->m_functionType == te::sa::Normal)
325  {
326  ext = kTree.getMBR();
327  }
328 
329  //search
330  std::vector<int> results;
331  kTree.search(ext, results);
332 
333  //calculate new kernel valeu from old kernel value
334  double newKernel = 0.;
335  double prevKernel = ds->getDouble(kernelIdx);
336 
337  if(prevKernel > 0.)
338  {
339  //set new radius value
340  double newRadius = radius * pow((meanKernel / prevKernel), 0.5);
341 
342  //limit the radius
343  if(newRadius > sqArea / 4.)
344  newRadius = sqArea / 4.;
345 
346  //calculate kernel value
347  newKernel = KernelValue(params, kMap, newRadius, coord, results);
348  }
349 
350  totKernel += newKernel;
351 
352  //set value
353  ds->setDouble(kernelIdx, newKernel);
354 
355  if(!task.isActive())
356  {
357  throw te::common::Exception(TE_TR("Operation canceled by the user."));
358  }
359 
360  task.pulse();
361  }
362 
363  //normalize output raster
364  DataSetKernelNormalize(params, kMap, ds, kernelIdx, geomIdx, totKernel);
365 }
366 
368 {
369  dsA->moveBeforeFirst();
370  dsB->moveBeforeFirst();
371  dsOut->moveBeforeFirst();
372 
373  //create task
375 
376  task.setTotalSteps(dsA->size());
377  task.setMessage(TE_TR("Calculating Kernel Ratio."));
378 
379  while(dsA->moveNext() && dsB->moveNext() && dsOut->moveNext())
380  {
381  double kernelA = dsA->getDouble(kernelIdx);
382  double kernelB = dsB->getDouble(kernelIdx);
383 
384  std::auto_ptr<te::gm::Geometry> geom = dsOut->getGeometry(geomIdx);
385 
386  double area = te::sa::GetArea(geom.get());
387 
388  //calculate kernel ratio value
389  double kernelValue = KernelRatioValue(params, area, kernelA, kernelB);
390 
391  dsOut->setDouble(kernelIdx, kernelValue);
392 
393  if(!task.isActive())
394  {
395  throw te::common::Exception(TE_TR("Operation canceled by the user."));
396  }
397 
398  task.pulse();
399  }
400 }
401 
403 {
404  assert(params);
405  assert(raster);
406 
408 
409  double normFactor = te::sa::Sum(kMap);
410 
411  double area = raster->getResolutionX() * raster->getResolutionY();
412 
413  //create task
415 
416  task.setTotalSteps(raster->getNumberOfRows());
417  task.setMessage(TE_TR("Calculating Kernel Normalization."));
418 
419  for(unsigned int i = 0; i < raster->getNumberOfRows(); ++i)
420  {
421  for(unsigned int j = 0; j < raster->getNumberOfColumns(); ++j)
422  {
423  double kernel = 0.;
424 
425  raster->getValue(j, i, kernel);
426 
427  double normKernel = 0.;
428 
429  switch(type)
430  {
432  normKernel = (kernel * normFactor) / totKernel;
433  break;
434 
435  case te::sa::Density:
436  normKernel = ((kernel * normFactor) / totKernel) / area;
437  break;
438 
439  case te::sa::Probability:
440  normKernel = kernel / totKernel;
441  break;
442  }
443 
444  raster->setValue(j, i, normKernel);
445  }
446 
447  if(!task.isActive())
448  {
449  throw te::common::Exception(TE_TR("Operation canceled by the user."));
450  }
451 
452  task.pulse();
453  }
454 }
455 
456 void te::sa::DataSetKernelNormalize(te::sa::KernelInputParams* params, te::sa::KernelMap& kMap, te::mem::DataSet* ds, int kernelIdx, int geomIdx, double totKernel)
457 {
458  assert(params);
459  assert(ds);
460 
462 
463  double normFactor = te::sa::Sum(kMap);
464 
465  //create task
467 
468  task.setTotalSteps(ds->size());
469  task.setMessage(TE_TR("Calculating Kernel Normalization."));
470 
471  //normalize kernel attribute values
472  ds->moveBeforeFirst();
473 
474  while(ds->moveNext())
475  {
476  std::auto_ptr<te::gm::Geometry> geom = ds->getGeometry(geomIdx);
477 
478  double area = te::sa::GetArea(geom.get());
479 
480  double kernel = ds->getDouble(kernelIdx);
481 
482  double normKernel = 0.;
483 
484  switch(type)
485  {
487  normKernel = (kernel * normFactor) / totKernel;
488  break;
489 
490  case te::sa::Density:
491  normKernel = ((kernel * normFactor) / totKernel) / area;
492  break;
493 
494  case te::sa::Probability:
495  normKernel = kernel / totKernel;
496  break;
497  }
498 
499  ds->setDouble(kernelIdx, normKernel);
500 
501  if(!task.isActive())
502  {
503  throw te::common::Exception(TE_TR("Operation canceled by the user."));
504  }
505 
506  task.pulse();
507  }
508 }
509 
510 double te::sa::KernelValue(te::sa::KernelInputParams* params, te::sa::KernelMap& kMap, double radius, te::gm::Coord2D& coord, std::vector<int> idxVec)
511 {
512  double kernelValue = 0.;
513 
514  for(std::size_t t = 0; t < idxVec.size(); ++t)
515  {
516  int id = idxVec[t];
517 
518  te::gm::Geometry* g = kMap[id].first;
519 
520  double intensity = kMap[id].second;
521 
522  double distance = te::sa::CalculateDistance(g, coord);
523 
524  //calculate kernel value for this element
525  double localK = 0.;
526 
527  switch(params->m_functionType)
528  {
529  case te::sa::Quartic:
530  localK = KernelQuartic(radius, distance, intensity);
531  break;
532  case te::sa::Normal:
533  localK = KernelNormal(radius, distance, intensity);
534  break;
535  case te::sa::Triangular:
536  localK = KernelTriangular(radius, distance, intensity);
537  break;
539  localK = KernelNegExponential(radius, distance, intensity);
540  break;
541  case te::sa::Uniform:
542  localK = KernelUniform(radius, distance, intensity);
543  break;
544  }
545 
546  kernelValue += localK;
547  }
548 
549  return kernelValue;
550 }
551 
552 double te::sa::KernelRatioValue(te::sa::KernelOutputParams* params, double area, double kernelA, double kernelB)
553 {
554  double kernelValue = 0.;
555 
556  switch(params->m_combinationType)
557  {
558  case te::sa::Ratio:
559 
560  if (kernelB == 0.)
561  kernelValue = 0.;
562  else
563  kernelValue = kernelA/kernelB;
564 
565  break;
566 
567  case te::sa::Log_Ratio:
568 
569  if (kernelB == 0.)
570  kernelValue = 0.;
571  else
572  kernelValue = log(kernelA/kernelB);
573 
574  break;
575 
577 
578  kernelValue = kernelA - kernelB;
579 
580  break;
581 
583 
584  kernelValue = (kernelA - kernelB) * area;
585 
586  break;
587 
588  case te::sa::Abs_Sum:
589 
590  kernelValue = kernelA + kernelB;
591 
592  break;
593 
595 
596  kernelValue = (kernelA + kernelB) * area;
597 
598  break;
599  }
600 
601  return kernelValue;
602 }
603 
604 double te::sa::KernelQuartic(double tau, double distance, double intensity)
605 {
606  if (distance > tau)
607  return 0.0;
608 
609  return intensity * (3.0 / (tau * tau * M_PI)) *
610  pow(1 - ((distance * distance)/ (tau * tau)),2.0);
611 }
612 
613 double te::sa::KernelNormal(double tau, double distance, double intensity)
614 {
615  return intensity * (1.0 / (tau * tau * 2 * M_PI)) *
616  exp(-1.0 * (distance * distance)/ (2 * tau * tau));
617 }
618 
619 double te::sa::KernelUniform(double tau, double distance, double intensity)
620 {
621  if (distance > tau)
622  return 0.0;
623 
624  return intensity;
625 }
626 
627 double te::sa::KernelTriangular(double tau, double distance, double intensity)
628 {
629  if (distance > tau)
630  return 0.0;
631 
632  return intensity * (1.0 - 1.0/tau) * distance;
633 }
634 
635 double te::sa::KernelNegExponential(double tau, double distance, double intensity)
636 {
637  if (distance > tau)
638  return 0.0;
639 
640  return intensity * exp(-3.0 * distance);
641 }
642 
644 {
645  te::sa::KernelMap::iterator it = kMap.begin();
646 
647  double meanMTmp = 0.;
648  int meanETmp = 0;
649 
650  while(it != kMap.end())
651  {
652  double intensity = it->second.second;
653 
654  if(intensity > 0.)
655  {
656  int exp;
657  double mantissa = frexp(intensity, &exp);
658 
659  meanMTmp += log(mantissa);
660  meanETmp += exp;
661  }
662 
663  ++it;
664  }
665 
666  double meanM = (meanMTmp + (meanETmp * log(2.))) / kMap.size();
667  meanM = exp(meanM);
668 
669  return meanM;
670 }
TESAEXPORT void GridRatioKernel(te::sa::KernelOutputParams *params, te::rst::Raster *rasterA, te::rst::Raster *rasterB, te::rst::Raster *rasterOut)
Evaluates kernel ratio value using a raster as output data.
std::size_t size() const
It returns the collection size, if it is known.
Definition: DataSet.cpp:311
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
TESAEXPORT void DataSetRatioKernel(te::sa::KernelOutputParams *params, te::mem::DataSet *dsA, te::mem::DataSet *dsB, te::mem::DataSet *dsOut, int kernelIdx, int geomIdx)
Evaluates kernel ratio value using a dataset as output data.
std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
Definition: DataSet.cpp:537
void setMessage(const std::string &message)
Set the task message.
TESAEXPORT void GridAdaptRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::rst::Raster *raster)
Evaluates kernel value using a raster as output data and a adaptative value for radius.
Functions used in statistics operations.
double y
y-coordinate.
Definition: Coord2D.h:114
Class that represents the kernel input parameters.
Definition: KernelParams.h:54
TESAEXPORT void GridKernelNormalize(te::sa::KernelInputParams *params, te::sa::KernelMap &kMap, te::rst::Raster *raster, double totKernel)
Normalizes kernel values based on type of estimation.
TESAEXPORT void GridStatRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::rst::Raster *raster, double radius)
Evaluates kernel value using a raster as output data and a fixed value for radius.
double x
x-coordinate.
Definition: Coord2D.h:113
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
Definition: Raster.cpp:213
KernelEstimationType
Definition: Enums.h:77
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
TESAEXPORT double KernelQuartic(double tau, double distance, double intensity)
Kernel functions for Quartic type.
std::map< int, std::pair< te::gm::Geometry *, double > > KernelMap
double m_urx
Upper right corner x-coordinate.
Definition: Envelope.h:346
TESAEXPORT te::gm::Coord2D GetCentroidCoord(te::gm::Geometry *geom)
Function used to get centroid coord of a geometry.
Definition: Utils.cpp:243
TESAEXPORT double KernelUniform(double tau, double distance, double intensity)
Kernel functions for Uniform type.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
This file contains a functions used by the kernel operation.
TESAEXPORT double KernelValue(te::sa::KernelInputParams *params, te::sa::KernelMap &kMap, double radius, te::gm::Coord2D &coord, std::vector< int > idxVec)
Evaluates kernel value of events with intensity.
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:346
Utilitary function for spatial analysis module.
Class that represents the kernel output parameters.
Definition: KernelParams.h:95
bool isActive() const
Verify if the task is active.
TESAEXPORT void DataSetAdaptRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::mem::DataSet *ds, int kernelIdx, int geomIdx)
Evaluates kernel value using a dataset as output data and a adaptative value for radius.
void setTotalSteps(int value)
Set the task total stepes.
TESAEXPORT double GetArea(te::gm::Geometry *geom)
Function used to get area of a geometry.
Definition: Utils.cpp:278
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
Definition: DataSet.h:65
double m_llx
Lower left corner x-coordinate.
Definition: Envelope.h:344
TESAEXPORT double Sum(te::sa::GeneralizedProximityMatrix *gpm, int attrIdx)
Function used to calculate sum of a specific attribute from a gpm.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
An abstract class for raster data strucutures.
Definition: Raster.h:71
TESAEXPORT double KernelRatioValue(te::sa::KernelOutputParams *params, double area, double kernelA, double kernelB)
Evaluates kernel ratio value.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
Definition: Raster.cpp:208
te::sa::KernelFunctionType m_functionType
Kernel function type.
Definition: KernelParams.h:80
double getResolutionX() const
Returns the raster horizontal (x-axis) resolution.
Definition: Raster.cpp:218
double getArea() const
It returns the area of this envelope as measured in the spatial reference system of it...
Definition: Envelope.h:453
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const
Range search query.
Definition: Index.h:326
TESAEXPORT double KernelTriangular(double tau, double distance, double intensity)
Kernel functions for Triangular type.
Grid * getGrid()
It returns the raster grid.
Definition: Raster.cpp:94
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Definition: Exception.h:58
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
te::sa::KernelCombinationType m_combinationType
Kernel combination type (used by ratio kernel)
Definition: KernelParams.h:118
TESAEXPORT void DataSetKernelNormalize(te::sa::KernelInputParams *params, te::sa::KernelMap &kMap, te::mem::DataSet *ds, int kernelIdx, int geomIdx, double totKernel)
Normalizes kernel values based on type of estimation.
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
double m_lly
Lower left corner y-coordinate.
Definition: Envelope.h:345
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
Definition: DataSet.cpp:328
bool moveNext()
It moves the internal pointer to the next item of the collection.
Definition: DataSet.cpp:316
const te::gm::Envelope & getMBR(void) const
It returns the bounding box of all elements in the tree.
Definition: Index.h:343
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
Definition: DataSet.cpp:477
double m_ury
Upper right corner y-coordinate.
Definition: Envelope.h:347
te::sa::KernelEstimationType m_estimationType
Kernel estimation type.
Definition: KernelParams.h:81
void gridToGeo(const double &col, const double &row, double &x, double &y) const
Get the spatial location of a grid point.
Definition: Grid.cpp:301
double getResolutionY() const
Returns the raster vertical (y-axis) resolution.
Definition: Raster.cpp:223
TESAEXPORT double CalculateDistance(te::gm::Geometry *geom, te::gm::Coord2D &coord)
Function used to calculate the distance from a coord to the center of a geometry. ...
Definition: Utils.cpp:209
#define M_PI
TESAEXPORT void DataSetStatRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::mem::DataSet *ds, int kernelIdx, int geomIdx, double radius)
Evaluates kernel value using a dataset as output data and a fixed value for radius.
void setDouble(std::size_t i, double value)
Definition: DataSet.cpp:482
TESAEXPORT double KernelNegExponential(double tau, double distance, double intensity)
Kernel functions for Negative Exponential type.
TESAEXPORT double KernelNormal(double tau, double distance, double intensity)
Kernel functions for Normal type.
TESAEXPORT double KernelGeometricMean(te::sa::KernelMap &kMap)
Calculates the geometric mean from kernel map (intensity value) using log.