-// VISU VISUGUI : GUI of VISU component
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+// VISU VISUGUI : GUI of VISU component
// File : VisuGUI_Plot3DDlg.cxx
// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
-
+//
#include "VisuGUI_Plot3DDlg.h"
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_ViewManager_i.hh"
#include "VISU_Plot3DPL.hxx"
-#include "SALOME_Actor.h"
#include "SVTK_ViewWindow.h"
-#include <qlayout.h>
-#include <qvalidator.h>
-#include <qtabwidget.h>
+#include "SALOME_Actor.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "LightApp_Application.h"
+#include <SalomeApp_IntSpinBox.h>
+#include <SalomeApp_DoubleSpinBox.h>
+
+#include <QLayout>
+#include <QValidator>
+#include <QTabWidget>
+#include <QRadioButton>
+#include <QCheckBox>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QKeyEvent>
+#include <QButtonGroup>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
static void renderViewFrame (SVTK_ViewWindow* vw)
{
if (vw) {
-//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
- vw->getRenderer()->ResetCameraClippingRange();
- vw->Repaint();
-//}
+// vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
}
}
//=======================================================================
class TPlane : public SALOME_Actor
{
- float mySize;
+ vtkFloatingPointType mySize;
vtkDataSetMapper* myMapper;
vtkPlaneSource* myPlaneSource;
public:
// constructor
- TPlane(float planeSize): mySize(planeSize)
+ TPlane(vtkFloatingPointType planeSize): mySize(planeSize)
{
Init();
}
// set plane parameters
- void Set(float origin[3], float normal[3])
+ void Set(vtkFloatingPointType origin[3], vtkFloatingPointType normal[3])
{
- float point2[3], point1[3];
+ vtkFloatingPointType point2[3], point1[3];
vtkMath::Perpendiculars(normal, point1, point2, 0.);
for (int i = 0; i < 3; ++i) {
point1[ i ] = point1[ i ] * mySize + origin[ i ];
~TPlane() {
myMapper->RemoveAllInputs();
myMapper->Delete();
- myPlaneSource->UnRegisterAllOutputs();
+ // commented: porting to vtk 5.0
+ //myPlaneSource->UnRegisterAllOutputs();
myPlaneSource->Delete();
};
// Not implemented.
//purpose :
//=======================================================================
VisuGUI_Plot3DPane::VisuGUI_Plot3DPane (QWidget* parent)
- : QVBox(parent), myInitFromPrs(false), myPreviewActor(NULL),
- myViewWindow(VISU::GetViewWindow()), myPrs(NULL), myPipeCopy(NULL)
+ : QWidget(parent), myInitFromPrs(false), myPreviewActor(NULL),
+ myViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>()), myPrs(NULL), myPipeCopy(NULL)
{
- layout()->setAlignment(Qt::AlignTop);
- setSpacing(6);
+ QVBoxLayout* aMainLay = new QVBoxLayout( this );
+ aMainLay->setAlignment(Qt::AlignTop);
+ aMainLay->setSpacing(6);
// Orientation
- GBOrientation = new QButtonGroup (tr("Orientation"), this, "GBOrientation");
- GBOrientation->setTitle(tr("ORIENTATION"));
- GBOrientation->setColumnLayout(0, Qt::Vertical);
- GBOrientation->layout()->setSpacing(0);
- GBOrientation->layout()->setMargin(0);
- QGridLayout* BGOrientationLayout = new QGridLayout (GBOrientation->layout());
+ GBOrientation = new QButtonGroup ( this );
+ GBoxOrient = new QGroupBox(tr("ORIENTATION"),this);
+ aMainLay->addWidget(GBoxOrient);
+
+ //GBOrientation->setColumnLayout(0, Qt::Vertical);
+ //GBOrientation->layout()->setSpacing(0);
+ //GBOrientation->layout()->setMargin(0);
+ QGridLayout* BGOrientationLayout = new QGridLayout (GBoxOrient);
BGOrientationLayout->setAlignment(Qt::AlignTop);
BGOrientationLayout->setSpacing(6);
BGOrientationLayout->setMargin(11);
QRadioButton *RBxy, *RByz, *RBzx;
- RBxy = new QRadioButton (tr("// X-Y"), GBOrientation, "RBxy");
- RByz = new QRadioButton (tr("// Y-Z"), GBOrientation, "RByz");
- RBzx = new QRadioButton (tr("// Z-X"), GBOrientation, "RBzx");
+ RBxy = new QRadioButton (tr("// X-Y"), GBoxOrient );
+ RByz = new QRadioButton (tr("// Y-Z"), GBoxOrient );
+ RBzx = new QRadioButton (tr("// Z-X"), GBoxOrient );
BGOrientationLayout->addWidget(RBxy, 0, 0);
BGOrientationLayout->addWidget(RByz, 0, 1);
BGOrientationLayout->addWidget(RBzx, 0, 2);
+ GBOrientation->addButton( RBxy, 0 );
+ GBOrientation->addButton( RByz, 1 );
+ GBOrientation->addButton( RBzx, 2 );
+
// Rotation
- QGroupBox* GBrot = new QGroupBox (tr("ROTATIONS"), this, "GBrot");
- GBrot->setColumnLayout(0, Qt::Vertical);
- GBrot->layout()->setSpacing(0);
- GBrot->layout()->setMargin(0);
- QGridLayout* GBrotLayout = new QGridLayout (GBrot->layout());
+ QGroupBox* GBrot = new QGroupBox (tr("ROTATIONS"), this);
+ aMainLay->addWidget( GBrot );
+ //GBrot->setColumnLayout(0, Qt::Vertical);
+ //GBrot->layout()->setSpacing(0);
+ //GBrot->layout()->setMargin(0);
+ QGridLayout* GBrotLayout = new QGridLayout (GBrot);
GBrotLayout->setAlignment(Qt::AlignTop);
GBrotLayout->setSpacing(6);
GBrotLayout->setMargin(11);
// label 1
- LabelRot1 = new QLabel (tr("ROTATION_X"), GBrot, "LabelRot1");
+ LabelRot1 = new QLabel (tr("ROTATION_X"), GBrot );
GBrotLayout->addWidget(LabelRot1, 0, 0);
// spin 1
- Rot1 = new QtxDblSpinBox (-180, 180, 5, GBrot);
+ Rot1 = new SalomeApp_DoubleSpinBox (GBrot);
+ VISU::initSpinBox( Rot1, -180, 180, 5, "angle_precision" );
Rot1->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
GBrotLayout->addWidget(Rot1, 0, 1);
// label 2
- LabelRot2 = new QLabel (tr("ROTATION_Y"), GBrot, "LabelRot2");
+ LabelRot2 = new QLabel (tr("ROTATION_Y"), GBrot);
GBrotLayout->addWidget(LabelRot2, 1, 0);
// spin 2
- Rot2 = new QtxDblSpinBox (-180, 180, 5, GBrot);
+ Rot2 = new SalomeApp_DoubleSpinBox (GBrot);
+ VISU::initSpinBox( Rot2, -180, 180, 5, "angle_precision" );
Rot2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
GBrotLayout->addWidget(Rot2, 1, 1);
// Position
- QGroupBox* GBpos = new QGroupBox (tr("POSITION"), this, "GBpos");
- GBpos->setColumnLayout(0, Qt::Horizontal);
- GBpos->layout()->setSpacing(0);
- GBpos->layout()->setMargin(0);
- QGridLayout* GBposLayout = new QGridLayout (GBpos->layout());
+ QGroupBox* GBpos = new QGroupBox (tr("POSITION"), this);
+ aMainLay->addWidget( GBpos );
+ //GBpos->setColumnLayout(0, Qt::Horizontal);
+ //GBpos->layout()->setSpacing(0);
+ //GBpos->layout()->setMargin(0);
+ QGridLayout* GBposLayout = new QGridLayout (GBpos);
GBposLayout->setAlignment(Qt::AlignTop);
GBposLayout->setSpacing(6);
GBposLayout->setMargin(11);
// value label
- QLabel * valueLabel = new QLabel (tr("POSITION_VALUE"), GBpos, "LabelRot1");
+ QLabel * valueLabel = new QLabel (tr("POSITION_VALUE"), GBpos);
GBposLayout->addWidget(valueLabel, 0, 0);
// value spin
- PositionSpn = new QtxDblSpinBox (0, 1, 0.1, GBpos);
+ PositionSpn = new SalomeApp_DoubleSpinBox (GBpos);
+ VISU::initSpinBox( PositionSpn, 0, 1, 0.1, "parametric_precision" );
GBposLayout->addWidget(PositionSpn, 0, 1);
// Relative CheckBox
- RelativeChkB = new QCheckBox (tr("RELATIVE"), GBpos, "RelativeChkB");
+ RelativeChkB = new QCheckBox (tr("RELATIVE"), GBpos);
RelativeChkB->setChecked(true);
GBposLayout->addWidget(RelativeChkB, 0, 2);
// Scale, Presentation type, Nb Contours, Preview
QFrame* bottomFrame = new QFrame (this);
+ aMainLay->addWidget( bottomFrame );
QGridLayout* bottomLayout = new QGridLayout (bottomFrame);
bottomLayout->setAlignment(Qt::AlignTop);
bottomLayout->setSpacing(11);
bottomLayout->setMargin(0);
// scale
QLabel* scaleLabel = new QLabel (tr("SCALE"), bottomFrame);
- ScaleSpn = new QtxDblSpinBox (-1.e6, 1.e6, 0.1, bottomFrame);
+ ScaleSpn = new SalomeApp_DoubleSpinBox (bottomFrame);
+ VISU::initSpinBox( ScaleSpn, -1.e38, 1.e38, 0.1, "visual_data_precision" );
// Presentation type
- GBPrsType = new QHButtonGroup (tr("PRESENTATION_TYPE"), bottomFrame);
- new QRadioButton (tr("SURFACE"), GBPrsType);
- new QRadioButton (tr("CONTOUR"), GBPrsType);
+ GBPrsType = new QButtonGroup ( bottomFrame);
+ QGroupBox* aGB = new QGroupBox (tr("PRESENTATION_TYPE"), bottomFrame);
+ QHBoxLayout* aHBoxLay = new QHBoxLayout( aGB );
+
+ QRadioButton* aRB = new QRadioButton (tr("SURFACE"), aGB);
+ aHBoxLay->addWidget( aRB );
+ GBPrsType->addButton( aRB, 0 );
+ aRB = new QRadioButton (tr("CONTOUR"), aGB);
+ aHBoxLay->addWidget( aRB );
+ GBPrsType->addButton( aRB, 1 );
// nb Contours
QLabel* nbContLabel = new QLabel (tr("NUMBER_CONTOURS"), bottomFrame);
- NbContoursSpn = new QSpinBox (1, 999, 1, bottomFrame, "NbContoursSpn");
+ NbContoursSpn = new SalomeApp_IntSpinBox ( bottomFrame );
+ NbContoursSpn->setAcceptNames( false );
+ NbContoursSpn->setMinimum( 1 );
+ NbContoursSpn->setMaximum( 999 );
+ NbContoursSpn->setSingleStep( 1 );
+
// Preview
PreviewChkB = new QCheckBox (tr("PREVIEW"), bottomFrame);
PreviewChkB->setChecked(false);
bottomLayout->addWidget(scaleLabel, 0, 0);
bottomLayout->addWidget(ScaleSpn, 0, 1);
- bottomLayout->addMultiCellWidget(GBPrsType, 1, 1, 0, 1);
+ bottomLayout->addWidget(aGB, 1, 0, 1, 2);
bottomLayout->addWidget(nbContLabel, 2, 0);
bottomLayout->addWidget(NbContoursSpn, 2, 1);
bottomLayout->addWidget(PreviewChkB, 3, 0);
// signals and slots connections
- connect(GBOrientation, SIGNAL(clicked(int)), this, SLOT(orientationChanged(int)));
+ connect(GBOrientation, SIGNAL(buttonClicked(int)), this, SLOT(orientationChanged(int)));
connect(Rot1, SIGNAL(valueChanged(double)), this, SLOT(updatePreview()));
connect(Rot2, SIGNAL(valueChanged(double)), this, SLOT(updatePreview()));
connect(PositionSpn, SIGNAL(valueChanged(double)), this, SLOT(onPositionSpn()));
connect(RelativeChkB, SIGNAL(toggled(bool)), this, SLOT(onRelativePos(bool)));
- connect(GBPrsType, SIGNAL(clicked(int)), this, SLOT(onPrsType(int)));
+ connect(GBPrsType, SIGNAL(buttonClicked(int)), this, SLOT(onPrsType(int)));
connect(PreviewChkB, SIGNAL(toggled(bool)), this, SLOT(updatePreview()));
}
//purpose :
//=======================================================================
VisuGUI_Plot3DPane::~VisuGUI_Plot3DPane()
-{
-}
+{}
//=======================================================================
//function : storePrsParams
if (!myPipeCopy)
myPipeCopy = VISU_Plot3DPL::New();
if (myPrs) {
- myPipeCopy->ShallowCopy(myPrs->GetPL());
+ myPipeCopy->ShallowCopy(myPrs->GetPipeLine(), true);
storeToPrsObject(myPrs);
}
}
if (!myPipeCopy)
myPipeCopy = VISU_Plot3DPL::New();
if (myPrs)
- myPrs->GetPL()->ShallowCopy(myPipeCopy);
+ myPrs->GetPipeLine()->ShallowCopy(myPipeCopy, false);
}
//=======================================================================
void VisuGUI_Plot3DPane::onPositionSpn()
{
if (myPrs && !RelativeChkB->isChecked()) {
- float minPos, maxPos;
+ vtkFloatingPointType minPos, maxPos;
storePrsParams();
- myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos);
+ myPrs->GetSpecificPL()->GetMinMaxPosition(minPos, maxPos);
restorePrsParams();
if (minPos > PositionSpn->value())
minPos = PositionSpn->value();
//=======================================================================
void VisuGUI_Plot3DPane::onRelativePos(bool isRelativePos)
{
- float minPos = 0., maxPos = 1., pos = PositionSpn->value();
+ vtkFloatingPointType minPos = 0., maxPos = 1., pos = PositionSpn->value();
if (myPrs) {
storePrsParams();
- myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos);
+ myPrs->GetSpecificPL()->GetMinMaxPosition(minPos, maxPos);
restorePrsParams();
- if (isRelativePos) // absolute -> relative
- pos = (pos - minPos) / (maxPos - minPos);
- else // relative -> absolute
- pos = minPos * (1. - pos) + maxPos * pos;
+ if (-1e-7 < (maxPos - minPos) && (maxPos - minPos) < 1e-7) {
+ pos = 0;
+ } else {
+ if (isRelativePos) // absolute -> relative
+ pos = (pos - minPos) / (maxPos - minPos);
+ else // relative -> absolute
+ pos = minPos * (1. - pos) + maxPos * pos;
+ }
}
if (isRelativePos) {
minPos = 0.;
maxPos = 1.;
}
- PositionSpn->setMinValue(minPos);
- PositionSpn->setMaxValue(maxPos);
- PositionSpn->setLineStep((maxPos - minPos) / 10.);
+ PositionSpn->setMinimum(minPos);
+ PositionSpn->setMaximum(maxPos);
+ PositionSpn->setSingleStep((maxPos - minPos) / 10.);
PositionSpn->setValue(pos);
}
//=======================================================================
void VisuGUI_Plot3DPane::updatePreview()
{
- if (myInitFromPrs || !myPrs || !myViewWindow)
+ if(myPreviewActor){
+ vtkRenderer* aRend = myPreviewActor->GetRenderer();
+ vtkRenderWindow* aWnd = aRend->GetRenderWindow();
+ if (!aWnd) return;
+ }
+ if (myInitFromPrs || !myPrs || !myViewWindow)
return;
bool fitall = false;
if (PreviewChkB->isChecked()) // place preview plane
if (!planePreview) {
myPreviewActor = planePreview = new TPlane(myPrs->GetInput()->GetLength());
myViewWindow->AddActor(planePreview);
- fitall = !VISU::GetActor(myPrs, myViewWindow);
+ fitall = !VISU::FindActor(myViewWindow, myPrs);
}
// set plane parameters corresponding to control values
storePrsParams();
- float normal[3], origin[3];
- myPrs->GetPlot3DPL()->GetBasePlane(origin, normal, true);
+ vtkFloatingPointType normal[3], origin[3];
+ myPrs->GetSpecificPL()->GetBasePlane(origin, normal, true);
planePreview->Set(origin, normal);
restorePrsParams();
}
renderViewFrame(myViewWindow);
- if (fitall) {
+ if (fitall && VISU::GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false)) {
myPreviewActor->SetInfinitive(false);
myViewWindow->onFitAll();
myPreviewActor->SetInfinitive(true);
case VISU::Plot3D::YZ: id = 1; break;
default: id = 2;
}
- GBOrientation->setButton(id);
- orientationChanged(id);
+ GBOrientation->button(id)->click();
// rotation
Rot1->setValue(thePrs->GetRotateX() * 180./PI);
// prs type
id = thePrs->GetIsContourPrs() ? CONTOUR_PRS_ID : SURFACE_PRS_ID;
- GBPrsType->setButton(id);
- onPrsType(id);
+ GBPrsType->button(id)->click();
// nb contours
NbContoursSpn->setValue(thePrs->GetNbOfContours());
// disable cutting plane controls if the mesh is planar
- if (thePrs->GetPL()->IsPlanarInput())
+ if (thePrs->GetPipeLine()->IsPlanarInput())
{
- GBOrientation->setEnabled(false);
+ //GBOrientation->setEnabled(false);
+ GBoxOrient->setEnabled(false);
Rot1 ->setEnabled(false);
Rot2 ->setEnabled(false);
PositionSpn ->setEnabled(false);
if (myInitFromPrs)
return 0;
// orientation
- int id = GBOrientation->id (GBOrientation->selected());
+ int id = GBOrientation->id (GBOrientation->checkedButton());
VISU::Plot3D::Orientation ori;
switch (id) {
case 0 : ori = VISU::Plot3D::XY; break;
thePrs->SetScaleFactor(ScaleSpn->value());
// prs type
- id = GBPrsType->id (GBPrsType->selected());
+ id = GBPrsType->id (GBPrsType->checkedButton());
thePrs->SetContourPrs(id == CONTOUR_PRS_ID);
// nb contours
//=======================================================================
bool VisuGUI_Plot3DPane::check()
{
- if (myPreviewActor && myViewWindow) // erase preview
- {
+ if(!myPreviewActor) return true;
+
+ vtkRenderer* aRend = myPreviewActor->GetRenderer();
+ vtkRenderWindow* aWnd = aRend->GetRenderWindow();
+ if(aRend && aWnd){
myPreviewActor->SetVisibility(false);
myViewWindow->RemoveActor(myPreviewActor);
myPreviewActor->Delete();
myPreviewActor = 0;
}
-
+
return true;
}
+void VisuGUI_Plot3DPane::setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos)
+{
+ // Set plane
+ int id;
+ switch (theOrientation) {
+ case VISU::Plot3D::XY: id = 0; break;
+ case VISU::Plot3D::YZ: id = 1; break;
+ default: id = 2;
+ }
+ GBOrientation->button(id)->click();
+ GBoxOrient->setEnabled(false);
+
+
+ // Set rotation
+ Rot1->setValue(theXRotation * 180./PI);
+ Rot1->setEnabled(false);
+ Rot2->setValue(theYRotation * 180./PI);
+ Rot2->setEnabled(false);
+
+ // Set position
+ RelativeChkB->setChecked(false);
+ onRelativePos(false); // update range
+ PositionSpn->setValue(thePlanePos);
+ RelativeChkB->setEnabled(false);
+ PositionSpn->setEnabled(false);
+}
+
+
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
-VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg(QWidget* parent)
- : QDialog(parent, "VisuGUI_Plot3DDlg", false, WStyle_Customize |
- WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule)
+ : VisuGUI_ScalarBarBaseDlg(theModule)
{
- setCaption(tr("TITLE"));
+ setWindowTitle(tr("TITLE"));
setSizeGripEnabled(TRUE);
QVBoxLayout* TopLayout = new QVBoxLayout(this);
TopLayout->setSpacing(6);
TopLayout->setMargin(11);
- QTabWidget* aTabBox = new QTabWidget (this);
+ myTabBox = new QTabWidget (this);
myIsoPane = new VisuGUI_Plot3DPane (this);
- myIsoPane->setMargin(5);
- aTabBox->addTab(myIsoPane, tr("PLOT3D_TAB_TITLE"));
- myScalarPane = new VisuGUI_ScalarBarPane (this, false);
- myScalarPane->setMargin(5);
- aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB_TITLE"));
+ if ( myIsoPane->layout() )
+ myIsoPane->layout()->setMargin(5);
+ myTabBox->addTab(myIsoPane, tr("PLOT3D_TAB_TITLE"));
+ myInputPane = new VisuGUI_InputPane(VISU::TPLOT3D, theModule, this);
+ myTabBox->addTab(GetScalarPane(), tr("SCALAR_BAR_TAB_TITLE"));
+ myTabBox->addTab(myInputPane, tr("INPUT_TAB_TITLE"));
- TopLayout->addWidget(aTabBox);
+ TopLayout->addWidget(myTabBox);
- QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
+ QGroupBox* GroupButtons = new QGroupBox (this );
GroupButtons->setGeometry(QRect(10, 10, 281, 48));
- GroupButtons->setColumnLayout(0, Qt::Vertical);
- GroupButtons->layout()->setSpacing(0);
- GroupButtons->layout()->setMargin(0);
- QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout());
+ //GroupButtons->setColumnLayout(0, Qt::Vertical);
+ //GroupButtons->layout()->setSpacing(0);
+ //GroupButtons->layout()->setMargin(0);
+ QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons);
GroupButtonsLayout->setAlignment(Qt::AlignTop);
GroupButtonsLayout->setSpacing(6);
GroupButtonsLayout->setMargin(11);
- QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons, "buttonOk");
+ QPushButton* buttonOk = new QPushButton (tr("BUT_OK"), GroupButtons);
buttonOk->setAutoDefault(TRUE);
buttonOk->setDefault(TRUE);
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
GroupButtonsLayout->addItem(new QSpacerItem (5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
- QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons, "buttonCancel");
+ QPushButton* buttonCancel = new QPushButton (tr("BUT_CANCEL") , GroupButtons);
buttonCancel->setAutoDefault(TRUE);
GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
+ QPushButton* buttonHelp = new QPushButton (tr("BUT_HELP") , GroupButtons);
+ buttonHelp->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonHelp, 0, 3);
TopLayout->addWidget(GroupButtons);
// signals and slots connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
}
+VisuGUI_Plot3DDlg::~VisuGUI_Plot3DDlg()
+{}
+
//=======================================================================
//function : accept
//purpose :
//=======================================================================
void VisuGUI_Plot3DDlg::accept()
{
-/*if (!VISU::CheckActiveStudyLock()) {
- return;
- }
- if (myIsoPane->check() && myScalarPane->check()) {
- if (!isModal()) {
- VISU::Plot3D_i* prs = myIsoPane->GetPrs();
- bool isCreation = !VISU::GetActor(prs, myViewWindow);
- if (storeToPrsObject(prs)) {
- if (isCreation) { // creation
- if (myViewWindow) {
- try {
- VISU::CreateActor(prs);
- }
- catch (...) {
- reject();
- return;
- }
- myViewWindow->onFitAll();
- }
- } else { // edition
- VISU::RecreateActor(prs);
- renderViewFrame(myViewWindow);
- }
- } else {
- if (isCreation) {
- prs->RemoveFromStudy();
- //study->updateObjBrowser();
- }
- }
-}*/
- QDialog::accept();
-//}
+ if (myIsoPane->check() && GetScalarPane()->check())
+ VisuGUI_ScalarBarBaseDlg::accept();
}
//=======================================================================
//=======================================================================
void VisuGUI_Plot3DDlg::reject()
{
- myIsoPane->check(); // hide preview
-
-/*if (!isModal() && myIsoPane->GetPrs() &&
- !VISU::GetActor(myIsoPane->GetPrs(), myViewWindow)) {
- _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
- if (!aStudy->GetProperties()->IsLocked()) {
- myIsoPane->GetPrs()->RemoveFromStudy();
- myIsoPane->GetStudyFrame()->getStudy()->updateObjBrowser();
- }
-}*/
- QDialog::reject();
+ VisuGUI_ScalarBarBaseDlg::reject();
+}
+
+//=======================================================================
+//function : initFromPrsObject
+//purpose :
+//=======================================================================
+void VisuGUI_Plot3DDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+ bool theInit )
+{
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TPLOT3D>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+ VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
+ myIsoPane->initFromPrsObject(myPrsCopy);
+
+ if( !theInit )
+ return;
+
+ myInputPane->initFromPrsObject( myPrsCopy );
+ myTabBox->setCurrentIndex( 0 );
+}
+
+//=======================================================================
+//function : storeToPrsObject
+//purpose :
+//=======================================================================
+int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
+{
+ if(!myInputPane->check() || !GetScalarPane()->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
+ anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
+
+ VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(myPrsCopy, thePrs);
+
+ return anIsOk;
+}
+
+//=======================================================================
+//function : onHelp
+//purpose :
+//=======================================================================
+QString VisuGUI_Plot3DDlg::GetContextHelpFilePath()
+{
+ return "plot_3d_page.html";
+}
+
+//=======================================================================
+//function : setPlane
+//purpose :
+//=======================================================================
+void VisuGUI_Plot3DDlg::setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos)
+{
+ myIsoPane->setPlane(theOrientation, theXRotation, theYRotation, thePlanePos);
}