/** * Constructs the widget. Sets all information from the given parameters. * Calculates the textcolor and sets the stylesheet. * * @brief EntryWidget::EntryWidget * @param parent * @param date * @param name * @param pattern * @param lang */ EntryWidget::EntryWidget(QWidget *parent, QString date, QString name, QString pattern, QString lang) : QWidget(parent), ui(new Ui::EntryWidget) { EntryEntity entryEntity; this->entity = entryEntity; this->entity.setEntryDate(date); this->entity.setEntryName(name); this->entity.setPattern(pattern); this->entity.setLanguage(lang); ui->setupUi(this); setupColor(); QString textStyle = QString("color: "); QColor textColor = MainWindow::calculateTextColor(this->langColor); textStyle.append(textColor.name()); ui->lblHeader->setText(date); ui->lblLang->setText(lang); ui->lblName->setText(name); ui->lblPattern->setText(pattern); this->setStyleSheet(textStyle); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Set up the dialog box to reflect the appropriate processing function //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //! \brief set up the dialog box to reflect the appropriate processing function //! \param[in] f enum that indicates which operation to perform //! \param[in] img target image void IPDialog::setup(IP_Function f, QImage img) { m_retProcImg = img; // original unscaled copy; used when user is satisfied m_origImg = img.scaled(128, 128, Qt::KeepAspectRatio); // for display purpose; show original m_resultImg = img.scaled(128, 128, Qt::KeepAspectRatio); // for display purpose; show result m_currentFuct = f; // current processing function clearOptLay (); // clear IP options layout m_dispResult ->setChecked(true); switch(m_currentFuct) { case COLOR: m_boxOpt->setTitle(tr("Color")); setupColor(); // set up layout m_ip ->processImg(IP::Red, m_resultImg); // default is red break; case THRESHOLD: m_boxOpt->setTitle(tr("Threshold")); setupThres(); m_ip ->lookUpTable(128); // default threshold level is 128 m_ip ->processImg(IP::IndThres, m_resultImg); // default is threshold individual band break; case EDGE: m_boxOpt->setTitle(tr("Edge detection")); setupEdge(); m_ip ->prewittMask(m_resultImg, m_origImg, 128); // default is prewitt mask with threshold level = 128 break; default: break; } m_ipDisplay ->storeImage(tr("Result"), m_resultImg); // display the result }
void XtionGrabber::onInit() { ros::NodeHandle& nh = getMTPrivateNodeHandle(); std::string depthDevice; std::string colorDevice; if(!nh.getParam("depth_device", depthDevice) || !nh.getParam("color_device", colorDevice)) { ROS_FATAL("depth_device and color_device parameters are mandatory!"); throw std::runtime_error("depth_device and color_device parameters are mandatory!"); } nh.param("depth_width", m_depthWidth, 640); nh.param("depth_height", m_depthHeight, 480); nh.param("color_width", m_colorWidth, 1280); nh.param("color_height", m_colorHeight, 1024); m_deviceName = getPrivateNodeHandle().getNamespace(); if(!setupColor(colorDevice)) throw std::runtime_error("Could not setup color channel"); if(!setupDepth(depthDevice)) throw std::runtime_error("Could not setup depth channel"); m_colorFocalLength = 525.0f * m_colorWidth / 640; // The depth sensor actually has a different focal length, but since // we are using hw registration, the rgb focal length applies. m_depthFocalLength = 525.0f * m_depthWidth / 640; m_cloudGenerator.init(m_depthWidth, m_depthHeight, m_depthFocalLength); m_filledCloudGenerator.init(1280, 960, 525.0f * 1280 / 640); setupRGBInfo(); setupDepthInfo(); m_pub_cloud = nh.advertise<sensor_msgs::PointCloud2>("cloud", 1); m_pub_filledCloud = nh.advertise<sensor_msgs::PointCloud2>("cloud_filled", 1); NODELET_INFO("Starting streaming..."); m_thread = boost::thread(boost::bind(&XtionGrabber::read_thread, this)); }
/** * Constructs the widget. Sets all information from the given EntryEntity and calculates the textcolor. * * @brief EntryWidget::EntryWidget * @param entity * @param parent */ EntryWidget::EntryWidget(EntryEntity entity, QWidget *parent) : QWidget(parent), ui(new Ui::EntryWidget) { this->entity = entity; setupColor(); QString textStyle = QString("color: "); QColor textColor = MainWindow::calculateTextColor(this->langColor); textStyle.append(textColor.name()).append(";"); ui->setupUi(this); ui->lblHeader->setText(entity.getEntryDate()); ui->lblLang->setText(entity.getLanguage()); ui->lblName->setText(entity.getEntryName()); ui->lblPattern->setText(entity.getPattern()); this->setStyleSheet(textStyle); }
// ---------------------------------------------------------------------------------------- SColorPicker::SColorPicker(eColor color, QWidget *parent, const char *name):QWidget(parent) , mpLayout(NULL) , mpIndicator(NULL) , mpColorValue(NULL) , mSettingValue(false) { setObjectName(name); mpLayout = new QHBoxLayout(); mpLayout->setContentsMargins(0, 0, 0, 0); setLayout(mpLayout); mpIndicator = new QLabel(this); mpIndicator->setObjectName(ON_SETTINGS_LABEL); mpLayout->addWidget(mpIndicator, 0); mpColorValue = new SSlider(Qt::Horizontal, this); mpColorValue->setMinimum(0); mpColorValue->setMaximum(255); mpLayout->addWidget(mpColorValue, 1); setupColor(color); connect(mpColorValue, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int))); }
CVoid DebugRenderer::renderData(const NxDebugRenderable& data) const { glUseProgram(0); glPushAttrib( GL_ENABLE_BIT | GL_CURRENT_BIT ); glDisable(GL_LIGHTING); glDisable( GL_TEXTURE_2D ); glEnable( GL_CULL_FACE ); glLineWidth(1.0f); glMatrixMode(GL_MODELVIEW); // Render points NxU32 NbPoints = data.getNbPoints(); if(NbPoints) { const NxDebugPoint* Points = data.getPoints(); glBegin(GL_POINTS); while(NbPoints--) { setupColor(Points->color); glVertex3fv(&Points->p.x); Points++; } glEnd(); } // Render lines NxU32 NbLines = data.getNbLines(); if(NbLines) { const NxDebugLine* Lines = data.getLines(); glBegin(GL_LINES); while(NbLines--) { setupColor(Lines->color); glVertex3fv(&Lines->p0.x); glVertex3fv(&Lines->p1.x); Lines++; } glEnd(); } // Render triangles NxU32 NbTris = data.getNbTriangles(); if(NbTris) { const NxDebugTriangle* Triangles = data.getTriangles(); glBegin(GL_TRIANGLES); while(NbTris--) { setupColor(Triangles->color); glVertex3fv(&Triangles->p0.x); glVertex3fv(&Triangles->p1.x); glVertex3fv(&Triangles->p2.x); Triangles++; } glEnd(); } glPopAttrib(); }