]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Bug 0016836: Dump to Post Script
authorvsv <vsv@opencascade.com>
Mon, 17 Nov 2008 14:58:16 +0000 (14:58 +0000)
committervsv <vsv@opencascade.com>
Mon, 17 Nov 2008 14:58:16 +0000 (14:58 +0000)
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h

index 90f34b292fbd34ebdd823af7854969deefee873e..8a96ad566c24f2c1a69fbfc16f5371448ebdf45b 100755 (executable)
@@ -64,6 +64,7 @@
 #include <Visual3d_View.hxx>
 #include <Graphic3d_MapOfStructure.hxx>
 #include <Graphic3d_Structure.hxx>
+#include <Graphic3d_ExportFormat.hxx>
 
 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
index 515a2c8a67ce59870a06778dbaba08872f71a145..9db177fe6633cbc10d6105bc157428c68028aac5 100755 (executable)
@@ -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;