Skip to content
Snippets Groups Projects
Select Git revision
  • bb815a3781ceba8b672a17a0829719f9d809e626
  • master default protected
  • antenna-patterns
  • qt5-qopenglwidget
  • license-demo
  • isolated
  • isolated-fixedprofile
  • release_1.1
  • press-conference
  • rim-only
  • release_1.0
11 results

pulsescopewidget.cpp

Blame
  • pulsescopewidget.cpp 4.20 KiB
    /******************************************************************************
     *   Copyright (C) 2009 by Oliver Bock                                        *
     *   oliver.bock[AT]aei.mpg.de                                                *
     *                                                                            *
     *   This file is part of PulsatingScience.                                   *
     *                                                                            *
     *   PulsatingScience is free software: you can redistribute it and/or modify *
     *   it under the terms of the GNU General Public License as published        *
     *   by the Free Software Foundation, version 3 of the License.               *
     *                                                                            *
     *   PulsatingScience is distributed in the hope that it will be useful,      *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of           *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
     *   GNU General Public License for more details.                             *
     *                                                                            *
     *   You should have received a copy of the GNU General Public License        *
     *   along with PulsatingScience. If not, see <http://www.gnu.org/licenses/>. *
     *                                                                            *
     ******************************************************************************/
    
    #include "pulsescopewidget.h"
    
    PulseScopeWidget::PulseScopeWidget(QWidget *parent) : QGraphicsView(parent),
        m_scene()
    {
        setViewport(new QGLWidget(QGLFormat(QGL::AlphaChannel | QGL::SampleBuffers)));
        QGLWidget *glScope = (QGLWidget*) viewport();
    
        QString msgThis = tr("pulse profile");
        if(!glScope->format().directRendering()) {
            QString msg = tr("Sorry, no direct rendering support for %1...");
            qWarning() << msg.arg(msgThis);
        }
        if(!glScope->format().doubleBuffer()) {
            QString msg = tr("Sorry, no double buffering support for %1...");
            qWarning() << msg.arg(msgThis);
        }
        if(!glScope->format().rgba()) {
            QString msg = tr("Sorry, no RGBA support for %1...");
            qWarning() << msg.arg(msgThis);
        }
        if(!glScope->format().alpha()) {
            QString msg = tr("Sorry, no alpha channel support for %1...");
            qWarning() << msg.arg(msgThis);
        }
        if(!glScope->format().sampleBuffers()) {
            QString msg = tr("Sorry, no multisampling support for %1...");
            qWarning() << msg.arg(msgThis);
        }
    
        m_scopeSizeH = 360.0 * PERIODS;
        m_scopeSizeV = 10.0;
    
        m_pathLHO = NULL;
        m_pathLLO = NULL;
        m_pathVirgo = NULL;
    
        m_xAxis = m_scene.addLine(0.0, m_scopeSizeV/2.0, m_scopeSizeH, m_scopeSizeV/2.0, QPen(QColor("white")));
        m_xAxis->setZValue(1);
        m_yAxis = m_scene.addLine(0.0, 0.0, 0.0, m_scopeSizeV);
        m_yAxis->setZValue(1);
    
        setScene(&m_scene);
    }
    
    PulseScopeWidget::~PulseScopeWidget()
    {
        m_scene.clear();
    }