void ChannelViewer::initUi(Ui::MainWindow *ui) { if (_ui == NULL) { _ui = ui; connect(ui->tangentInType, SIGNAL(currentIndexChanged(QString)), SLOT(onTangentTypeChanged(QString))); connect(ui->tangentInValue, SIGNAL(valueChanged(double)), SLOT(onTangentValueChanged(double))); connect(ui->tangentOutType, SIGNAL(currentIndexChanged(QString)), SLOT(onTangentTypeChanged(QString))); connect(ui->tangentOutValue, SIGNAL(valueChanged(double)), SLOT(onTangentValueChanged(double))); connect(ui->extrapolationInType, SIGNAL(currentIndexChanged(QString)), SLOT(onChannelChanged(QString))); connect(ui->extrapolationOutType, SIGNAL(currentIndexChanged(QString)), SLOT(onChannelChanged(QString))); connect(ui->keyTime, SIGNAL(valueChanged(double)), SLOT(onKeyChanged(double))); connect(ui->keyValue, SIGNAL(valueChanged(double)), SLOT(onKeyChanged(double))); }
/****************************************************************************** * Add new channels * * @param pNbChannels the number of new channels ******************************************************************************/ void Qtfe::addChannels( int pNbChannels ) { // Iterate through number of channels for ( int i = 0; i < pNbChannels; ++i ) { // Create a channel and store it QtfeChannel* channel = new QtfeChannel( this ); _channels.push_back( channel ); // Add it to main widget _transferFunctionGroupBox->layout()->addWidget( channel ); // Do connection(s) QObject::connect( channel, SIGNAL( channelChanged() ), this, SLOT( onChannelChanged() ) ); } }
void ccColorLevelsDlg::onApply() { //save parameters s_inputLevels[0] = minInputSpinBox->value(); s_inputLevels[1] = maxInputSpinBox->value(); s_outputLevels[0] = minOutputSpinBox->value(); s_outputLevels[1] = maxOutputSpinBox->value(); s_outputLevelsEnabled = outputLevelsCheckBox->isChecked(); if ( m_cloud && ( minInputSpinBox->value() != 0 || maxInputSpinBox->value() != 255 || minOutputSpinBox->value() != 0 || maxOutputSpinBox->value() != 255 ) ) { bool applyRGB[3] = {channelComboBox->currentIndex() == RGB || channelComboBox->currentIndex() == RED, channelComboBox->currentIndex() == RGB || channelComboBox->currentIndex() == GREEN, channelComboBox->currentIndex() == RGB || channelComboBox->currentIndex() == BLUE }; //update display ccPointCloud* pc = ccHObjectCaster::ToPointCloud(m_cloud); unsigned pointCount = m_cloud->size(); int qIn = s_inputLevels[1] - s_inputLevels[0]; int pOut = s_outputLevels[1] - s_outputLevels[0]; for (unsigned i=0; i<pointCount; ++i) { const ColorCompType* rgb = m_cloud->getPointColor(i); ColorCompType newRgb[3]; for (unsigned c=0; c<3; ++c) { if (applyRGB[c]) { double newC = s_outputLevels[0]; if (qIn) { double u = (static_cast<double>(rgb[c]) - s_inputLevels[0]) / qIn; newC = s_outputLevels[0] + u * pOut; } newRgb[c] = static_cast<ColorCompType>(std::max<double>(std::min<double>(newC,ccColor::MAX),0.0)); } else { newRgb[c] = rgb[c]; } } //set the new color if (pc) { pc->setPointColor(i,newRgb); } else { //DGM FIXME: dirty! memcpy(const_cast<ColorCompType*>(rgb),newRgb,sizeof(ColorCompType)*3); } } //update display m_cloud->getDisplay()->redraw(); //update histogram onChannelChanged(channelComboBox->currentIndex()); } //after applying the filter we reset the boundaries to (0,255) //in case the user clicks multiple times on the "Apply" button! minInputSpinBox->setValue(0); maxInputSpinBox->setValue(255); minOutputSpinBox->setValue(0); maxOutputSpinBox->setValue(255); }