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


C++ ITable类代码示例

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


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

示例1: ERROR2

bool FeatureConnector::loadMetaData(Ilwis::IlwisObject *obj)
{
    bool ok = CoverageConnector::loadMetaData(obj);
    if ( !ok)
        return false;
    FeatureCoverage *fcoverage = static_cast<FeatureCoverage *>(obj);
    IlwisTypes coverageType = itPOINT;

    int features = _odf->value("PointMap","Points").toInt(&ok);
    if (!ok) {
        coverageType = itLINE;
        features = _odf->value("SegmentMapStore","Segments").toInt(&ok);
        if (!ok) {
            coverageType = itPOLYGON;
            features = _odf->value("PolygonMapStore","Polygons").toInt(&ok);
        }
    }

    if (ok){
        fcoverage->featureTypes(coverageType);
        fcoverage->setFeatureCount(coverageType, features);
    }
    else
       return ERROR2(ERR_INVALID_PROPERTY_FOR_2,"Records",obj->name());

    ITable tbl = fcoverage->attributeTable();
    tbl->setRows(fcoverage->featureCount());
    return true;

}
开发者ID:JeroenBrinkman,项目名称:IlwisConnectors,代码行数:30,代码来源:featureconnector.cpp

示例2: AttributeModel

void IlwisObjectModel::resetAttributeModel(const QString& attributeName){

    auto setAttributeModel = [&](int i, const ColumnDefinition& coldef, const QString& attributeName){
        if ( coldef.name() == attributeName){
            AttributeModel *attribute = new AttributeModel(coldef, this, _ilwisobject);
            _attributes[i] = attribute;
        }
    };

    IlwisTypes objecttype = _ilwisobject->ilwisType();
    if ( objecttype == itRASTER){
        IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
        if ( raster->hasAttributes()){
            for(int i = 0; i < raster->attributeTable()->columnCount(); ++i){
                setAttributeModel(i,raster->attributeTable()->columndefinition(i), attributeName);
            }
        }
    } else if ( hasType(objecttype,itFEATURE)){
        IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
        for(int i = 0; i < features->attributeDefinitions().definitionCount(); ++i){
            setAttributeModel(i,features->attributeTable()->columndefinition(i), attributeName);
        }
    } else if ( hasType(objecttype,itTABLE)){
        ITable tbl = _ilwisobject.as<Table>();
        for(int i = 0; i < tbl->columnCount(); ++i){
            setAttributeModel(i,tbl->columndefinition(i),attributeName);
        }
    }

}
开发者ID:VincentBeltman,项目名称:IlwisCore,代码行数:30,代码来源:ilwisobjectmodel.cpp

示例3: statistics

ITable RasterCoverage::histogramAsTable()
{
    std::vector<NumericStatistics::HistogramBin> hist;
    if ( histogramCalculated())
        hist = statistics().histogram();
    else {
        hist = statistics(ContainerStatistics<PIXVALUETYPE>::pHISTOGRAM).histogram();
    }
    
    int count = 0;
    ITable histogram;

    histogram.prepare();
    histogram->addColumn("min", IDomain("value"), true);
    histogram->addColumn("max", IDomain("value"), true);
    histogram->addColumn("counts", IDomain("count"));

    count = 0;
    PIXVALUETYPE vstart = datadef().range<NumericRange>()->min();
	if (hist.size() > 0) {
		for (int i = 0; i < hist.size() - 1; ++i) {
			auto& h = hist[i];
			histogram->record(count, { vstart, h._limit, h._count });
			vstart = h._limit;
			++count;
		}
	}

    return histogram;
}
开发者ID:MartinSchouwenburg,项目名称:IlwisTest,代码行数:30,代码来源:rastercoverage.cpp

示例4: kernel

