Skip to content
Snippets Groups Projects
Commit 745ae09f authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

test device tango test

parent 54001894
No related branches found
No related tags found
No related merge requests found
......@@ -36,15 +36,17 @@ Gof2master::Gof2master(CumbiaPool *cumbia_pool, QWidget *parent) :
QVBoxLayout *mainlo = new QVBoxLayout(this);
QGraphicsView *gv = new QGraphicsView(this);
QGraphicsScene *sce = new QGraphicsScene(this);
sce->setSceneRect(0, 0, 600, 600);
gv->setScene(sce);
mainlo->addWidget(gv);
// gv->installEventFilter(new MouseWheelViewScaler(this));
const int distrib_r = 60;
int period = 100, i; // p.value("i").toInt();
int period = 100, i = 0; // p.value("i").toInt();
// const QStringList &srcs {"hor_orbit_err", "ver_orbit_err", "hor_corr_set", "ver_corr_set" };
const QStringList &srcs {"double_spectrum_ro", "long_spectrum_ro", "short_spectrum_ro" };
QVector<QColor> cc {"yellow", "blue", "green", "violet", "orange", "pink"};
const QStringList &srcs {"double_spectrum_ro", "long_spectrum_ro" };
// const QStringList &srcs {"wave" };
QVector<QColor> cc {"yellow", "white", "green", "violet", "orange", "pink"};
const double wi = sce->width(), he = sce->height();
foreach(const QString& s, srcs) {
QuWatcher *w = new QuWatcher(this, cu_pool, m_ctrl_factory_pool);
......@@ -58,7 +60,7 @@ Gof2master::Gof2master(CumbiaPool *cumbia_pool, QWidget *parent) :
float yp = he/2.0 * (i / 2);
i++;
QuCircularPlotI *ni = new QuCircularPlotI(nullptr, QSize(300, 300));
QuCircularPlotI *ni = new QuCircularPlotI(nullptr, QSize(wi/2.1, he/2.1));
QuCircularPlotEngine *pie = ni->engine();
qucircularplot_attributes &a = pie->a;
......@@ -72,7 +74,8 @@ Gof2master::Gof2master(CumbiaPool *cumbia_pool, QWidget *parent) :
sce->addItem(ni);
ni->setPos(xp, yp);
QuCircularPlotCurve *crv = pie->addCurve(w->source());
printf("\e[1;32m created curve %s\e[0m\n", qstoc(crv->source()));
printf("\e[1;32m created curve %s\e[0m scene %fx%f i %d x pos %f y pos %f item w %f h %f\n",
qstoc(crv->source()), wi, he, i, xp, yp, ni->boundingRect().width(), ni->boundingRect().height());
QPen pe = crv->pen();
pe.setColor(cc.at(i % cc.size()));
// set all but one of the two plots' background to black
......@@ -109,12 +112,24 @@ Gof2master::~Gof2master()
delete ui;
}
void Gof2master::onNewData(const CuData &da)
{
pretty_pri("\e[1;33m%s\e[0m", datos(da));
void Gof2master::onNewData(const CuData &da) {
bool err = da.B(CuDType::Err); // da.B("err")
QuString src = da.s(CuDType::Src); // da.s("src")
QString s = src.section('/', -1);
if(da.s(CuDType::Type) == "property") {
double m, M;
m = da.D(CuDType::Min);
M = da.D(CuDType::Max);
pretty_pri("m: %f M: %f", m, M);
if(M > m) {
pretty_pri("setting min/max: m: %f M: %f", m, M);
m_get_plot(s)->engine()->setYLowerBound(m);
m_get_plot(s)->engine()->setYUpperBound(M);
qucircularplot_attributes &a = m_get_plot(s)->engine()->a;
a.axes.x.baseline = (M - m) / 2.0;
}
}
// pretty_pri("\e[1;33m%s\e[0m", datos(da));
std::vector<double> v;
QVector<double> y;
if(da.containsKey(CuDType::Value)) { // da.containsKey("value")
......@@ -132,6 +147,9 @@ void Gof2master::onNewData(const CuData &da)
}
if(err)
perr("read error: %s -> %s", da.s(CuDType::Src).c_str(), da.s(CuDType::Message).c_str()); // da.s("src"), da.s("msg")
pretty_pri("data %s: %s [%f - %f]", qstoc(src), da.s(CuDType::Value).c_str(),
m_get_plot(s)->engine()->yLowerBound(), m_get_plot(s)->engine()->yUpperBound());
}
void Gof2master::zoomMoved(double dx, double dy) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment