From 38ec856cd8cb5f10c3fa7628d7e18197f97cce50 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 17 Nov 2008 14:58:16 +0000 Subject: [PATCH] Bug 0016836: Dump to Post Script --- src/OCCViewer/OCCViewer_ViewWindow.cxx | 25 +++++++++++++++++++++++++ src/OCCViewer/OCCViewer_ViewWindow.h | 5 ++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 90f34b292..8a96ad566 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -64,6 +64,7 @@ #include #include #include +#include static QEvent* l_mbPressEvent = 0; @@ -1389,6 +1390,30 @@ QImage OCCViewer_ViewWindow::dumpView() return px.toImage(); } +bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img, + const QString& fileName, + const QString& format ) +{ + if ( format != "PS" && format != "EPS") + return SUIT_ViewWindow::dumpViewToFormat( img, fileName, format ); + + Handle(Visual3d_View) a3dView = myViewPort->getView()->View(); + + if (format == "PS") + a3dView->Export(qPrintable(fileName), Graphic3d_EF_PostScript); + else if (format == "EPS") + a3dView->Export(qPrintable(fileName), Graphic3d_EF_EnhPostScript); + + return true; +} + + +QString OCCViewer_ViewWindow::filter() const +{ + return tr( "OCC_IMAGE_FILES" ); +} + + /*! \brief Set parameters of the cutting plane \param on if \c true, cutting plane is enabled diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 515a2c8a6..9db177fe6 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -114,6 +114,7 @@ public slots: virtual void showEvent( QShowEvent * ); virtual void hideEvent( QHideEvent * ); + signals: void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type); void vpTransformationFinished(OCCViewer_ViewWindow::OperationType type); @@ -123,7 +124,9 @@ signals: void Hide( QHideEvent * ); protected: - QImage dumpView(); + virtual QImage dumpView(); + virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format ); + virtual QString filter() const; /* Transformation selected but not started yet */ bool transformRequested() const; -- 2.39.2