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
QColor LayerDrawer::color(const IRepresentation &rpr, double value, DrawerInterface::ColorValueMeaning cvm)
{
    if ( _activeAttribute != sUNDEF){
        VisualAttribute& attr = _visualProperties[_activeAttribute];
        if ( cvm ==DrawerInterface::cvmFRACTION){
            NumericRange numrange = attr.stretchRange();
            if ( !numrange.isValid()){
                numrange = attr.actualRange();
            }
            value = numrange.min() + numrange.distance() * value;

        }
        QColor clr = attr.value2color(value);
        return clr;
    }
    return QColor();
}
Ejemplo n.º 4
0
bool NumericRange::operator<=(const NumericRange &vr)
{
    return max() <= vr.max() && min() <= vr.min() && max() <= vr.min();
}
Ejemplo n.º 5
0
bool NumericRange::operator>(const NumericRange &vr)
{
    return max() > vr.max() && min() > vr.min() && min() > vr.max();
}
Ejemplo n.º 6
0
bool NumericRange::operator==(const NumericRange& vr) {
    return vr.max() == max() && vr.min() == min() && vr.resolution() == resolution();
}