Ejemplo 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();
    }
}
Ejemplo n.º 3
0
bool NumericRange::operator==(const NumericRange& vr) {
    return vr.max() == max() && vr.min() == min() && vr.resolution() == resolution();
}