本文整理汇总了C++中ITable::column方法的典型用法代码示例。如果您正苦于以下问题:C++ ITable::column方法的具体用法?C++ ITable::column怎么用?C++ ITable::column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITable
的用法示例。
在下文中一共展示了ITable::column方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
bool Selection::execute(ExecutionContext *ctx, SymbolTable& symTable)
{
if (_prepState == sNOTPREPARED)
if((_prepState = prepare(ctx, symTable)) != sPREPARED)
return false;
IRasterCoverage outputRaster = _outputObj.as<RasterCoverage>();
IRasterCoverage inputRaster = _inputObj.as<RasterCoverage>();
quint32 rec = 0;
quint32 colIndex = iUNDEF;
std::unordered_map<quint32, quint32> coverageIndex;
if ( _attribColumn != "") {
ITable tbl = inputRaster->attributeTable();
std::vector<QVariant> values = tbl->column(COVERAGEKEYCOLUMN);
for(const QVariant& val : values) {
coverageIndex[val.toInt()] = rec++;
}
colIndex = tbl->columnIndex(_attribColumn);
}
BoxedAsyncFunc selection = [&](const BoundingBox& box ) -> bool {
BoundingBox inpbox = box.size();
inpbox += _base;
inpbox += std::vector<qint32>{0, box.min_corner().y,0};
if ( _zvalue == iUNDEF)
inpbox.copyFrom(box, BoundingBox::dimZ);
PixelIterator iterOut(outputRaster, box);
PixelIterator iterIn(inputRaster, inpbox);
double v_in = 0;
std::for_each(iterOut, iterOut.end(), [&](double& v){
v_in = *iterIn;
if ( v_in != rUNDEF) {
if ( _attribColumn != "") {
quint32 rec = coverageIndex[v_in];
QVariant var = inputRaster->attributeTable()->cell(colIndex, rec);
v = var.toDouble();
if ( isNumericalUndef(v))
v = rUNDEF;
} else {
v = v_in;
}
}
++iterIn;
++iterOut;
}
);
return true;
};
ctx->_threaded = false;
bool resource = OperationHelperRaster::execute(ctx,selection, outputRaster, _box);
if ( resource && ctx != 0) {
QVariant value;
value.setValue<IRasterCoverage>(outputRaster);
ctx->setOutput(symTable, value, outputRaster->name(), itRASTER,outputRaster->source());
}
return resource;
}