bool FeatureConnector::storeMetaData(FeatureCoverage *fcov, IlwisTypes type) {
    if ( type == 0)
        return false;
    DataDefinition datadef;

    ITable attTable = fcov->attributeTable();
    ColumnDefinition coldef = attTable->columndefinition(COVERAGEKEYCOLUMN);
    if ( coldef.isValid()) {
        datadef = coldef.datadef();
    } else {
        IIndexedIdDomain indexdom;
        indexdom.prepare();
        indexdom->setRange(IndexedIdentifierRange(type2Prefix(type),fcov->featureCount(type)));
        datadef.domain(indexdom);
    }

    bool ok = CoverageConnector::storeMetaData(fcov, type, datadef);
    if ( !ok)
        return false;

    QString dataFile = fcov->name();
    int index = dataFile.lastIndexOf(".");
    if ( index != -1) {
        dataFile = dataFile.left(index);
    }

    _odf->setKeyValue("Domain","Type","DomainUniqueID");
    _odf->setKeyValue("DomainSort","Sorting","AlphaNumeric");
    _odf->setKeyValue("DomainSort","Prefix","feature");
    _odf->setKeyValue("DomainSort","Class","Domain UniqueID");
    _odf->setKeyValue("DomainIdentifier","Nr",QString::number(fcov->featureCount(type)));


    if ( fcov->featureTypes() & itPOLYGON){
        ok = storeMetaPolygon(fcov, dataFile);
    }
    if ( fcov->featureTypes() & itLINE){
        ok = storeMetaLine(fcov, dataFile);
    }

    _odf->store();
    return ok;
}
Exemple #2
0
bool ItemDomainMergerIndexedItems::merge()
{
    IIndexedIdDomain iddom;

    QSharedPointer<IndexedIdentifierRange> range1 = _domain1->range<IndexedIdentifierRange>();
    QSharedPointer<IndexedIdentifierRange> range2 = _domain1->range<IndexedIdentifierRange>();

    std::unique_ptr<IndexedIdentifierRange> newRange(IndexedIdentifierRange::merge(range1, range2));
    if ( newRange->count() == 0)
        return false;

    for(quint32 i=0; i < range2->count(); ++i) {
        _renumber[i] =  range1->count() + i + 1;
    }

    iddom.prepare();
    iddom->setRange(*newRange.get());
    _mergedDomain = iddom;
    return true;
}