void TransFunc1DKeysEditor::updateFromProperty() {
    tgtAssert(property_, "No property");

    // check whether new transfer function object has been assigned
    if (property_->get() != transferFuncIntensity_) {
        transferFuncIntensity_ = dynamic_cast<TransFunc1DKeys*>(property_->get());
        // propagate transfer function to mapping canvas and texture painter
        texturePainter_->setTransFunc(transferFuncIntensity_);
        transCanvas_->setTransFunc(transferFuncIntensity_);

        updateDataBounds();
        updateMappingSpin(true);
        updateThresholdFromProperty();

        if (property_->get() && !transferFuncIntensity_) {
            if (isEnabled()) {
                LWARNING("Current transfer function not supported by this editor. Disabling.");
                setEnabled(false);
            }
        }
    }

    // check whether the volume associated with the TransFuncProperty has changed
    const VolumeBase* newHandle = property_->getVolumeHandle();
    if (newHandle != volume_) {
        volume_ = newHandle;
        volumeChanged();
    }

    alwaysFit_->blockSignals(true);
    if(property_->getAlwaysFitToDomain())
        alwaysFit_->setCheckState(Qt::Checked);
    else
        alwaysFit_->setCheckState(Qt::Unchecked);
    alwaysFit_->blockSignals(false);

    if (transferFuncIntensity_) {
        setEnabled(true);

        // update treshold widgets from tf
        updateDataBounds();
        updateMappingSpin(true);
        updateThresholdFromProperty();

        // repaint control elements
        repaintAll();
    }
    else {
        setEnabled(false);
    }
}
Beispiel #2
0
void QSLPlotCartesianSet::setData(const QVector<double> &xArr,
                                  const QVector<double> &yArr)
{
    mX.setView(xArr);
    mY.setView(yArr);
    updateDataBounds();
    emit dataChanged();
}
Beispiel #3
0
void QSLPlotCartesianSet::copyData(const QSLArray1D<double> &xArr,
                                   const QSLArray1D<double> &yArr)
{
    mX.setCopy(xArr);
    mY.setCopy(yArr);
    updateDataBounds();
    emit dataChanged();
}
void TransFunc1DKeysEditor::volumeChanged() {
    if (volume_ /*&& volume_->hasRepresentation<VolumeRAM>()*/) {

        updateDataBounds();

        /*if(unit == "")
            dataLabel_->setText("Data Bounds");
        else
            dataLabel_->setText(QString("Data Bounds [") + QString::fromStdString(unit) + "]");*/

        RealWorldMapping rwm = volume_->getRealWorldMapping();
        if(property_->getAlwaysFitToDomain() || (((rwm.getOffset() != 0.0f) || (rwm.getScale() != 1.0f) ||
          (rwm.getUnit() != "")) && *transferFuncIntensity_ == TransFunc1DKeys())) {
            fitDomainToData();
        }
        // propagate new volume to transfuncMappingCanvas
        transCanvas_->volumeChanged(volume_);
    }
    else {
        transCanvas_->volumeChanged(0);
    }

    checkDomainVersusData();
}