bool FeatureConnector::loadBinaryData(Ilwis::IlwisObject *obj) {
    if ( obj == nullptr)
        return false;

    FeatureCoverage *fcoverage = static_cast<FeatureCoverage *>(obj);

    QString file = _odf->value("BaseMap", "AttributeTable");
    ITable extTable;
    if ( file != sUNDEF) {
        if(!extTable.prepare(file)){
            kernel()->issues()->log(file,TR(ERR_NO_INITIALIZED_1).arg(file),IssueObject::itWarning);
            return false;
        }
    }
    bool ok = false;
     if (fcoverage->featureTypes() == itPOINT)
        ok = loadBinaryPoints(fcoverage);
    else if (fcoverage->featureTypes() == itLINE)
        ok = loadBinarySegments(fcoverage);
    else if (fcoverage->featureTypes() == itPOLYGON)
        ok = loadBinaryPolygons(fcoverage);
    if ( ok && extTable.isValid()) {
        ITable attTbl = fcoverage->attributeTable();
        quint32 keyIndex = attTbl->columnIndex(COVERAGEKEYCOLUMN);
        for(quint32 rowExt=0; rowExt < extTable->records(); ++rowExt) {
            vector<QVariant> rec = extTable->record(rowExt);
            for(quint32 rowAtt = 0; rowAtt < attTbl->records(); ++rowAtt ) {
                if ( attTbl->cell(keyIndex, rowAtt) == rowExt + 1) {
                    attTbl->record(rowAtt,rec);
                }
            }
        }
    }
    return ok;
}
开发者ID:JeroenBrinkman,项目名称:IlwisConnectors,代码行数:35,代码来源:featureconnector.cpp

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

示例6: assignTable

bool Assignment::assignTable(ExecutionContext *ctx) {

    ITable outputFC = _outputObj.as<Table>();
    ITable inputFC = _inputObj.as<Table>();
    outputFC = inputFC->copyTable(ANONYMOUS_PREFIX);

    return true;
}
开发者ID:MartinSchouwenburg,项目名称:IlwisTest,代码行数:8,代码来源:assignment.cpp

示例7: getLayerHandle

bool GdalFeatureConnector::loadMetaData(Ilwis::IlwisObject *data,const IOOptions& options){

    if(!CoverageConnector::loadMetaData(data, options))
        return false;

    FeatureCoverage *fcoverage = static_cast<FeatureCoverage *>(data);
    fcoverage->setFeatureCount(itFEATURE, iUNDEF, FeatureInfo::ALLFEATURES);

    OGRLayerH hLayer = getLayerHandle();

    if ( hLayer) {
        //feature types
        IlwisTypes type = translateOGRType(gdal()->getLayerGeometry(hLayer));
        if (type == itUNKNOWN){
            WARN(QString("Unknown feature type of layer %1 from: %2").arg(0).arg(_filename.toString()));
        }else{
            fcoverage->featureTypes(type);
        }

        //feature counts
        int temp = gdal()->getFeatureCount(hLayer, FALSE);//TRUE to FORCE databases to scan whole layer, FALSe can end up in -1 for unknown result
        if (temp == -1){
            WARN(QString("Couldn't determine feature count of layer %1 from meta data of %2").arg(0).arg(_filename.toString()));
        }else{
            int featureCount = fcoverage->featureCount(type);
            featureCount += temp;
            fcoverage->setFeatureCount(type, featureCount,0); // subgeometries are not known at this level
        }
        //attribute table
        ITable attTable;
        Resource resource(_filename, itFLATTABLE);
        if(!attTable.prepare(resource,{"asflattable", true})) {//will load whole meta data of the table
            ERROR1(ERR_NO_INITIALIZED_1,resource.name());
            return false;
        }
        fcoverage->setAttributes(attTable);

        //layer envelopes/extents
        Envelope bbox;
        OGREnvelope envelope;//might sometimes be supported as 3D now only posssible from OGRGeometry
        OGRErr err = gdal()->getLayerExtent(hLayer, &envelope , FALSE);//TRUE to FORCE
        if (err != OGRERR_NONE){
            if (err == OGRERR_FAILURE){//on an empty layer or if simply too expensive(FORECE=FALSE) OGR_L_GetExtent may return OGRERR_FAILURE
                WARN(QString("Couldn't determine the extent of layer %1 from meta data of %2").arg(0).arg(_filename.toString()));
            }else{
                ERROR0(QString("Couldn't load extent of layer %1 from %2: %3").arg(0).arg(_filename.toString()).arg(gdal()->translateOGRERR(err)));
            }
        }else{
            bbox = Envelope(Coordinate(envelope.MinX,envelope.MinY),Coordinate(envelope.MaxX,envelope.MaxY));
        }
        fcoverage->envelope(bbox);
//        fcoverage->coordinateSystem()->envelope(bbox);
    }

    gdal()->closeFile(sourceRef().toLocalFile(), data->id());

    return true;
}
开发者ID:maduhu,项目名称:IlwisConnectors,代码行数:58,代码来源:gdalfeatureconnector.cpp

