Salome HOME
Fix of the following issues:
[modules/visu.git] / src / VISUGUI / VisuGUI_GaussPointsDlg.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  VISU VISUGUI : GUI of VISU component
23 //  File   : VisuGUI_GaussPointsDlg.cxx
24 //  Author : Oleg UVAROV
25 //  Module : VISU
26 //
27 #include "VisuGUI_GaussPointsDlg.h"
28
29 #include "VISUConfig.hh"
30
31 #include "VisuGUI_Tools.h"
32 #include "VisuGUI_InputPane.h"
33
34 #include "VISU_ColoredPrs3dFactory.hh"
35 #include "VISU_GaussPoints_i.hh"
36 #include "VISU_Prs3dUtils.hh"
37 #include "VISU_GaussPointsPL.hxx"
38 #include "VISU_OpenGLPointSpriteMapper.hxx"
39 #include "VISU_Convertor.hxx"
40
41 #include "VVTK_PrimitiveBox.h"
42 #include "VVTK_SizeBox.h"
43
44 #include "LightApp_Application.h"
45 #include "SalomeApp_Module.h"
46 #include "LightApp_SelectionMgr.h"
47 #include "SUIT_Desktop.h"
48 #include "SUIT_ResourceMgr.h"
49 #include "SUIT_Session.h"
50 #include "SUIT_MessageBox.h"
51 #include "SVTK_FontWidget.h"
52
53 #include "QtxDoubleSpinBox.h"
54
55 #include <QLayout>
56 #include <QTabWidget>
57 #include <QButtonGroup>
58 #include <QRadioButton>
59 #include <QFileDialog>
60 #include <QValidator>
61 #include <QColorDialog>
62 #include <QGroupBox>
63 #include <QCheckBox>
64 #include <QLabel>
65 #include <QPushButton>
66 #include <QLineEdit>
67 #include <QSpinBox>
68 #include <QComboBox>
69 #include <QToolButton>
70 #include <QTabWidget>
71 #include <QKeyEvent>
72
73 #include <vtkPolyData.h>
74 #include <vtkDataSet.h>
75 #include <vtkSphereSource.h>
76
77 using namespace std;
78
79 VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent):
80   QWidget(parent)
81 {
82   myVerX = 0.01;  myVerY = 0.10;  myVerW = 0.08;  myVerH = 0.80;
83   myHorX = 0.10;  myHorY = 0.01;  myHorW = 0.80;  myHorH = 0.08;
84   myVerTS = myVerLS = myVerBW = myVerBH = 0;
85   myHorTS = myHorLS = myHorBW = myHorBH = 0;
86   Imin = 0.0; Imax = 0.0;
87   myRangeMode = -1;
88
89   QVBoxLayout* aMainLayout = new QVBoxLayout( this );
90   aMainLayout->setSpacing(6);
91   //setMargin(11);
92
93   // Active bar ========================================================
94   QGroupBox* ActiveBarGroup = new QGroupBox (tr("ACTIVE_BAR_GRP"), this );
95   aMainLayout->addWidget(ActiveBarGroup);
96   //ActiveBarGroup->setColumnLayout(0, Qt::Vertical );
97   //ActiveBarGroup->layout()->setSpacing( 0 );
98   //ActiveBarGroup->layout()->setMargin( 0 );
99   QGridLayout* ActiveBarGroupLayout = new QGridLayout( ActiveBarGroup );
100   ActiveBarGroupLayout->setAlignment( Qt::AlignTop );
101   ActiveBarGroupLayout->setSpacing( 6 );
102   ActiveBarGroupLayout->setMargin( 11 );
103
104   QButtonGroup* BarTypeGroup = new QButtonGroup( ActiveBarGroup );
105   QGroupBox* aGB = new QGroupBox( ActiveBarGroup );
106   QVBoxLayout* aVBLay = new QVBoxLayout( aGB );
107   
108   BarTypeGroup->setExclusive( true );
109   //aGB->setFrameStyle( QFrame::NoFrame );
110   aVBLay->setMargin( 0 );
111
112   myRBLocal = new QRadioButton( tr( "LOCAL" ), aGB );
113   myRBGlobal = new QRadioButton( tr( "GLOBAL" ), aGB );
114   aVBLay->addWidget( myRBLocal );
115   aVBLay->addWidget( myRBGlobal );
116
117   BarTypeGroup->addButton( myRBLocal );
118   BarTypeGroup->addButton( myRBGlobal );
119
120   myCBDisplayed = new QCheckBox( tr( "DISPLAYED" ), ActiveBarGroup );
121
122   ActiveBarGroupLayout->addWidget( aGB, 0, 0, 2, 1 );
123   ActiveBarGroupLayout->addWidget( myCBDisplayed, 1, 1 );
124
125   // Range ============================================================
126   RangeGroup = new QButtonGroup ( this );
127   aGB = new QGroupBox( tr("SCALAR_RANGE_GRP"), this );
128   aMainLayout->addWidget(aGB);
129
130   QGridLayout* RangeGroupLayout = new QGridLayout( aGB );
131   RangeGroupLayout->setAlignment( Qt::AlignTop );
132   RangeGroupLayout->setSpacing( 6 );
133   RangeGroupLayout->setMargin( 11 );
134
135   myModeLbl = new QLabel("Scalar Mode", aGB);
136
137   myModeCombo = new QComboBox(aGB);
138
139   RBFieldRange = new QRadioButton (tr("FIELD_RANGE_BTN"), aGB);
140   RBImposedRange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), aGB);
141   RBFieldRange->setChecked( true );
142   RangeGroup->addButton( RBFieldRange );
143   RangeGroup->addButton( RBImposedRange );
144
145   MinEdit = new QLineEdit( aGB );
146   MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
147   MinEdit->setMinimumWidth( 70 );
148   MinEdit->setValidator( new QDoubleValidator(this) );
149   MinEdit->setText( "0.0" );
150   QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB);
151   MinLabel->setBuddy(MinEdit);
152
153   MaxEdit = new QLineEdit( aGB );
154   MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
155   MaxEdit->setMinimumWidth( 70 );
156   MaxEdit->setValidator( new QDoubleValidator(this) );
157   MaxEdit->setText( "0.0" );
158   QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB);
159   MaxLabel->setBuddy(MaxEdit);
160
161   RangeGroupLayout->addWidget( myModeLbl,      0, 0 );
162   RangeGroupLayout->addWidget( myModeCombo,    0, 1, 1, 3);
163   RangeGroupLayout->addWidget( RBFieldRange,   1, 0, 1, 2);
164   RangeGroupLayout->addWidget( RBImposedRange, 1, 2, 1, 2);
165   RangeGroupLayout->addWidget( MinLabel,       2, 0 );
166   RangeGroupLayout->addWidget( MinEdit,        2, 1 );
167   RangeGroupLayout->addWidget( MaxLabel,       2, 2 );
168   RangeGroupLayout->addWidget( MaxEdit,        2, 3 );
169
170   // Colors and Labels ========================================================
171   QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this );
172   aMainLayout->addWidget(ColLabGroup);
173   //ColLabGroup->setColumnLayout(0, Qt::Vertical );
174   //ColLabGroup->layout()->setSpacing( 0 );
175   //ColLabGroup->layout()->setMargin( 0 );
176   QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup );
177   ColLabGroupLayout->setAlignment( Qt::AlignTop );
178   ColLabGroupLayout->setSpacing( 6 );
179   ColLabGroupLayout->setMargin( 11 );
180
181   QButtonGroup* TypeGroup = new QButtonGroup( ColLabGroup );
182   aGB = new QGroupBox ( ColLabGroup );
183   aVBLay = new QVBoxLayout( aGB );
184   TypeGroup->setExclusive( true );
185   //aGB->setFrameStyle( QFrame::NoFrame );
186   aVBLay->setMargin( 0 );
187
188   BicolorButton = new QRadioButton( tr( "BICOLOR" ), aGB );
189   aVBLay->addWidget( BicolorButton );
190   TypeGroup->addButton( BicolorButton );
191   RainbowButton = new QRadioButton( tr( "RAINBOW" ), aGB );
192   aVBLay->addWidget( RainbowButton );
193   TypeGroup->addButton( RainbowButton );
194
195   ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup );
196   ColorSpin = new QSpinBox( ColLabGroup );
197   ColorSpin->setMinimum( 2 );
198   ColorSpin->setMaximum( 256 );
199   ColorSpin->setSingleStep( 1 );
200   ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
201   ColorSpin->setMinimumWidth( 70 );
202   ColorSpin->setValue( 64 );
203
204   LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup);
205   LabelSpin = new QSpinBox( ColLabGroup );
206   LabelSpin->setMinimum( 2 );
207   LabelSpin->setMaximum( 65 );
208   LabelSpin->setSingleStep( 1 );
209   LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
210   LabelSpin->setMinimumWidth( 70 );
211   LabelSpin->setValue( 5 );
212
213   ColLabGroupLayout->addWidget( aGB, 0, 0, 2, 1);
214   ColLabGroupLayout->addWidget( ColorLabel, 1, 1);
215   ColLabGroupLayout->addWidget( ColorSpin,  1, 2);
216   ColLabGroupLayout->addWidget( LabelLabel, 1, 3);
217   ColLabGroupLayout->addWidget( LabelSpin,  1, 4);
218
219   //TopLayout->addWidget( ColLabGroup );
220
221   // Orientation ==========================================================
222   QButtonGroup* OrientGroup = new QButtonGroup ( this );
223   aGB = new QGroupBox( tr("ORIENTATION_GRP"), this  );
224   aMainLayout->addWidget(aGB);
225   //OrientGroup->setColumnLayout(0, Qt::Vertical );
226   //OrientGroup->layout()->setSpacing( 0 );
227   //OrientGroup->layout()->setMargin( 0 );
228   QGridLayout* OrientGroupLayout = new QGridLayout( aGB );
229   OrientGroupLayout->setAlignment( Qt::AlignTop );
230   OrientGroupLayout->setSpacing( 6 );
231   OrientGroupLayout->setMargin( 11 );
232
233   RBvert = new QRadioButton (tr("VERTICAL_BTN"), aGB );
234   RBvert->setChecked( true );
235   OrientGroup->addButton( RBvert );
236   RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), aGB);
237   OrientGroup->addButton( RBhori
238                           );
239   OrientGroupLayout->addWidget( RBvert, 0, 0 );
240   OrientGroupLayout->addWidget( RBhori, 0, 1 );
241
242   //  TopLayout->addWidget( OrientGroup );
243
244   // Origin ===============================================================
245   QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this );
246   aMainLayout->addWidget( OriginGroup );
247   //OriginGroup->setColumnLayout(0, Qt::Vertical );
248   //OriginGroup->layout()->setSpacing( 0 );
249   //OriginGroup->layout()->setMargin( 0 );
250   QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup );
251   OriginGroupLayout->setAlignment( Qt::AlignTop );
252   OriginGroupLayout->setSpacing( 6 );
253   OriginGroupLayout->setMargin( 11 );
254
255   QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup );
256   XSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, OriginGroup );
257   XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
258   XSpin->setMinimumWidth( 70 );
259   XSpin->setValue( 0.01 );
260
261   QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup );
262   YSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, OriginGroup );
263   YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
264   YSpin->setMinimumWidth( 70 );
265   YSpin->setValue( 0.01 );
266
267   OriginGroupLayout->addWidget( XLabel, 0, 0);
268   OriginGroupLayout->addWidget( XSpin,  0, 1);
269   OriginGroupLayout->addWidget( YLabel, 0, 2);
270   OriginGroupLayout->addWidget( YSpin,  0, 3);
271
272   //TopLayout->addWidget( OriginGroup );
273
274   // Dimensions =========================================================
275   QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this );
276   aMainLayout->addWidget( DimGroup );
277   //DimGroup->setColumnLayout(0, Qt::Vertical );
278   //DimGroup->layout()->setSpacing( 0 );
279   //DimGroup->layout()->setMargin( 0 );
280   QGridLayout* DimGroupLayout = new QGridLayout( DimGroup );
281   DimGroupLayout->setAlignment( Qt::AlignTop );
282   DimGroupLayout->setSpacing( 6 );
283   DimGroupLayout->setMargin( 11 );
284
285   QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup );
286   WidthSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, DimGroup );
287   WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
288   WidthSpin->setMinimumWidth( 70 );
289   WidthSpin->setValue( 0.1 );
290
291   QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup );
292   HeightSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, DimGroup );
293   HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
294   HeightSpin->setMinimumWidth( 70 );
295   HeightSpin->setValue( 0.8 );
296
297   QLabel* SpacingLabel = new QLabel (tr("LBL_SPACING"), DimGroup );
298   SpacingSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.01, DimGroup );
299   SpacingSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
300   SpacingSpin->setMinimumWidth( 70 );
301   SpacingSpin->setValue( 0.01 );
302
303   DimGroupLayout->addWidget( WidthLabel, 0, 0);
304   DimGroupLayout->addWidget( WidthSpin,  0, 1);
305   DimGroupLayout->addWidget( HeightLabel, 0, 2);
306   DimGroupLayout->addWidget( HeightSpin,  0, 3);
307   DimGroupLayout->addWidget( SpacingLabel, 0, 4);
308   DimGroupLayout->addWidget( SpacingSpin,  0, 5);
309
310   //TopLayout->addWidget( DimGroup );
311
312   QWidget* aSaveBox = new QWidget(this);
313   aMainLayout->addWidget( aSaveBox );
314
315   QHBoxLayout* aHBoxLay = new QHBoxLayout( aSaveBox );
316   
317   myTextBtn = new QPushButton("Text properties...", aSaveBox);
318   aHBoxLay->addWidget( myTextBtn );
319   
320   myBarBtn = new QPushButton("Bar properties...", aSaveBox);
321   aHBoxLay->addWidget( myBarBtn );
322
323   myTextDlg = new VisuGUI_TextPrefDlg(this);
324   aMainLayout->addWidget( myTextDlg );
325   myTextDlg->setTitleVisible(true);
326
327   myBarDlg = new VisuGUI_BarPrefDlg(this);
328   aMainLayout->addWidget( myBarDlg );
329
330   QGroupBox* CheckGroup = new QGroupBox("", this );
331   aMainLayout->addWidget( CheckGroup );
332   QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup );
333
334   myHideBar = new QCheckBox(tr("HIDE_SCALAR_BAR"), CheckGroup);
335   myHideBar->setChecked(false);
336   CheckGroupLayout->addWidget(myHideBar, 0, 0);
337
338   // signals and slots connections ===========================================
339   connect( RBFieldRange,  SIGNAL( clicked() ), this, SLOT( fieldRangeClicked() ) );
340   connect( RBImposedRange,SIGNAL( clicked() ), this, SLOT( imposedRangeClicked() ) );
341
342   connect( myModeCombo,   SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) );
343
344   connect( myRBLocal,     SIGNAL( clicked() ), this, SLOT( onLocalScalarBar() ) );
345   connect( myRBGlobal,    SIGNAL( clicked() ), this, SLOT( onGlobalScalarBar() ) );
346
347   connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorLabel, SLOT( setEnabled( bool ) ) );
348   connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorSpin, SLOT( setEnabled( bool ) ) );
349   connect( RainbowButton, SIGNAL( toggled( bool ) ), LabelLabel, SLOT( setEnabled( bool ) ) );
350   connect( RainbowButton, SIGNAL( toggled( bool ) ), LabelSpin, SLOT( setEnabled( bool ) ) );
351   connect( OrientGroup,   SIGNAL( buttonClicked( int ) ), this, SLOT( changeDefaults( int ) ) );
352   connect( XSpin,         SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
353   connect( YSpin,         SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
354   connect( myTextBtn,     SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
355   connect( myBarBtn,      SIGNAL( clicked() ), this, SLOT( onBarPref() ) );
356
357   changeDefaults( 0 );
358   myIsStoreTextProp = false;
359 }
360
361 bool VisuGUI_GaussScalarBarPane::UseFieldRange(bool theInit)
362 {
363   if ( theInit )
364     return !myPrsCopy->IsRangeFixed();
365
366   return RBFieldRange->isChecked() || !myPrsCopy->GetIsActiveLocalScalarBar();
367 }
368
369
370 void VisuGUI_GaussScalarBarPane::onGlobalScalarBar()
371 {
372   myPrsCopy->SetIsActiveLocalScalarBar(false);
373   myPrsCopy->SetSourceRange();
374
375   myCBDisplayed->setEnabled( false );
376
377   RBImposedRange->setEnabled( false );
378   RBFieldRange->setEnabled( false );
379
380   MinEdit->setEnabled( false );
381   MaxEdit->setEnabled( false );
382
383   MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
384   MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
385 }
386
387
388 void VisuGUI_GaussScalarBarPane::onLocalScalarBar()
389 {
390   myPrsCopy->SetIsActiveLocalScalarBar(true);
391   if ( RBFieldRange->isChecked() )
392     myPrsCopy->SetSourceRange();
393   else
394     myPrsCopy->SetRange(myPrsCopy->GetMin(), myPrsCopy->GetMax());
395
396   myCBDisplayed->setEnabled( true );
397
398   RBImposedRange->setEnabled( true );
399   RBFieldRange->setEnabled( true );
400
401   MinEdit->setEnabled( RBImposedRange->isChecked() );
402   MaxEdit->setEnabled( RBImposedRange->isChecked() );
403
404   MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
405   MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
406 }
407
408
409 /*!
410   Called when Range mode is changed to FieldRange
411 */
412 void VisuGUI_GaussScalarBarPane::fieldRangeClicked()
413 {
414   myPrsCopy->SetSourceRange();
415
416   RBFieldRange->setChecked( true );
417   RBImposedRange->setChecked( false );
418
419   MinEdit->setEnabled( false );
420   MaxEdit->setEnabled( false );
421
422   MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
423   MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
424 }
425
426
427 /*!
428   Called when Range mode is changed to FieldRange
429 */
430 void VisuGUI_GaussScalarBarPane::imposedRangeClicked()
431 {
432   myPrsCopy->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
433
434   RBImposedRange->setChecked( true );
435   RBFieldRange->setChecked( false );
436
437   MinEdit->setEnabled( true );
438   MaxEdit->setEnabled( true );
439 }
440
441
442 /*!
443   Called when scalar mode is changed
444 */
445 void VisuGUI_GaussScalarBarPane::changeScalarMode( int theMode )
446 {
447   myPrsCopy->SetScalarMode( theMode );
448   if ( UseFieldRange() ) {
449     MinEdit->setText( QString::number( myPrsCopy->GetSourceMin() ) );
450     MaxEdit->setText( QString::number( myPrsCopy->GetSourceMax() ) );
451   }
452 }
453
454 /**
455  * Initialise dialog box from presentation object
456  */
457 void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs,
458                                                    bool theInit ) 
459 {
460   myPrsCopy = thePrs;
461
462   myModeCombo->setCurrentIndex(thePrs->GetScalarMode());
463
464   bool activeLocal = thePrs->GetIsActiveLocalScalarBar();
465   if ( activeLocal ) {
466     RBImposedRange->setChecked( !UseFieldRange(theInit) );
467     RBFieldRange->setChecked( UseFieldRange(theInit) );
468     MinEdit->setEnabled( !UseFieldRange(theInit) );
469     MaxEdit->setEnabled( !UseFieldRange(theInit) );
470   } else {
471     RBImposedRange->setEnabled( false );
472     RBFieldRange->setEnabled( false );
473     MinEdit->setEnabled( false );
474     MaxEdit->setEnabled( false );
475   }
476
477   MinEdit->setText( QString::number( thePrs->GetMin() ) );
478   MaxEdit->setText( QString::number( thePrs->GetMax() ) );
479
480   setPosAndSize( thePrs->GetPosX(),
481                  thePrs->GetPosY(),
482                  thePrs->GetWidth(),
483                  thePrs->GetHeight(),
484                  thePrs->GetBarOrientation());
485
486   if(RBvert->isChecked()) {
487     myVerTS = thePrs->GetTitleSize();
488     myVerLS = thePrs->GetLabelSize();
489     myVerBW = thePrs->GetBarWidth();
490     myVerBH = thePrs->GetBarHeight();
491   } else {
492     myHorTS = thePrs->GetTitleSize();
493     myHorLS = thePrs->GetLabelSize();
494     myHorBW = thePrs->GetBarWidth();
495     myHorBH = thePrs->GetBarHeight();
496   }
497
498   myBarDlg->setLabelsPrecision( VISU::ToPrecision( thePrs->GetLabelsFormat() ) );
499   myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
500
501   SpacingSpin->setValue(thePrs->GetSpacing());
502
503   myRBLocal->setChecked( activeLocal );
504
505   myRBGlobal->setChecked( !activeLocal );
506   myRBGlobal->setEnabled( thePrs->IsGlobalRangeDefined() );
507   if( !thePrs->IsGlobalRangeDefined() )
508     myRBLocal->setChecked( true );
509
510   myCBDisplayed->setEnabled( activeLocal );
511   myCBDisplayed->setChecked( thePrs->GetIsDispGlobalScalarBar() );
512
513   bool bicolor = thePrs->GetSpecificPL()->GetBicolor();
514   BicolorButton->setChecked( bicolor );
515   RainbowButton->setChecked( !bicolor );
516   ColorLabel->setEnabled( !bicolor );
517   ColorSpin->setEnabled( !bicolor );
518   LabelLabel->setEnabled( !bicolor );
519   LabelSpin->setEnabled( !bicolor );
520
521   setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
522
523   // Update myModeCombo
524   int aNbComp = thePrs->GetField()->myNbComp;
525   bool isScalarMode = (aNbComp > 1);
526   myModeCombo->clear();
527   myModeCombo->addItem("<Modulus>");
528   VISU::PField aField = thePrs->GetField();
529   const VISU::TNames& aCompNames = aField->myCompNames;
530   const VISU::TNames& aUnitNames = aField->myUnitNames;
531   for(int i = 0; i < aNbComp; i++){
532     QString aComponent = QString(aCompNames[i].c_str()).simplified();
533     if(aComponent.isNull() || aComponent == "")
534       aComponent = "Component " + QString::number(i+1);
535     else
536       aComponent = "[" + QString::number(i+1) + "] " + aComponent;
537
538     QString anUnit = QString(aUnitNames[i].c_str()).simplified();
539     if(anUnit.isNull() || anUnit == "")
540       anUnit = "-";
541     
542     aComponent = aComponent + ", " + anUnit;
543
544     myModeCombo->addItem(aComponent);
545   }
546   //
547   myModeCombo->setCurrentIndex(thePrs->GetScalarMode());
548   if (aNbComp==1){
549     myModeCombo->setCurrentIndex(1);
550   }
551   //
552   myModeLbl->setEnabled(isScalarMode);
553   myModeCombo->setEnabled(isScalarMode);
554
555   // "Title"
556   myTextDlg->setTitleText(QString(thePrs->GetTitle()));
557
558   vtkFloatingPointType R, G, B;
559   thePrs->GetTitleColor(R, G, B);
560
561   int lp = VISU::ToPrecision( thePrs->GetLabelsFormat() );
562   myBarDlg->setLabelsPrecision( lp );
563   myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
564
565   myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
566                                   thePrs->GetTitFontType(),
567                                   thePrs->IsBoldTitle(),
568                                   thePrs->IsItalicTitle(),
569                                   thePrs->IsShadowTitle());
570
571   // "Labels"
572   thePrs->GetLabelColor(R, G, B);
573
574   myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
575                                   thePrs->GetLblFontType(),
576                                   thePrs->IsBoldLabel(),
577                                   thePrs->IsItalicLabel(),
578                                   thePrs->IsShadowLabel());
579
580   myHideBar->setChecked(!thePrs->IsBarVisible());
581 }
582
583 /**
584  * Store values to presentation object
585  */
586 int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) {
587   thePrs->SetScalarMode(myModeCombo->currentIndex());
588
589   if (RBFieldRange->isChecked()) {
590     thePrs->SetSourceRange();
591   } else {
592     thePrs->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
593   }
594
595   thePrs->SetSpacing(SpacingSpin->value());
596   thePrs->SetIsActiveLocalScalarBar(myRBLocal->isChecked());
597   thePrs->SetIsDispGlobalScalarBar(myCBDisplayed->isChecked());
598   thePrs->SetBiColor(BicolorButton->isChecked());
599
600   thePrs->SetPosition(XSpin->value(), YSpin->value());
601   thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
602   thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL);
603   thePrs->SetNbColors(ColorSpin->value());
604   thePrs->SetLabels(LabelSpin->value());
605
606   if(RBvert->isChecked()) {
607     thePrs->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH);
608   } else {
609     thePrs->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH);
610   }
611
612   std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
613   thePrs->SetLabelsFormat( f.c_str() );
614   thePrs->SetUnitsVisible(myBarDlg->isUnitsVisible());
615
616   thePrs->SetBarVisible(!myHideBar->isChecked());
617
618   if (myIsStoreTextProp) {
619     // "Title"
620     thePrs->SetTitle(myTextDlg->getTitleText().toLatin1().data());
621
622     QColor aTitColor (255, 255, 255);
623     int aTitleFontFamily = VTK_ARIAL;
624     bool isTitleBold = false;
625     bool isTitleItalic = false;
626     bool isTitleShadow = false;
627
628     myTextDlg->myTitleFont->GetData(aTitColor, aTitleFontFamily,
629                                     isTitleBold, isTitleItalic, isTitleShadow);
630
631     thePrs->SetBoldTitle(isTitleBold);
632     thePrs->SetItalicTitle(isTitleItalic);
633     thePrs->SetShadowTitle(isTitleShadow);
634     thePrs->SetTitFontType(aTitleFontFamily);
635     thePrs->SetTitleColor(aTitColor.red()/255.,
636                           aTitColor.green()/255.,
637                           aTitColor.blue()/255.);
638
639     // "Label"
640     QColor aLblColor (255, 255, 255);
641     int aLabelFontFamily = VTK_ARIAL;
642     bool isLabelBold = false;
643     bool isLabelItalic = false;
644     bool isLabelShadow = false;
645
646     myTextDlg->myLabelFont->GetData(aLblColor, aLabelFontFamily,
647                                     isLabelBold, isLabelItalic, isLabelShadow);
648
649     thePrs->SetBoldLabel(isLabelBold);
650     thePrs->SetItalicLabel(isLabelItalic);
651     thePrs->SetShadowLabel(isLabelShadow);
652     thePrs->SetLblFontType(aLabelFontFamily);
653     thePrs->SetLabelColor(aLblColor.red()/255.,
654                           aLblColor.green()/255.,
655                           aLblColor.blue()/255.);
656   }
657
658   return 1;
659 }
660
661 /*!
662   Called when orientation is changed
663 */
664 void VisuGUI_GaussScalarBarPane::changeDefaults( int )
665 {
666   if ( RBvert->isChecked() ) {
667     XSpin->setValue( myVerX );
668     YSpin->setValue( myVerY );
669     WidthSpin->setValue( myVerW );
670     HeightSpin->setValue( myVerH );
671   }
672   else {
673     XSpin->setValue( myHorX );
674     YSpin->setValue( myHorY );
675     WidthSpin->setValue( myHorW );
676     HeightSpin->setValue( myHorH );
677   }
678 }
679
680 /*!
681   Called when X,Y position is changed
682 */
683 void VisuGUI_GaussScalarBarPane::XYChanged( double )
684 {
685   QtxDoubleSpinBox* snd = (QtxDoubleSpinBox*)sender();
686   if ( snd == XSpin ) {
687     WidthSpin->setMaximum( 1.0 - XSpin->value() );
688   }
689   if ( snd == YSpin ) {
690     HeightSpin->setMaximum( 1.0 - YSpin->value() );
691   }
692 }
693
694 /*!
695   Sets size and position
696 */
697 void VisuGUI_GaussScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
698 {
699   if ( vert ) {
700     myVerX = x;
701     myVerY = y;
702     myVerW = w;
703     myVerH = h;
704     RBvert->setChecked( true );
705   }
706   else {
707     myHorX = x;
708     myHorY = y;
709     myHorW = w;
710     myHorH = h;
711     RBhori->setChecked( true );
712   }
713   changeDefaults( 0 );
714 }
715
716 /*!
717   Sets colors and labels number
718 */
719 void VisuGUI_GaussScalarBarPane::setScalarBarData( int colors, int labels )
720 {
721   ColorSpin->setValue( colors );
722   LabelSpin->setValue( labels );
723 }
724
725 /*!
726   Gets orientation
727 */
728 int VisuGUI_GaussScalarBarPane::getOrientation()
729 {
730   if (RBvert->isChecked() )
731     return  1;
732   else
733     return 0;
734 }
735
736 /*!
737   Sets and gets parameters
738 */
739 double VisuGUI_GaussScalarBarPane::getX() {
740   return XSpin->value();
741 }
742
743 double VisuGUI_GaussScalarBarPane::getY() {
744   return YSpin->value();
745 }
746
747 double VisuGUI_GaussScalarBarPane::getWidth() {
748   return WidthSpin->value();
749 }
750
751 double VisuGUI_GaussScalarBarPane::getHeight() {
752   return HeightSpin->value();
753 }
754
755 int VisuGUI_GaussScalarBarPane::getNbColors() {
756   return ColorSpin->value();
757 }
758
759 int VisuGUI_GaussScalarBarPane::getNbLabels() {
760   return LabelSpin->value();
761 }
762
763 void VisuGUI_GaussScalarBarPane::onTextPref()
764 {
765   myIsStoreTextProp = myTextDlg->exec();
766 }
767
768 void VisuGUI_GaussScalarBarPane::onBarPref()
769 {
770   if(RBvert->isChecked())
771     myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
772   else
773     myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
774   if(myBarDlg->exec()) {
775     if(RBvert->isChecked())
776       myBarDlg->getRatios(myVerTS, myVerLS, myVerBW, myVerBH);
777     else
778       myBarDlg->getRatios(myHorTS, myHorLS, myHorBW, myHorBH);
779   }
780 }
781
782 /*!
783  * Constructor
784  */
785 VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule):
786   myModule(theModule),
787   VisuGUI_Prs3dDlg(theModule)
788 {
789   //setName("VisuGUI_GaussPointsDlg");
790   setWindowTitle(tr("DLG_PROP_TITLE"));
791   setSizeGripEnabled(TRUE);
792
793   QVBoxLayout* TopLayout = new QVBoxLayout(this);
794   TopLayout->setSpacing(6);
795   TopLayout->setMargin(11);
796
797
798   // Presentation
799   QButtonGroup* PrsGroup = new QButtonGroup( this );
800   QGroupBox* aGB = new QGroupBox( tr( "PRS_TITLE" ), this );
801   QHBoxLayout* aHBLay = new QHBoxLayout( aGB );
802   PrsGroup->setExclusive( true );
803   aHBLay->setMargin( 11 );
804   aHBLay->setSpacing(6);
805
806   myResultsButton = new QRadioButton( tr( "RESULTS" ), aGB );
807   myGeometryButton = new QRadioButton( tr( "GEOMETRY" ), aGB );
808   myDefShapeButton = new QRadioButton( tr( "DEFORMED_SHAPE" ), aGB );
809   aHBLay->addWidget( myResultsButton );
810   aHBLay->addWidget( myGeometryButton );
811   aHBLay->addWidget( myDefShapeButton );
812
813   PrsGroup->addButton( myResultsButton );
814   PrsGroup->addButton( myGeometryButton );
815   PrsGroup->addButton( myDefShapeButton );
816   
817
818   myTabBox = new QTabWidget (this);
819
820   // Gauss points pane
821   QWidget* aBox = new QWidget (this);
822   QVBoxLayout* aVBLay = new QVBoxLayout( aBox );
823   aVBLay->setMargin(11);
824   aVBLay->setSpacing(6);
825
826   // Primitive
827   myPrimitiveBox = new VVTK_PrimitiveBox( aBox );
828   aVBLay->addWidget( myPrimitiveBox );
829
830   // Size
831   mySizeBox = new VVTK_SizeBox( aBox );
832   aVBLay->addWidget( mySizeBox );
833
834   // Deformed Shape
835   myDefShapeBox = new QGroupBox( tr( "DEFORMED_SHAPE_TITLE" ), aBox );
836   aVBLay->addWidget( myDefShapeBox );
837   //myDefShapeBox->setColumnLayout(0, Qt::Vertical );
838   //myDefShapeBox->layout()->setSpacing( 0 );
839   //myDefShapeBox->layout()->setMargin( 0 );
840
841   QGridLayout* aDefShapeLayout = new QGridLayout( myDefShapeBox );
842   aDefShapeLayout->setAlignment(Qt::AlignTop);
843   aDefShapeLayout->setSpacing(6);
844   aDefShapeLayout->setMargin(11);
845   
846   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
847   int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
848
849   QLabel* aScaleLabel = new QLabel( tr( "SCALE_FACTOR" ), myDefShapeBox );
850   myScaleSpinBox = new QtxDoubleSpinBox( 0.0, 10.0, 0.1, aPrecision*(-1), 32, myDefShapeBox );
851   
852   aDefShapeLayout->addWidget( aScaleLabel, 0, 0 );
853   aDefShapeLayout->addWidget( myScaleSpinBox, 0, 1 );
854
855   // Scalar Bar pane
856   myScalarPane = new VisuGUI_GaussScalarBarPane(this);
857   if ( myScalarPane->layout() )
858     myScalarPane->layout()->setMargin(5);
859
860   // Input pane
861   myInputPane = new VisuGUI_InputPane(VISU::TGAUSSPOINTS, theModule, this);
862   myInputPane->SetRestoreInitialSelection(false);
863
864   connect( myResultsButton,  SIGNAL( clicked() ),       mySizeBox,    SLOT( onToggleResults() ) );
865   connect( myResultsButton,  SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) );
866   connect( myGeometryButton, SIGNAL( clicked() ),       mySizeBox,    SLOT( onToggleGeometry() ) );
867   connect( myDefShapeButton, SIGNAL( toggled( bool ) ), this,         SLOT( onToggleDefShape( bool ) ) );
868   connect( myDefShapeButton, SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) );
869
870   myTabBox->addTab(aBox, tr("GAUSS_POINTS_TAB"));
871   myTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
872   myTabBox->addTab(myInputPane, tr("INPUT_TAB"));
873
874   // Common buttons ===========================================================
875   QGroupBox* GroupButtons = new QGroupBox( this );
876   //GroupButtons->setColumnLayout(0, Qt::Vertical );
877   //GroupButtons->layout()->setSpacing( 0 );
878   //GroupButtons->layout()->setMargin( 0 );
879   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons );
880   GroupButtonsLayout->setAlignment( Qt::AlignTop );
881   GroupButtonsLayout->setSpacing( 6 );
882   GroupButtonsLayout->setMargin( 11 );
883
884   QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons );
885   buttonOk->setAutoDefault( TRUE );
886   buttonOk->setDefault( TRUE );
887   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
888   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
889
890   QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons );
891   buttonCancel->setAutoDefault( TRUE );
892   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
893
894   QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons );
895   buttonHelp->setAutoDefault( TRUE );
896   GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
897
898   TopLayout->addWidget( aGB );
899   TopLayout->addWidget( myTabBox );
900   TopLayout->addWidget( GroupButtons );
901
902   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
903   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
904   connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
905 }
906
907 VisuGUI_GaussPointsDlg::~VisuGUI_GaussPointsDlg()
908 {}
909
910 void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
911                                                 bool theInit )
912 {
913   if( theInit )
914     myPrsCopy = VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
915
916   myScalarPane->initFromPrsObject( myPrsCopy, theInit );
917
918   bool isDeformed = myPrsCopy->GetIsDeformed();
919   myScaleSpinBox->setValue( myPrsCopy->GetScaleFactor() );
920   myDefShapeButton->setChecked( isDeformed );
921   myDefShapeButton->setEnabled( myPrsCopy->GetField()->myNbComp > 1 );
922   onToggleDefShape( isDeformed );
923
924   bool isResults = myPrsCopy->GetIsColored();
925   myResultsButton->setChecked( isResults && !isDeformed );
926   myGeometryButton->setChecked( !isResults && !isDeformed );
927
928   myPrimitiveBox->setPrimitiveType( myPrsCopy->GetPrimitiveType() );
929   myPrimitiveBox->setClampMaximum( myPrsCopy->GetMaximumSupportedSize() );
930   myPrimitiveBox->setClamp( myPrsCopy->GetClamp() );
931   myPrimitiveBox->setMainTexture( myPrsCopy->GetQMainTexture() );
932   myPrimitiveBox->setAlphaTexture( myPrsCopy->GetQAlphaTexture() );
933   myPrimitiveBox->setAlphaThreshold( myPrsCopy->GetAlphaThreshold() );
934   myPrimitiveBox->setResolution( myPrsCopy->GetResolution() );
935   myPrimitiveBox->setFaceLimit( myPrsCopy->GetFaceLimit() );
936
937   mySizeBox->setType( isResults || isDeformed ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry );
938   mySizeBox->setGeomSize( myPrsCopy->GetGeomSize() );
939   mySizeBox->setMinSize( myPrsCopy->GetMinSize() );
940   mySizeBox->setMaxSize( myPrsCopy->GetMaxSize() );
941   mySizeBox->setMagnification( myPrsCopy->GetMagnification() );
942   mySizeBox->setIncrement( myPrsCopy->GetMagnificationIncrement() );
943   mySizeBox->setColor( myPrsCopy->GetQColor() );
944
945   //Disable Size controls if there are no OpenGL extensions
946   char* ext = (char*)glGetString( GL_EXTENSIONS );
947   if( strstr( ext, "GL_ARB_point_sprite" ) == NULL ||
948       strstr( ext, "GL_ARB_shader_objects" ) == NULL ||
949       strstr( ext, "GL_ARB_vertex_buffer_object" ) == NULL )
950       mySizeBox->enableSizeControls(false);
951
952   if( !theInit )
953     return;
954
955   myInputPane->initFromPrsObject( myPrsCopy );
956   myTabBox->setCurrentIndex( 0 );
957 }
958
959 int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
960 {
961   if(!myInputPane->check())
962     return 0;
963
964   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
965   anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
966
967   myPrsCopy->SetIsDeformed( myDefShapeButton->isChecked() );
968   myPrsCopy->SetScaleFactor( myScaleSpinBox->value() );
969
970   int aPrimitiveType = myPrimitiveBox->getPrimitiveType();
971   myPrsCopy->SetPrimitiveType( VISU::GaussPoints::PrimitiveType( aPrimitiveType )  );
972
973   myPrsCopy->SetClamp( myPrimitiveBox->getClamp() );
974
975   QString aMainTexture = myPrimitiveBox->getMainTexture();
976   QString anAlphaTexture = myPrimitiveBox->getAlphaTexture();
977
978   aMainTexture = aMainTexture.isNull() ? myPrsCopy->GetQMainTexture() : aMainTexture;
979   anAlphaTexture = anAlphaTexture.isNull() ? myPrsCopy->GetQAlphaTexture() : anAlphaTexture;
980
981   myPrsCopy->SetTextures( aMainTexture.toLatin1().data(), anAlphaTexture.toLatin1().data() );
982
983   myPrsCopy->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() );
984
985   myPrsCopy->SetResolution( myPrimitiveBox->getResolution() );
986   myPrsCopy->SetFaceLimit( myPrimitiveBox->getFaceLimit() );
987
988   bool isColored = !myGeometryButton->isChecked();
989   if( isColored )
990   {
991     myPrsCopy->SetIsColored( true );
992     myPrsCopy->SetMinSize( mySizeBox->getMinSize() );
993     myPrsCopy->SetMaxSize( mySizeBox->getMaxSize() );
994   }
995   else
996   {
997     myPrsCopy->SetIsColored( false );
998     myPrsCopy->SetQColor( mySizeBox->getColor() );
999     myPrsCopy->SetGeomSize( mySizeBox->getGeomSize() );
1000   }
1001
1002   myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
1003   myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
1004
1005   VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs); 
1006   
1007   //Set created Gauss points presentation selected,
1008   //Issue 0019874(EDF 746 VISU: Picking alphanumeric Gauss)
1009   if(thePrs){
1010     SALOME_ListIO aListIO;
1011     //    LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule);
1012     Handle(SALOME_InteractiveObject) anIO = thePrs->GetIO();
1013     if(anIO && anIO->hasEntry()) {
1014       aListIO.Append(anIO);
1015       VISU::UpdateObjBrowser(myModule,true);
1016       //IPAL20836 aSelectionMgr->setSelectedObjects(aListIO); 
1017     }
1018     else
1019       myInputPane->SetRestoreInitialSelection(true);
1020   }
1021   return anIsOk;
1022 }
1023
1024 void VisuGUI_GaussPointsDlg::onToggleDefShape( bool on )
1025 {
1026   if( on )//myDefShapeButton->isChecked() )
1027   {
1028     myDefShapeBox->show();
1029     mySizeBox->setType( VVTK_SizeBox::Results );
1030   }
1031   else
1032     myDefShapeBox->hide();
1033 }
1034
1035 void VisuGUI_GaussPointsDlg::accept()
1036 {
1037   if( (bool)myPrsCopy && myPrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
1038   {
1039     int aNumberOfFaces = myPrimitiveBox->getFaceNumber();
1040     int aNumberOfPoints = myPrsCopy->GetSpecificPL()->GetInput()->GetNumberOfCells();
1041
1042     if( aNumberOfFaces * aNumberOfPoints > myPrimitiveBox->getFaceLimit() )
1043     {
1044       QString aWarning = "The number of faces needed to perform the 'Geometrical Sphere' primitive\n";
1045       aWarning.append( "presentation might be too important to ensure an acceptable frame rate.\n\n" );
1046       aWarning.append( "Can you please confirm that you want to continue anyway?" );
1047       if( SUIT_MessageBox::warning( this, tr( "Warning" ), aWarning, tr( "&OK" ), tr( "&Cancel" ) ) == 1 )
1048         return;
1049     }
1050
1051     /*
1052     float aMemory = 50.0 * 1024.0 * (float)aNumberOfFaces * (float)aNumberOfPoints;
1053
1054     cout << aNumberOfFaces << endl;
1055     cout << aNumberOfPoints << endl;
1056     cout << aMemory << endl;
1057
1058     vtkSphereSource* aSphere = vtkSphereSource::New();
1059     aSphere->SetThetaResolution( myPrimitiveBox->getResolution() );
1060     aSphere->SetPhiResolution( myPrimitiveBox->getResolution() );
1061     aSphere->GetOutput()->Update();
1062     aSphere->GetOutput()->GetActualMemorySize();
1063
1064     aMemory = aSphere->GetOutput()->GetActualMemorySize() * 1024.0 * (float)aNumberOfPoints;
1065
1066     if( VISU_PipeLine::CheckAvailableMemory( aMemory ) == 0 )
1067     {
1068       SUIT_MessageBox::error1( this, "caption", "text", "ok" );
1069       return 0;
1070     }
1071     */
1072   }
1073
1074   //if( myScalarPane->check() )
1075   VisuGUI_Prs3dDlg::accept();
1076 }
1077
1078 QString VisuGUI_GaussPointsDlg::GetContextHelpFilePath()
1079 {
1080   return "types_of_gauss_points_presentations_page.html";
1081 }