1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "SVTK_PsOptionsDlg.h"
22 #include <QtxDoubleSpinBox.h>
30 #include <QPushButton>
35 SVTK_PsOptionsDlg::SVTK_PsOptionsDlg( QWidget* theParent):
38 setWindowTitle( tr( "DLG_PSOPTIONS_TITLE" ) );
39 QVBoxLayout* aTopLayout = new QVBoxLayout( this );
40 aTopLayout->setSpacing( 6 );
41 aTopLayout->setMargin( 6 );
44 QGroupBox* anOptionsBox = new QGroupBox( tr( "PS_OPTIONS" ), this );
45 QGridLayout* anOptionsLayout = new QGridLayout( anOptionsBox );
46 anOptionsLayout->setSpacing( 6 );
47 anOptionsLayout->setMargin( 11 );
49 // 1.1 Line width factor
50 QLabel* lineLabel = new QLabel( tr( "PS_LINE_WIDTH" ), anOptionsBox);
51 myLineFactor = new QtxDoubleSpinBox(0.0, 10.0, 0.1, anOptionsBox);
52 myLineFactor->setValue(0.714);
54 // 1.2 Point size factor
55 QLabel* pointLabel = new QLabel( tr( "PS_POINT_SIZE" ), anOptionsBox);
56 myPointFactor = new QtxDoubleSpinBox(0.0, 10.0, 0.1, anOptionsBox);
57 myPointFactor->setValue(0.714);
59 // 1.3 Sort method ("No sorting (fastest, poor)", "Simple sorting (fast, good)" and "BSP sorting (slow, best)"
60 QLabel* sortLabel = new QLabel( tr( "PS_SORT_METHOD" ), anOptionsBox);
61 mySortType = new QComboBox( anOptionsBox );
62 mySortType->addItem( tr( "PS_NO_SORTING" ) );
63 mySortType->addItem( tr( "PS_SIMPLE_SORTING" ) );
64 mySortType->addItem( tr( "PS_BPS_SORTING" ) );
66 // 1.4 Rasterize 3D geometry
67 myRasterize3D = new QCheckBox( tr( "PS_RASTERIZE_3D" ), anOptionsBox );
69 // 1.5 Use shfill shading operator
70 myPs3Shading = new QCheckBox( tr( "PS_USE_SHFILL" ), anOptionsBox );
72 // Add widgets to layout
73 anOptionsLayout->addWidget( lineLabel, 0, 0 );
74 anOptionsLayout->addWidget( myLineFactor, 0, 1 );
75 anOptionsLayout->addWidget( pointLabel, 1, 0 );
76 anOptionsLayout->addWidget( myPointFactor, 1, 1 );
77 anOptionsLayout->addWidget( sortLabel, 2, 0 );
78 anOptionsLayout->addWidget( mySortType, 2, 1 );
79 anOptionsLayout->addWidget( myRasterize3D, 3, 0, 1, 2 );
80 anOptionsLayout->addWidget( myPs3Shading, 4, 0, 1, 2 );
83 QGroupBox* aButtonBox = new QGroupBox(theParent);
85 QPushButton* okBtn = new QPushButton(tr("BUT_OK"), aButtonBox);
86 QPushButton* closeBtn = new QPushButton(tr("BUT_CLOSE"), aButtonBox);
88 QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
90 QHBoxLayout* aLay = new QHBoxLayout(aButtonBox);
94 aLay->addWidget(okBtn);
95 aLay->addItem(aSpacer);
96 aLay->addWidget(closeBtn);
98 connect(okBtn, SIGNAL(clicked()), SLOT(accept()));
99 connect(closeBtn, SIGNAL(clicked()), SLOT(reject()));
101 aTopLayout->addWidget( anOptionsBox );
102 aTopLayout->addWidget( aButtonBox );
108 SVTK_PsOptionsDlg::~SVTK_PsOptionsDlg()
113 * Return line scale factor
115 double SVTK_PsOptionsDlg::getLineFactor() const {
116 return myLineFactor->value();
120 * Return point scale factor
122 double SVTK_PsOptionsDlg::getPointFactor() const {
123 return myPointFactor->value();
129 int SVTK_PsOptionsDlg::getSortType() const {
130 return mySortType->currentIndex();
134 * Return rasterize 3D flag
136 bool SVTK_PsOptionsDlg::isRasterize3D() const {
137 return myRasterize3D->isChecked();
141 * Return Ps3Shading flag
143 bool SVTK_PsOptionsDlg::isPs3Shading() const {
144 return myPs3Shading->isChecked();