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


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

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


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

示例1: loadData

bool PostgresqlFeatureCoverageLoader::loadData(FeatureCoverage *fcoverage) const
{
    //qDebug() << "PostgresqlFeatureCoverageLoader::loadData()";

    ITable table;
    PostgresqlDatabaseUtil pgUtil(_resource,_options);
    Resource tableResource = pgUtil.resourceForType(itFLATTABLE);
    table.prepare(tableResource, _options);

    PostgresqlTableLoader tableLoader(table->source(), _options);
    if (!tableLoader.loadData(table.ptr())) {
        ERROR1("Could not load table data for table '%1'", table->name());
        return false;
    }

    // metadata already set it to correct number, creating new features will up the count agains; so reset to 0.
    fcoverage->setFeatureCount(itFEATURE, iUNDEF, FeatureInfo::ALLFEATURES);

    QList<MetaGeometryColumn> metaGeometries;
    pgUtil.getMetaForGeometryColumns(metaGeometries);
    QSqlQuery query = pgUtil.doQuery(selectGeometries(metaGeometries), "featurecoverageloader");
    quint32 geometriesPerFeature = metaGeometries.size();

    IDomain semantics;
    pgUtil.prepareSubFeatureSemantics(semantics, metaGeometries);

    while (query.next()) {
        if (geometriesPerFeature == 0) {
            fcoverage->newFeature(0);
        } else {
            // index 0 is root, indeces > 0 are subfeatures of root
            bool atRoot = true;
            SPFeatureI rootFeature;
            // iterate semantics to keep predefined order
            ItemRangeIterator iter(semantics->range<>().data());
            while (iter.isValid()) {
                QString geomName = (*iter)->name();
                ICoordinateSystem crs;
                std::for_each(metaGeometries.begin(), metaGeometries.end(), [&crs,geomName](MetaGeometryColumn c) {
                    if (c.geomColumn == geomName) {
                        crs = c.crs;
                    }
                });
                if (atRoot) {
                    atRoot = false;
                    geos::geom::Geometry *rootGeometry = createGeometry(query, geomName, crs);
                    rootFeature = fcoverage->newFeature(rootGeometry, false);
                } else {
                    geos::geom::Geometry *subGeometry = createGeometry(query, geomName, crs);
                    rootFeature->createSubFeature(geomName,subGeometry);
                }
                ++iter;
            }
        }
    }
    fcoverage->attributesFromTable(table);

    return true;
}
开发者ID:CarstenHollmann,项目名称:IlwisConnectors,代码行数:59,代码来源:postgresqlfeaturecoverageloader.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 if(symbol._type == itTABLE){
                            ITable table = symbol._var.value<ITable>();
                            if(table.isValid())
                                result = table->source().url().toString();
                        }
                    }
                }
            }

            kernel()->issues()->log(QString(TR("Operation has executed succesfully")), IssueObject::itError);
        }else {
            qDebug() << "operation failed";
        }
        emit finished();
    }catch(const ErrorObject& err){

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


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