ColumnDefinition::ColumnDefinition(const ColumnDefinition& coldef){
    if(coldef.__bool__())
    {
        Ilwis::ColumnDefinition* ilwDef = coldef.ptr().get();
        if(ilwDef->isValid())
            _ilwisColDef.reset(new Ilwis::ColumnDefinition(*ilwDef));
    }
}
 PyObject* Table::columns() const{
     Ilwis::ITable tbl = this->ptr()->as<Ilwis::Table>();
     PyObject* list = newPyTuple(tbl->columnCount());
     for(int i = 0; i < tbl->columnCount(); i++){
         Ilwis::ColumnDefinition coldef = tbl->columndefinition(i);
         if (!setTupleItem(list, i, PyUnicodeFromString(coldef.name().toStdString().data())))
             throw Ilwis::ErrorObject(QString("internal conversion error while trying to add '%1' to list of columns").arg(tbl->columndefinition(i).name()));
     }
     return list;
 }
Esempio n. 3
0
 std::vector<std::string> Table::columns() const{
     Ilwis::ITable tbl = this->ptr()->as<Ilwis::Table>();
     std::vector<std::string> vector;
     for(int i = 0; i < tbl->columnCount(); i++){
         Ilwis::ColumnDefinition coldef = tbl->columndefinition(i);
         vector.push_back( coldef.name().toStdString() );
         //if (!setTupleItem(list, i, PyUnicodeFromString(coldef.name().toStdString().data())))
             //throw Ilwis::ErrorObject(QString("internal conversion error while trying to add '%1' to list of columns").arg(tbl->columndefinition(i).name()));
     }
     return vector;
 }
AttributeModel::AttributeModel(const Ilwis::ColumnDefinition& def, QObject *parent, const Ilwis::IIlwisObject& obj) :
    QObject(parent),
    _coldefinition(def),
    _owner(obj)
{
    if ( def.isValid() && def.datadef().domain()->ilwisType() == itITEMDOMAIN && def.datadef().domain()->valueType() != itINDEXEDITEM) {
        if (!def.datadef().domain()->range().isNull()) {
            QString defset = def.datadef().domain()->range()->toString();
            defset = defset.mid(defset.indexOf(":") + 1);
            _attributeValuesDefaultRange = defset.split("|");
        }
        if (!def.datadef().range().isNull()) {
            QString defset = def.datadef().domain()->range()->toString();
            defset = defset.mid(defset.indexOf(":") + 1);
            _attributeValuesActualRange = defset.split("|");
        }
    }
}