Exemplo n.º 1
0
void ChartModel::fillXValues()
{
   _xvalues.clear();
    NumericRange rng = Ilwis::MathHelper::roundRange(0, _table->table()->recordCount());
    double scale = rng.max() / _chartWidth;
    int marker = rng.min();
    for( int x = 0; x < _chartWidth; ++x){
        double value = x * scale;
        if ( value > marker){
            _xvalues.push_back(QString::number(marker));
            marker += rng.resolution();
        }else
            _xvalues.push_back("");
    }
}
void NumericRepresentationSetter::prepare(VisualAttributeModel *vattrib, const IIlwisObject &obj, const ColumnDefinition &cdef)
{
    VisualAttributeEditor::prepare(vattrib, obj, cdef);

    if ( attribute()->layer() && attribute()->layer()->drawer()){
        QVariant actAttribute = attribute()->layer()->drawer()->attribute("activevisualattribute");
           if ( !actAttribute.isValid())
               return ;
        auto var = attribute()->layer()->drawer()->attribute("visualattribute|stretchrange|" + actAttribute.toString());
        NumericRange numrange = var.value<NumericRange>();
        if ( !numrange.isValid())
            return;

        NumericRange roundedRange = MathHelper::roundRange(numrange.min(), numrange.max());
        double tickValue = roundedRange.min();
        while(tickValue <= numrange.max()){
            _rprElements.push_back(new RepresentationElement(QString::number(tickValue),this));
            tickValue += roundedRange.resolution();
        }
        _rprElements.push_back(new RepresentationElement(QString::number(tickValue),this));

        emit rprNameChanged();
    }
}
Exemplo n.º 3
0
void ChartModel::fillYValues(QList<QVariant>& yvalues, IlwisTypes valueTypeYAxis, int columnIndex)
{
    QVariant oldValue = 0;
    std::vector<QVariant> values = _table->table()->column(columnIndex);
    NumericRange rng = Ilwis::MathHelper::roundRange(0, _table->table()->recordCount());
    double scale = rng.max() / _chartWidth;
    for( int x = 0; x < _chartWidth; ++x){
        int index = x * scale;
        if ( index < values.size()){

            QVariant v = values[index];
            if ( hasType(valueTypeYAxis,itNUMBER)){
                if ( v == rUNDEF)
                    v = oldValue;
                else
                    oldValue = v;
            }
            yvalues.push_back(v);
        }
    }
}
Exemplo n.º 4
0
bool NumericRange::operator<=(const NumericRange &vr)
{
    return max() <= vr.max() && min() <= vr.min() && max() <= vr.min();
}
Exemplo n.º 5
0
bool NumericRange::operator>(const NumericRange &vr)
{
    return max() > vr.max() && min() > vr.min() && min() > vr.max();
}
Exemplo n.º 6
0
bool NumericRange::operator==(const NumericRange& vr) {
    return vr.max() == max() && vr.min() == min() && vr.resolution() == resolution();
}