示例8: PutData

/**
 * Maps the specified key to the specified value in this table.
 * The key can not be NULL.
 * The value can be retrieved by calling the get method with a key that is equal to the original key.
 * @param keyName the key
 * @param value the value
 */
void SmartDashboard::PutData(std::string key, Sendable *data)
{
	if (data == NULL)
	{
		//TODO wpi_setWPIErrorWithContext(NullParameter, "value");
		return;
	}
    ITable* dataTable = m_table->GetSubTable(key);
    dataTable->PutString("~TYPE~", data->GetSmartDashboardType());
    data->InitTable(dataTable);
    m_tablesToData[dataTable] = data;
}
开发者ID:128keaton,项目名称:wpilib,代码行数:19,代码来源:SmartDashboard.cpp

示例9: storeBinaryData

bool CoverageConnector::storeBinaryData(IlwisObject *obj, IlwisTypes tp)
{
    Coverage *coverage = static_cast<Coverage *>(obj);
    ITable attTable = coverage->attributeTable();
    if ( attTable.isValid()) {
        QScopedPointer<TableConnector> conn(createTableConnector(attTable, coverage, tp));
        return conn->storeBinaryData(attTable.ptr());

    }

    return false;
}
开发者ID:JeroenBrinkman,项目名称:IlwisConnectors,代码行数:12,代码来源:coverageconnector.cpp

示例10: QVariant

bool FeatureConnector::loadBinaryPolygons30(FeatureCoverage *fcoverage, ITable& tbl) {
    BinaryIlwis3Table polTable;
    if ( !polTable.load(_odf)) {
        return ERROR1(ERR_COULD_NOT_OPEN_READING_1,_odf->fileinfo().fileName())    ;
    }

    BinaryIlwis3Table topTable;
    if ( !topTable.load(_odf,"top")) {
        return ERROR1(ERR_COULD_NOT_OPEN_READING_1,_odf->fileinfo().fileName())    ;
    }

    qint32 colValue = polTable.index("PolygonValue");
    qint32 colTopStart = polTable.index("TopStart");
    qint32 colArea = polTable.index("Area");
    int nrPolygons = polTable.rows();
    bool isNumeric = _odf->value("BaseMap","Range") != sUNDEF;

    double v;
    for(int i = 0; i < nrPolygons; ++i) {
        polTable.get(i,colArea, v);
        if ( v < 0)
            continue;
        polTable.get(i,colTopStart,v);
        qint32 index = v;
        std::vector<std::vector<Coordinate2d>> rings;
        if (getRings(index, topTable, polTable, rings)) {
            if ( rings.size() == 0)
                continue;
            Polygon polygon;
            polygon.outer().resize(rings[0].size());
            std::copy(rings[0].begin(), rings[0].end(), polygon.outer().begin());
            for(int j = 1; j < rings.size(); ++j) {
                polygon.inners()[j-1].resize(rings[j].size());
                std::copy(rings[j].begin(), rings[j].end(), polygon.inners()[j-1].begin());
            }
            polTable.get(i, colValue, v);
            if ( isNumeric) {
                tbl->cell(COVERAGEKEYCOLUMN, i, QVariant(i));
                tbl->cell(FEATUREVALUECOLUMN, i, QVariant(v));
                fcoverage->newFeature({polygon});
            } else {
                quint32 itemId = v;
                tbl->cell(COVERAGEKEYCOLUMN, i, QVariant(itemId));
                SPFeatureI feature = fcoverage->newFeature({polygon});
                tbl->cell(FEATUREIDCOLUMN, i, QVariant(feature->featureid()));
            }
        }
    }
    return true;
}
开发者ID:JeroenBrinkman,项目名称:IlwisConnectors,代码行数:50,代码来源:featureconnector.cpp

