--- /dev/null
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SVTK_PsOptionsDlg.h"
+
+#include <QtxDoubleSpinBox.h>
+
+#include <QCheckBox>
+#include <QComboBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLayout>
+#include <QSlider>
+#include <QPushButton>
+
+/*!
+ * Constructor
+ */
+SVTK_PsOptionsDlg::SVTK_PsOptionsDlg( QWidget* theParent):
+ QDialog( theParent )
+{
+ setWindowTitle( tr( "DLG_PSOPTIONS_TITLE" ) );
+ QVBoxLayout* aTopLayout = new QVBoxLayout( this );
+ aTopLayout->setSpacing( 6 );
+ aTopLayout->setMargin( 6 );
+
+ // 1. Options
+ QGroupBox* anOptionsBox = new QGroupBox( tr( "PS_OPTIONS" ), this );
+ QGridLayout* anOptionsLayout = new QGridLayout( anOptionsBox );
+ anOptionsLayout->setSpacing( 6 );
+ anOptionsLayout->setMargin( 11 );
+
+ // 1.1 Line width factor
+ QLabel* lineLabel = new QLabel( tr( "PS_LINE_WIDTH" ), anOptionsBox);
+ myLineFactor = new QtxDoubleSpinBox(0.0, 10.0, 0.1, anOptionsBox);
+ myLineFactor->setValue(0.714);
+
+ // 1.2 Point size factor
+ QLabel* pointLabel = new QLabel( tr( "PS_POINT_SIZE" ), anOptionsBox);
+ myPointFactor = new QtxDoubleSpinBox(0.0, 10.0, 0.1, anOptionsBox);
+ myPointFactor->setValue(0.714);
+
+ // 1.3 Sort method ("No sorting (fastest, poor)", "Simple sorting (fast, good)" and "BSP sorting (slow, best)"
+ QLabel* sortLabel = new QLabel( tr( "PS_SORT_METHOD" ), anOptionsBox);
+ mySortType = new QComboBox( anOptionsBox );
+ mySortType->addItem( tr( "PS_NO_SORTING" ) );
+ mySortType->addItem( tr( "PS_SIMPLE_SORTING" ) );
+ mySortType->addItem( tr( "PS_BPS_SORTING" ) );
+
+ // 1.4 Rasterize 3D geometry
+ myRasterize3D = new QCheckBox( tr( "PS_RASTERIZE_3D" ), anOptionsBox );
+
+ // 1.5 Use shfill shading operator
+ myPs3Shading = new QCheckBox( tr( "PS_USE_SHFILL" ), anOptionsBox );
+
+ // Add widgets to layout
+ anOptionsLayout->addWidget( lineLabel, 0, 0 );
+ anOptionsLayout->addWidget( myLineFactor, 0, 1 );
+ anOptionsLayout->addWidget( pointLabel, 1, 0 );
+ anOptionsLayout->addWidget( myPointFactor, 1, 1 );
+ anOptionsLayout->addWidget( sortLabel, 2, 0 );
+ anOptionsLayout->addWidget( mySortType, 2, 1 );
+ anOptionsLayout->addWidget( myRasterize3D, 3, 0, 1, 2 );
+ anOptionsLayout->addWidget( myPs3Shading, 4, 0, 1, 2 );
+
+
+ QGroupBox* aButtonBox = new QGroupBox(theParent);
+
+ QPushButton* okBtn = new QPushButton(tr("BUT_OK"), aButtonBox);
+ QPushButton* closeBtn = new QPushButton(tr("BUT_CLOSE"), aButtonBox);
+
+ QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+ QHBoxLayout* aLay = new QHBoxLayout(aButtonBox);
+ aLay->setMargin(6);
+ aLay->setSpacing(11);
+
+ aLay->addWidget(okBtn);
+ aLay->addItem(aSpacer);
+ aLay->addWidget(closeBtn);
+
+ connect(okBtn, SIGNAL(clicked()), SLOT(accept()));
+ connect(closeBtn, SIGNAL(clicked()), SLOT(reject()));
+
+ aTopLayout->addWidget( anOptionsBox );
+ aTopLayout->addWidget( aButtonBox );
+}
+
+/*!
+ * Destructor
+ */
+SVTK_PsOptionsDlg::~SVTK_PsOptionsDlg()
+{
+}
+
+/*!
+ * Return line scale factor
+ */
+double SVTK_PsOptionsDlg::getLineFactor() const {
+ return myLineFactor->value();
+}
+
+/*!
+ * Return point scale factor
+ */
+double SVTK_PsOptionsDlg::getPointFactor() const {
+ return myPointFactor->value();
+}
+
+/*!
+ * Return sort type
+ */
+int SVTK_PsOptionsDlg::getSortType() const {
+ return mySortType->currentIndex();
+}
+
+/*!
+ * Return rasterize 3D flag
+ */
+bool SVTK_PsOptionsDlg::isRasterize3D() const {
+ return myRasterize3D->isChecked();
+}
+
+/*!
+ * Return Ps3Shading flag
+ */
+bool SVTK_PsOptionsDlg::isPs3Shading() const {
+ return myPs3Shading->isChecked();
+}
--- /dev/null
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SVTK_PSOPTIONSDLG_H
+#define SVTK_PSOPTIONSDLG_H
+
+#include <QDialog>
+
+class QtxDoubleSpinBox;
+class QCheckBox;
+class QComboBox;
+
+
+class SVTK_PsOptionsDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SVTK_PsOptionsDlg( QWidget* parent );
+ ~SVTK_PsOptionsDlg();
+
+ double getLineFactor() const;
+ double getPointFactor() const;
+ int getSortType() const;
+ bool isRasterize3D() const;
+ bool isPs3Shading() const;
+
+private:
+ QtxDoubleSpinBox* myLineFactor;
+ QtxDoubleSpinBox* myPointFactor;
+ QComboBox* mySortType;
+ QCheckBox* myRasterize3D;
+ QCheckBox* myPs3Shading;
+};
+
+#endif //SVTK_PSOPTIONSDLG_H
#include "SVTK_NonIsometricDlg.h"
#include "SVTK_UpdateRateDlg.h"
#include "SVTK_CubeAxesDlg.h"
+#include "SVTK_PsOptionsDlg.h"
#include "SVTK_SetRotationPointDlg.h"
#include "SVTK_ViewParameterDlg.h"
#include "SVTK_ViewModel.h"
if ( format != "PS" && format != "EPS" && format != "PDF" )
return SUIT_ViewWindow::dumpViewToFormat( img, fileName, format );
- SUIT_OverrideCursor wc;
+ SVTK_PsOptionsDlg* optionsDlg = new SVTK_PsOptionsDlg(this);
+ if ( optionsDlg->exec() == QDialog::Accepted ) {
+ SUIT_OverrideCursor wc;
- vtkGL2PSExporter *anExporter = vtkGL2PSExporter::New();
- anExporter->SetRenderWindow(getRenderWindow());
+ vtkGL2PSExporter *anExporter = vtkGL2PSExporter::New();
+ anExporter->SetRenderWindow(getRenderWindow());
- if ( format == "PS" ) {
- anExporter->SetFileFormatToPS();
- anExporter->CompressOff();
- }
-
- if ( format == "EPS" ) {
- anExporter->SetFileFormatToEPS();
- anExporter->CompressOff();
- }
+ // Set options
+ anExporter->SetLineWidthFactor(optionsDlg->getLineFactor());
+ anExporter->SetPointSizeFactor(optionsDlg->getPointFactor());
+ anExporter->SetSort((vtkGL2PSExporter::SortScheme)optionsDlg->getSortType());
+ anExporter->SetWrite3DPropsAsRasterImage((int)optionsDlg->isRasterize3D());
+ anExporter->SetPS3Shading((int)optionsDlg->isPs3Shading());
+
+ if ( format == "PS" ) {
+ anExporter->SetFileFormatToPS();
+ anExporter->CompressOff();
+ }
+
+ if ( format == "EPS" ) {
+ anExporter->SetFileFormatToEPS();
+ anExporter->CompressOff();
+ }
- if ( format == "PDF" ) {
- anExporter->SetFileFormatToPDF();
+ if ( format == "PDF" ) {
+ anExporter->SetFileFormatToPDF();
+ }
+
+ QString aFilePrefix(fileName);
+ QString anExtension(SUIT_Tools::extension(fileName));
+ aFilePrefix.truncate(aFilePrefix.length() - 1 - anExtension.length());
+ anExporter->SetFilePrefix(aFilePrefix.toLatin1().data());
+ anExporter->Write();
+ anExporter->Delete();
}
-
- QString aFilePrefix(fileName);
- QString anExtension(SUIT_Tools::extension(fileName));
- aFilePrefix.truncate(aFilePrefix.length() - 1 - anExtension.length());
- anExporter->SetFilePrefix(aFilePrefix.toLatin1().data());
- anExporter->Write();
- anExporter->Delete();
-
- return true;
+ delete optionsDlg;
+ return true;
}
/*!
<translation>Scaling</translation>
</message>
</context>
+<context>
+ <name>SVTK_PsOptionsDlg</name>
+ <message>
+ <source>DLG_PSOPTIONS_TITLE</source>
+ <translation>Post Script export options</translation>
+ </message>
+ <message>
+ <source>PS_OPTIONS</source>
+ <translation>Options</translation>
+ </message>
+ <message>
+ <source>PS_LINE_WIDTH</source>
+ <translation>Line width factor</translation>
+ </message>
+ <message>
+ <source>PS_POINT_SIZE</source>
+ <translation>Point size factor</translation>
+ </message>
+ <message>
+ <source>PS_SORT_METHOD</source>
+ <translation>Sort method</translation>
+ </message>
+ <message>
+ <source>PS_NO_SORTING</source>
+ <translation>No sorting</translation>
+ </message>
+ <message>
+ <source>PS_SIMPLE_SORTING</source>
+ <translation>Simple sorting</translation>
+ </message>
+ <message>
+ <source>PS_BPS_SORTING</source>
+ <translation>BSP sorting</translation>
+ </message>
+ <message>
+ <source>PS_RASTERIZE_3D</source>
+ <translation>Rasterize 3D geometry</translation>
+ </message>
+ <message>
+ <source>PS_USE_SHFILL</source>
+ <translation>Use shfill shading operator</translation>
+ </message>
+</context>
<context>
<name>SVTK_RecorderDlg</name>
<message>