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