From ce07f0d21e4a441cee715645756c013450621513 Mon Sep 17 00:00:00 2001 From: Bayram Yenikaya Date: Mon, 19 Feb 2024 10:30:35 -0800 Subject: [PATCH] added function playMovie() --- gui/appWindow.cpp | 1 + gui/polyView.cpp | 46 +++++++++++++++++++++++++++++++++++----------- gui/polyView.h | 5 +++-- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/gui/appWindow.cpp b/gui/appWindow.cpp index b869196..13f671b 100644 --- a/gui/appWindow.cpp +++ b/gui/appWindow.cpp @@ -273,6 +273,7 @@ void appWindow::createMenusAndMainWidget(){ view->addAction("Move down", this, SLOT(shiftDown()), Qt::Key_Down); view->addAction("Reset view", m_poly, SLOT(resetView()), Qt::Key_R); view->addAction("Change display order", m_poly, SLOT(changeOrder()), Qt::Key_O); + view->addAction("Movie mode", m_poly, SLOT([playMovie()), Qt::Key_M); view->addAction("Toggle annotations", m_poly, SLOT(toggleAnno()), Qt::Key_A); view->addAction("Toggle filled", m_poly, SLOT(toggleFilled()), Qt::Key_F); view->addAction("Toggle points display", diff --git a/gui/polyView.cpp b/gui/polyView.cpp index 595cee2..f8a36e4 100644 --- a/gui/polyView.cpp +++ b/gui/polyView.cpp @@ -97,6 +97,7 @@ polyView::polyView(QWidget *parent, chooseFilesDlg * chooseFiles, m_showLayerAnno = false; m_showFilledPolys = false; m_changeDisplayOrder = false; + m_movie_frame_id = -1; m_emptyRubberBand = QRect(-10, -10, 0, 0); // off-screen rubberband m_rubberBand = m_emptyRubberBand; @@ -477,7 +478,7 @@ bool polyView::hasSelectedPolygons() const{ } // Plot the current data. See worldToPixelCoords() for how to convert // from world to screen coordinates. -void polyView::displayData(QPainter *paint) { +void polyView::displayData(QPainter *paint, int pol_id) { //utils::Timer my_clock("polyView::displayData"); setupViewingWindow(); // Must happen before anything else @@ -525,6 +526,7 @@ void polyView::displayData(QPainter *paint) { // Plot the images and polygons for (int vi = 0; vi < (int)m_polyVec.size(); vi++) { + if (pol_id >= 0 && pol_id != vi) continue; int vecIter = m_polyVecOrder[vi]; // Skip the files the user does not want to see @@ -1678,19 +1680,19 @@ void polyView::refreshPixmap() { // directly. Later we'll display the pixmap without redrawing // whenever possible for reasons of speed. - m_pixmap = QPixmap(size()); - m_pixmap.fill(QColor(m_prefs.bgColor.c_str())); + m_pixmap = QPixmap(size()); + m_pixmap.fill(QColor(m_prefs.bgColor.c_str())); - QPainter paint(&m_pixmap); - paint.initFrom(this); + QPainter paint(&m_pixmap); + paint.initFrom(this); - QFont F; - F.setPointSize(m_prefs.fontSize); - //F.setStyleStrategy(QFont::NoAntialias); - paint.setFont(F); + QFont F; + F.setPointSize(m_prefs.fontSize); + //F.setStyleStrategy(QFont::NoAntialias); + paint.setFont(F); - displayData(&paint); - update(); + displayData(&paint); + update(); return; } @@ -2492,6 +2494,28 @@ void polyView::drawMark(int x0, int y0, QColor color, int lineWidth, } +void polyView::playMovie(){ + + cout <<"in playMovie: "<< m_movie_frame_id< & values); + void playMovie(); void toggleAnno(); void toggleFilled(); void toggleShowGrid(); @@ -232,7 +233,7 @@ public slots: bool hasSelectedPolygons() const; - void displayData( QPainter *paint ); + void displayData( QPainter *paint, int i = -1 ); void drawMarks(QPainter *paint); void plotDPoly(bool plotPoints, bool plotEdges, @@ -331,7 +332,7 @@ public slots: bool m_showAnnotations; bool m_showFilledPolys; - + int m_movie_frame_id; std::vector m_highlights; int m_showEdges, m_showPoints, m_showPointsEdges, m_displayMode;