当前位置: 首页>>代码示例>>C++>>正文


C++ IRasterCoverage::source方法代码示例

本文整理汇总了C++中IRasterCoverage::source方法的典型用法代码示例。如果您正苦于以下问题:C++ IRasterCoverage::source方法的具体用法?C++ IRasterCoverage::source怎么用?C++ IRasterCoverage::source使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRasterCoverage的用法示例。


在下文中一共展示了IRasterCoverage::source方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: resample

bool OperationHelperRaster::resample(IRasterCoverage& raster1, IRasterCoverage& raster2, ExecutionContext *ctx) {
    if ( !raster1.isValid())
        return false;

    IGeoReference commonGeoref = raster1->georeference();
    if ( ctx->_masterGeoref != sUNDEF) {
        if(!commonGeoref.prepare(ctx->_masterGeoref))
            return false;
    }
    if (raster1->georeference()!= commonGeoref ){
        Resource res;
        res.prepare();
        QString expr = QString("%3=resample(%1,%2,bicubic)").arg(raster1->source().url().toString()).arg(commonGeoref->source().url().toString()).arg(res.name());
        ExecutionContext ctxLocal;
        SymbolTable symtabLocal;
        if(!commandhandler()->execute(expr,&ctxLocal,symtabLocal))
            return false;
        QVariant var = symtabLocal.getValue(res.name());
        raster1 = var.value<IRasterCoverage>();
    }
    if ( raster2.isValid() && raster2->georeference()!= commonGeoref ){
        Resource res;
        res.prepare();
        QString expr = QString("%3=resample(%1,%2,bicubic)").arg(raster2->source().url().toString()).arg(commonGeoref->source().url().toString()).arg(res.name());
        ExecutionContext ctxLocal;
        SymbolTable symtabLocal;
        if(!commandhandler()->execute(expr,&ctxLocal,symtabLocal))
            return false;
        QVariant var = symtabLocal.getValue(res.name());
        IRasterCoverage outRaster = var.value<IRasterCoverage>();
        raster2.assign(outRaster);
    }
    return true;
}
开发者ID:VincentBeltman,项目名称:IlwisCore,代码行数:34,代码来源:operationhelpergrid.cpp

示例2: process

void OperationWorker::process(){
    try {
        Operation op(_expression);
        SymbolTable tbl;
        ExecutionContext ctx;

        if(op->execute(&ctx, tbl)){
            if ( ctx._results.size() > 0){
                for(auto resultName : ctx._results){
                    Symbol symbol = tbl.getSymbol(resultName);
                    if ( hasType(symbol._type, itNUMBER)){
                        result += symbol._var.toDouble();
                    }else if ( hasType(symbol._type, itSTRING)){
                        result += symbol._var.toString();
                    }else if ( hasType(symbol._type, (itCOVERAGE | itTABLE))){
                        if ( symbol._type == itRASTER){
                            IRasterCoverage raster = symbol._var.value<IRasterCoverage>();
                            if ( raster.isValid())
                                result = raster->source().url().toString();
                        }
                    }
                }
            }
        }else {
            qDebug() << "operation failed";
        }
        emit finished();
    }catch(const ErrorObject& err){

    }
    emit finished();
}
开发者ID:ridoo,项目名称:IlwisCore,代码行数:32,代码来源:operationworker.cpp

示例3: runApplication

bool runApplication( OperationExpression opExpr, QString *result){
    Operation op(opExpr);
    SymbolTable tbl;
    ExecutionContext ctx;

    if(op->execute(&ctx, tbl)){
        if ( ctx._results.size() > 0){
            for(auto resultName : ctx._results){
                Symbol symbol = tbl.getSymbol(resultName);
                if ( hasType(symbol._type, itNUMBER)){
                    *result += symbol._var.toDouble();
                }else if ( hasType(symbol._type, itSTRING)){
                    *result += symbol._var.toString();
                }else if ( hasType(symbol._type, (itCOVERAGE | itTABLE))){
                    if ( symbol._type == itRASTER){
                        IRasterCoverage raster = symbol._var.value<IRasterCoverage>();
                        QUrl url = raster->source().container();
                    }
                }
            }
        }
        return true;
    }
    return false;
}
开发者ID:CarstenHollmann,项目名称:IlwisUITest,代码行数:25,代码来源:operationcatalogmodel.cpp

示例4: execute

bool AggregateRaster::execute(ExecutionContext *ctx, SymbolTable& symTable)
{
    if (_prepState == sNOTPREPARED)
        if((_prepState = prepare(ctx,symTable)) != sPREPARED)
            return false;

    IRasterCoverage outputRaster = _outputObj.as<RasterCoverage>();

    quint64 currentCount = 0;
    BoxedAsyncFunc aggregateFun = [&](const BoundingBox& box) -> bool {
        //Size sz = outputRaster->size();
        PixelIterator iterOut(outputRaster, box);
        BoundingBox inpBox(Pixel(box.min_corner().x,
                                             box.min_corner().y * groupSize(1),
                                             box.min_corner().z * groupSize(2)),
                             Pixel((box.max_corner().x+1) * groupSize(0) - 1,
                                             (box.max_corner().y + 1) * groupSize(1) - 1,
                                             (box.max_corner().z + 1) * groupSize(2) - 1) );

        BlockIterator blockIter(_inputObj.as<RasterCoverage>(),Size<>(groupSize(0),groupSize(1), groupSize(2)), inpBox);
        NumericStatistics stats;
        PixelIterator iterEnd = iterOut.end();
        while(iterOut != iterEnd) {
            GridBlock& block = *blockIter;
            stats.calculate(block.begin(), block.end(), _method);
            double v = stats[_method];
           *iterOut = v;
            ++iterOut;
            ++blockIter;
            updateTranquilizer(currentCount++, 1000);
        }
        return true;
    };
    bool res = OperationHelperRaster::execute(ctx, aggregateFun, outputRaster);

    if ( res && ctx != 0) {
        QVariant value;
        value.setValue<IRasterCoverage>(outputRaster);
        ctx->setOutput(symTable,value,outputRaster->name(), itRASTER, outputRaster->source() );
    }
    return res;
}
开发者ID:CarstenHollmann,项目名称:IlwisCore,代码行数:42,代码来源:aggregateraster.cpp

示例5: 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;


}
开发者ID:ridoo,项目名称:IlwisCore,代码行数:64,代码来源:selection.cpp


注:本文中的IRasterCoverage::source方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。