// 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
//
//
//
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
-#include "SalomeApp_Application.h"
+#include "VISU_ColoredPrs3dFactory.hh"
+
+#include "LightApp_Application.h"
#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
#include <limits.h>
using namespace std;
-VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent)
- : QVBox(parent)
+VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent,
+ VisuGUI_ScalarBarPane* theScalarPane)
+ : QVBox(parent),
+ myScalarPane(theScalarPane)
{
QFrame* TopGroup = new QFrame( this, "TopGroup" );
TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
LabelMax->setBuddy(MaxIso);
TopGroupLayout->addWidget( MaxIso, 2, 1 );
-
-// CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup);
-// CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
-// TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1);
-// CBUpdate->setChecked(false);
QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup);
TopGroupLayout->addMultiCellWidget( aUpdateBtn, 3, 3, 0, 1);
connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
-
-// CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup);
-// CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
-// TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1);
}
void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs)
NbrIso->setValue(thePrs->GetNbSurfaces());
MinIso->setText(QString::number(thePrs->GetSubMin()));
MaxIso->setText(QString::number(thePrs->GetSubMax()));
-// switch(thePrs->GetScaling()){
-// case VISU::LOGARITHMIC :
-// CBLog->setChecked(true);
-// break;
-// default:
-// CBLog->setChecked(false);
-// }
}
int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs)
thePrs->SetNbSurfaces(NbrIso->value());
thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
return 1;
-// if (CBUpdate->isChecked())
-// {
-// thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
-// if (CBLog->isChecked())
-// thePrs->SetScaling(VISU::LOGARITHMIC);
-// else
-// thePrs->SetScaling(VISU::LINEAR);
-// }
}
void VisuGUI_IsoSurfPane::onCBUpdate()
{
- // if (CBUpdate->isChecked()) {
myScalarPane->setRange(MinIso->text().toDouble(), MaxIso->text().toDouble(), true);
- // }
-// CBLog->setDisabled(false);
-// else CBLog->setDisabled(true);
}
bool VisuGUI_IsoSurfPane::check()
tr("MSG_MINMAX_VALUES"),
tr("BUT_OK"));
return false;
- } // else if (/* CBUpdate->isChecked() && CBLog->isChecked() && */
-// (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) ) {
-// SUIT_MessageBox::warn1( this,
-// tr("WRN_VISU"),
-// tr("WRN_LOGARITHMIC_RANGE_ISOSURF"),
-// tr("BUT_OK"));
-// return false;
-// }
+ }
return true;
}
Constructor
*/
VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_IsoSurfacesDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ : VisuGUI_ScalarBarBaseDlg(theModule)
{
setCaption(tr("DEFINE_ISOSURFACES"));
setSizeGripEnabled( TRUE );
TopLayout->setSpacing( 6 );
TopLayout->setMargin(11);
- QTabWidget* aTabBox = new QTabWidget(this);
- myIsoPane = new VisuGUI_IsoSurfPane(this);
+ myTabBox = new QTabWidget(this);
+ myIsoPane = new VisuGUI_IsoSurfPane(this, GetScalarPane());
myIsoPane->setMargin( 5 );
- aTabBox->addTab(myIsoPane, "Iso Surface");
- myScalarPane = new VisuGUI_ScalarBarPane(this, false);
- myIsoPane->setScalarBarPane(myScalarPane);
- myScalarPane->setMargin( 5 );
- aTabBox->addTab(myScalarPane, "Scalar Bar");
+ myTabBox->addTab(myIsoPane, "Iso Surface");
+ myInputPane = new VisuGUI_InputPane(VISU::TISOSURFACES, theModule, this);
+ myTabBox->addTab(GetScalarPane(), "Scalar Bar");
+ myTabBox->addTab(myInputPane, "Input");
- TopLayout->addWidget(aTabBox);
+ TopLayout->addWidget(myTabBox);
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+ QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" );
+ 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_IsoSurfacesDlg::~VisuGUI_IsoSurfacesDlg()
+{}
+
void VisuGUI_IsoSurfacesDlg::accept()
{
- if (myIsoPane->check() && myScalarPane->check())
- QDialog::accept();
+ if ( myIsoPane->check() )
+ VisuGUI_ScalarBarBaseDlg::accept();
+}
+
+void VisuGUI_IsoSurfacesDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+ bool theInit )
+{
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TISOSURFACES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+ VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
+ myIsoPane->initFromPrsObject(myPrsCopy);
+
+ if( !theInit )
+ return;
+
+ myInputPane->initFromPrsObject( myPrsCopy );
+ myTabBox->setCurrentPage( 0 );
+}
+
+int VisuGUI_IsoSurfacesDlg::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::TISOSURFACES>().Copy(myPrsCopy, thePrs);
+
+ return anIsOk;
+}
+
+QString VisuGUI_IsoSurfacesDlg::GetContextHelpFilePath()
+{
+ return "iso_surfaces_page.html";
}