示例11: createAttributes

bool GdalFeatureConnector::createAttributes(const ITable& tbl, OGRLayerH layer, const std::vector<OGRFieldDefnH>& fielddefs,std::vector<bool>& validAttributes) {
    if ( layer == 0)
        return false;

    int index=0;
    for(int i=0; i < tbl->columnCount(); ++i){
        if ( validAttributes[i]) {
            if(gdal()->addAttribute(layer,fielddefs[index],TRUE) != OGRERR_NONE){
                validAttributes[i] = false;
                WARN2(ERR_NO_INITIALIZED_2,tbl->columndefinition(i).name(),tbl->name());
            }
            ++index;
        }
    }
    return true;
}
开发者ID:maduhu,项目名称:IlwisConnectors,代码行数:16,代码来源:gdalfeatureconnector.cpp

示例12: attributesFromTable

void FeatureCoverage::attributesFromTable(const ITable& otherTable)
{
    _attributeDefinition.clearAttributeDefinitions();

    for(int col =0; col < otherTable->columnCount(); ++col){
        _attributeDefinition.addColumn(otherTable->columndefinition(col));
    }

    if (otherTable->recordCount() != _features.size())
        return;

    for(int rec =0; rec < otherTable->recordCount(); ++rec){
        auto& feature=  _features[rec];
        feature->record(otherTable->record(rec));
    }
}
开发者ID:CarstenHollmann,项目名称:IlwisCore,代码行数:16,代码来源:featurecoverage.cpp

示例13: kernel

bool CoverageConnector::loadMetaData(Ilwis::IlwisObject *data)
{
    Ilwis3Connector::loadMetaData(data);

    Coverage *coverage = static_cast<Coverage *>(data);
    QString csyName = _odf->value("BaseMap","CoordSystem");
    if ( csyName.toLower() == "latlonwgs84.csy")
        csyName = "code=epsg:4326";
    ICoordinateSystem csy;
    if ( !csy.prepare(csyName)) {
        kernel()->issues()->log(csyName,TR("Coordinate system couldnt be initialized, defaulting to 'unknown'"),IssueObject::itWarning);
        QString resource = QString("ilwis://file/unknown.csy");
        if (!csy.prepare(resource)) {
            kernel()->issues()->log(TR("Fallback to 'unknown failed', corrupt system files defintion"));
            return false;
        }
    }
    coverage->setCoordinateSystem(csy);


    QString attfile = _odf->value("BaseMap", "AttributeTable");
    QString basemaptype = _odf->value("BaseMap", "Type");
    // feature coverages always have an attribute table; rasters might have
    if ( basemaptype != "Map" || attfile != sUNDEF) {
        ITable attTable = prepareAttributeTable(attfile, basemaptype);
        if (!attTable.isValid())
            return false;

        coverage->attributeTable(attTable);
    }

    QString cbounds = _odf->value("BaseMap","CoordBounds");
    QStringList parts = cbounds.split(" ");
    if ( parts.size() == 4) {
        double minx = parts[0].toDouble();
        double miny = parts[1].toDouble();
        double maxx = parts[2].toDouble();
        double maxy = parts[3].toDouble();
        Box2D<double> env(Coordinate(minx, miny), Coordinate(maxx, maxy));
        coverage->envelope(env);
    } else {
        kernel()->issues()->log(TR(ERR_INVALID_PROPERTY_FOR_2).arg("Coordinate boundaries", data->name()), IssueObject::itWarning);
    }


    return true;
}
开发者ID:JeroenBrinkman,项目名称:IlwisConnectors,代码行数:47,代码来源:coverageconnector.cpp

