29 #include "../../dataaccess/utils/Utils.h"
30 #include "../../geometry/GeometryProperty.h"
31 #include "../../memory/DataSet.h"
32 #include "../../raster/Raster.h"
47 KernelMap::iterator itA = m_kMapA.begin();
49 while(itA != m_kMapA.end())
51 delete itA->second.first;
58 KernelMap::iterator itB = m_kMapB.begin();
60 while(itB != m_kMapB.end())
62 delete itB->second.first;
71 assert(m_inputParamsA.get());
72 assert(m_inputParamsB.get());
73 assert(m_outputParams.get());
84 std::auto_ptr<te::rst::Raster> rasterA = buildRaster(m_inputParamsA.get(), m_kTree,
"MEM");
87 runRasterKernel(m_inputParamsA.get(), m_kTree, m_kMapA, rasterA.get());
90 std::auto_ptr<te::rst::Raster> rasterB = buildRaster(m_inputParamsB.get(), m_kTree,
"MEM");
93 runRasterKernel(m_inputParamsB.get(), m_kTree, m_kMapB, rasterB.get());
96 std::auto_ptr<te::rst::Raster> rasterOut = buildRaster(m_inputParamsA.get(), m_kTree,
"GDAL");
104 std::auto_ptr<te::da::DataSetType> dsTypeA = createDataSetType(m_inputParamsA->m_dsType.get());
107 std::auto_ptr<te::mem::DataSet> dataSetA = runDataSetKernel(m_inputParamsA.get(), m_kTree, m_kMapA, dsTypeA.get());
110 std::auto_ptr<te::da::DataSetType> dsTypeB = createDataSetType(m_inputParamsB->m_dsType.get());
113 std::auto_ptr<te::mem::DataSet> dataSetB = runDataSetKernel(m_inputParamsB.get(), m_kTree, m_kMapB, dsTypeB.get());
116 std::auto_ptr<te::da::DataSetType> dsTypeOut = createDataSetType(m_inputParamsA->m_dsType.get());
119 std::auto_ptr<te::mem::DataSet> dataSetOut = createDataSet(m_inputParamsA->m_ds.get(), dsTypeOut.get());
122 std::size_t kernelIdx = dsTypeOut->getPropertyPosition(m_outputParams->m_outputAttrName);
131 saveDataSet(dataSetOut.get(), dsTypeOut.get());
137 m_inputParamsA.reset(inParamsA);
138 m_inputParamsB.reset(inParamsB);
167 int id = atoi(strId.c_str());
173 m_kTree.insert(*box,
id);
177 if(!m_inputParamsA->m_intensityAttrName.empty())
182 std::pair<te::gm::Geometry*, double> pairA((
te::gm::Geometry*)g->clone(), valueA);
184 m_kMapA.insert(KernelMap::value_type(
id, pairA));
188 if(!m_inputParamsB->m_intensityAttrName.empty())
193 std::pair<te::gm::Geometry*, double> pairB((
te::gm::Geometry*)g->clone(), valueB);
195 m_kMapB.insert(KernelMap::value_type(
id, pairB));
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.
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.
virtual void execute()
Function to execute the kernel operation.
Utility functions for the data access module.
A class that models the description of a dataset.
This file contains a class that represents the kernel ratio operation.
void setInputParameters(te::sa::KernelInputParams *inParamsA, te::sa::KernelInputParams *inParamsB)
PrimaryKey * getPrimaryKey() const
It returns the primary key associated to the dataset type.
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that take part of the primary key.
~KernelRatioOperation()
Virtual destructor.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
An Envelope defines a 2D rectangular region.
virtual std::string getAsString(std::size_t i, int precision=0) const
Method for retrieving a data value as a string plain representation.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
KernelOutputType
Defines the kernel result storage mode.
A dataset is the unit of information manipulated by the data access module of TerraLib.
It describes a primary key (pk) constraint.
KernelRatioOperation()
Default constructor.
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
TESAEXPORT double GetDataValue(te::dt::AbstractData *ad)
Function used to get the numeric value from a gpm property.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
virtual std::auto_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
const std::string & getName() const
It returns the property name.