Exemple #1
0
void LinearGauge::loadSettings( QSettings& pSettings )
{
	// Scale
	Qt::Orientation orientation = (Qt::Orientation) pSettings.value("orientation", Qt::Vertical).toInt();
	QwtThermo::ScalePos scalePosition = (QwtThermo::ScalePos) pSettings.value("scalePosition", QwtThermo::LeftScale).toInt();
	setOrientation( orientation, scalePosition );
	setMinValue( pSettings.value("minValue", 0).toDouble() );
	setMaxValue( pSettings.value("maxValue", 10).toDouble() );

	// Ticks
	setScaleMaxMinor( pSettings.value("scaleMaxMinor", 4).toInt() );
	setScaleMaxMajor( pSettings.value("scaleMaxMajor", 12).toInt() );
	scaleDraw()->enableComponent( QwtAbstractScaleDraw::Labels, pSettings.value("labels", true).toBool() );
	setFont( QFont(	pSettings.value("font").toString(), pSettings.value("fontSize", 8).toDouble()) );

	// Pipe
	setValue( pSettings.value("value", 8).toDouble() );
	setPipeWidth( pSettings.value("pipeWidth", 10).toInt() );
	setFillBrush( QBrush( pSettings.value("pipeColor").toUInt() ) );

	// Alarm
	setAlarmLevel( pSettings.value("alarmLevel", 7).toDouble() );
	setAlarmBrush( QBrush( pSettings.value("alarmBrush").toUInt() ) );
	setAlarmEnabled( pSettings.value("alarmEnabled").toBool() );	

	// Color
	setTextColor( pSettings.value("textColor").toUInt() );
	setBackgroundColor( pSettings.value("backgroundColor").toUInt() );

	AbstractGauge::loadSettings( pSettings );
}
Exemple #2
0
/*!
  \brief Constructor
  \param parent Parent widget

  Create a compass widget with a scale, no needle and no rose.
  The default origin is 270.0 with no valid value. It accepts
  mouse and keyboard inputs and has no step size. The default mode
  is QwtDial::RotateNeedle.
*/
QwtCompass::QwtCompass( QWidget* parent ):
    QwtDial( parent )
{
    d_data = new PrivateData;

    setScaleDraw( new QwtCompassScaleDraw() );

    setOrigin( 270.0 );
    setWrapping( true );

    setScaleMaxMajor( 36 );
    setScaleMaxMinor( 10 );

    setScale( 0.0, 360.0 ); // degrees as default
    setTotalSteps( 360 );
}
Exemple #3
0
Plot::Plot(QWidget *parent)
    : QwtPolarPlot(parent)
    , m_azimuthChange(new QTimer(this))
    , m_currTime(new QTime)
    , m_nextAzimuthData(new QTimer(this))
    , m_isStarted(false)
    , m_showIDs(true)
    , m_tracksStorage(new MarksTracksStorage(this))
      /*, m_picker(new QwtPolarPicker(QwtPicker::CrossRubberBand,
                                    QwtPicker::ActiveOnly,
                                    this->canvas()))*/
    , m_isIDMoving(false)
    , m_currMovingCurveID(0)
    , m_wrongMarksSound(new QSound(":/Resources/WrongMarksReceived.wav", this))
    , m_rightMarksSound(new QSound(":/Resources/RadarShort.wav", this))
    , m_offSounds(false)
    , m_markIndex(0)
    , m_upToIndex(0)
    , m_isIndexMarkFirstAppearance(true)
    , m_pauseAzimuth(0.0)
    , m_isPaused(false)
{
    m_tracksStorage->setStorageSize(40);

    /*m_picker->setStateMachine(new QwtPickerDragPointMachine);
    m_picker->setMousePattern(QwtPicker::MouseSelect1, Qt::LeftButton);
    m_picker->setRubberBandPen(QColor("#00FF00"));
    m_picker->setTrackerPen(QColor(Qt::white));
    m_picker->setTrackerFont(QFont("Verdana", 10));*/

    setAutoReplot( false );
    setPlotBackground( QColor("#0B0B3B") );
    canvas()->setStyleSheet("background: #0B0B3B");
    // Maked plot squared
    this->zoom(QwtPointPolar(0, 0), ZOOMDEFAULTFACTOR);

    // setting start point at 12 o'clock
    setAzimuthOrigin(M_PI/2);

    // scales
    setScale(QwtPolar::Azimuth, 360, 0, 30);
    setScaleMaxMinor(QwtPolar::Azimuth, 30);
    setScaleMaxMajor(QwtPolar::Azimuth, 30);

    setScale(QwtPolar::Radius, 0.0, 400.0 / ZOOMDEFAULTFACTOR, 50.0);
    setScaleMaxMinor(QwtPolar::Radius, qCeil(400.0 / (50.0 * ZOOMDEFAULTFACTOR)));
    setScaleMaxMajor(QwtPolar::Radius, qCeil(400.0 / (50.0 * ZOOMDEFAULTFACTOR)));

    // grids
    m_grid = new QwtPolarGrid();
    m_grid->setPen(QPen(Qt::gray));
    for(int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++)
    {
        m_grid->showGrid(scaleId);
    }
    m_grid->setAxisPen(QwtPolar::AxisAzimuth, QPen(Qt::gray));
    m_grid->setAzimuthScaleDraw(new AzimuthScaleDraw());
    m_grid->showAxis(QwtPolar::AxisAzimuth, true);
    m_grid->showAxis(QwtPolar::AxisLeft, false);
    m_grid->showAxis(QwtPolar::AxisRight, true);
    m_grid->showAxis(QwtPolar::AxisTop, false);
    m_grid->showAxis(QwtPolar::AxisBottom, false);
    m_grid->showGrid(QwtPolar::Azimuth, true);
    m_grid->showGrid(QwtPolar::Radius, true);
    m_grid->attach(this);

    setMinimumSize(defaultPlotSize);

    m_currAzimuth = 0;
    QVector<double> azimuth;
    QVector<double> radius;
    azimuth.fill(m_currAzimuth, 2);
    radius.append(0);
    radius.append(maxBeamRadius);
    m_beamCurve = new QwtPolarCurve;
    m_beamCurve->setPen(QPen(QBrush(Qt::green), beamPenWidth));
    m_beamData = new Data(azimuth, radius, beamId);

    m_beamCurve->setData(m_beamData);
    m_beamCurve->attach(this);

    // Blind Zone Curve
    radius.clear();
    azimuth.clear();
    radius.fill(5, 33);
    for(double i = 0; i <= 360; i += 11.25) {
        azimuth.append(i);
    }
    QwtPolarCurve *blindZoneCurve = new QwtPolarCurveJamming;
    blindZoneCurve->setPen(QPen(QBrush(Qt::yellow), 0));
    Data *blindZoneData = new Data(azimuth, radius, 0x10000);
    blindZoneCurve->setData(blindZoneData);
    blindZoneCurve->attach(this);

    m_cycleTime = Cicle10;
    m_azimuthChange->setInterval(cicleInterval);

    m_nextAzimuthData->setInterval(packetsInterval);

    connect(m_azimuthChange, SIGNAL(timeout()), this, SLOT(azimuthChanged()));
    connect(m_nextAzimuthData, SIGNAL(timeout()), this, SLOT(nextAzimuthData()));
//    connect(m_picker, SIGNAL(moved(QwtPointPolar)), this, SLOT(moveMarkID(QwtPointPolar)));
//    connect(m_picker, SIGNAL(appended(QwtPointPolar)), this, SLOT(selectMarkID(QwtPointPolar)));
//    connect(m_picker, SIGNAL(activated(bool)), this, SLOT(stopMoving(bool)));
}