##// END OF EJS Templates
Force range for each transformation among synchronized graphs, ignore missing X unit in data files since it's always time...
jeandet -
r1384:e344de146add
parent child
Show More
@@ -130,6 +130,7 signals:
130 130 void move_sig(double factor, Qt::Orientation orientation, bool forward=true);
131 131 void move_sig(double dx, double dy, bool forward=true);
132 132 void transform_sig(const DateTimeRangeTransformation& tranformation, bool forward=true);
133 void setrange_sig(const DateTimeRange& range, bool updateVar=false, bool forward=true);
133 134
134 135 protected:
135 136 void closeEvent(QCloseEvent *event) override;
@@ -550,13 +550,10 DateTimeRange VisualizationGraphWidget::graphRange() const noexcept
550 550
551 551 void VisualizationGraphWidget::setGraphRange(const DateTimeRange &range, bool updateVar, bool forward)
552 552 {
553 auto oldRange = graphRange();
554 553 impl->setRange(range, updateVar);
555 554 if(forward)
556 555 {
557 auto newRange = graphRange();
558 if(auto tf = DateTimeRangeHelper::computeTransformation(oldRange,newRange))
559 emit this->transform_sig(tf.value(), false);
556 emit this->setrange_sig(this->graphRange(), true, false);
560 557 }
561 558
562 559 }
@@ -632,28 +629,28 void VisualizationGraphWidget::zoom(double factor, int center, Qt::Orientation o
632 629 {
633 630 impl->zoom(factor, center, orientation);
634 631 if(forward && orientation==Qt::Horizontal)
635 emit this->zoom_sig(factor, center, orientation, false);
632 emit this->setrange_sig(this->graphRange(), true, false);
636 633 }
637 634
638 635 void VisualizationGraphWidget::move(double factor, Qt::Orientation orientation, bool forward)
639 636 {
640 637 impl->move(factor, orientation);
641 638 if(forward)
642 emit this->move_sig(factor, orientation, false);
639 emit this->setrange_sig(this->graphRange(), true, false);
643 640 }
644 641
645 642 void VisualizationGraphWidget::move(double dx, double dy, bool forward)
646 643 {
647 644 impl->move(dx, dy);
648 645 if(forward)
649 emit this->move_sig(dx, dy, false);
646 emit this->setrange_sig(this->graphRange(), true, false);
650 647 }
651 648
652 649 void VisualizationGraphWidget::transform(const DateTimeRangeTransformation &tranformation, bool forward)
653 650 {
654 651 impl->transform(tranformation);
655 652 if(forward)
656 emit this->transform_sig(tranformation, false);
653 emit this->setrange_sig(this->graphRange(), true, false);
657 654 }
658 655
659 656 void VisualizationGraphWidget::accept(IVisualizationWidgetVisitor *visitor)
@@ -890,7 +887,7 void VisualizationGraphWidget::mouseMoveEvent(QMouseEvent *event)
890 887 if(sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::None)
891 888 {
892 889 auto [dx,dy] = impl->moveGraph(event->pos());
893 emit this->move_sig(dx,0., false); // don't sync Y transformations
890 emit this->setrange_sig(this->graphRange(), true, false);
894 891 }
895 892 else if(sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::SelectionZones)
896 893 {
@@ -183,21 +183,23 void VisualizationZoneWidget::insertGraph(int index, VisualizationGraphWidget *g
183 183 for(int i=0;i<layout->count();i++)
184 184 {
185 185 auto graph = qobject_cast<VisualizationGraphWidget *>(layout->itemAt(i)->widget());
186 connect(graphWidget, &VisualizationGraphWidget::zoom_sig, graph, &VisualizationGraphWidget::zoom);
187 connect(graphWidget, &VisualizationGraphWidget::transform_sig, graph, &VisualizationGraphWidget::transform);
188
189 connect(graphWidget, qOverload<double,Qt::Orientation,bool>(&VisualizationGraphWidget::move_sig),
190 graph, qOverload<double,Qt::Orientation,bool>(&VisualizationGraphWidget::move));
191 connect(graphWidget, qOverload<double,double,bool>(&VisualizationGraphWidget::move_sig),
192 graph, qOverload<double,double,bool>(&VisualizationGraphWidget::move));
193
194 connect(graph, &VisualizationGraphWidget::zoom_sig, graphWidget, &VisualizationGraphWidget::zoom);
195 connect(graph, &VisualizationGraphWidget::transform_sig, graphWidget, &VisualizationGraphWidget::transform);
196
197 connect(graph, qOverload<double,Qt::Orientation,bool>(&VisualizationGraphWidget::move_sig),
198 graphWidget, qOverload<double,Qt::Orientation,bool>(&VisualizationGraphWidget::move));
199 connect(graph, qOverload<double,double,bool>(&VisualizationGraphWidget::move_sig),
200 graphWidget, qOverload<double,double,bool>(&VisualizationGraphWidget::move));
186 connect(graphWidget, &VisualizationGraphWidget::setrange_sig, graph, &VisualizationGraphWidget::setGraphRange);
187 connect(graph, &VisualizationGraphWidget::setrange_sig, graphWidget, &VisualizationGraphWidget::setGraphRange);
188 // connect(graphWidget, &VisualizationGraphWidget::zoom_sig, graph, &VisualizationGraphWidget::zoom);
189 // connect(graphWidget, &VisualizationGraphWidget::transform_sig, graph, &VisualizationGraphWidget::transform);
190
191 // connect(graphWidget, qOverload<double,Qt::Orientation,bool>(&VisualizationGraphWidget::move_sig),
192 // graph, qOverload<double,Qt::Orientation,bool>(&VisualizationGraphWidget::move));
193 // connect(graphWidget, qOverload<double,double,bool>(&VisualizationGraphWidget::move_sig),
194 // graph, qOverload<double,double,bool>(&VisualizationGraphWidget::move));
195
196 // connect(graph, &VisualizationGraphWidget::zoom_sig, graphWidget, &VisualizationGraphWidget::zoom);
197 // connect(graph, &VisualizationGraphWidget::transform_sig, graphWidget, &VisualizationGraphWidget::transform);
198
199 // connect(graph, qOverload<double,Qt::Orientation,bool>(&VisualizationGraphWidget::move_sig),
200 // graphWidget, qOverload<double,Qt::Orientation,bool>(&VisualizationGraphWidget::move));
201 // connect(graph, qOverload<double,double,bool>(&VisualizationGraphWidget::move_sig),
202 // graphWidget, qOverload<double,double,bool>(&VisualizationGraphWidget::move));
201 203 }
202 204 if(auto graph = firstGraph())
203 205 {
@@ -245,8 +245,11 bool tryReadUnit(Properties &properties, const QString &key, const QString &line
245 245
246 246 bool ScalarParserHelper::checkProperties()
247 247 {
248 return checkUnit(m_Properties, X_AXIS_UNIT_PROPERTY,
249 QObject::tr("The x-axis unit could not be found in the file"));
248 if(auto hasXUnit = checkUnit(m_Properties, X_AXIS_UNIT_PROPERTY, QObject::tr("The x-axis unit could not be found in the file"));!hasXUnit)
249 {
250 m_Properties[X_AXIS_UNIT_PROPERTY] = QVariant::fromValue(Unit{"s",true});
251 }
252 return true;
250 253 }
251 254
252 255 IDataSeries* ScalarParserHelper::createSeries()
@@ -402,8 +405,11 void SpectrogramParserHelper::handleDataHoles()
402 405
403 406 bool VectorParserHelper::checkProperties()
404 407 {
405 return checkUnit(m_Properties, X_AXIS_UNIT_PROPERTY,
406 QObject::tr("The x-axis unit could not be found in the file"));
408 if(auto hasXUnit = checkUnit(m_Properties, X_AXIS_UNIT_PROPERTY, QObject::tr("The x-axis unit could not be found in the file"));!hasXUnit)
409 {
410 m_Properties[X_AXIS_UNIT_PROPERTY] = QVariant::fromValue(Unit{"s",true});
411 }
412 return true;
407 413 }
408 414
409 415 IDataSeries* VectorParserHelper::createSeries()
General Comments 0
You need to be logged in to leave comments. Login now