#include "gtl_gui_apfc_series.h" namespace gtl { namespace gui { apfc_series::apfc_series(bool is_updating, bool is_amplitude, gtl::math::apfc* apfc, gtl::analog_data* ai, ::chart::axis_horz* axis_x, ::chart::axis_vert* axis_y) : chart_series(ai, axis_x, axis_y) , _apfc(apfc) , _is_ampl(is_amplitude) { _is_updating = is_updating; connect(_apfc, >l::math::apfc::changed, this, &apfc_series::update); connect(_apfc, >l::math::apfc::initialized, this, &apfc_series::update); } apfc_series::~apfc_series() { } void apfc_series::set_apfc(math::apfc *apfc) { disconnect(_apfc, >l::math::apfc::changed, this, &apfc_series::update); disconnect(_apfc, >l::math::apfc::initialized, this, &apfc_series::update); _apfc = apfc; connect(_apfc, >l::math::apfc::changed, this, &apfc_series::update); connect(_apfc, >l::math::apfc::initialized, this, &apfc_series::update); } QString apfc_series::name() const { return _name; } void apfc_series::set_name(const QString &newName) { _name = newName; } void apfc_series::update() { clear(); if(_apfc) { axis_x()->set_boundaries(0, _apfc->frequency()); qreal res = _apfc->resolution(); for(int i = 0; i < _apfc->size(); i++) { if(_is_ampl) add(QPointF(i*res, _apfc->at(i).first)); else add(QPointF(i*res, _apfc->at(i).second)); } emit data_changed(); } } } // namespace gui } // namespace gtl