Domain* DataDefinition::domain() const{
    Ilwis::IDomain ilwDom = (this->ptr().domain());
    if(ilwDom.isValid()){
        return new Domain(ilwDom);
    }else
        return NULL;
}
Example #2
0
Domain Domain::parent() const{
    if(this->ptr()->as<Ilwis::Domain>()->parent().isValid()){
        unsigned long long id = this->ptr()->as<Ilwis::Domain>()->parent()->id();
        Ilwis::IDomain domain;
        domain.prepare(id);
        return Domain (domain);
    } else {
        throw Ilwis::ErrorObject(QString("No parent domain found"));
    }
}
Example #3
0
void ChartModel::setXAxis(int columnIndex)
{
    if ( _chartWidth == 0)
        return;

    if ( columnIndex >= _table->table()->columnCount())
        return;
    _xvalues.clear();
    if ( columnIndex <= 0){
        _valueTypeXaxis = itINT32;
        _xAxisIsRecordNr = true;

        fillXValues();
    }else {
        columnIndex--; // columnIndex == 0 is the record counter
        std::vector<QVariant> values = _table->table()->column(columnIndex);
        Ilwis::IDomain dom = _table->table()->columndefinition(columnIndex).datadef().domain();
        _valueTypeXaxis = dom->valueType();
        if ( hasType(_valueTypeXaxis, itSTRING)){
            std::set<QString> strings;
            for(auto value : values){
                strings.insert(value.toString());
            }
            _hasXAggregation = values.size() != strings.size();
            for(auto str : strings){
                _xvalues.push_back(QVariant(str));
            }
        }else {
            for(auto v : values){
                _xvalues.push_back(dom->impliedValue(v));
            }
        }
    }
    if (!_xAxisIsRecordNr )
        std::sort(_xvalues.begin(), _xvalues.end());

    _columnIndex = columnIndex;
    if ( _columnIndex > 0)
        _xAxis = _table->table()->columndefinition(columnIndex-1).name();
    else
        _xAxis = TR("Record nr");

    emit yAttributesChanged();


}
QString RepresentationSetter::activeValueType() const
{
    if ( layer() && layer()->drawer()){
        QVariant var = layer()->drawer()->attribute("activevisualattribute");
        if ( !var.isValid())
            return "";
        var = layer()->drawer()->attribute("visualattribute|domain|" + var.toString());
        Ilwis::IDomain dom = var.value<IDomain>();
        if ( !dom.isValid())
            return "";
        if ( hasType(dom->valueType(), itNUMBER))
            return "number";
        if ( hasType(dom->valueType(), itTHEMATICITEM|itNUMERICITEM|itTIMEITEM))
            return "item";
    }
    return "";
}