示例14: file

bool FeatureConnector::loadBinaryPolygons37(FeatureCoverage *fcoverage, ITable& tbl) {
    QString datafile = _odf->value("PolygonMapStore","DataPol");
    datafile = context()->workingCatalog()->filesystemLocation().toLocalFile() + "/" + datafile;
    QFile file(datafile);

    if (!file.exists()){
        kernel()->issues()->log(TR(ERR_MISSING_DATA_FILE_1).arg(file.fileName()));
        return false;
    }
    if(!file.open(QIODevice::ReadOnly )){
        kernel()->issues()->log(TR(ERR_COULD_NOT_OPEN_READING_1).arg(file.fileName()));
        return false;
    }
    QDataStream stream(&file);
    int nrPolygons = fcoverage->featureCount(itPOLYGON);
    SPAttributeRecord record( new AttributeRecord(tbl,FEATUREIDCOLUMN));
    bool isNumeric = _odf->value("BaseMap","Range") != sUNDEF;

    for(int j=0; j < nrPolygons; ++j) {
        Polygon pol;
        readRing(stream, pol.outer());
        double value;
        quint32 numberOfHoles;
        stream.readRawData((char *)&value, 8);
        stream.readRawData((char *)&numberOfHoles, 4);
        pol.inners().resize(numberOfHoles);
        for(quint32 i=0; i< numberOfHoles;++i)
            readRing(stream, pol.inners()[i]);
        if ( isNumeric) {
            tbl->cell(COVERAGEKEYCOLUMN, j, QVariant(j));
            tbl->cell(FEATUREVALUECOLUMN, j, QVariant(value));
            SPFeatureI feature = fcoverage->newFeature({pol});
            tbl->cell(FEATUREIDCOLUMN, j, QVariant(feature->featureid()));
        } else {
            quint32 itemId = value;
            tbl->cell(COVERAGEKEYCOLUMN, j, QVariant(itemId));
            SPFeatureI feature = fcoverage->newFeature({pol});
            tbl->cell(FEATUREIDCOLUMN, j, QVariant(feature->featureid()));
        }

    }
    file.close();

    return true;
}
开发者ID:JeroenBrinkman,项目名称:IlwisConnectors,代码行数:45,代码来源:featureconnector.cpp

示例15: getForm

UserModelEditor::UserModelEditor() : ModelEntityEditor< ::Model::User >() {
    // Remove unsed widget
    getForm()->removeWidget("id");
    getForm()->removeWidget("created_at");
    getForm()->removeWidget("last_access");
    getForm()->removeWidget("puppetftp_role");
    getForm()->removeWidget("passwd");

    // Set label
    getForm()->getWidget("firstname")->setLabel("First Name");
    getForm()->getWidget("lastname")->setLabel("Last Name");
    getForm()->getWidget("email")->setLabel("Email");

    // Add custom attribute
    getForm()->getWidget("email")->setAttribute("autocomplete", "off");

    // Get role
    ITable*         table = DatabaseManager::instance()->getTable("puppetftp_role");
    if (table == NULL) {
        // rediriger ou gérer le cas d'erreur

    }
    QList<QObject*> roles = table->getAll();

    // Create custom widget
    InputChoice* selectRole = new InputChoice("puppetftp_role", InputChoice::SELECT);
    selectRole->setLabel("Role");

    for (QList<QObject*>::const_iterator it = roles.begin(); it != roles.end(); it++) {
        Model::Role* role = dynamic_cast<Model::Role*>(*it);
        selectRole->addOption(QString::number(role->getId()), role->getName());
    }
    getForm()->addWidget("editor", selectRole);

    Input* password = new Input("passwd", Input::PASSWORD);
    password->setLabel("Password");
    password->setAttribute("autocomplete", "off");

    getForm()->addWidget("editor", password);

    roles.clear();
    delete table;
}
开发者ID:PuppetFTP,项目名称:PuppetFTP,代码行数:43,代码来源:UserModelEditor.cpp


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