theReInit boolean flag is added to Prs3d::Apply() - to reinitialize dialogs when the input is changing.
* \return True of the set of input parameters is correct and was succesfully applied,
* False otherwise
*/
- boolean Apply();
+ boolean Apply(in boolean theReInit);
//! Sets Result object used by presentation to obtain its input
void SetResultObject(in Result theResult);
VISU_ScalarMapPL
::SetScalarRange(vtkFloatingPointType theRange[2])
{
+ //cout << "VISU_ScalarMapPL::SetScalarRange" << endl;
if(!VISU::CheckIsSameRange(GetScalarRange(), theRange)){
+ //cout << "( " << theRange[0] << " : " << theRange[1] << " )"<< endl;
myFieldTransform->SetScalarRange(theRange);
myBarTable->SetRange(theRange);
}
VisuGUI_ClippingDlg.cxx \
VisuGUI_DialogRunner.cxx \
VisuGUI_OffsetDlg.cxx \
- VisuGUI_Plot3DDlg.cxx \
+ VisuGUI_Prs3dDlg.cxx \
VisuGUI_ScalarBarDlg.cxx \
+ VisuGUI_Plot3DDlg.cxx \
VisuGUI_GaussPointsDlg.cxx \
VisuGUI_DeformedShapeDlg.cxx \
VisuGUI_IsoSurfacesDlg.cxx \
VisuGUI_ClippingDlg.h \
VisuGUI_DialogRunner.h \
VisuGUI_OffsetDlg.h \
- VisuGUI_Plot3DDlg.h \
+ VisuGUI_Prs3dDlg.h \
VisuGUI_ScalarBarDlg.h \
+ VisuGUI_Plot3DDlg.h \
VisuGUI_GaussPointsDlg.h \
VisuGUI_DeformedShapeDlg.h \
VisuGUI_IsoSurfacesDlg.h \
msgstr "Z :"
+#: VisuGUI_InputPane.cxx
+
+msgid "VisuGUI_InputPane::MED_FILE"
+msgstr "Med File :"
+
+msgid "VisuGUI_InputPane::MESH"
+msgstr "Mesh :"
+
+msgid "VisuGUI_InputPane::ENTITY"
+msgstr "Entity :"
+
+msgid "VisuGUI_InputPane::FIELD"
+msgstr "Field :"
+
+msgid "VisuGUI_InputPane::TIME_STAMP"
+msgstr "Time Stamp :"
+
+msgid "VisuGUI_InputPane::REINITIALIZE"
+msgstr "Reinitialize"
+
+
+
#: VisuGUI_ScalarBarDlg.cxx
msgid "VisuGUI_ScalarBarDlg::&OK"
#include "VISU_Gen_i.hh"
#include "VISU_CutLines_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_PipeLine.hxx"
#include "VISU_PipeLineUtils.hxx"
#include <qhbox.h>
#include <qtabwidget.h>
#include <qhgroupbox.h>
+#include <qlineedit.h>
#include <vtkRenderer.h>
#include <vtkPolyData.h>
bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutLinesDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- myPreviewActor(0),myPreviewActorGlyphs(0)
+ : VisuGUI_Prs3dDlg(theModule),
+ myPreviewActor(0),myPreviewActorGlyphs(0)
{
setCaption("Cut Lines Definition");
setSizeGripEnabled(true);
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
+void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- myPrs = thePrs;
- myScalarPane->initFromPrsObject(thePrs);
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
- if( thePrs->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( thePrs );
- myTabBox->showPage( myInputPane );
- }
- myTabBox->setCurrentPage( 0 );
+ myScalarPane->initFromPrsObject(myPrsCopy);
- myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
- myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
- myPosSpn->setValue(thePrs->GetDisplacement());
- setOrientation(thePrs->GetOrientationType());
+ myRotXSpn->setValue(myPrsCopy->GetRotateX()*180./PI);
+ myRotYSpn->setValue(myPrsCopy->GetRotateY()*180./PI);
+ myPosSpn->setValue(myPrsCopy->GetDisplacement());
+ setOrientation(myPrsCopy->GetOrientationType());
- myNbSpn->setValue( (int)thePrs->GetNbLines() );
- myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
- myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
- myPosSpn2->setValue(thePrs->GetDisplacement2());
- setOrientation2(thePrs->GetOrientationType2());
+ myNbSpn->setValue( (int)myPrsCopy->GetNbLines() );
+ myRotXSpn2->setValue(myPrsCopy->GetRotateX2()*180./PI);
+ myRotYSpn2->setValue(myPrsCopy->GetRotateY2()*180./PI);
+ myPosSpn2->setValue(myPrsCopy->GetDisplacement2());
+ setOrientation2(myPrsCopy->GetOrientationType2());
hasInit = true;
- myCutLines = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
- myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted());
+ myCutLines = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(myPrsCopy, VISU::ColoredPrs3d_i::EDoNotPublish);
+ myCutLines->CopyCurvesInverted(myPrsCopy->GetCurvesInverted());
if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true);
myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
- myCBSetDef->setChecked(thePrs->IsDefault());
+ myCBSetDef->setChecked(myPrsCopy->IsDefault());
DrawTable();
// Draw Preview
if (myPreviewCheck->isChecked()) {
createPlanes();
}
+
+ if( !theInit )
+ return;
+
+ if( myPrsCopy->IsTimeStampFixed() )
+ myTabBox->removePage( myInputPane );
+ else
+ {
+ myInputPane->initFromPrsObject( myPrsCopy );
+ myTabBox->showPage( myInputPane );
+ }
+ myTabBox->setCurrentPage( 0 );
}
//------------------------------------------------------------------------------
-int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
+int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
{
- myScalarPane->storeToPrsObject(thePrs);
+ myScalarPane->storeToPrsObject(myPrsCopy);
- if( !thePrs->IsTimeStampFixed() )
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- myInputPane->storeToPrsObject( thePrs );
+ myInputPane->storeToPrsObject( myPrsCopy );
}
- thePrs->SetOrientation(getOrientaion(),
- myRotXSpn->value()*PI/180.,
- myRotYSpn->value()*PI/180.);
- thePrs->SetDisplacement(myPosSpn->value());
- thePrs->SetNbLines((int)myNbSpn->value());
+ myPrsCopy->SetOrientation(getOrientaion(),
+ myRotXSpn->value()*PI/180.,
+ myRotYSpn->value()*PI/180.);
+ myPrsCopy->SetDisplacement(myPosSpn->value());
+ myPrsCopy->SetNbLines((int)myNbSpn->value());
- thePrs->SetOrientation2(getOrientaion(false),
- myRotXSpn2->value()*PI/180.,
- myRotYSpn2->value()*PI/180.);
- thePrs->SetDisplacement2(myPosSpn2->value());
+ myPrsCopy->SetOrientation2(getOrientaion(false),
+ myRotXSpn2->value()*PI/180.,
+ myRotYSpn2->value()*PI/180.);
+ myPrsCopy->SetDisplacement2(myPosSpn2->value());
if (!myCBSetDef->isChecked())
- thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
- else thePrs->SetDefault();
+ myPrsCopy->SetBasePlanePosition(myBasePlanePos->text().toDouble());
+ else myPrsCopy->SetDefault();
for (int i = 0; i < (int)myNbSpn->value(); ++i) {
if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
- thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
- else thePrs->SetDefaultPosition(i);
+ myPrsCopy->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
+ else myPrsCopy->SetDefaultPosition(i);
}
if (myAllCurvesInvertedCheck->isChecked())
- thePrs->SetAllCurvesInverted(true);
+ myPrsCopy->SetAllCurvesInverted(true);
+
+ VISU::TSameAsFactory<VISU::TCUTLINES>().Copy(thePrs, myPrsCopy);
+
return 1;
}
MYGenerateCurve = myCurvesCheck->isChecked();
// if (myScalarPane->check()) {
/*jfa tmp:((QWidget*)sender())->setDisabled(true);
- storeToPrsObject(myPrs);
+ storeToPrsObject(myPrsCopy);
if (myIsCreation) {
if (isGenerateTable()) {
- visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
+ visuGUI->GetVisuGen()->CreateTable(myPrsCopy->GetEntry());
if (isGenerateCurves()) {
SALOMEDSClient_Study* aStudy = study()->studyDS();
- SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+ SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrsCopy->GetEntry());
if( aSObject ) {
SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
}
if (GET_VTK_VIEWWINDOW(myMgr)) {
try {
- visuGUI->CreateActor(myPrs);
+ visuGUI->CreateActor(myPrsCopy);
} catch (...) {
reject();
return;
GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
}
} else {
- visuGUI->RecreateActor(myPrs);
+ visuGUI->RecreateActor(myPrsCopy);
if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
vf->getRenderer()->ResetCameraClippingRange();
}
// Remove old Table
SALOMEDSClient_Study* aStudy = study()->studyDS();
- SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+ SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrsCopy->GetEntry());
if( aSObject ) {
SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
void VisuGUI_CutLinesDlg::reject()
{
/*jfa tmp:if (myIsCreation) {
- myPrs->RemoveFromStudy();
+ myPrsCopy->RemoveFromStudy();
VisuGUI::application()->objectBrowser()->updateTree();
}*/
myScalarPane->deletePreview();
{
if (myAllCurvesInvertedCheck->isChecked()){
myCutLines->SetAllCurvesInverted(true);
- myPrs->SetAllCurvesInverted(true);
+ myPrsCopy->SetAllCurvesInverted(true);
}
else {
myCutLines->SetAllCurvesInverted(false);
- myPrs->SetAllCurvesInverted(false);
+ myPrsCopy->SetAllCurvesInverted(false);
}
updateGlyphs(true);
}
#include <qhbuttongroup.h>
#include <qvalidator.h>
#include <qtabwidget.h>
+#include <qcheckbox.h>
+
+class QLineEdit;
class SUIT_ViewManager;
class SalomeApp_Module;
class CutLines_i;
}
-class VisuGUI_CutLinesDlg: public QDialog
+class VisuGUI_CutLinesDlg: public VisuGUI_Prs3dDlg
{
Q_OBJECT
VisuGUI_CutLinesDlg (SalomeApp_Module* theModule);
~VisuGUI_CutLinesDlg();
- void initFromPrsObject (VISU::CutLines_i* thePrs);
- int storeToPrsObject (VISU::CutLines_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
bool isGenerateTable() { return myCreateTable->isChecked(); }
bool isGenerateCurves() { return myCreateTable->isChecked() && myCurvesCheck->isChecked(); }
QCheckBox* myPreviewCheck;
QCheckBox* myAllCurvesInvertedCheck;
- VISU::CutLines_i* myPrs;
+ SALOME::GenericObjPtr<VISU::CutLines_i> myPrsCopy;
//jfa tmp:SUIT_ViewManager *myMgr;
//jfa tmp:SUIT_ViewWindow *myStudyWnd;
#include "VisuGUI_ViewTools.h"
#include "VisuGUI_InputPane.h"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_CutPlanes_i.hh"
#include "VISU_CutPlanesPL.hxx"
#include "SUIT_ResourceMgr.h"
#include <qlayout.h>
+#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qstyle.h>
#include <qstring.h>
Constructor
*/
VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutPlanesDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ : VisuGUI_Prs3dDlg(theModule)
{
setCaption("Cut Planes Definition");
setSizeGripEnabled(true);
// this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
}
-void VisuGUI_CutPlanesDlg::initFromPrsObject (VISU::CutPlanes_i* thePrs)
+void VisuGUI_CutPlanesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- myPrs = thePrs;
- myScalarPane->initFromPrsObject(thePrs);
- myCutPane->initFromPrsObject(thePrs);
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TCUTPLANES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+ myScalarPane->initFromPrsObject( myPrsCopy );
+
+ if( !theInit )
+ return;
- if( thePrs->IsTimeStampFixed() )
+ myScalarPane->initFromPrsObject(myPrsCopy);
+ myCutPane->initFromPrsObject(myPrsCopy);
+
+ if( myPrsCopy->IsTimeStampFixed() )
myTabBox->removePage( myInputPane );
else
{
- myInputPane->initFromPrsObject( thePrs );
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->showPage( myInputPane );
}
myTabBox->setCurrentPage( 0 );
}
-int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::CutPlanes_i* thePrs)
+int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
{
int ok = 1;
- if( !thePrs->IsTimeStampFixed() )
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- ok = myInputPane->storeToPrsObject( thePrs );
+ ok = myInputPane->storeToPrsObject(myPrsCopy);
}
- return ok && myScalarPane->storeToPrsObject(thePrs) && myCutPane->storeToPrsObject(thePrs);
+ ok = ok && myScalarPane->storeToPrsObject(myPrsCopy) && myCutPane->storeToPrsObject(myPrsCopy);
+
+ VISU::TSameAsFactory<VISU::TCUTPLANES>().Copy(thePrs, myPrsCopy);
+
+ return ok;
}
void VisuGUI_CutPlanesDlg::accept()
#ifndef VISUGUI_CUTPLANESDLG_H
#define VISUGUI_CUTPLANESDLG_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
#include "VISU_CutPlanes_i.hh"
#include <SALOME_Actor.h>
+#include <qspinbox.h>
#include <qradiobutton.h>
#include <qtable.h>
#include <qtabwidget.h>
+#include <QtxDblSpinBox.h>
+
#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(VISU_Gen)
-class QtxDblSpinBox;
class SUIT_ViewWindow;
class SUIT_ViewManager;
class SalomeApp_Module;
class VisuGUI_InputPane;
-
class VisuGUI_CutPlanesPane : public QFrame
{
Q_OBJECT
};
-class VisuGUI_CutPlanesDlg : public QDialog
+class VisuGUI_CutPlanesDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT
VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule);
~VisuGUI_CutPlanesDlg() {};
- void initFromPrsObject (VISU::CutPlanes_i* thePrs);
- int storeToPrsObject (VISU::CutPlanes_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
private:
void keyPressEvent( QKeyEvent* e );
VisuGUI_ScalarBarPane* myScalarPane;
VisuGUI_InputPane* myInputPane;
VISU::CutPlanes_i* myPrs;
+ SALOME::GenericObjPtr<VISU::CutPlanes_i> myPrsCopy;
};
#include "VisuGUI_Tools.h"
#include "VisuGUI_InputPane.h"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_DeformedShape_i.hh"
#include "SalomeApp_Module.h"
* Constructor
*/
VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_DeformedShapeDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ : VisuGUI_Prs3dDlg(theModule)
{
setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
}
-void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::DeformedShape_i* thePrs)
+void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- myScalarPane->initFromPrsObject(thePrs);
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
- if( thePrs->IsTimeStampFixed() )
+ myScalarPane->initFromPrsObject( myPrsCopy );
+
+ setFactor(myPrsCopy->GetScale());
+ UseMagn->setChecked(myPrsCopy->IsColored());
+
+ if( !theInit )
+ return;
+
+ if( myPrsCopy->IsTimeStampFixed() )
myTabBox->removePage( myInputPane );
else
{
- myInputPane->initFromPrsObject( thePrs );
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->showPage( myInputPane );
}
myTabBox->setCurrentPage( 0 );
-
- setFactor(thePrs->GetScale());
- UseMagn->setChecked(thePrs->IsColored());
}
-int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
- myScalarPane->storeToPrsObject(thePrs);
+int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
+ myScalarPane->storeToPrsObject(myPrsCopy);
- if( !thePrs->IsTimeStampFixed() )
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- myInputPane->storeToPrsObject( thePrs );
+ myInputPane->storeToPrsObject( myPrsCopy );
}
- thePrs->SetScale(getFactor());
- thePrs->ShowColored(isColored());
+ myPrsCopy->SetScale(getFactor());
+ myPrsCopy->ShowColored(isColored());
+
+ VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
+
return 1;
}
#ifndef VISUGUI_DEFORMEDSHAPEDLS_H
#define VISUGUI_DEFORMEDSHAPEDLS_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
#include "QtxDblSpinBox.h"
class DeformedShape_i;
}
-class VisuGUI_DeformedShapeDlg : public QDialog
+class VisuGUI_DeformedShapeDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT
bool isColored()
{ return UseMagn->isChecked(); }
- void initFromPrsObject(VISU::DeformedShape_i* thePrs);
- int storeToPrsObject(VISU::DeformedShape_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
private:
void keyPressEvent( QKeyEvent* e );
QTabWidget* myTabBox;
VisuGUI_ScalarBarPane* myScalarPane;
VisuGUI_InputPane* myInputPane;
+ SALOME::GenericObjPtr<VISU::DeformedShape_i> myPrsCopy;
};
#endif // VISUGUI_DEFORMEDSHAPEDLS_H
using namespace VISU;
-VisuGUI_FieldFilter::VisuGUI_FieldFilter( VISU::VISUType theType,
- const QString& thePrs3dEntry ) :
- myType( theType ),
- myPrs3dEntry( thePrs3dEntry )
+VisuGUI_FieldFilter::VisuGUI_FieldFilter( VISU::VISUType theType ) :
+ myType( theType )
{
}
{
}
+void VisuGUI_FieldFilter::setPrs3dEntry( const QString& theEntry )
+{
+ myPrs3dEntry = theEntry;
+}
+
bool VisuGUI_FieldFilter::isOk( const SUIT_DataOwner* theDataOwner ) const
{
const LightApp_DataOwner* anOwner =
class VisuGUI_FieldFilter : public SUIT_SelectionFilter
{
public:
- VisuGUI_FieldFilter( VISU::VISUType theType,
- const QString& thePrs3dEntry );
+ VisuGUI_FieldFilter( VISU::VISUType theType );
~VisuGUI_FieldFilter();
+public:
virtual bool isOk( const SUIT_DataOwner* ) const;
+ void setPrs3dEntry( const QString& theEntry );
+
private:
VISU::VISUType myType;
QString myPrs3dEntry;
#include "VisuGUI_Tools.h"
#include "VisuGUI_InputPane.h"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_GaussPoints_i.hh"
#include "VISU_GaussPointsPL.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "SUIT_MessageBox.h"
#include "SVTK_FontWidget.h"
+#include "QtxDblSpinBox.h"
+
#include <qlayout.h>
#include <qtabwidget.h>
#include <qbuttongroup.h>
#include <qfiledialog.h>
#include <qvalidator.h>
#include <qcolordialog.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qtoolbutton.h>
+#include <qtabwidget.h>
#include <vtkPolyData.h>
#include <vtkDataSet.h>
/*!
Gets orientation
*/
-int VisuGUI_GaussScalarBarPane::getOrientation()
+int VisuGUI_GaussScalarBarPane::getOrientation()
{
if (RBvert->isChecked() )
return 1;
return 0;
}
+/*!
+ Sets and gets parameters
+*/
+double VisuGUI_GaussScalarBarPane::getX() {
+ return XSpin->value();
+}
+
+double VisuGUI_GaussScalarBarPane::getY() {
+ return YSpin->value();
+}
+
+double VisuGUI_GaussScalarBarPane::getWidth() {
+ return WidthSpin->value();
+}
+
+double VisuGUI_GaussScalarBarPane::getHeight() {
+ return HeightSpin->value();
+}
+
+int VisuGUI_GaussScalarBarPane::getNbColors() {
+ return ColorSpin->value();
+}
+
+int VisuGUI_GaussScalarBarPane::getNbLabels() {
+ return LabelSpin->value();
+}
+
+bool VisuGUI_GaussScalarBarPane::isToSave() {
+ return CBSave ? CBSave->isChecked() : false;
+}
void VisuGUI_GaussScalarBarPane::onTextPref()
{
* Constructor
*/
VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool SetPref):
- QDialog(VISU::GetDesktop(theModule),
- "VisuGUI_GaussPointsDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- myPrs(NULL)
+ VisuGUI_Prs3dDlg(theModule)
{
setName("VisuGUI_ScalarBarDlg");
setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
}
-void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs )
+void VisuGUI_GaussPointsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- bool isDeformed = thePrs->GetIsDeformed();
- myScaleSpinBox->setValue( thePrs->GetScaleFactor() );
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+ myScalarPane->initFromPrsObject( myPrsCopy );
+
+ bool isDeformed = myPrsCopy->GetIsDeformed();
+ myScaleSpinBox->setValue( myPrsCopy->GetScaleFactor() );
myDefShapeButton->setChecked( isDeformed );
- myDefShapeButton->setEnabled( thePrs->GetField()->myNbComp > 1 );
+ myDefShapeButton->setEnabled( myPrsCopy->GetField()->myNbComp > 1 );
onToggleDefShape( isDeformed );
- bool isResults = thePrs->GetIsColored();
+ bool isResults = myPrsCopy->GetIsColored();
myResultsButton->setChecked( isResults && !isDeformed );
myGeometryButton->setChecked( !isResults && !isDeformed );
- myPrimitiveBox->setPrimitiveType( thePrs->GetPrimitiveType() );
- myPrimitiveBox->setClampMaximum( thePrs->GetMaximumSupportedSize() );
- myPrimitiveBox->setClamp( thePrs->GetClamp() );
- myPrimitiveBox->setMainTexture( thePrs->GetMainTexture() );
- myPrimitiveBox->setAlphaTexture( thePrs->GetAlphaTexture() );
- myPrimitiveBox->setAlphaThreshold( thePrs->GetAlphaThreshold() );
- myPrimitiveBox->setResolution( thePrs->GetResolution() );
- myPrimitiveBox->setFaceLimit( thePrs->GetFaceLimit() );
+ myPrimitiveBox->setPrimitiveType( myPrsCopy->GetPrimitiveType() );
+ myPrimitiveBox->setClampMaximum( myPrsCopy->GetMaximumSupportedSize() );
+ myPrimitiveBox->setClamp( myPrsCopy->GetClamp() );
+ myPrimitiveBox->setMainTexture( myPrsCopy->GetMainTexture() );
+ myPrimitiveBox->setAlphaTexture( myPrsCopy->GetAlphaTexture() );
+ myPrimitiveBox->setAlphaThreshold( myPrsCopy->GetAlphaThreshold() );
+ myPrimitiveBox->setResolution( myPrsCopy->GetResolution() );
+ myPrimitiveBox->setFaceLimit( myPrsCopy->GetFaceLimit() );
mySizeBox->setType( isResults || isDeformed ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry );
- mySizeBox->setGeomSize( thePrs->GetGeomSize() );
- mySizeBox->setMinSize( thePrs->GetMinSize() );
- mySizeBox->setMaxSize( thePrs->GetMaxSize() );
- mySizeBox->setMagnification( thePrs->GetMagnification() );
- mySizeBox->setIncrement( thePrs->GetMagnificationIncrement() );
- mySizeBox->setColor( thePrs->GetColor() );
-
- myScalarPane->initFromPrsObject(thePrs);
+ mySizeBox->setGeomSize( myPrsCopy->GetGeomSize() );
+ mySizeBox->setMinSize( myPrsCopy->GetMinSize() );
+ mySizeBox->setMaxSize( myPrsCopy->GetMaxSize() );
+ mySizeBox->setMagnification( myPrsCopy->GetMagnification() );
+ mySizeBox->setIncrement( myPrsCopy->GetMagnificationIncrement() );
+ mySizeBox->setColor( myPrsCopy->GetColor() );
+
+ if( !theInit )
+ return;
- if( thePrs->IsTimeStampFixed() )
+ if( myPrsCopy->IsTimeStampFixed() )
myTabBox->removePage( myInputPane );
else
{
- myInputPane->initFromPrsObject( thePrs );
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->showPage( myInputPane );
}
myTabBox->setCurrentPage( 0 );
-
- myPrs = thePrs;
}
-int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs )
+int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
{
- thePrs->SetIsDeformed( myDefShapeButton->isChecked() );
- thePrs->SetScaleFactor( myScaleSpinBox->value() );
+ myPrsCopy->SetIsDeformed( myDefShapeButton->isChecked() );
+ myPrsCopy->SetScaleFactor( myScaleSpinBox->value() );
- thePrs->SetPrimitiveType( myPrimitiveBox->getPrimitiveType() );
+ myPrsCopy->SetPrimitiveType( myPrimitiveBox->getPrimitiveType() );
- thePrs->SetClamp( myPrimitiveBox->getClamp() );
+ myPrsCopy->SetClamp( myPrimitiveBox->getClamp() );
QString aMainTexture = myPrimitiveBox->getMainTexture();
QString anAlphaTexture = myPrimitiveBox->getAlphaTexture();
- aMainTexture = aMainTexture.isNull() ? thePrs->GetMainTexture() : aMainTexture;
- anAlphaTexture = anAlphaTexture.isNull() ? thePrs->GetAlphaTexture() : anAlphaTexture;
+ aMainTexture = aMainTexture.isNull() ? myPrsCopy->GetMainTexture() : aMainTexture;
+ anAlphaTexture = anAlphaTexture.isNull() ? myPrsCopy->GetAlphaTexture() : anAlphaTexture;
- thePrs->SetTextures( aMainTexture, anAlphaTexture );
+ myPrsCopy->SetTextures( aMainTexture, anAlphaTexture );
- thePrs->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() );
+ myPrsCopy->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() );
- thePrs->SetResolution( myPrimitiveBox->getResolution() );
- thePrs->SetFaceLimit( myPrimitiveBox->getFaceLimit() );
+ myPrsCopy->SetResolution( myPrimitiveBox->getResolution() );
+ myPrsCopy->SetFaceLimit( myPrimitiveBox->getFaceLimit() );
bool isColored = !myGeometryButton->isChecked();
if( isColored )
{
- thePrs->SetIsColored( true );
- thePrs->SetMinSize( mySizeBox->getMinSize() );
- thePrs->SetMaxSize( mySizeBox->getMaxSize() );
+ myPrsCopy->SetIsColored( true );
+ myPrsCopy->SetMinSize( mySizeBox->getMinSize() );
+ myPrsCopy->SetMaxSize( mySizeBox->getMaxSize() );
}
else
{
- thePrs->SetIsColored( false );
- thePrs->SetColor( mySizeBox->getColor() );
- thePrs->SetGeomSize( mySizeBox->getGeomSize() );
+ myPrsCopy->SetIsColored( false );
+ myPrsCopy->SetColor( mySizeBox->getColor() );
+ myPrsCopy->SetGeomSize( mySizeBox->getGeomSize() );
}
- thePrs->SetMagnification( mySizeBox->getMagnification() );
- thePrs->SetMagnificationIncrement( mySizeBox->getIncrement() );
+ myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
+ myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
int ok = 1;
- if( !thePrs->IsTimeStampFixed() )
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- ok = myInputPane->storeToPrsObject( thePrs );
+ ok = myInputPane->storeToPrsObject( myPrsCopy );
}
+ ok = ok && myScalarPane->storeToPrsObject( myPrsCopy );
+
+ VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(thePrs, myPrsCopy);
- return ok && myScalarPane->storeToPrsObject(thePrs);
+ return ok;
}
void VisuGUI_GaussPointsDlg::onToggleDefShape( bool on )
void VisuGUI_GaussPointsDlg::accept()
{
- if( myPrs && myPrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
+ if( myPrsCopy && myPrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
{
int aNumberOfFaces = myPrimitiveBox->getFaceNumber();
- int aNumberOfPoints = ( (vtkPolyData*)myPrs->GetSpecificPL()->GetInput() )->GetNumberOfCells();
+ int aNumberOfPoints = ( (vtkPolyData*)myPrsCopy->GetSpecificPL()->GetInput() )->GetNumberOfCells();
if( aNumberOfFaces * aNumberOfPoints > myPrimitiveBox->getFaceLimit() )
{
#ifndef VISUGUI_GAUSSPOINTSDLS_H
#define VISUGUI_GAUSSPOINTSDLS_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
#include <qvbox.h>
-#include <qdialog.h>
-#include <qgroupbox.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlineedit.h>
-#include <qbuttongroup.h>
-#include <qradiobutton.h>
-#include <qspinbox.h>
-#include <qcombobox.h>
-#include <qtoolbutton.h>
-#include <qtabwidget.h>
+
+class QtxDblSpinBox;
class SalomeApp_Module;
class VVTK_PrimitiveBox;
int getOrientation();
void setPosAndSize( double x, double y, double w, double h, bool vert );
- double getX() {return XSpin->value();}
- double getY() {return YSpin->value();}
- double getWidth() {return WidthSpin->value();}
- double getHeight() {return HeightSpin->value();}
void setScalarBarData( int colors, int labels );
- int getNbColors() {return ColorSpin->value();}
- int getNbLabels() {return LabelSpin->value();}
- bool isToSave() {return CBSave ? CBSave->isChecked() : false;}
+ double getX();
+ double getY();
+ double getWidth();
+ double getHeight();
+ int getNbColors();
+ int getNbLabels();
+ bool isToSave();
void initFromPrsObject(VISU::GaussPoints_i* thePrs);
int storeToPrsObject(VISU::GaussPoints_i* thePrs);
* Uses for set up initial parameters of the Gauss Points
* presentation and edit them interactively.
*/
-class VisuGUI_GaussPointsDlg : public QDialog
+class VisuGUI_GaussPointsDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT
~VisuGUI_GaussPointsDlg() {}
//! Initializing dialog from the Gauss Points presentation.
- void initFromPrsObject(VISU::GaussPoints_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
//! Update Gauss Points presentation using parameters from the dialog.
- int storeToPrsObject(VISU::GaussPoints_i* thePrs);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
private:
void keyPressEvent( QKeyEvent* e );
void accept();
private:
- VISU::GaussPoints_i* myPrs;
-
QTabWidget* myTabBox;
VisuGUI_GaussScalarBarPane* myScalarPane;
VisuGUI_InputPane* myInputPane;
QGroupBox* myDefShapeBox;
QtxDblSpinBox* myScaleSpinBox;
+
+ SALOME::GenericObjPtr<VISU::GaussPoints_i> myPrsCopy;
};
#endif // VISUGUI_GAUSSPOINTSDLS_H
#include "VisuGUI_InputPane.h"
+#include "VisuGUI_Prs3dDlg.h"
#include "VisuGUI_FieldFilter.h"
#include "VisuGUI_Tools.h"
#include "SALOMEDSClient_AttributeComment.hxx"
#include "SALOMEDSClient_AttributeName.hxx"
+#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
using namespace VISU;
-VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType, SalomeApp_Module* theModule, QWidget* parent ) :
- QGroupBox( 2, Qt::Horizontal, parent ),
- myModule( theModule )
+VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType,
+ SalomeApp_Module* theModule,
+ VisuGUI_Prs3dDlg* theDialog ) :
+ QGroupBox( 2, Qt::Horizontal, theDialog ),
+ myModule( theModule ),
+ myDialog( theDialog ),
+ myPrs( NULL )
{
setFrameStyle( QFrame::Box | QFrame::Sunken );
connect( GetSelectionMgr( theModule ), SIGNAL( selectionChanged() ), SLOT( onSelectionChanged() ) );
- new QLabel( "Med File : ", this );
+ new QLabel( tr( "MED_FILE" ), this );
myMedFile = new QLineEdit( this );
myMedFile->setReadOnly( true );
myMedFile->setEnabled( false );
myMedFile->setPaletteForegroundColor( Qt::black );
- new QLabel( "Mesh : ", this );
+ new QLabel( tr( "MESH" ), this );
myMeshName = new QLineEdit( this );
myMeshName->setReadOnly( true );
myMeshName->setEnabled( false );
myMeshName->setPaletteForegroundColor( Qt::black );
- new QLabel( "Entity : ", this );
+ new QLabel( tr( "ENTITY" ), this );
myEntityName = new QLineEdit( this );
myEntityName->setReadOnly( true );
myEntityName->setEnabled( false );
myEntityName->setPaletteForegroundColor( Qt::black );
- new QLabel( "Field : ", this );
+ new QLabel( tr( "FIELD" ), this );
myFieldName = new QLineEdit( this );
myFieldName->setReadOnly( true );
- new QLabel( "Time Stamp : ", this );
+ new QLabel( tr( "TIME_STAMP" ), this );
myTimeStamps = new QComboBox( this );
- myFieldFilter = 0;
+ myReInit = new QCheckBox( tr( "REINITIALIZE" ), this );
+ myReInit->setChecked( true );
+
+ connect( myReInit, SIGNAL( toggled( bool ) ), SLOT( onReInitialize( bool ) ) );
+
onSelectionChanged();
+ myFieldFilter = new VisuGUI_FieldFilter( theType );
+ GetSelectionMgr( myModule )->installFilter( myFieldFilter );
+
hide();
}
myEntityName->setText( anEntityName );
myFieldName->setText( aFieldName );
myTimeStamps->setCurrentItem( 0 );
+
+ if( myReInit->isChecked() && myPrs )
+ {
+ myPrs->SetResultObject( myResult );
+ myPrs->SetMeshName( aMeshName.latin1() );
+ myPrs->SetEntity( VISU::Entity( myEntity ) );
+ myPrs->SetFieldName( aFieldName.latin1() );
+ myPrs->SetTimeStampNumber( myPrs->GetTimeStampNumberByIndex( 0 ) );
+ myPrs->Apply( true );
+
+ myDialog->initFromPrsObject( myPrs, false );
+ }
}
}
+void VisuGUI_InputPane::onReInitialize( bool on )
+{
+ if( on )
+ onSelectionChanged();
+}
+
void VisuGUI_InputPane::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs )
{
- myFieldFilter = new VisuGUI_FieldFilter( thePrs->GetType(), thePrs->GetHolderEntry() );
- GetSelectionMgr( myModule )->installFilter( myFieldFilter );
+ if( myPrs == thePrs )
+ return;
+
+ myPrs = thePrs;
clear();
myMeshName->setText( thePrs->GetMeshName() );
myFieldName->setText( thePrs->GetFieldName() );
myTimeStamps->setCurrentItem( thePrs->GetTimeStampIndexByNumber( aTimeStampNumber ) );
+
+ myFieldFilter->setPrs3dEntry( thePrs->GetHolderEntry() );
}
int VisuGUI_InputPane::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
thePrs->SetEntity( VISU::Entity( myEntity ) );
thePrs->SetFieldName( myFieldName->text().latin1() );
thePrs->SetTimeStampNumber( thePrs->GetTimeStampNumberByIndex( myTimeStamps->currentItem() ) );
- return ( int )thePrs->Apply();
+ return ( int )thePrs->Apply( false );
}
#include <qgroupbox.h>
+class QCheckBox;
class QComboBox;
class QLineEdit;
class SalomeApp_Module;
class LightApp_SelectionMgr;
+class VisuGUI_Prs3dDlg;
class VisuGUI_FieldFilter;
namespace VISU
Q_OBJECT
public:
- VisuGUI_InputPane( VISU::VISUType theType, SalomeApp_Module* theModule, QWidget* parent );
+ VisuGUI_InputPane( VISU::VISUType theType,
+ SalomeApp_Module* theModule,
+ VisuGUI_Prs3dDlg* theDialog );
virtual ~VisuGUI_InputPane();
public:
public slots:
virtual void onSelectionChanged();
+ virtual void onReInitialize( bool );
private:
SalomeApp_Module* myModule;
+ VisuGUI_Prs3dDlg* myDialog;
+ VISU::ColoredPrs3d_i* myPrs;
QLineEdit* myMedFile;
QLineEdit* myMeshName;
QLineEdit* myEntityName;
QLineEdit* myFieldName;
QComboBox* myTimeStamps;
+ QCheckBox* myReInit;
VISU::Result_var myResult;
int myEntity;
#include "VisuGUI_Tools.h"
#include "VisuGUI_InputPane.h"
+#include "VISU_ColoredPrs3dFactory.hh"
+
#include "LightApp_Application.h"
#include "SUIT_Desktop.h"
Constructor
*/
VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_IsoSurfacesDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ : VisuGUI_Prs3dDlg(theModule)
{
setCaption(tr("DEFINE_ISOSURFACES"));
setSizeGripEnabled( TRUE );
QDialog::reject();
}
-void VisuGUI_IsoSurfacesDlg::initFromPrsObject(VISU::IsoSurfaces_i* thePrs)
+void VisuGUI_IsoSurfacesDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- myScalarPane->initFromPrsObject(thePrs);
- myIsoPane->initFromPrsObject(thePrs);
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TISOSURFACE>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+ myScalarPane->initFromPrsObject(myPrsCopy);
+ myIsoPane->initFromPrsObject(myPrsCopy);
+
+ if( !theInit )
+ return;
- if( thePrs->IsTimeStampFixed() )
+ if( myPrsCopy->IsTimeStampFixed() )
myTabBox->removePage( myInputPane );
else
{
- myInputPane->initFromPrsObject( thePrs );
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->showPage( myInputPane );
}
myTabBox->setCurrentPage( 0 );
}
-int VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::IsoSurfaces_i* thePrs)
+int VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
{
int ok = 1;
- if( !thePrs->IsTimeStampFixed() )
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- ok = myInputPane->storeToPrsObject( thePrs );
+ ok = myInputPane->storeToPrsObject( myPrsCopy );
}
- return ok && myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs);
+ ok = ok && myScalarPane->storeToPrsObject( myPrsCopy ) && myIsoPane->storeToPrsObject(myPrsCopy);
+
+ VISU::TSameAsFactory<VISU::TISOSURFACE>().Copy(thePrs, myPrsCopy);
+
+ return ok;
}
void VisuGUI_IsoSurfacesDlg::onHelp()
#ifndef VISUGUI_ISOSURFACESDLG_H
#define VISUGUI_ISOSURFACESDLG_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
#include "VISU_IsoSurfaces_i.hh"
#include <qdialog.h>
};
-class VisuGUI_IsoSurfacesDlg : public QDialog
+class VisuGUI_IsoSurfacesDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT;
VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule);
~VisuGUI_IsoSurfacesDlg() {};
- void initFromPrsObject(VISU::IsoSurfaces_i* thePrs);
- int storeToPrsObject(VISU::IsoSurfaces_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
private:
void keyPressEvent( QKeyEvent* e );
VisuGUI_IsoSurfPane* myIsoPane;
VisuGUI_ScalarBarPane* myScalarPane;
VisuGUI_InputPane* myInputPane;
+
+ SALOME::GenericObjPtr<VISU::IsoSurfaces_i> myPrsCopy;
};
#endif // VISUGUI_ISOSURFACESDLG_H
#include "VisuGUI_ViewTools.h"
#include "VisuGUI_InputPane.h"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_ViewManager_i.hh"
#include "VISU_Plot3DPL.hxx"
#include "SUIT_ResourceMgr.h"
#include "LightApp_Application.h"
+#include "QtxDblSpinBox.h"
+
#include <qlayout.h>
#include <qvalidator.h>
#include <qtabwidget.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
//purpose :
//=======================================================================
VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_Plot3DDlg", false, WStyle_Customize |
- WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ : VisuGUI_Prs3dDlg(theModule)
{
setCaption(tr("TITLE"));
setSizeGripEnabled(TRUE);
//function : initFromPrsObject
//purpose :
//=======================================================================
-void VisuGUI_Plot3DDlg::initFromPrsObject (VISU::Plot3D_i* thePrs)
+void VisuGUI_Plot3DDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- myScalarPane->initFromPrsObject(thePrs);
- myIsoPane->initFromPrsObject(thePrs);
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TPLOT3D>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+ myScalarPane->initFromPrsObject(myPrsCopy);
+ myIsoPane->initFromPrsObject(myPrsCopy);
- if( thePrs->IsTimeStampFixed() )
+ if( !theInit )
+ return;
+
+ if( myPrsCopy->IsTimeStampFixed() )
myTabBox->removePage( myInputPane );
else
{
- myInputPane->initFromPrsObject( thePrs );
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->showPage( myInputPane );
}
myTabBox->setCurrentPage( 0 );
//function : storeToPrsObject
//purpose :
//=======================================================================
-int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::Plot3D_i* thePrs)
+int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
{
int ok = 1;
- if( !thePrs->IsTimeStampFixed() )
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- ok = myInputPane->storeToPrsObject( thePrs );
+ ok = myInputPane->storeToPrsObject( myPrsCopy );
}
+ ok = ok && myScalarPane->storeToPrsObject(myPrsCopy) && myIsoPane->storeToPrsObject(myPrsCopy);
+
+ VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(thePrs, myPrsCopy);
- return ok && myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs);
+ return ok;
}
//=======================================================================
#ifndef VISUGUI_PLOT3D_H
#define VISUGUI_PLOT3D_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
#include "VISU_Plot3D_i.hh"
};
-class VisuGUI_Plot3DDlg : public QDialog
+class VisuGUI_Plot3DDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT
VisuGUI_Plot3DDlg (SalomeApp_Module* theModule);
~VisuGUI_Plot3DDlg() {};
- void initFromPrsObject (VISU::Plot3D_i* thePrs);
- int storeToPrsObject (VISU::Plot3D_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
void setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos);
VisuGUI_Plot3DPane* myIsoPane;
VisuGUI_ScalarBarPane* myScalarPane;
VisuGUI_InputPane* myInputPane;
+
+ SALOME::GenericObjPtr<VISU::Plot3D_i> myPrsCopy;
};
#endif // VISUGUI_PLOT3D_H
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 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
+// 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.
+//
+// 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
+//
+//
+//
+// File : VisuGUI_Prs3dDlg.cxx
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+
+#include "VisuGUI_Prs3dDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_FontWidget.h"
+
+#include "VISUConfig.hh"
+#include "VISU_Convertor.hxx"
+#include "VISU_ScalarMapPL.hxx"
+#include "VISU_ScalarMapAct.h"
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_Result_i.hh"
+
+#include "LightApp_Application.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+
+#include <qcheckbox.h>
+#include <qlineedit.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qcombobox.h>
+#include <qvbox.h>
+#include <qtoolbutton.h>
+#include <qlayout.h>
+#include <qvalidator.h>
+#include <qcolordialog.h>
+#include <qtabwidget.h>
+
+#include "QtxDblSpinBox.h"
+
+#include <vtkTextProperty.h>
+
+#include <limits.h>
+
+using namespace std;
+
+//-----------------------------------------------------------------------
+// Text Preferences Dialog
+//-----------------------------------------------------------------------
+
+/*!
+ Constructor
+*/
+VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
+ : QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+ setName("VisuGUI_TextPrefDlg");
+ setCaption(tr("TIT_TEXT_PREF"));
+ setSizeGripEnabled(TRUE);
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ // "Title" grp
+ QGroupBox* aTitleGrp = new QGroupBox (2, Qt::Vertical, tr("LBL_TITLE"), this);
+
+ // edit line
+ myTitleEdt = new QLineEdit (aTitleGrp);
+
+ // font
+ QHBox* aHBox = new QHBox (aTitleGrp);
+ aHBox->setSpacing(5);
+ myTitleFont = new SVTK_FontWidget (aHBox);
+
+ TopLayout->addWidget(aTitleGrp);
+
+ // "Labels" grp
+ QGroupBox* aLabelsGrp = new QGroupBox (1, Qt::Vertical, tr("LBL_LABELS"), this);
+
+ // font
+ aHBox = new QHBox (aLabelsGrp);
+ aHBox->setSpacing(5);
+ myLabelFont = new SVTK_FontWidget (aHBox);
+
+ TopLayout->addWidget(aLabelsGrp);
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ 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" );
+ 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 );
+
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
+}
+
+QString VisuGUI_TextPrefDlg::getTitleText()
+{
+ return myTitleEdt->text();
+}
+
+void VisuGUI_TextPrefDlg::setTitleText(QString theText)
+{
+ myTitleEdt->setText(theText);
+}
+
+void VisuGUI_TextPrefDlg::setTitleVisible(bool isVisible)
+{
+ if(isVisible)
+ myTitleEdt->show();
+ else
+ myTitleEdt->hide();
+}
+
+void VisuGUI_TextPrefDlg::onHelp()
+{
+ QString aHelpFileName = "/files/scalar_map_presentation.htm";
+ LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+ if (app) {
+ VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+ app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+ }
+ else {
+ SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+ QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+ QObject::tr("BUT_OK"));
+ }
+}
+
+void VisuGUI_TextPrefDlg::storeBeginValues()
+{
+ myTitle = myTitleEdt->text();
+ myTitleFont->GetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]);
+ myLabelFont->GetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
+}
+
+/*!
+ Called when <Cancel> button is clicked, restore begin values
+*/
+void VisuGUI_TextPrefDlg::reject()
+{
+ myTitleEdt->setText(myTitle);
+ myTitleFont->SetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]);
+ myLabelFont->SetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
+
+ QDialog::reject();
+}
+/*!
+ Called when <Ok> button is clicked, store begin values
+*/
+void VisuGUI_TextPrefDlg::accept()
+{
+ storeBeginValues();
+
+ QDialog::accept();
+}
+
+/*!
+ Provides help on F1 button click
+*/
+void VisuGUI_TextPrefDlg::keyPressEvent( QKeyEvent* e )
+{
+ QDialog::keyPressEvent( e );
+ if ( e->isAccepted() )
+ return;
+
+ if ( e->key() == Key_F1 )
+ {
+ e->accept();
+ onHelp();
+ }
+}
+
+//-----------------------------------------------------------------------
+// Scalar Bar Pane
+//-----------------------------------------------------------------------
+
+/*!
+ Constructor
+*/
+VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
+ QVBox(parent), myPreviewActor(0)
+{
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ QString propertyName;
+ propertyName = QString("scalar_bar_vertical_");
+ myVerX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
+ myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
+ myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
+ myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+
+ propertyName = QString("scalar_bar_horizontal_");
+ myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
+ myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
+ myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
+ myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
+
+ Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
+ myRangeMode = -1;
+
+ setSpacing(6);
+ //setMargin(11);
+
+ // Range ============================================================
+ RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup");
+ RangeGroup->setColumnLayout(0, Qt::Vertical );
+ RangeGroup->layout()->setSpacing( 0 );
+ RangeGroup->layout()->setMargin( 0 );
+ QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup->layout() );
+ RangeGroupLayout->setAlignment( Qt::AlignTop );
+ RangeGroupLayout->setSpacing( 6 );
+ RangeGroupLayout->setMargin( 11 );
+
+ myModeLbl = new QLabel("Scalar Mode", RangeGroup);
+
+ myModeCombo = new QComboBox(RangeGroup);
+
+ CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup);
+ CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFrange");
+ RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBIrange");
+ RBFrange->setChecked( true );
+
+ MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
+ MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MinEdit->setMinimumWidth( 70 );
+ MinEdit->setValidator( new QDoubleValidator(this) );
+ MinEdit->setText( "0.0" );
+ QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
+ MinLabel->setBuddy(MinEdit);
+
+ MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
+ MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MaxEdit->setMinimumWidth( 70 );
+ MaxEdit->setValidator( new QDoubleValidator(this) );
+ MaxEdit->setText( "0.0" );
+ QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
+ MaxLabel->setBuddy(MaxEdit);
+
+ RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
+ RangeGroupLayout->addMultiCellWidget( myModeCombo, 0, 0, 1, 3);
+ RangeGroupLayout->addMultiCellWidget( CBLog, 1, 1, 0, 3);
+ RangeGroupLayout->addMultiCellWidget( RBFrange, 2, 2, 0, 1);
+ RangeGroupLayout->addMultiCellWidget( RBIrange, 2, 2, 2, 3);
+ RangeGroupLayout->addWidget( MinLabel, 3, 0 );
+ RangeGroupLayout->addWidget( MinEdit, 3, 1 );
+ RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
+ RangeGroupLayout->addWidget( MaxEdit, 3, 3 );
+
+ //TopLayout->addWidget( RangeGroup );
+
+ // Colors and Labels ========================================================
+ QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
+ ColLabGroup->setColumnLayout(0, Qt::Vertical );
+ ColLabGroup->layout()->setSpacing( 0 );
+ ColLabGroup->layout()->setMargin( 0 );
+ QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup->layout() );
+ ColLabGroupLayout->setAlignment( Qt::AlignTop );
+ ColLabGroupLayout->setSpacing( 6 );
+ ColLabGroupLayout->setMargin( 11 );
+
+ QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup, "ColorLabel");
+ ColorSpin = new QSpinBox( 2, 256, 1, ColLabGroup );
+ ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ ColorSpin->setMinimumWidth( 70 );
+ ColorSpin->setValue( 64 );
+
+ QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup, "LabelLabel");
+ LabelSpin = new QSpinBox( 2, 65, 1, ColLabGroup );
+ LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ LabelSpin->setMinimumWidth( 70 );
+ LabelSpin->setValue( 5 );
+
+ ColLabGroupLayout->addWidget( ColorLabel, 0, 0);
+ ColLabGroupLayout->addWidget( ColorSpin, 0, 1);
+ ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
+ ColLabGroupLayout->addWidget( LabelSpin, 0, 3);
+
+ //TopLayout->addWidget( ColLabGroup );
+
+ // Orientation ==========================================================
+ QButtonGroup* OrientGroup = new QButtonGroup (tr("ORIENTATION_GRP"), this, "OrientGroup");
+ OrientGroup->setColumnLayout(0, Qt::Vertical );
+ OrientGroup->layout()->setSpacing( 0 );
+ OrientGroup->layout()->setMargin( 0 );
+ QGridLayout* OrientGroupLayout = new QGridLayout( OrientGroup->layout() );
+ OrientGroupLayout->setAlignment( Qt::AlignTop );
+ OrientGroupLayout->setSpacing( 6 );
+ OrientGroupLayout->setMargin( 11 );
+
+ RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGroup, "RBvert");
+ RBvert->setChecked( true );
+ RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), OrientGroup, "RBhori");
+ OrientGroupLayout->addWidget( RBvert, 0, 0 );
+ OrientGroupLayout->addWidget( RBhori, 0, 1 );
+
+ // TopLayout->addWidget( OrientGroup );
+
+ // Origin ===============================================================
+ QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this, "OriginGroup");
+ OriginGroup->setColumnLayout(0, Qt::Vertical );
+ OriginGroup->layout()->setSpacing( 0 );
+ OriginGroup->layout()->setMargin( 0 );
+ QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
+ OriginGroupLayout->setAlignment( Qt::AlignTop );
+ OriginGroupLayout->setSpacing( 6 );
+ OriginGroupLayout->setMargin( 11 );
+
+ QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup, "XLabel");
+ XSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+ XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ XSpin->setMinimumWidth( 70 );
+ XSpin->setValue( 0.01 );
+
+ QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup, "YLabel");
+ YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+ YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ YSpin->setMinimumWidth( 70 );
+ YSpin->setValue( 0.01 );
+
+ OriginGroupLayout->addWidget( XLabel, 0, 0);
+ OriginGroupLayout->addWidget( XSpin, 0, 1);
+ OriginGroupLayout->addWidget( YLabel, 0, 2);
+ OriginGroupLayout->addWidget( YSpin, 0, 3);
+
+ //TopLayout->addWidget( OriginGroup );
+
+ // Dimensions =========================================================
+ QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this, "DimGroup");
+ DimGroup->setColumnLayout(0, Qt::Vertical );
+ DimGroup->layout()->setSpacing( 0 );
+ DimGroup->layout()->setMargin( 0 );
+ QGridLayout* DimGroupLayout = new QGridLayout( DimGroup->layout() );
+ DimGroupLayout->setAlignment( Qt::AlignTop );
+ DimGroupLayout->setSpacing( 6 );
+ DimGroupLayout->setMargin( 11 );
+
+ QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup, "WidthLabel");
+ WidthSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+ WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ WidthSpin->setMinimumWidth( 70 );
+ WidthSpin->setValue( 0.1 );
+
+ QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup, "HeightLabel");
+ HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+ HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ HeightSpin->setMinimumWidth( 70 );
+ HeightSpin->setValue( 0.8 );
+
+ DimGroupLayout->addWidget( WidthLabel, 0, 0);
+ DimGroupLayout->addWidget( WidthSpin, 0, 1);
+ DimGroupLayout->addWidget( HeightLabel, 0, 2);
+ DimGroupLayout->addWidget( HeightSpin, 0, 3);
+
+ //TopLayout->addWidget( DimGroup );
+
+ // Save check box ===========================================================
+ QHBox* aSaveBox = new QHBox(this);
+ if (!SetPref) {
+ CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
+ //TopLayout->addWidget(CBSave);
+ }
+ else {
+ CBSave = 0;
+ }
+ myTextBtn = new QPushButton("Text properties...", aSaveBox);
+ myTextDlg = new VisuGUI_TextPrefDlg(this);
+ myTextDlg->setTitleVisible(!SetPref);
+
+ QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
+ CheckGroup->setColumnLayout(0, Qt::Vertical );
+ CheckGroup->layout()->setSpacing( 0 );
+ CheckGroup->layout()->setMargin( 0 );
+ QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup->layout() );
+
+ myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
+ myPreviewCheck->setChecked(false);
+ CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
+
+ // signals and slots connections ===========================================
+ connect( RangeGroup, SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
+ connect( myModeCombo, SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) );
+ connect( OrientGroup, SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
+ connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+ connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+ connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
+ connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
+ connect( ColorSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
+ connect( LabelSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
+ connect( WidthSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
+ connect( HeightSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
+ connect( CBLog, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ));
+ changeRange( 0 );
+ changeDefaults( 0 );
+ myIsStoreTextProp = false;
+ myBusy = false;
+}
+
+/**
+ * Initializes dialog box values from resources
+ */
+void VisuGUI_ScalarBarPane::initFromResources() {
+ int sbCol=64,sbLab=5,orient=0;
+ float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
+ float sbVmin=0., sbVmax=0.;
+ bool sbRange=false;
+ QString aString;
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
+ int aPlace = 1;
+ if (anIsArrangeBar){
+ aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
+ }
+
+ int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
+ myModeCombo->setCurrentItem(aScalarMode);
+
+ orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", orient);
+ if(orient != 0){
+ orient=1;
+ sbX1=0.2;
+ sbY1=0.01;
+ sbW=0.6;
+ sbH=0.12;
+ }
+
+ QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
+
+ sbX1 = aResourceMgr->doubleValue("VISU", propertyName + "x", sbX1);
+ sbY1 = aResourceMgr->doubleValue("VISU", propertyName + "y", sbY1);
+
+ sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW);
+ sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH);
+
+ if(orient){
+ sbY1 += sbH*(aPlace-1);
+ } else {
+ sbX1 += sbW*(aPlace-1);
+ }
+ sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol);
+ sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab);
+
+ int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
+ if (rangeType == 1) sbRange = true;
+ sbVmin = aResourceMgr->doubleValue("VISU", "scalar_range_min", sbVmin);
+ sbVmax = aResourceMgr->doubleValue("VISU", "scalar_range_max", sbVmax);
+
+ bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
+ setLogarithmic(isLog);
+
+ if((sbX1 < 0.) || (sbY1 < 0.) ||
+ ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
+ if(orient == 0) {
+ sbX1=0.01;
+ sbY1=0.1;
+ sbW=0.1;
+ sbH=0.8;
+ } else {
+ sbX1=0.2;
+ sbY1=0.01;
+ sbW=0.6;
+ sbH=0.12;
+ }
+ }
+ if(sbCol < 2) sbCol=2;
+ if(sbCol > 64) sbCol=64;
+ if(sbLab < 2) sbLab=2;
+ if(sbLab > 65) sbLab=65;
+
+ if(sbVmin > sbVmax) {
+ sbVmin=0.;
+ sbVmax=0.;
+ }
+
+ setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
+ setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 0);
+ setScalarBarData( sbCol, sbLab );
+
+ // "Title"
+ bool isBold = false, isItalic = false, isShadow = false;
+ int aFontFamily = VTK_ARIAL;
+
+ if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
+ {
+ QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
+
+ if ( f.family() == "Arial" )
+ aFontFamily = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ aFontFamily = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ aFontFamily = VTK_TIMES;
+
+ isBold = f.bold();
+ isItalic = f.italic();
+ isShadow = f.underline();
+ }
+
+ QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
+
+ myTextDlg->myTitleFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
+
+ // "Labels"
+ isBold = isItalic = isShadow = false;
+ aFontFamily = VTK_ARIAL;
+
+ if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
+ {
+ QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
+
+ if ( f.family() == "Arial" )
+ aFontFamily = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ aFontFamily = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ aFontFamily = VTK_TIMES;
+
+ isBold = f.bold();
+ isItalic = f.italic();
+ isShadow = f.underline();
+ }
+
+ aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
+
+ myTextDlg->myLabelFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
+}
+
+/**
+ * Stores dialog values to resources
+ */
+void VisuGUI_ScalarBarPane::storeToResources() {
+ int orient = (RBvert->isChecked())? 0 : 1;
+ float sbX1 = XSpin->value();
+ float sbY1 = YSpin->value();
+ float sbW = WidthSpin->value();
+ float sbH = HeightSpin->value();
+ int sbCol = ColorSpin->value();
+ int sbLab = LabelSpin->value();
+
+ if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
+ if(orient == 0) {
+ sbX1=0.01;
+ sbY1=0.1;
+ sbW=0.17;
+ sbH=0.8;
+ } else {
+ sbX1=0.2;
+ sbY1=0.01;
+ sbW=0.6;
+ sbH=0.12;
+ }
+ }
+
+ bool sbRange = RBIrange->isChecked();
+ float sbVmin = (float)(MinEdit->text().toDouble());
+ float sbVmax = (float)(MaxEdit->text().toDouble());
+
+ if(sbVmin > sbVmax) {
+ sbVmin=0.;
+ sbVmax=0.;
+ }
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ aResourceMgr->setValue("VISU", "scalar_bar_orientation", orient);
+
+ QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
+
+ aResourceMgr->setValue("VISU", propertyName + "x", sbX1);
+ aResourceMgr->setValue("VISU", propertyName + "y", sbY1);
+ aResourceMgr->setValue("VISU", propertyName + "width", sbW);
+ aResourceMgr->setValue("VISU", propertyName + "height", sbH);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_num_colors", sbCol);
+ aResourceMgr->setValue("VISU", "scalar_bar_num_labels", sbLab);
+
+ if(sbRange)
+ {
+ aResourceMgr->setValue("VISU", "scalar_range_type", 1);
+ aResourceMgr->setValue("VISU", "scalar_range_min" ,sbVmin);
+ aResourceMgr->setValue("VISU", "scalar_range_max" ,sbVmax);
+ }
+ else
+ aResourceMgr->setValue("VISU", "scalar_range_type", 0);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
+
+ ////
+
+ if (myIsStoreTextProp) {
+ // "Title"
+ QColor aTitleColor (255, 255, 255);
+ int aTitleFontFamily = VTK_ARIAL;
+ bool isTitleBold = false;
+ bool isTitleItalic = false;
+ bool isTitleShadow = false;
+
+ myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
+ isTitleBold, isTitleItalic, isTitleShadow);
+
+ QFont aTitleFont;
+
+ aTitleFont.setBold(isTitleBold);
+ aTitleFont.setItalic(isTitleItalic);
+ aTitleFont.setUnderline(isTitleShadow);
+
+ QString titleFontFamily;
+ switch (aTitleFontFamily) {
+ case VTK_ARIAL:
+ titleFontFamily = "Arial";
+ break;
+ case VTK_COURIER:
+ titleFontFamily = "Courier";
+ break;
+ case VTK_TIMES:
+ titleFontFamily = "Times";
+ break;
+ }
+ aTitleFont.setFamily(titleFontFamily);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
+
+ // "Label"
+ QColor aLabelColor (255, 255, 255);
+ int aLabelFontFamily = VTK_ARIAL;
+ bool isLabelBold = false;
+ bool isLabelItalic = false;
+ bool isLabelShadow = false;
+
+ myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
+ isLabelBold, isLabelItalic, isLabelShadow);
+
+
+ QFont aLabelFont;
+
+ aLabelFont.setBold(isLabelBold);
+ aLabelFont.setItalic(isLabelItalic);
+ aLabelFont.setUnderline(isLabelShadow);
+
+ QString labelFontFamily;
+ switch (aLabelFontFamily) {
+ case VTK_ARIAL:
+ labelFontFamily = "Arial";
+ break;
+ case VTK_COURIER:
+ labelFontFamily = "Courier";
+ break;
+ case VTK_TIMES:
+ labelFontFamily = "Times";
+ break;
+ }
+
+ aLabelFont.setFamily(labelFontFamily);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
+
+ aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
+ }
+}
+
+/**
+ * Initialise dialog box from presentation object
+ */
+void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
+{
+ initFromResources();
+ myScalarMap = dynamic_cast<VISU::ScalarMap_i*>(thePrs);
+ if( !myScalarMap )
+ return;
+
+ myTitle = myScalarMap->GetTitle();
+ setPosAndSize( myScalarMap->GetPosX(),
+ myScalarMap->GetPosY(),
+ myScalarMap->GetWidth(),
+ myScalarMap->GetHeight(),
+ myScalarMap->GetBarOrientation());
+ switch(myScalarMap->GetScaling()){
+ case VISU::LOGARITHMIC :
+ setLogarithmic(true);
+ break;
+ default:
+ setLogarithmic(false);
+ }
+ CORBA::Double aRange[2] = {myScalarMap->GetSourceMin(), myScalarMap->GetSourceMax()};
+ Rmin = aRange[0]; Rmax = aRange[1];
+ setRange( myScalarMap->GetMin(), myScalarMap->GetMax(),
+ /*0.0, 0.0,*/ myScalarMap->IsRangeFixed() );
+ setScalarBarData( myScalarMap->GetNbColors(), myScalarMap->GetLabels() );
+
+ // Update myModeCombo
+ int aNbComp = myScalarMap->GetField()->myNbComp;
+ bool isScalarMode = (aNbComp > 1);
+ myModeCombo->clear();
+ myModeCombo->insertItem("<Modulus>");
+ const VISU::PField& aField = myScalarMap->GetField();
+ const VISU::TNames& aCompNames = aField->myCompNames;
+ const VISU::TNames& aUnitNames = aField->myUnitNames;
+ for(int i = 0; i < aNbComp; i++){
+ QString aComponent = QString(aCompNames[i].c_str()).simplifyWhiteSpace();
+ if(aComponent.isNull() || aComponent == "")
+ aComponent = "Component " + QString::number(i+1);
+ else
+ aComponent = "[" + QString::number(i+1) + "] " + aComponent;
+
+ QString anUnit = QString(aUnitNames[i].c_str()).simplifyWhiteSpace();
+ if(anUnit.isNull() || anUnit == "")
+ anUnit = "-";
+
+ aComponent = aComponent + ", " + anUnit;
+
+ myModeCombo->insertItem(aComponent);
+ }
+ //
+ myModeCombo->setCurrentItem(myScalarMap->GetScalarMode());
+ if (aNbComp==1){
+ myModeCombo->setCurrentItem(1);
+ }
+ //
+ myModeLbl->setEnabled(isScalarMode);
+ myModeCombo->setEnabled(isScalarMode);
+
+ // "Title"
+ myTextDlg->setTitleText(QString(myScalarMap->GetTitle()));
+
+ vtkFloatingPointType R, G, B;
+ myScalarMap->GetTitleColor(&R, &G, &B);
+
+ myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+ myScalarMap->GetTitFontType(),
+ myScalarMap->IsBoldTitle(),
+ myScalarMap->IsItalicTitle(),
+ myScalarMap->IsShadowTitle());
+
+ // "Labels"
+ myScalarMap->GetLabelColor(&R, &G, &B);
+
+ myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+ myScalarMap->GetLblFontType(),
+ myScalarMap->IsBoldLabel(),
+ myScalarMap->IsItalicLabel(),
+ myScalarMap->IsShadowLabel());
+
+ // Draw Preview
+ if (myPreviewCheck->isChecked()) {
+ createScalarBar();
+ updatePreview();
+ }
+
+}
+/*! Slot update preview of scalar bar, if preview is checked
+ */
+void VisuGUI_ScalarBarPane::updatePreview()
+{
+ if (myPreviewCheck->isChecked()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
+ deleteScalarBar();
+ createScalarBar();
+ vf->Repaint();
+ }
+ }
+}
+
+/*! Creating preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::createScalarBar()
+{
+ if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
+ if (myPreviewActor != 0) return;
+ if (myScalarMap == NULL) return;
+
+ if (!check()) return;
+ myScalarMapPL = VISU_ScalarMapPL::New();
+ if(myScalarMap->GetSpecificPL())
+ myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL());
+
+ if ( myBusy ) return;
+
+ myBusy = true;
+
+ int sbCol,sbLab;
+ sbCol = getNbColors();
+ sbLab = getNbLabels();
+ if(sbCol < 2) sbCol=2;
+ if(sbCol > 64) sbCol=64;
+ if(sbLab < 2) sbLab=2;
+ if(sbLab > 65) sbLab=65;
+ myPreviewActor = VISU_ScalarMapAct::New();
+ VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar();
+ myPreviewActor->GetScalarBar()->VisibilityOn();
+ myPreviewActor->PickableOff();
+
+ myScalarMapPL->SetScalarMode(myModeCombo->currentItem());
+ if(isLogarithmic())
+ myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
+ else
+ myScalarMapPL->SetScaling(VISU::LINEAR);
+ vtkFloatingPointType theRange[2];
+ theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
+ theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
+ myScalarMapPL->SetScalarRange(theRange);
+ myScalarMapPL->SetNbColors(sbCol);
+
+ myScalarMapPL->Update();
+
+ aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
+
+ if (myTextDlg->getTitleText().latin1() != "")
+ aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
+ else
+ aScalarBarActor->SetTitle(myTitle.c_str());
+ aScalarBarActor->SetOrientation(getOrientation());
+ aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
+ aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY());
+ aScalarBarActor->SetWidth(getWidth());
+ aScalarBarActor->SetHeight(getHeight());
+ aScalarBarActor->SetNumberOfLabels(sbLab);
+ aScalarBarActor->SetMaximumNumberOfColors(sbCol);
+
+ // title text property
+ QColor aTitleColor;
+ int aTitleFontFamily;
+ bool isTitleBold;
+ bool isTitleItalic;
+ bool isTitleShadow;
+ myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
+ isTitleBold,isTitleItalic,isTitleShadow);
+ vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
+ aTitleProp->SetFontFamily(aTitleFontFamily);
+ aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255.,
+ vtkFloatingPointType(aTitleColor.green())/255.,
+ vtkFloatingPointType(aTitleColor.blue())/255.);
+ (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+ (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+ (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+
+ // label text property
+ QColor aLabelColor;
+ int aLabelFontFamily;
+ bool isLabelBold;
+ bool isLabelItalic;
+ bool isLabelShadow;
+ myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
+ isLabelBold, isLabelItalic, isLabelShadow);
+ vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
+ aLabelProp->SetFontFamily(aLabelFontFamily);
+ aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255.,
+ vtkFloatingPointType(aLabelColor.green())/255.,
+ vtkFloatingPointType(aLabelColor.blue())/255.);
+ (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+ (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+ (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+
+ aScalarBarActor->Modified();
+
+ VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
+
+ myBusy = false;
+}
+/*! Deleting preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::deleteScalarBar()
+{
+ if ( myBusy ) return;
+
+ if (myPreviewActor == 0) return;
+ vtkRenderer* aRend = myPreviewActor->GetRenderer();
+ vtkRenderWindow* aWnd = aRend->GetRenderWindow();
+ if(aRend && aWnd)
+ myPreviewActor->RemoveFromRender(aRend);
+ myPreviewActor->GetScalarBar()->VisibilityOff();
+ myPreviewActor->Delete();
+ myPreviewActor = 0;
+
+ if (myScalarMapPL){
+ myScalarMapPL->Delete();
+ myScalarMapPL = 0;
+ }
+}
+/*! public: Deleting preview scalar bar
+ */
+void VisuGUI_ScalarBarPane::deletePreview()
+{
+ deleteScalarBar();
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
+ vf->Repaint();
+}
+/**
+ * Store values to presentation object
+ */
+int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
+ if( !myScalarMap )
+ return 0;
+
+ myScalarMap->SetScalarMode(myModeCombo->currentItem());
+ myScalarMap->SetPosition(XSpin->value(), YSpin->value());
+ myScalarMap->SetSize(WidthSpin->value(), HeightSpin->value());
+ myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
+ if(isLogarithmic())
+ myScalarMap->SetScaling(VISU::LOGARITHMIC);
+ else
+ myScalarMap->SetScaling(VISU::LINEAR);
+
+ if (RBFrange->isChecked()) {
+ myScalarMap->SetSourceRange();
+ } else {
+ myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+ }
+ myScalarMap->SetNbColors(ColorSpin->value());
+ myScalarMap->SetLabels(LabelSpin->value());
+
+ if (isToSave()) storeToResources();
+
+ if (myIsStoreTextProp) {
+ // "Title"
+ myScalarMap->SetTitle(myTextDlg->getTitleText().latin1());
+
+ QColor aTitColor (255, 255, 255);
+ int aTitleFontFamily = VTK_ARIAL;
+ bool isTitleBold = false;
+ bool isTitleItalic = false;
+ bool isTitleShadow = false;
+
+ myTextDlg->myTitleFont->GetData(aTitColor, aTitleFontFamily,
+ isTitleBold, isTitleItalic, isTitleShadow);
+
+ myScalarMap->SetBoldTitle(isTitleBold);
+ myScalarMap->SetItalicTitle(isTitleItalic);
+ myScalarMap->SetShadowTitle(isTitleShadow);
+ myScalarMap->SetTitFontType(aTitleFontFamily);
+ myScalarMap->SetTitleColor(aTitColor.red()/255.,
+ aTitColor.green()/255.,
+ aTitColor.blue()/255.);
+
+ // "Label"
+ QColor aLblColor (255, 255, 255);
+ int aLabelFontFamily = VTK_ARIAL;
+ bool isLabelBold = false;
+ bool isLabelItalic = false;
+ bool isLabelShadow = false;
+
+ myTextDlg->myLabelFont->GetData(aLblColor, aLabelFontFamily,
+ isLabelBold, isLabelItalic, isLabelShadow);
+
+ myScalarMap->SetBoldLabel(isLabelBold);
+ myScalarMap->SetItalicLabel(isLabelItalic);
+ myScalarMap->SetShadowLabel(isLabelShadow);
+ myScalarMap->SetLblFontType(aLabelFontFamily);
+ myScalarMap->SetLabelColor(aLblColor.red()/255.,
+ aLblColor.green()/255.,
+ aLblColor.blue()/255.);
+ myIsStoreTextProp = false;
+ }
+
+ return 1;
+}
+
+/*!
+ Called when orientation is changed
+*/
+void VisuGUI_ScalarBarPane::changeDefaults( int )
+{
+ if ( RBvert->isChecked() ) {
+ XSpin->setValue( myVerX );
+ YSpin->setValue( myVerY );
+ WidthSpin->setValue( myVerW );
+ HeightSpin->setValue( myVerH );
+ }
+ else {
+ XSpin->setValue( myHorX );
+ YSpin->setValue( myHorY );
+ WidthSpin->setValue( myHorW );
+ HeightSpin->setValue( myHorH );
+ }
+ updatePreview();
+}
+
+/*!
+ Called when Range mode is changed
+*/
+void VisuGUI_ScalarBarPane::changeRange( int )
+{
+ int mode = -1;
+ if ( RBFrange->isChecked() )
+ mode = 0;
+ if ( RBIrange->isChecked() )
+ mode = 1;
+ if ( myRangeMode == mode )
+ return;
+ //MinSpin->setMaxValue( Fmin );
+ //MaxSpin->setMinValue( Fmax );
+ if ( RBFrange->isChecked() ) {
+ //MinLabel->setEnabled( false );
+ MinEdit->setEnabled( false );
+ //MaxLabel->setEnabled( false );
+ MaxEdit->setEnabled( false );
+ if ( mode != -1 ) {
+ Imin = MinEdit->text().toDouble();
+ Imax = MaxEdit->text().toDouble();
+ }
+ MinEdit->setText( QString::number( Rmin ) );
+ MaxEdit->setText( QString::number( Rmax ) );
+ }
+ else {
+ //MinLabel->setEnabled( true );
+ MinEdit->setEnabled( true );
+ //MaxLabel->setEnabled( true );
+ MaxEdit->setEnabled( true );
+ MinEdit->setText( QString::number( Imin ) );
+ MaxEdit->setText( QString::number( Imax ) );
+ }
+ myRangeMode = mode;
+ updatePreview();
+}
+
+/*!
+ Called when X,Y position is changed
+*/
+void VisuGUI_ScalarBarPane::XYChanged( double )
+{
+ QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
+ if ( snd == XSpin ) {
+ WidthSpin->setMaxValue( 1.0 - XSpin->value() );
+ }
+ if ( snd == YSpin ) {
+ HeightSpin->setMaxValue( 1.0 - YSpin->value() );
+ }
+ updatePreview();
+}
+
+/*!
+ Called when scalar mode is changed
+*/
+void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
+{
+ if ( myScalarMap ) {
+ if ( RBFrange->isChecked() ) {
+ int aMode = myScalarMap->GetScalarMode();
+ myScalarMap->SetScalarMode(theMode);
+ CORBA::Double aRange[2] = {myScalarMap->GetSourceMin(), myScalarMap->GetSourceMax()};
+ MinEdit->setText( QString::number( aRange[0] ) );
+ MaxEdit->setText( QString::number( aRange[1] ) );
+ myScalarMap->SetScalarMode(aMode);
+ }
+ }
+ updatePreview();
+}
+
+/*!
+ Sets default values and range mode
+*/
+void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
+{
+ Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
+ if ( RBIrange->isChecked() ) {
+ MinEdit->setText( QString::number( Imin ) );
+ MaxEdit->setText( QString::number( Imax ) );
+ }
+ else {
+ MinEdit->setText( QString::number( Rmin ) );
+ MaxEdit->setText( QString::number( Rmax ) );
+ }
+ myRangeMode = -1;
+ if( sbRange )
+ RBIrange->setChecked( true );
+ else
+ RBFrange->setChecked( true );
+ changeRange( 0 );
+}
+
+/*!
+ Sets default values and range mode
+*/
+void VisuGUI_ScalarBarPane::setDefaultRange(double imin, double imax){
+ Rmin = imin;
+ Rmax = imax;
+}
+
+/*!
+ Sets and gets parameters
+*/
+bool VisuGUI_ScalarBarPane::isIRange() {
+ return RBIrange->isChecked();
+}
+
+double VisuGUI_ScalarBarPane::getMin() {
+ return MinEdit->text().toDouble();
+}
+
+double VisuGUI_ScalarBarPane::getMax() {
+ return MaxEdit->text().toDouble();
+}
+
+double VisuGUI_ScalarBarPane::getX() {
+ return XSpin->value();
+}
+
+double VisuGUI_ScalarBarPane::getY() {
+ return YSpin->value();
+}
+
+double VisuGUI_ScalarBarPane::getWidth() {
+ return WidthSpin->value();
+}
+
+double VisuGUI_ScalarBarPane::getHeight() {
+ return HeightSpin->value();
+}
+
+int VisuGUI_ScalarBarPane::getNbColors() {
+ return ColorSpin->value();
+}
+
+int VisuGUI_ScalarBarPane::getNbLabels() {
+ return LabelSpin->value();
+}
+
+bool VisuGUI_ScalarBarPane::isLogarithmic() {
+ return CBLog->isChecked();
+}
+
+void VisuGUI_ScalarBarPane::setLogarithmic( bool on ) {
+ CBLog->setChecked( on );
+}
+
+bool VisuGUI_ScalarBarPane::isToSave() {
+ return CBSave ? CBSave->isChecked() : false;
+}
+
+/*!
+ Sets size and position
+*/
+void VisuGUI_ScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
+{
+ if ( vert ) {
+ myVerX = x;
+ myVerY = y;
+ myVerW = w;
+ myVerH = h;
+ RBvert->setChecked( true );
+ }
+ else {
+ myHorX = x;
+ myHorY = y;
+ myHorW = w;
+ myHorH = h;
+ RBhori->setChecked( true );
+ }
+ changeDefaults( 0 );
+}
+
+/*!
+ Sets colors and labels number
+*/
+void VisuGUI_ScalarBarPane::setScalarBarData( int colors, int labels )
+{
+ ColorSpin->setValue( colors );
+ LabelSpin->setValue( labels );
+}
+
+/*!
+ Gets orientation
+*/
+int VisuGUI_ScalarBarPane::getOrientation()
+{
+ if (RBvert->isChecked() )
+ return 1;
+ else
+ return 0;
+}
+
+/*!
+ Called when <OK> button is clicked, validates data and closes dialog
+*/
+bool VisuGUI_ScalarBarPane::check()
+{
+ double minVal = MinEdit->text().toDouble();
+ double maxVal = MaxEdit->text().toDouble();
+ if ( RBIrange->isChecked() ) {
+ if (minVal >= maxVal) {
+ SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
+ tr("MSG_MINMAX_VALUES"),
+ tr("BUT_OK"));
+ return false;
+ }
+ }
+ // check if logarithmic mode is on and check imposed range to not contain negative values
+ if ( CBLog->isChecked() ) {
+ if ( RBIrange->isChecked() ) {
+ if ( (minVal > 0) && (maxVal > 0) ) {
+ // nothing to do
+ }
+ else {
+ SUIT_MessageBox::warn1( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_RANGE"),
+ tr("BUT_OK"));
+ return false;
+ }
+ }
+ else {
+ if ( Rmin > 0 && Rmax > 0 ) {
+ // nothing to do
+ }
+ else {
+ SUIT_MessageBox::warn1( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+ tr("BUT_OK"));
+ RBIrange->setChecked(1);
+ changeRange(1);
+ //MinEdit->setText( QString::number( Rmin ) );
+ //MaxEdit->setText( QString::number( Rmax ) );
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+void VisuGUI_ScalarBarPane::onTextPref()
+{
+ myTextDlg->storeBeginValues();
+ myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp;
+ updatePreview();
+}
+
+void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
+{
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
+ if (thePreview) {
+ createScalarBar();
+ } else {
+ deleteScalarBar();
+ }
+ vf->Repaint();
+ }
+}
+
+VisuGUI_Prs3dDlg::VisuGUI_Prs3dDlg( SalomeApp_Module* theModule )
+ : QDialog( VISU::GetDesktop( theModule ), 0, false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+}
+
+void VisuGUI_Prs3dDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool theInit )
+{
+}
+
+int VisuGUI_Prs3dDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
+{
+ return 1;
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 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
+// 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.
+//
+// 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
+//
+//
+//
+// File : VisuGUI_Prs3dDlg.h
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+
+#ifndef VISUGUI_PRS3DDLG_H
+#define VISUGUI_PRS3DDLG_H
+
+#include <qdialog.h>
+#include <qvbox.h>
+
+#include "SALOME_GenericObjPointer.hh"
+
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QCheckBox;
+class QPushButton;
+class QRadioButton;
+class QSpinBox;
+class QLineEdit;
+class QComboBox;
+class QToolButton;
+class QTabWidget;
+
+class QtxDblSpinBox;
+
+class SalomeApp_Module;
+class SVTK_FontWidget;
+class VISU_ScalarMapAct;
+class VISU_ScalarMapPL;
+
+namespace VISU
+{
+ class ColoredPrs3d_i;
+ class ScalarMap_i;
+}
+
+class VisuGUI_TextPrefDlg: public QDialog
+{
+ Q_OBJECT;
+
+ public:
+ VisuGUI_TextPrefDlg (QWidget* parent);
+ ~VisuGUI_TextPrefDlg() {};
+
+ QString getTitleText();
+ void setTitleText(QString theText);
+
+ void setTitleVisible(bool isVisible);
+
+ void storeBeginValues();
+
+ private:
+ void keyPressEvent( QKeyEvent* e );
+
+ public:
+ SVTK_FontWidget* myTitleFont;
+ SVTK_FontWidget* myLabelFont;
+
+ protected slots:
+ void accept();
+ void reject();
+ void onHelp();
+
+ private:
+ QLineEdit* myTitleEdt;
+ QString myTitle;
+ QColor myColors[2];
+ int myComboVals[2];
+ bool myCheckVals[6];
+};
+
+
+class VisuGUI_ScalarBarPane : public QVBox
+{
+ Q_OBJECT;
+
+ public:
+ VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
+ ~VisuGUI_ScalarBarPane() {};
+
+ void setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
+ void setDefaultRange(double imin, double imax);
+ int getOrientation();
+ void setPosAndSize( double x, double y, double w, double h, bool vert );
+ void setScalarBarData( int colors, int labels );
+ bool isIRange();
+ double getMin();
+ double getMax();
+ double getX();
+ double getY();
+ double getWidth();
+ double getHeight();
+ int getNbColors();
+ int getNbLabels();
+ bool isLogarithmic();
+ void setLogarithmic( bool on );
+ bool isToSave();
+
+ void initFromResources();
+ void storeToResources();
+
+ void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs);
+ int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
+
+ bool check();
+ void deletePreview();
+
+ protected:
+ QButtonGroup* RangeGroup;
+ QRadioButton* RBFrange;
+ QRadioButton* RBIrange;
+ QLineEdit* MinEdit;
+ QLineEdit* MaxEdit;
+
+ QRadioButton* RBhori;
+ QRadioButton* RBvert;
+
+ QtxDblSpinBox* XSpin;
+ QtxDblSpinBox* YSpin;
+
+ QtxDblSpinBox* WidthSpin;
+ QtxDblSpinBox* HeightSpin;
+
+ QSpinBox* ColorSpin;
+ QSpinBox* LabelSpin;
+
+ QCheckBox* CBSave;
+ QCheckBox* CBLog;
+ QLabel* myModeLbl;
+ QComboBox* myModeCombo;
+ QPushButton* myTextBtn;
+ VisuGUI_TextPrefDlg* myTextDlg;
+
+ double Imin, Imax, /* Fmin, Fmax,*/ Rmin, Rmax;
+ double myHorX, myHorY, myHorW, myHorH;
+ double myVerX, myVerY, myVerW, myVerH;
+ int myRangeMode;
+ bool myIsStoreTextProp;
+
+ private slots:
+ void changeDefaults( int );
+ void changeRange( int );
+ void XYChanged( double );
+ void changeScalarMode( int );
+ void onTextPref();
+ void onPreviewCheck(bool thePreview);
+ void updatePreview();
+
+ private:
+ void createScalarBar();
+ void deleteScalarBar();
+
+ QCheckBox* myPreviewCheck;
+ VISU_ScalarMapAct* myPreviewActor;
+ VISU::ScalarMap_i* myScalarMap;
+ VISU_ScalarMapPL* myScalarMapPL;
+ std::string myTitle;
+
+ bool myBusy;
+};
+
+class VisuGUI_Prs3dDlg : public QDialog
+{
+ Q_OBJECT;
+
+ public:
+ VisuGUI_Prs3dDlg( SalomeApp_Module* theModule );
+ ~VisuGUI_Prs3dDlg() {}
+
+ virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool theInit = true );
+ virtual int storeToPrsObject( VISU::ColoredPrs3d_i* thePrs );
+};
+
+#endif
#include "VISU_ScalarMapAct.h"
#include "VISU_Result_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "LightApp_Application.h"
using namespace std;
-
-VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
- QVBox(parent), myPreviewActor(0)
-{
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
- QString propertyName;
- propertyName = QString("scalar_bar_vertical_");
- myVerX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
- myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
- myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
- myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
-
- propertyName = QString("scalar_bar_horizontal_");
- myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
- myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
- myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
- myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
-
- Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
- myRangeMode = -1;
-
- setSpacing(6);
- //setMargin(11);
-
- // Range ============================================================
- RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup");
- RangeGroup->setColumnLayout(0, Qt::Vertical );
- RangeGroup->layout()->setSpacing( 0 );
- RangeGroup->layout()->setMargin( 0 );
- QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup->layout() );
- RangeGroupLayout->setAlignment( Qt::AlignTop );
- RangeGroupLayout->setSpacing( 6 );
- RangeGroupLayout->setMargin( 11 );
-
- myModeLbl = new QLabel("Scalar Mode", RangeGroup);
-
- myModeCombo = new QComboBox(RangeGroup);
-
- CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup);
- CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFrange");
- RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBIrange");
- RBFrange->setChecked( true );
-
- MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
- MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- MinEdit->setMinimumWidth( 70 );
- MinEdit->setValidator( new QDoubleValidator(this) );
- MinEdit->setText( "0.0" );
- QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
- MinLabel->setBuddy(MinEdit);
-
- MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
- MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- MaxEdit->setMinimumWidth( 70 );
- MaxEdit->setValidator( new QDoubleValidator(this) );
- MaxEdit->setText( "0.0" );
- QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
- MaxLabel->setBuddy(MaxEdit);
-
- RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
- RangeGroupLayout->addMultiCellWidget( myModeCombo, 0, 0, 1, 3);
- RangeGroupLayout->addMultiCellWidget( CBLog, 1, 1, 0, 3);
- RangeGroupLayout->addMultiCellWidget( RBFrange, 2, 2, 0, 1);
- RangeGroupLayout->addMultiCellWidget( RBIrange, 2, 2, 2, 3);
- RangeGroupLayout->addWidget( MinLabel, 3, 0 );
- RangeGroupLayout->addWidget( MinEdit, 3, 1 );
- RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
- RangeGroupLayout->addWidget( MaxEdit, 3, 3 );
-
- //TopLayout->addWidget( RangeGroup );
-
- // Colors and Labels ========================================================
- QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
- ColLabGroup->setColumnLayout(0, Qt::Vertical );
- ColLabGroup->layout()->setSpacing( 0 );
- ColLabGroup->layout()->setMargin( 0 );
- QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup->layout() );
- ColLabGroupLayout->setAlignment( Qt::AlignTop );
- ColLabGroupLayout->setSpacing( 6 );
- ColLabGroupLayout->setMargin( 11 );
-
- QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup, "ColorLabel");
- ColorSpin = new QSpinBox( 2, 256, 1, ColLabGroup );
- ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- ColorSpin->setMinimumWidth( 70 );
- ColorSpin->setValue( 64 );
-
- QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup, "LabelLabel");
- LabelSpin = new QSpinBox( 2, 65, 1, ColLabGroup );
- LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- LabelSpin->setMinimumWidth( 70 );
- LabelSpin->setValue( 5 );
-
- ColLabGroupLayout->addWidget( ColorLabel, 0, 0);
- ColLabGroupLayout->addWidget( ColorSpin, 0, 1);
- ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
- ColLabGroupLayout->addWidget( LabelSpin, 0, 3);
-
- //TopLayout->addWidget( ColLabGroup );
-
- // Orientation ==========================================================
- QButtonGroup* OrientGroup = new QButtonGroup (tr("ORIENTATION_GRP"), this, "OrientGroup");
- OrientGroup->setColumnLayout(0, Qt::Vertical );
- OrientGroup->layout()->setSpacing( 0 );
- OrientGroup->layout()->setMargin( 0 );
- QGridLayout* OrientGroupLayout = new QGridLayout( OrientGroup->layout() );
- OrientGroupLayout->setAlignment( Qt::AlignTop );
- OrientGroupLayout->setSpacing( 6 );
- OrientGroupLayout->setMargin( 11 );
-
- RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGroup, "RBvert");
- RBvert->setChecked( true );
- RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), OrientGroup, "RBhori");
- OrientGroupLayout->addWidget( RBvert, 0, 0 );
- OrientGroupLayout->addWidget( RBhori, 0, 1 );
-
- // TopLayout->addWidget( OrientGroup );
-
- // Origin ===============================================================
- QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this, "OriginGroup");
- OriginGroup->setColumnLayout(0, Qt::Vertical );
- OriginGroup->layout()->setSpacing( 0 );
- OriginGroup->layout()->setMargin( 0 );
- QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
- OriginGroupLayout->setAlignment( Qt::AlignTop );
- OriginGroupLayout->setSpacing( 6 );
- OriginGroupLayout->setMargin( 11 );
-
- QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup, "XLabel");
- XSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
- XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- XSpin->setMinimumWidth( 70 );
- XSpin->setValue( 0.01 );
-
- QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup, "YLabel");
- YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
- YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- YSpin->setMinimumWidth( 70 );
- YSpin->setValue( 0.01 );
-
- OriginGroupLayout->addWidget( XLabel, 0, 0);
- OriginGroupLayout->addWidget( XSpin, 0, 1);
- OriginGroupLayout->addWidget( YLabel, 0, 2);
- OriginGroupLayout->addWidget( YSpin, 0, 3);
-
- //TopLayout->addWidget( OriginGroup );
-
- // Dimensions =========================================================
- QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this, "DimGroup");
- DimGroup->setColumnLayout(0, Qt::Vertical );
- DimGroup->layout()->setSpacing( 0 );
- DimGroup->layout()->setMargin( 0 );
- QGridLayout* DimGroupLayout = new QGridLayout( DimGroup->layout() );
- DimGroupLayout->setAlignment( Qt::AlignTop );
- DimGroupLayout->setSpacing( 6 );
- DimGroupLayout->setMargin( 11 );
-
- QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup, "WidthLabel");
- WidthSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
- WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- WidthSpin->setMinimumWidth( 70 );
- WidthSpin->setValue( 0.1 );
-
- QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup, "HeightLabel");
- HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
- HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- HeightSpin->setMinimumWidth( 70 );
- HeightSpin->setValue( 0.8 );
-
- DimGroupLayout->addWidget( WidthLabel, 0, 0);
- DimGroupLayout->addWidget( WidthSpin, 0, 1);
- DimGroupLayout->addWidget( HeightLabel, 0, 2);
- DimGroupLayout->addWidget( HeightSpin, 0, 3);
-
- //TopLayout->addWidget( DimGroup );
-
- // Save check box ===========================================================
- QHBox* aSaveBox = new QHBox(this);
- if (!SetPref) {
- CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
- //TopLayout->addWidget(CBSave);
- }
- else {
- CBSave = 0;
- }
- myTextBtn = new QPushButton("Text properties...", aSaveBox);
- myTextDlg = new VisuGUI_TextPrefDlg(this);
- myTextDlg->setTitleVisible(!SetPref);
-
- QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
- CheckGroup->setColumnLayout(0, Qt::Vertical );
- CheckGroup->layout()->setSpacing( 0 );
- CheckGroup->layout()->setMargin( 0 );
- QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup->layout() );
-
- myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
- myPreviewCheck->setChecked(false);
- CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
-
- // signals and slots connections ===========================================
- connect( RangeGroup, SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
- connect( myModeCombo, SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) );
- connect( OrientGroup, SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
- connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
- connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
- connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
- connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
- connect( ColorSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
- connect( LabelSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
- connect( WidthSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
- connect( HeightSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
- connect( CBLog, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ));
- changeRange( 0 );
- changeDefaults( 0 );
- myIsStoreTextProp = false;
- myBusy = false;
-}
-
-/**
- * Initializes dialog box values from resources
- */
-void VisuGUI_ScalarBarPane::initFromResources() {
- int sbCol=64,sbLab=5,orient=0;
- float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
- float sbVmin=0., sbVmax=0.;
- bool sbRange=false;
- QString aString;
-
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
- bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
- int aPlace = 1;
- if (anIsArrangeBar){
- aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
- }
-
- int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
- myModeCombo->setCurrentItem(aScalarMode);
-
- orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", orient);
- if(orient != 0){
- orient=1;
- sbX1=0.2;
- sbY1=0.01;
- sbW=0.6;
- sbH=0.12;
- }
-
- QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
- sbX1 = aResourceMgr->doubleValue("VISU", propertyName + "x", sbX1);
- sbY1 = aResourceMgr->doubleValue("VISU", propertyName + "y", sbY1);
-
- sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW);
- sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH);
-
- if(orient){
- sbY1 += sbH*(aPlace-1);
- } else {
- sbX1 += sbW*(aPlace-1);
- }
- sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol);
- sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab);
-
- int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
- if (rangeType == 1) sbRange = true;
- sbVmin = aResourceMgr->doubleValue("VISU", "scalar_range_min", sbVmin);
- sbVmax = aResourceMgr->doubleValue("VISU", "scalar_range_max", sbVmax);
-
- bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
- setLogarithmic(isLog);
-
- if((sbX1 < 0.) || (sbY1 < 0.) ||
- ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
- if(orient == 0) {
- sbX1=0.01;
- sbY1=0.1;
- sbW=0.1;
- sbH=0.8;
- } else {
- sbX1=0.2;
- sbY1=0.01;
- sbW=0.6;
- sbH=0.12;
- }
- }
- if(sbCol < 2) sbCol=2;
- if(sbCol > 64) sbCol=64;
- if(sbLab < 2) sbLab=2;
- if(sbLab > 65) sbLab=65;
-
- if(sbVmin > sbVmax) {
- sbVmin=0.;
- sbVmax=0.;
- }
-
- setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
- setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 0);
- setScalarBarData( sbCol, sbLab );
-
- // "Title"
- bool isBold = false, isItalic = false, isShadow = false;
- int aFontFamily = VTK_ARIAL;
-
- if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
- {
- QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
-
- if ( f.family() == "Arial" )
- aFontFamily = VTK_ARIAL;
- else if ( f.family() == "Courier" )
- aFontFamily = VTK_COURIER;
- else if ( f.family() == "Times" )
- aFontFamily = VTK_TIMES;
-
- isBold = f.bold();
- isItalic = f.italic();
- isShadow = f.underline();
- }
-
- QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
-
- myTextDlg->myTitleFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
-
- // "Labels"
- isBold = isItalic = isShadow = false;
- aFontFamily = VTK_ARIAL;
-
- if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
- {
- QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
-
- if ( f.family() == "Arial" )
- aFontFamily = VTK_ARIAL;
- else if ( f.family() == "Courier" )
- aFontFamily = VTK_COURIER;
- else if ( f.family() == "Times" )
- aFontFamily = VTK_TIMES;
-
- isBold = f.bold();
- isItalic = f.italic();
- isShadow = f.underline();
- }
-
- aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
-
- myTextDlg->myLabelFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
-}
-
-/**
- * Stores dialog values to resources
- */
-void VisuGUI_ScalarBarPane::storeToResources() {
- int orient = (RBvert->isChecked())? 0 : 1;
- float sbX1 = XSpin->value();
- float sbY1 = YSpin->value();
- float sbW = WidthSpin->value();
- float sbH = HeightSpin->value();
- int sbCol = ColorSpin->value();
- int sbLab = LabelSpin->value();
-
- if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
- if(orient == 0) {
- sbX1=0.01;
- sbY1=0.1;
- sbW=0.17;
- sbH=0.8;
- } else {
- sbX1=0.2;
- sbY1=0.01;
- sbW=0.6;
- sbH=0.12;
- }
- }
-
- bool sbRange = RBIrange->isChecked();
- float sbVmin = (float)(MinEdit->text().toDouble());
- float sbVmax = (float)(MaxEdit->text().toDouble());
-
- if(sbVmin > sbVmax) {
- sbVmin=0.;
- sbVmax=0.;
- }
-
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
- aResourceMgr->setValue("VISU", "scalar_bar_orientation", orient);
-
- QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
- aResourceMgr->setValue("VISU", propertyName + "x", sbX1);
- aResourceMgr->setValue("VISU", propertyName + "y", sbY1);
- aResourceMgr->setValue("VISU", propertyName + "width", sbW);
- aResourceMgr->setValue("VISU", propertyName + "height", sbH);
-
- aResourceMgr->setValue("VISU", "scalar_bar_num_colors", sbCol);
- aResourceMgr->setValue("VISU", "scalar_bar_num_labels", sbLab);
-
- if(sbRange)
- {
- aResourceMgr->setValue("VISU", "scalar_range_type", 1);
- aResourceMgr->setValue("VISU", "scalar_range_min" ,sbVmin);
- aResourceMgr->setValue("VISU", "scalar_range_max" ,sbVmax);
- }
- else
- aResourceMgr->setValue("VISU", "scalar_range_type", 0);
-
- aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
-
- ////
-
- if (myIsStoreTextProp) {
- // "Title"
- QColor aTitleColor (255, 255, 255);
- int aTitleFontFamily = VTK_ARIAL;
- bool isTitleBold = false;
- bool isTitleItalic = false;
- bool isTitleShadow = false;
-
- myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
- isTitleBold, isTitleItalic, isTitleShadow);
-
- QFont aTitleFont;
-
- aTitleFont.setBold(isTitleBold);
- aTitleFont.setItalic(isTitleItalic);
- aTitleFont.setUnderline(isTitleShadow);
-
- QString titleFontFamily;
- switch (aTitleFontFamily) {
- case VTK_ARIAL:
- titleFontFamily = "Arial";
- break;
- case VTK_COURIER:
- titleFontFamily = "Courier";
- break;
- case VTK_TIMES:
- titleFontFamily = "Times";
- break;
- }
- aTitleFont.setFamily(titleFontFamily);
-
- aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
-
- aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
-
- // "Label"
- QColor aLabelColor (255, 255, 255);
- int aLabelFontFamily = VTK_ARIAL;
- bool isLabelBold = false;
- bool isLabelItalic = false;
- bool isLabelShadow = false;
-
- myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
- isLabelBold, isLabelItalic, isLabelShadow);
-
-
- QFont aLabelFont;
-
- aLabelFont.setBold(isLabelBold);
- aLabelFont.setItalic(isLabelItalic);
- aLabelFont.setUnderline(isLabelShadow);
-
- QString labelFontFamily;
- switch (aLabelFontFamily) {
- case VTK_ARIAL:
- labelFontFamily = "Arial";
- break;
- case VTK_COURIER:
- labelFontFamily = "Courier";
- break;
- case VTK_TIMES:
- labelFontFamily = "Times";
- break;
- }
-
- aLabelFont.setFamily(labelFontFamily);
-
- aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
-
- aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
- }
-}
-
-/**
- * Initialise dialog box from presentation object
- */
-void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
- initFromResources();
- myScalarMap = thePrs;
- myTitle = thePrs->GetTitle();
- setPosAndSize( thePrs->GetPosX(),
- thePrs->GetPosY(),
- thePrs->GetWidth(),
- thePrs->GetHeight(),
- thePrs->GetBarOrientation());
- switch(thePrs->GetScaling()){
- case VISU::LOGARITHMIC :
- setLogarithmic(true);
- break;
- default:
- setLogarithmic(false);
- }
- CORBA::Double aRange[2] = {thePrs->GetSourceMin(), thePrs->GetSourceMax()};
- Rmin = aRange[0]; Rmax = aRange[1];
- setRange( thePrs->GetMin(), thePrs->GetMax(),
- /*0.0, 0.0,*/ thePrs->IsRangeFixed() );
- setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
-
- // Update myModeCombo
- int aNbComp = thePrs->GetField()->myNbComp;
- bool isScalarMode = (aNbComp > 1);
- myModeCombo->clear();
- myModeCombo->insertItem("<Modulus>");
- const VISU::PField& aField = thePrs->GetField();
- const VISU::TNames& aCompNames = aField->myCompNames;
- const VISU::TNames& aUnitNames = aField->myUnitNames;
- for(int i = 0; i < aNbComp; i++){
- QString aComponent = QString(aCompNames[i].c_str()).simplifyWhiteSpace();
- if(aComponent.isNull() || aComponent == "")
- aComponent = "Component " + QString::number(i+1);
- else
- aComponent = "[" + QString::number(i+1) + "] " + aComponent;
-
- QString anUnit = QString(aUnitNames[i].c_str()).simplifyWhiteSpace();
- if(anUnit.isNull() || anUnit == "")
- anUnit = "-";
-
- aComponent = aComponent + ", " + anUnit;
-
- myModeCombo->insertItem(aComponent);
- }
- //
- myModeCombo->setCurrentItem(thePrs->GetScalarMode());
- if (aNbComp==1){
- myModeCombo->setCurrentItem(1);
- }
- //
- myModeLbl->setEnabled(isScalarMode);
- myModeCombo->setEnabled(isScalarMode);
-
- // "Title"
- myTextDlg->setTitleText(QString(thePrs->GetTitle()));
-
- vtkFloatingPointType R, G, B;
- thePrs->GetTitleColor(&R, &G, &B);
-
- myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
- thePrs->GetTitFontType(),
- thePrs->IsBoldTitle(),
- thePrs->IsItalicTitle(),
- thePrs->IsShadowTitle());
-
- // "Labels"
- thePrs->GetLabelColor(&R, &G, &B);
-
- myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
- thePrs->GetLblFontType(),
- thePrs->IsBoldLabel(),
- thePrs->IsItalicLabel(),
- thePrs->IsShadowLabel());
-
- // Draw Preview
- if (myPreviewCheck->isChecked()) {
- createScalarBar();
- updatePreview();
- }
-
-}
-/*! Slot update preview of scalar bar, if preview is checked
- */
-void VisuGUI_ScalarBarPane::updatePreview()
-{
- if (myPreviewCheck->isChecked()) {
- if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
- deleteScalarBar();
- createScalarBar();
- vf->Repaint();
- }
- }
-}
-
-/*! Creating preview scalar bar
- */
-void VisuGUI_ScalarBarPane::createScalarBar()
-{
- if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
- if (myPreviewActor != 0) return;
- if (myScalarMap == NULL) return;
-
- if (!check()) return;
- myScalarMapPL = VISU_ScalarMapPL::New();
- if(myScalarMap->GetSpecificPL())
- myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL());
-
- if ( myBusy ) return;
-
- myBusy = true;
-
- int sbCol,sbLab;
- sbCol = getNbColors();
- sbLab = getNbLabels();
- if(sbCol < 2) sbCol=2;
- if(sbCol > 64) sbCol=64;
- if(sbLab < 2) sbLab=2;
- if(sbLab > 65) sbLab=65;
- myPreviewActor = VISU_ScalarMapAct::New();
- VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar();
- myPreviewActor->GetScalarBar()->VisibilityOn();
- myPreviewActor->PickableOff();
-
- myScalarMapPL->SetScalarMode(myModeCombo->currentItem());
- if(isLogarithmic())
- myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
- else
- myScalarMapPL->SetScaling(VISU::LINEAR);
- vtkFloatingPointType theRange[2];
- theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
- theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
- myScalarMapPL->SetScalarRange(theRange);
- myScalarMapPL->SetNbColors(sbCol);
-
- myScalarMapPL->Update();
-
- aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
-
- if (myTextDlg->getTitleText().latin1() != "")
- aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
- else
- aScalarBarActor->SetTitle(myTitle.c_str());
- aScalarBarActor->SetOrientation(getOrientation());
- aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
- aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY());
- aScalarBarActor->SetWidth(getWidth());
- aScalarBarActor->SetHeight(getHeight());
- aScalarBarActor->SetNumberOfLabels(sbLab);
- aScalarBarActor->SetMaximumNumberOfColors(sbCol);
-
- // title text property
- QColor aTitleColor;
- int aTitleFontFamily;
- bool isTitleBold;
- bool isTitleItalic;
- bool isTitleShadow;
- myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
- isTitleBold,isTitleItalic,isTitleShadow);
- vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
- aTitleProp->SetFontFamily(aTitleFontFamily);
- aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255.,
- vtkFloatingPointType(aTitleColor.green())/255.,
- vtkFloatingPointType(aTitleColor.blue())/255.);
- (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
- (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
- (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
-
- // label text property
- QColor aLabelColor;
- int aLabelFontFamily;
- bool isLabelBold;
- bool isLabelItalic;
- bool isLabelShadow;
- myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
- isLabelBold, isLabelItalic, isLabelShadow);
- vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
- aLabelProp->SetFontFamily(aLabelFontFamily);
- aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255.,
- vtkFloatingPointType(aLabelColor.green())/255.,
- vtkFloatingPointType(aLabelColor.blue())/255.);
- (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
- (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
- (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
-
- aScalarBarActor->Modified();
-
- VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
-
- myBusy = false;
-}
-/*! Deleting preview scalar bar
- */
-void VisuGUI_ScalarBarPane::deleteScalarBar()
-{
- if ( myBusy ) return;
-
- if (myPreviewActor == 0) return;
- vtkRenderer* aRend = myPreviewActor->GetRenderer();
- vtkRenderWindow* aWnd = aRend->GetRenderWindow();
- if(aRend && aWnd)
- myPreviewActor->RemoveFromRender(aRend);
- myPreviewActor->GetScalarBar()->VisibilityOff();
- myPreviewActor->Delete();
- myPreviewActor = 0;
-
- if (myScalarMapPL){
- myScalarMapPL->Delete();
- myScalarMapPL = 0;
- }
-}
-/*! public: Deleting preview scalar bar
- */
-void VisuGUI_ScalarBarPane::deletePreview()
-{
- deleteScalarBar();
- if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
- vf->Repaint();
-}
-/**
- * Store values to presentation object
- */
-int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) {
- thePrs->SetScalarMode(myModeCombo->currentItem());
- thePrs->SetPosition(XSpin->value(), YSpin->value());
- thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
- thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
- if(isLogarithmic())
- thePrs->SetScaling(VISU::LOGARITHMIC);
- else
- thePrs->SetScaling(VISU::LINEAR);
-
- if (RBFrange->isChecked()) {
- thePrs->SetSourceRange();
- } else {
- thePrs->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
- }
- thePrs->SetNbColors(ColorSpin->value());
- thePrs->SetLabels(LabelSpin->value());
-
- if (isToSave()) storeToResources();
-
- if (myIsStoreTextProp) {
- // "Title"
- thePrs->SetTitle(myTextDlg->getTitleText().latin1());
-
- QColor aTitColor (255, 255, 255);
- int aTitleFontFamily = VTK_ARIAL;
- bool isTitleBold = false;
- bool isTitleItalic = false;
- bool isTitleShadow = false;
-
- myTextDlg->myTitleFont->GetData(aTitColor, aTitleFontFamily,
- isTitleBold, isTitleItalic, isTitleShadow);
-
- thePrs->SetBoldTitle(isTitleBold);
- thePrs->SetItalicTitle(isTitleItalic);
- thePrs->SetShadowTitle(isTitleShadow);
- thePrs->SetTitFontType(aTitleFontFamily);
- thePrs->SetTitleColor(aTitColor.red()/255.,
- aTitColor.green()/255.,
- aTitColor.blue()/255.);
-
- // "Label"
- QColor aLblColor (255, 255, 255);
- int aLabelFontFamily = VTK_ARIAL;
- bool isLabelBold = false;
- bool isLabelItalic = false;
- bool isLabelShadow = false;
-
- myTextDlg->myLabelFont->GetData(aLblColor, aLabelFontFamily,
- isLabelBold, isLabelItalic, isLabelShadow);
-
- thePrs->SetBoldLabel(isLabelBold);
- thePrs->SetItalicLabel(isLabelItalic);
- thePrs->SetShadowLabel(isLabelShadow);
- thePrs->SetLblFontType(aLabelFontFamily);
- thePrs->SetLabelColor(aLblColor.red()/255.,
- aLblColor.green()/255.,
- aLblColor.blue()/255.);
- myIsStoreTextProp = false;
- }
-
- return 1;
-}
-
-/*!
- Called when orientation is changed
-*/
-void VisuGUI_ScalarBarPane::changeDefaults( int )
-{
- if ( RBvert->isChecked() ) {
- XSpin->setValue( myVerX );
- YSpin->setValue( myVerY );
- WidthSpin->setValue( myVerW );
- HeightSpin->setValue( myVerH );
- }
- else {
- XSpin->setValue( myHorX );
- YSpin->setValue( myHorY );
- WidthSpin->setValue( myHorW );
- HeightSpin->setValue( myHorH );
- }
- updatePreview();
-}
-
-/*!
- Called when Range mode is changed
-*/
-void VisuGUI_ScalarBarPane::changeRange( int )
-{
- int mode = -1;
- if ( RBFrange->isChecked() )
- mode = 0;
- if ( RBIrange->isChecked() )
- mode = 1;
- if ( myRangeMode == mode )
- return;
- //MinSpin->setMaxValue( Fmin );
- //MaxSpin->setMinValue( Fmax );
- if ( RBFrange->isChecked() ) {
- //MinLabel->setEnabled( false );
- MinEdit->setEnabled( false );
- //MaxLabel->setEnabled( false );
- MaxEdit->setEnabled( false );
- if ( mode != -1 ) {
- Imin = MinEdit->text().toDouble();
- Imax = MaxEdit->text().toDouble();
- }
- MinEdit->setText( QString::number( Rmin ) );
- MaxEdit->setText( QString::number( Rmax ) );
- }
- else {
- //MinLabel->setEnabled( true );
- MinEdit->setEnabled( true );
- //MaxLabel->setEnabled( true );
- MaxEdit->setEnabled( true );
- MinEdit->setText( QString::number( Imin ) );
- MaxEdit->setText( QString::number( Imax ) );
- }
- myRangeMode = mode;
- updatePreview();
-}
-
-/*!
- Called when X,Y position is changed
-*/
-void VisuGUI_ScalarBarPane::XYChanged( double )
-{
- QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
- if ( snd == XSpin ) {
- WidthSpin->setMaxValue( 1.0 - XSpin->value() );
- }
- if ( snd == YSpin ) {
- HeightSpin->setMaxValue( 1.0 - YSpin->value() );
- }
- updatePreview();
-}
-
-/*!
- Called when scalar mode is changed
-*/
-void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
-{
- if ( myScalarMap ) {
- if ( RBFrange->isChecked() ) {
- int aMode = myScalarMap->GetScalarMode();
- myScalarMap->SetScalarMode(theMode);
- CORBA::Double aRange[2] = {myScalarMap->GetSourceMin(), myScalarMap->GetSourceMax()};
- MinEdit->setText( QString::number( aRange[0] ) );
- MaxEdit->setText( QString::number( aRange[1] ) );
- myScalarMap->SetScalarMode(aMode);
- }
- }
- updatePreview();
-}
-
-/*!
- Sets default values and range mode
-*/
-void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
-{
- Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
- if ( RBIrange->isChecked() ) {
- MinEdit->setText( QString::number( Imin ) );
- MaxEdit->setText( QString::number( Imax ) );
- }
- else {
- MinEdit->setText( QString::number( Rmin ) );
- MaxEdit->setText( QString::number( Rmax ) );
- }
- myRangeMode = -1;
- if( sbRange )
- RBIrange->setChecked( true );
- else
- RBFrange->setChecked( true );
- changeRange( 0 );
-}
-
-/*!
- Sets default values and range mode
-*/
-void VisuGUI_ScalarBarPane::setDefaultRange(double imin, double imax){
- Rmin = imin;
- Rmax = imax;
-}
-
-/*!
- Sets size and position
-*/
-void VisuGUI_ScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
-{
- if ( vert ) {
- myVerX = x;
- myVerY = y;
- myVerW = w;
- myVerH = h;
- RBvert->setChecked( true );
- }
- else {
- myHorX = x;
- myHorY = y;
- myHorW = w;
- myHorH = h;
- RBhori->setChecked( true );
- }
- changeDefaults( 0 );
-}
-
-/*!
- Sets colors and labels number
-*/
-void VisuGUI_ScalarBarPane::setScalarBarData( int colors, int labels )
-{
- ColorSpin->setValue( colors );
- LabelSpin->setValue( labels );
-}
-
-/*!
- Gets orientation
-*/
-int VisuGUI_ScalarBarPane::getOrientation()
-{
- if (RBvert->isChecked() )
- return 1;
- else
- return 0;
-}
-
-/*!
- Called when <OK> button is clicked, validates data and closes dialog
-*/
-bool VisuGUI_ScalarBarPane::check()
-{
- double minVal = MinEdit->text().toDouble();
- double maxVal = MaxEdit->text().toDouble();
- if ( RBIrange->isChecked() ) {
- if (minVal >= maxVal) {
- SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
- tr("MSG_MINMAX_VALUES"),
- tr("BUT_OK"));
- return false;
- }
- }
- // check if logarithmic mode is on and check imposed range to not contain negative values
- if ( CBLog->isChecked() ) {
- if ( RBIrange->isChecked() ) {
- if ( (minVal > 0) && (maxVal > 0) ) {
- // nothing to do
- }
- else {
- SUIT_MessageBox::warn1( this,
- tr("WRN_VISU"),
- tr("WRN_LOGARITHMIC_RANGE"),
- tr("BUT_OK"));
- return false;
- }
- }
- else {
- if ( Rmin > 0 && Rmax > 0 ) {
- // nothing to do
- }
- else {
- SUIT_MessageBox::warn1( this,
- tr("WRN_VISU"),
- tr("WRN_LOGARITHMIC_FIELD_RANGE"),
- tr("BUT_OK"));
- RBIrange->setChecked(1);
- changeRange(1);
- //MinEdit->setText( QString::number( Rmin ) );
- //MaxEdit->setText( QString::number( Rmax ) );
- return false;
- }
- }
- }
- return true;
-}
-
-void VisuGUI_ScalarBarPane::onTextPref()
-{
- myTextDlg->storeBeginValues();
- myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp;
- updatePreview();
-}
-
-void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
-{
- if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
- if (thePreview) {
- createScalarBar();
- } else {
- deleteScalarBar();
- }
- vf->Repaint();
- }
-}
-
-//#######################################################################################
-
/*!
Constructor
*/
VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref)
- : QDialog(VISU::GetDesktop(theModule), 0, false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ : VisuGUI_Prs3dDlg(theModule)
{
setName("VisuGUI_ScalarBarDlg");
setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
/*!
Initialize dialog from the presentation
*/
-void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::ScalarMap_i* thePrs)
+void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- myScalarPane->initFromPrsObject( thePrs );
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TSCALARMAP>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+ myScalarPane->initFromPrsObject( myPrsCopy );
- if( thePrs->IsTimeStampFixed() )
+ if( !theInit )
+ return;
+
+ if( myPrsCopy->IsTimeStampFixed() )
myTabBox->removePage( myInputPane );
else
{
- myInputPane->initFromPrsObject( thePrs );
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->showPage( myInputPane );
}
myTabBox->setCurrentPage( 0 );
/*!
Store dialog to the presentation
*/
-int VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ScalarMap_i* thePrs)
+int VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
{
int ok = 1;
- if( !thePrs->IsTimeStampFixed() )
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- ok = myInputPane->storeToPrsObject( thePrs );
+ ok = myInputPane->storeToPrsObject( myPrsCopy );
}
- return ok && myScalarPane->storeToPrsObject(thePrs);
-}
+ ok = ok && myScalarPane->storeToPrsObject( myPrsCopy );
-/*!
- Provides help on F1 button click
-*/
-void VisuGUI_ScalarBarDlg::keyPressEvent( QKeyEvent* e )
-{
- QDialog::keyPressEvent( e );
- if ( e->isAccepted() )
- return;
+ VISU::TSameAsFactory<VISU::TSCALARMAP>().Copy(thePrs, myPrsCopy);
- if ( e->key() == Key_F1 )
- {
- e->accept();
- onHelp();
- }
-}
-
-//#######################################################################################
-VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
- : QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
-{
- setName("VisuGUI_TextPrefDlg");
- setCaption(tr("TIT_TEXT_PREF"));
- setSizeGripEnabled(TRUE);
-
- QVBoxLayout* TopLayout = new QVBoxLayout(this);
- TopLayout->setSpacing(6);
- TopLayout->setMargin(11);
-
- // "Title" grp
- QGroupBox* aTitleGrp = new QGroupBox (2, Qt::Vertical, tr("LBL_TITLE"), this);
-
- // edit line
- myTitleEdt = new QLineEdit (aTitleGrp);
-
- // font
- QHBox* aHBox = new QHBox (aTitleGrp);
- aHBox->setSpacing(5);
- myTitleFont = new SVTK_FontWidget (aHBox);
-
- TopLayout->addWidget(aTitleGrp);
-
- // "Labels" grp
- QGroupBox* aLabelsGrp = new QGroupBox (1, Qt::Vertical, tr("LBL_LABELS"), this);
-
- // font
- aHBox = new QHBox (aLabelsGrp);
- aHBox->setSpacing(5);
- myLabelFont = new SVTK_FontWidget (aHBox);
-
- TopLayout->addWidget(aLabelsGrp);
-
- // Common buttons ===========================================================
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- 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" );
- 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 );
-
- connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
- connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
- connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
-}
-
-void VisuGUI_TextPrefDlg::onHelp()
-{
- QString aHelpFileName = "/files/scalar_map_presentation.htm";
- LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
- if (app) {
- VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
- app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
- }
- else {
- SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
- QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
- QObject::tr("BUT_OK"));
- }
-}
-
-void VisuGUI_TextPrefDlg::storeBeginValues()
-{
- myTitle = myTitleEdt->text();
- myTitleFont->GetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]);
- myLabelFont->GetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
-}
-
-/*!
- Called when <Cancel> button is clicked, restore begin values
-*/
-void VisuGUI_TextPrefDlg::reject()
-{
- myTitleEdt->setText(myTitle);
- myTitleFont->SetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]);
- myLabelFont->SetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
-
- QDialog::reject();
-}
-/*!
- Called when <Ok> button is clicked, store begin values
-*/
-void VisuGUI_TextPrefDlg::accept()
-{
- storeBeginValues();
-
- QDialog::accept();
+ return ok;
}
/*!
Provides help on F1 button click
*/
-void VisuGUI_TextPrefDlg::keyPressEvent( QKeyEvent* e )
+void VisuGUI_ScalarBarDlg::keyPressEvent( QKeyEvent* e )
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
#ifndef VISUGUI_SCALARBARDLG_H
#define VISUGUI_SCALARBARDLG_H
-#include <qdialog.h>
+#include "VisuGUI_Prs3dDlg.h"
+
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qvbox.h>
-#include <qtoolbutton.h>
#include "QtxDblSpinBox.h"
#include "VISU_ScalarMap_i.hh"
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QRadioButton;
-class QCheckBox;
-class QPushButton;
-class QSpinBox;
-class QLineEdit;
-class QComboBox;
-class QVBox;
-class QToolButton;
-class QTabWidget;
-
-class QtxDblSpinBox;
-class SalomeApp_Module;
-class SVTK_FontWidget;
-class VISU_ScalarMapAct;
class VisuGUI_InputPane;
-class VisuGUI_TextPrefDlg: public QDialog
-{
- Q_OBJECT;
-
- public:
- VisuGUI_TextPrefDlg (QWidget* parent);
- ~VisuGUI_TextPrefDlg() {};
-
- QString getTitleText() { return myTitleEdt->text(); }
- void setTitleText(QString theText) { myTitleEdt->setText(theText); }
-
- void setTitleVisible (bool isVisible)
- { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
-
- void storeBeginValues();
-
- private:
- void keyPressEvent( QKeyEvent* e );
-
- public:
- SVTK_FontWidget* myTitleFont;
- SVTK_FontWidget* myLabelFont;
-
- protected slots:
- void accept();
- void reject();
- void onHelp();
-
- private:
- QLineEdit* myTitleEdt;
- QString myTitle;
- QColor myColors[2];
- int myComboVals[2];
- bool myCheckVals[6];
-};
-
-
-class VisuGUI_ScalarBarPane : public QVBox
-{
- Q_OBJECT;
-
- public:
- VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
- ~VisuGUI_ScalarBarPane() {};
-
- void setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
- void setDefaultRange(double imin, double imax);
- bool isIRange() {return RBIrange->isChecked();}
- double getMin() {return MinEdit->text().toDouble();}
- double getMax() {return MaxEdit->text().toDouble();}
- int getOrientation();
- void setPosAndSize( double x, double y, double w, double h, bool vert );
- double getX() {return XSpin->value();}
- double getY() {return YSpin->value();}
- double getWidth() {return WidthSpin->value();}
- double getHeight() {return HeightSpin->value();}
- void setScalarBarData( int colors, int labels );
- int getNbColors() {return ColorSpin->value();}
- int getNbLabels() {return LabelSpin->value();}
- bool isLogarithmic() {return CBLog->isChecked();}
- void setLogarithmic( bool on ) {CBLog->setChecked( on );}
- bool isToSave() {return CBSave ? CBSave->isChecked() : false;}
-
- void initFromResources();
- void storeToResources();
-
- void initFromPrsObject(VISU::ScalarMap_i* thePrs);
- int storeToPrsObject(VISU::ScalarMap_i* thePrs);
-
- bool check();
- void deletePreview();
-
- protected:
- QButtonGroup* RangeGroup;
- QRadioButton* RBFrange;
- QRadioButton* RBIrange;
- QLineEdit* MinEdit;
- QLineEdit* MaxEdit;
-
- QRadioButton* RBhori;
- QRadioButton* RBvert;
-
- QtxDblSpinBox* XSpin;
- QtxDblSpinBox* YSpin;
-
- QtxDblSpinBox* WidthSpin;
- QtxDblSpinBox* HeightSpin;
-
- QSpinBox* ColorSpin;
- QSpinBox* LabelSpin;
-
- QCheckBox* CBSave;
- QCheckBox* CBLog;
- QLabel* myModeLbl;
- QComboBox* myModeCombo;
- QPushButton* myTextBtn;
- VisuGUI_TextPrefDlg* myTextDlg;
-
- double Imin, Imax, /* Fmin, Fmax,*/ Rmin, Rmax;
- double myHorX, myHorY, myHorW, myHorH;
- double myVerX, myVerY, myVerW, myVerH;
- int myRangeMode;
- bool myIsStoreTextProp;
-
- private slots:
- void changeDefaults( int );
- void changeRange( int );
- void XYChanged( double );
- void changeScalarMode( int );
- void onTextPref();
- void onPreviewCheck(bool thePreview);
- void updatePreview();
-
- private:
- void createScalarBar();
- void deleteScalarBar();
-
- QCheckBox* myPreviewCheck;
- VISU_ScalarMapAct* myPreviewActor;
- VISU::ScalarMap_i* myScalarMap;
- VISU_ScalarMapPL* myScalarMapPL;
- std::string myTitle;
-
- bool myBusy;
-};
-
-
-class VisuGUI_ScalarBarDlg : public QDialog
+class VisuGUI_ScalarBarDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT;
void initFromResources() {myScalarPane->initFromResources();}
void storeToResources() {myScalarPane->storeToResources();}
- void initFromPrsObject(VISU::ScalarMap_i* thePrs);
- int storeToPrsObject(VISU::ScalarMap_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
private:
void keyPressEvent( QKeyEvent* e );
VisuGUI_ScalarBarPane* myScalarPane;
VisuGUI_InputPane* myInputPane;
QTabWidget* myTabBox;
+
+ SALOME::GenericObjPtr<VISU::ScalarMap_i> myPrsCopy;
};
#endif // VISUGUI_SCALARBARDLG_H
#include "VISU_Result_i.hh"
#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_ScalarMapPL.hxx"
#include "VISU_ScalarMapOnDeformedShapePL.hxx"
* Constructor
*/
VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_ScalarMapOnDeformedShapeDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- myIsAnimation(false),
- myVisuGUI(theModule)
+ : VisuGUI_Prs3dDlg(theModule),
+ myIsAnimation(false),
+ myUpdateScalars(true),
+ myIteration(1),
+ myVisuGUI(theModule)
{
- myPrs = NULL;
setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int)));
}
-void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject
- (VISU::ScalarMapOnDeformedShape_i* thePrs, bool isAnim)
+void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- myIsAnimation = isAnim;
- myPrs = thePrs;
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Create(thePrs,
+ VISU::ColoredPrs3d_i::EDoNotPublish);
- setFactor(myPrs->GetScale());
- myTimeStampsCombo->setDisabled(isAnim);
- myCurrMeshName = thePrs->GetCMeshName();
+ setFactor(myPrsCopy->GetScale());
+ myTimeStampsCombo->setDisabled(myIsAnimation);
+ myCurrMeshName = myPrsCopy->GetCMeshName();
- QString aFieldName(myPrs->GetScalarFieldName().c_str());
- CORBA::String_var aMeshName = myPrs->GetMeshName();
+ QString aFieldName(myPrsCopy->GetScalarFieldName().c_str());
+ CORBA::String_var aMeshName = myPrsCopy->GetMeshName();
float aIterFloat = GetFloatValueOfTimeStamp(aMeshName.in(),
- myPrs->GetScalarFieldName().c_str(),
- myPrs->GetScalarIteration(),
- myPrs->GetScalarEntity());
+ myPrsCopy->GetScalarFieldName().c_str(),
+ myPrsCopy->GetScalarIteration(),
+ myPrsCopy->GetScalarEntity());
QString aIteration(QString("%1").arg(aIterFloat));
if (myMeshFieldsTimes.size() == 0)
if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
_PTR(AttributeName) aNameAttr(anAttr);
QString aMeshName = VISU::getValue(aChildSObj, "myMeshName");
- CORBA::String_var aName = myPrs->GetMeshName();
+ CORBA::String_var aName = myPrsCopy->GetMeshName();
if (aMeshName != aName.in())
continue;
myCurrMeshName = aMeshName;
myTimeStampsCombo->setCurrentText(aIteration);
SetScalarField( false );
- myScalarPane->initFromPrsObject(myPrs);
+ myScalarPane->initFromPrsObject(myPrsCopy);
- if( thePrs->IsTimeStampFixed() )
+ if( !theInit )
+ return;
+
+ if( myPrsCopy->IsTimeStampFixed() )
myTabBox->removePage( myInputPane );
else
{
- myInputPane->initFromPrsObject( thePrs );
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->showPage( myInputPane );
}
myTabBox->setCurrentPage( 0 );
}
-int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject
- (VISU::ScalarMapOnDeformedShape_i* thePrs, bool theUpdateScalars, int theIter)
+int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
{
- thePrs->SetScale(getFactor());
+ myPrsCopy->SetScale(getFactor());
if (myIsAnimation)
- thePrs->SetCScalarField(myPrs->GetScalarMeshName().c_str(),
- getCurrentScalarFieldName().latin1(),
- theIter,
- myPrs->GetScalarEntity());
+ myPrsCopy->SetCScalarField(myPrsCopy->GetScalarMeshName().c_str(),
+ getCurrentScalarFieldName().latin1(),
+ myIteration,
+ myPrsCopy->GetScalarEntity());
else
- thePrs->SetCScalarField(myPrs->GetScalarMeshName().c_str(),
- getCurrentScalarFieldName().latin1(),
- myTimeStampsCombo->currentItem() + 1,
- myPrs->GetScalarEntity());
+ myPrsCopy->SetCScalarField(myPrsCopy->GetScalarMeshName().c_str(),
+ getCurrentScalarFieldName().latin1(),
+ myTimeStampsCombo->currentItem() + 1,
+ myPrsCopy->GetScalarEntity());
- if (theUpdateScalars) SetScalarField( false );
+ if (myUpdateScalars) SetScalarField( false );
- thePrs->ShowColored(true);
+ myPrsCopy->ShowColored(true);
- myScalarPane->storeToPrsObject(thePrs);
+ myScalarPane->storeToPrsObject(myPrsCopy);
- if( !thePrs->IsTimeStampFixed() )
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- myInputPane->storeToPrsObject( thePrs );
+ myInputPane->storeToPrsObject( myPrsCopy );
}
- myPrs = thePrs;
+ VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
return 1;
}
VISU::TEntity anEntity = getCurrentScalarEntity();
- myPrs->SetCScalarField(myCurrMeshName.latin1(),
+ myPrsCopy->SetCScalarField(myCurrMeshName.latin1(),
aFieldName.latin1(),
theIter,
anEntity);
if( save_scalar_pane )
{
- myScalarPane->storeToPrsObject(myPrs);
+ myScalarPane->storeToPrsObject(myPrsCopy);
UpdateScalarField();
}
}
}
void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){
- myPrs->SetScale(getFactor());
+ myPrsCopy->SetScale(getFactor());
vtkFloatingPointType aRange[2];
- myPrs->GetSpecificPL()->Build();
- myPrs->GetSpecificPL()->Update();
- myPrs->GetSpecificPL()->GetSourceRange(aRange);
+ myPrsCopy->GetSpecificPL()->Build();
+ myPrsCopy->GetSpecificPL()->Update();
+ myPrsCopy->GetSpecificPL()->GetSourceRange(aRange);
double aDoubleRange[2];
aDoubleRange[0] = double(aRange[0]);
aDoubleRange[1] = double(aRange[1]);
- myScalarPane->initFromPrsObject(myPrs);
+ myScalarPane->initFromPrsObject(myPrsCopy);
myScalarPane->setRange(aDoubleRange[0],aDoubleRange[1],myScalarPane->isIRange());
}
const int theIter,
const VISU::TEntity theEntity){
float ret=1;
- VISU::Result_i* theResult = myPrs->GetCResult();
+ VISU::Result_i* theResult = myPrsCopy->GetCResult();
VISU::PField aField = theResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
if(!aField) return ret;
VISU::TValField& aValField = aField->myValField;
#ifndef VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
#define VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
+
+#include "VISUConfig.hh"
+#include "VISU_Convertor.hxx"
#include "QtxDblSpinBox.h"
#include <qdialog.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
+#include <qcombobox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
class SalomeApp_Module;
class VisuGUI_InputPane;
-class QComboBox;
-class QString;
namespace VISU{
class ScalarMapOnDeformedShape_i;
}
-class VisuGUI_ScalarMapOnDeformedShapeDlg : public QDialog
+class VisuGUI_ScalarMapOnDeformedShapeDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT
void setFactor(double theFactor)
{ ScalFact->setValue(theFactor); }
+ void setAnimation( bool on ) { myIsAnimation = on; }
+ void setUpdateScalars( bool on ) { myUpdateScalars = on; }
+ void setIteration( int value ) { myIteration = value; }
- void initFromPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim=false);
- int storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalars=true,int theIter=1);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
int getCurrentScalarFieldNamePos();
QString getCurrentScalarFieldName();
QString myCurrMeshName;
int myCurrScalarIter;
bool myIsAnimation;
+ bool myUpdateScalars;
+ int myIteration;
_PTR(SObject) mySelectionObj;
- VISU::ScalarMapOnDeformedShape_i* myPrs;
+ SALOME::GenericObjPtr<VISU::ScalarMapOnDeformedShape_i> myPrsCopy;
SalomeApp_Module* myVisuGUI;
protected:
#include "VISU_Mesh_i.hh"
#include "VISU_Gen_i.hh"
#include "VISU_StreamLines_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_StreamLinesPL.hxx"
#include "VISU_Actor.h"
#include <SALOMEDSClient_SObject.hxx>
+#include "QtxDblSpinBox.h"
+
#include <limits.h>
#include <qlayout.h>
+#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qcolordialog.h>
#include <qtabwidget.h>
+#include <qpushbutton.h>
using namespace std;
VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_StreamLinesDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- myVisuGUI(theModule)
+ : VisuGUI_Prs3dDlg(theModule),
+ myVisuGUI(theModule)
{
- myPrs = NULL;
setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
}
-void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
+void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
- myScalarPane->initFromPrsObject(thePrs);
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TSTREAMLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
- if( thePrs->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( thePrs );
- myTabBox->showPage( myInputPane );
- }
- myTabBox->setCurrentPage( 0 );
+ myScalarPane->initFromPrsObject( myPrsCopy );
- myPrs = thePrs;
static int aNbOfSteps = 30;
- VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetSpecificPL();
+ VISU_StreamLinesPL* aStreamLinesPL = myPrsCopy->GetSpecificPL();
float aMin, aMax;
aMin = aStreamLinesPL->GetMinPropagationTime();
aMax = aStreamLinesPL->GetMaxPropagationTime();
myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
myIntegStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
- switch (thePrs->GetDirection()) {
+ switch (myPrsCopy->GetDirection()) {
case VISU::StreamLines::FORWARD:
myDirCombo->setCurrentItem(0);
break;
case VISU::StreamLines::BOTH:
myDirCombo->setCurrentItem(2);
}
- myUseScalar->setChecked(thePrs->IsColored());
- myPntPercent->setValue(thePrs->GetUsedPoints());
+ myUseScalar->setChecked(myPrsCopy->IsColored());
+ myPntPercent->setValue(myPrsCopy->GetUsedPoints());
mySrcCombo->setEnabled(false);
- QString aSrcEntry = thePrs->GetSourceEntry();
+ QString aSrcEntry = myPrsCopy->GetSourceEntry();
- SALOMEDS::Color anOldColor = thePrs->GetColor();
+ SALOMEDS::Color anOldColor = myPrsCopy->GetColor();
QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
setColor(aColor);
enableSetColor();
INITPRS(myPrsList, 4);
}
#undef INITPRS
+
+ if( !theInit )
+ return;
+
+ if( myPrsCopy->IsTimeStampFixed() )
+ myTabBox->removePage( myInputPane );
+ else
+ {
+ myInputPane->initFromPrsObject( myPrsCopy );
+ myTabBox->showPage( myInputPane );
+ }
+ myTabBox->setCurrentPage( 0 );
+
}
-int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::StreamLines_i* thePrs)
+int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
{
- bool isAccepted = myScalarPane->storeToPrsObject(thePrs);
+ bool isAccepted = myScalarPane->storeToPrsObject(myPrsCopy);
- if( isAccepted && !thePrs->IsTimeStampFixed() )
+ if( isAccepted && !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- isAccepted = myInputPane->storeToPrsObject( thePrs );
+ isAccepted = myInputPane->storeToPrsObject( myPrsCopy );
}
if (isAccepted) {
- thePrs->ShowColored(myUseScalar->isChecked());
- if (!thePrs->IsColored()) {
+ myPrsCopy->ShowColored(myUseScalar->isChecked());
+ if (!myPrsCopy->IsColored()) {
SALOMEDS::Color aColor;
aColor.R = myColor.red()/255.;
aColor.G = myColor.green()/255.;
aColor.B = myColor.blue()/255.;
- thePrs->SetColor(aColor);
+ myPrsCopy->SetColor(aColor);
}
VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
aPrs = createMesh(aType, aName);
}
}
- isAccepted = thePrs->SetParams(myIntegStepLen->value(),
+ isAccepted = myPrsCopy->SetParams(myIntegStepLen->value(),
myPropTime->value(),
myStepLen->value(),
aPrs,
// SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("WRN_VISU"),
// tr("ERR_CANT_BUILD_PRESENTATION"),
// tr("BUT_OK"));
+
+ VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(thePrs, myPrsCopy);
+
return isAccepted;
}
#ifndef VISUGUI_STREAMLINESDLG_H
#define VISUGUI_STREAMLINESDLG_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
-#include <qdialog.h>
+#include <qlabel.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qstringlist.h>
#include <qtabwidget.h>
+#include "VISUConfig.hh"
+
class SalomeApp_Module;
class VisuGUI_InputPane;
class QtxDblSpinBox;
class StreamLines_i;
}
-class VisuGUI_StreamLinesDlg: public QDialog
+class VisuGUI_StreamLinesDlg: public VisuGUI_Prs3dDlg
{
Q_OBJECT
public:
VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule);
~VisuGUI_StreamLinesDlg() {};
- void initFromPrsObject(VISU::StreamLines_i* thePrs);
- int storeToPrsObject(VISU::StreamLines_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
+
void setColor( QColor color );
void enableMagnColor( bool enable );
QStringList myPrsLst;
_PTR(SObject) mySelectionObj;
- VISU::StreamLines_i* myPrs;
+ SALOME::GenericObjPtr<VISU::StreamLines_i> myPrsCopy;
SalomeApp_Module* myVisuGUI;
private slots:
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_ScalarBarDlg.h"
#include "VisuGUI_DeformedShapeDlg.h"
#include "VisuGUI_CutPlanesDlg.h"
#include "VisuGUI_CutLinesDlg.h"
#include <qhgroupbox.h>
#include <qlcdnumber.h>
#include <qvgroupbox.h>
+#include <qtoolbutton.h>
#define MAXVAL 1e10
typedef VisuGUI_ScalarMapOnDeformedShapeDlg DLG;
typedef VISU::ScalarMapOnDeformedShape_i TYPE;
DLG* aDlg = new DLG (myModule);
- aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0]),true);
+ aDlg->setAnimation( true );
+ aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0]));
if (aDlg->exec())
{
int anbFrames=aDlg->getCurrentScalarNbIterations();
aIter = i+1;
if(i+1 > anbFrames)
aIter=anbFrames;
- aDlg->storeToPrsObject(aCurrPrs_i,false,aIter);
+ aDlg->setUpdateScalars(false);
+ aDlg->setIteration(aIter);
+ aDlg->storeToPrsObject(aCurrPrs_i);
}
}
delete aDlg;
#include "VisuGUI_VectorsDlg.h"
#include "VisuGUI.h"
-//#include "VisuGUI_Selection.h"
#include "VisuGUI_Tools.h"
#include "VisuGUI_InputPane.h"
+#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_Vectors_i.hh"
#include "LightApp_Application.h"
#include "SalomeApp_Module.h"
Constructor
*/
VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
- : QDialog(VISU::GetDesktop(theModule), "VisuGUI_VectorsDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ : VisuGUI_Prs3dDlg(theModule)
{
setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
-void VisuGUI_VectorsDlg::initFromPrsObject(VISU::Vectors_i* thePrs) {
- myScalarPane->initFromPrsObject(thePrs);
- if( thePrs->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( thePrs );
- myTabBox->showPage( myInputPane );
- }
- myTabBox->setCurrentPage( 0 );
- setScaleFactor(thePrs->GetScale());
- setLineWidth((int)thePrs->GetLineWidth());
- setUseMagnColor(thePrs->IsColored());
- SALOMEDS::Color anOldColor = thePrs->GetColor();
+void VisuGUI_VectorsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit) {
+ if( theInit )
+ myPrsCopy = VISU::TSameAsFactory<VISU::TVECTORS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+ myScalarPane->initFromPrsObject( myPrsCopy );
+
+ setScaleFactor(myPrsCopy->GetScale());
+ setLineWidth((int)myPrsCopy->GetLineWidth());
+ setUseMagnColor(myPrsCopy->IsColored());
+ SALOMEDS::Color anOldColor = myPrsCopy->GetColor();
QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
setColor(aColor);
- if (thePrs->GetGlyphType() != VISU::Vectors::NONE) {
+ if (myPrsCopy->GetGlyphType() != VISU::Vectors::NONE) {
setUseGlyphs(true);
- setGlyphType(thePrs->GetGlyphType());
- setGlyphPos(thePrs->GetGlyphPos());
+ setGlyphType(myPrsCopy->GetGlyphType());
+ setGlyphPos(myPrsCopy->GetGlyphPos());
} else
setUseGlyphs(false);
enableSetColor();
+
+ if( !theInit )
+ return;
+
+ if( myPrsCopy->IsTimeStampFixed() )
+ myTabBox->removePage( myInputPane );
+ else
+ {
+ myInputPane->initFromPrsObject( myPrsCopy );
+ myTabBox->showPage( myInputPane );
+ }
+ myTabBox->setCurrentPage( 0 );
}
-int VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
- myScalarPane->storeToPrsObject(thePrs);
- if( !thePrs->IsTimeStampFixed() )
+int VisuGUI_VectorsDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
+ myScalarPane->storeToPrsObject(myPrsCopy);
+ if( !myPrsCopy->IsTimeStampFixed() )
{
if( !myInputPane->check() )
return 0;
- myInputPane->storeToPrsObject( thePrs );
+ myInputPane->storeToPrsObject( myPrsCopy );
}
- thePrs->SetScale(getScaleFactor());
- thePrs->SetLineWidth(getLineWidth());
- thePrs->ShowColored(getUseMagnColor());
- if(!thePrs->IsColored()){
+ myPrsCopy->SetScale(getScaleFactor());
+ myPrsCopy->SetLineWidth(getLineWidth());
+ myPrsCopy->ShowColored(getUseMagnColor());
+ if(!myPrsCopy->IsColored()){
SALOMEDS::Color aColor;
aColor.R = myColor.red()/255.;
aColor.G = myColor.green()/255.;
aColor.B = myColor.blue()/255.;
- thePrs->SetColor(aColor);
+ myPrsCopy->SetColor(aColor);
}
if (getUseGlyphs()) {
- thePrs->SetGlyphPos(getGlyphPos());
- thePrs->SetGlyphType(getGlyphType());
+ myPrsCopy->SetGlyphPos(getGlyphPos());
+ myPrsCopy->SetGlyphType(getGlyphType());
} else
- thePrs->SetGlyphType(VISU::Vectors::NONE);
+ myPrsCopy->SetGlyphType(VISU::Vectors::NONE);
+
+ VISU::TSameAsFactory<VISU::TVECTORS>().Copy(thePrs, myPrsCopy);
+
return 1;
}
#ifndef VISUGUI_VECTORSDLG_H
#define VISUGUI_VECTORSDLG_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
#include "QtxDblSpinBox.h"
#include <qdialog.h>
class Vectors_i;
}
-class VisuGUI_VectorsDlg : public QDialog
+class VisuGUI_VectorsDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT
VISU::Vectors::GlyphPos getGlyphPos();
void enableMagnColor( bool enable );
- void initFromPrsObject(VISU::Vectors_i* thePrs);
- int storeToPrsObject(VISU::Vectors_i* thePrs);
+ virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+ virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
private:
void keyPressEvent( QKeyEvent* e );
VisuGUI_ScalarBarPane* myScalarPane;
VisuGUI_InputPane* myInputPane;
+ SALOME::GenericObjPtr<VISU::Vectors_i> myPrsCopy;
+
private slots:
void enableGlyphType();
void setVColor();
aPrs3d->SetEntity( theInput.myEntity );
aPrs3d->SetFieldName( theInput.myFieldName );
aPrs3d->SetTimeStampNumber( theInput.myTimeStampNumber );
- aPrs3d->Apply();
+ aPrs3d->Apply( false );
return aPrs3d;
}
theColoredPrs3d->SetEntity(theEntity);
theColoredPrs3d->SetFieldName(theFieldName.c_str());
theColoredPrs3d->SetTimeStampNumber(theIteration);
- if(theColoredPrs3d->Apply())
+ if(theColoredPrs3d->Apply(false))
return true;
#ifndef _DEXCEPT_
#ifdef NO_CAS_CATCH
{
typedef typename TL::TColoredEnum2Type<colored_prs3d_type_enum>::TResult TColoredPrs3d;
+ void
+ Copy(ColoredPrs3d_i* theColoredPrs3dTo, ColoredPrs3d_i* theColoredPrs3dFrom)
+ {
+ theColoredPrs3dTo->SetCResult(theColoredPrs3dFrom->GetCResult());
+ theColoredPrs3dTo->SetMeshName(theColoredPrs3dFrom->GetCMeshName().c_str());
+ theColoredPrs3dTo->SetEntity(theColoredPrs3dFrom->GetEntity());
+ theColoredPrs3dTo->SetFieldName(theColoredPrs3dFrom->GetCFieldName().c_str());
+ theColoredPrs3dTo->SetTimeStampNumber(theColoredPrs3dFrom->GetTimeStampNumber());
+ theColoredPrs3dTo->SameAs(theColoredPrs3dFrom);
+ }
+
TColoredPrs3d*
Create(ColoredPrs3d_i* theColoredPrs3d,
ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
{
TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(thePublishInStudyMode);
- aSameColoredPrs3d->SetCResult(theColoredPrs3d->GetCResult());
- aSameColoredPrs3d->SetMeshName(theColoredPrs3d->GetCMeshName().c_str());
- aSameColoredPrs3d->SetEntity(theColoredPrs3d->GetEntity());
- aSameColoredPrs3d->SetFieldName(theColoredPrs3d->GetCFieldName().c_str());
- aSameColoredPrs3d->SetTimeStampNumber(theColoredPrs3d->GetTimeStampNumber());
- aSameColoredPrs3d->SameAs(theColoredPrs3d);
+ Copy(aSameColoredPrs3d, theColoredPrs3d);
return aSameColoredPrs3d;
}
};
//---------------------------------------------------------------
bool
VISU::ColoredPrs3d_i
-::SetInput()
+::SetInput(bool theReInit)
{
try{
- if(TSuperClass::SetInput()){
+ if(TSuperClass::SetInput(theReInit)){
if(CheckIsPossible()){
- if(OnSetInput()){
+ if(OnSetInput(theReInit)){
if(Create(GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()))
return true;
}else
//---------------------------------------------------------------
bool
VISU::ColoredPrs3d_i
-::OnSetInput()
+::OnSetInput(bool theReInit)
{
myPreviousEntity = myEntity;
myPreviousFieldName = myFieldName;
if(anIsCreatNew)
CreatePipeLine(NULL); // to create proper pipeline
- DoSetInput(anIsCreatNew);
+ DoSetInput(anIsCreatNew, theReInit);
// To update title according to the new input
SetTitle(GetCTitle().c_str());
if(const ColoredPrs3d_i* aPrs3d = dynamic_cast<const ColoredPrs3d_i*>(theOrigin)){
ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(aPrs3d);
- bool anIsCreatNew = OnSetInput();
+ bool anIsCreatNew = OnSetInput(false);
if(anIsCreatNew)
Build(ESameAs);
TSuperClass::SameAs(theOrigin);
- SetScalarMode(anOrigin->GetScalarMode());
+ CORBA::Long aNbComp = GetField()->myNbComp;
+ CORBA::Long anOriginNbComp = anOrigin->GetField()->myNbComp;
+ if(anOriginNbComp < aNbComp)
+ SetScalarMode(0);
+ else
+ SetScalarMode(anOrigin->GetScalarMode());
+
SetNbColors(anOrigin->GetNbColors());
SetBarOrientation(anOrigin->GetBarOrientation());
SetLblFontType(anOrigin->GetLblFontType());
anOrigin->GetLabelColor(&r,&g,&b);
SetLabelColor(r,g,b);
+
+ UseFixedRange( anOrigin->IsRangeFixed() );
+ myIsTimeStampFixed = anOrigin->IsTimeStampFixed();
}
}
VISU::ColoredPrs3d_i
::SetScalarMode(CORBA::Long theScalarMode)
{
+ CORBA::Long aNbComp = GetField()->myNbComp;
+ if(aNbComp == 1)
+ theScalarMode = 1;
+ else if(theScalarMode > aNbComp)
+ theScalarMode = 0;
+
+ //cout << "VISU::ColoredPrs3d_i::SetScalarMode - " << theScalarMode << endl;
+
myScalarMapPL->SetScalarMode(theScalarMode);
}
VISU::ColoredPrs3d_i
::UseFixedRange(bool theUseFixedRange)
{
+ //cout << "UseFixedRange(" << (int)theUseFixedRange << ") for " << this << endl;
myIsFixedRange = theUseFixedRange;
}
SetEntity(theEntity);
SetFieldName(theFieldName.c_str());
SetTimeStampNumber(theTimeStampNumber);
- OnSetInput();
+ OnSetInput(false);
Build(ECreateNew); // to get corresponding input from result and initilize the pipeline
SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").latin1());
SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt());
myIsTimeStampFixed = VISU::Storable::FindValue(theMap,"myIsTimeStampFixed").toInt();
- OnSetInput();
+ OnSetInput(false);
SetHolderEntry(VISU::Storable::FindValue(theMap,"myHolderEntry").latin1());
*/
virtual
bool
- SetInput();
+ SetInput(bool theReInit);
//! Restore input parameters if Apply function fails (redefines Prs3d::OnRestoreInput)
virtual
*/
virtual
bool
- OnSetInput();
+ OnSetInput(bool theReInit);
/*!
Sets input data set according to basic input parameters -
*/
virtual
void
- DoSetInput(bool theIsInitilizePipe) = 0;
+ DoSetInput(bool theIsInitilizePipe, bool theReInit) = 0;
/*!
The enumeration allow to define what mode should be used for the presentation building.
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::DoSetInput(bool theIsInitilizePipe)
+::DoSetInput(bool theIsInitilizePipe, bool theReInit)
{
VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
if(!anInput)
GetCResult()->MinMaxConnect(this);
// To update scalar range according to the new input
- if(!IsTimeStampFixed())
+ if(!IsTimeStampFixed() || theReInit)
SetSourceRange();
}
//! Redefines VISU_ColoredPrs3d_i::DoSetInput
virtual
void
- DoSetInput(bool theIsInitilizePipe);
+ DoSetInput(bool theIsInitilizePipe, bool theReInit);
//! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
virtual
//----------------------------------------------------------------------------
void
VISU::IsoSurfaces_i
-::DoSetInput(bool theIsInitilizePipe)
+::DoSetInput(bool theIsInitilizePipe, bool theReInit)
{
- TSuperClass::DoSetInput(theIsInitilizePipe);
- if(theIsInitilizePipe || (!IsTimeStampFixed() && !IsRangeFixed()))
+ TSuperClass::DoSetInput(theIsInitilizePipe, theReInit);
+ if(theIsInitilizePipe || (!IsTimeStampFixed() && !IsRangeFixed()) || theReInit)
SetSubRange(GetSourceMin(), GetSourceMax());
}
//! Redefines VISU_ScalarMap_i::DoSetInput
virtual
void
- DoSetInput(bool theIsInitilizePipe);
+ DoSetInput(bool theIsInitilizePipe, bool theReInit);
//! Redefines VISU_ScalarMap_i::CheckIsPossible
virtual
//----------------------------------------------------------------------------
bool
VISU::Prs3d_i
-::SetInput()
+::SetInput(bool theReInit)
{
if(!myResult)
return false;
//----------------------------------------------------------------------------
CORBA::Boolean
VISU::Prs3d_i
-::Apply()
+::Apply(bool theReInit)
{
try{
- if(SetInput()){
+ if(SetInput(theReInit)){
UpdateActors();
return true;
}
//----------------------------------------------------------------------------
virtual
CORBA::Boolean
- Apply();
+ Apply(bool theReInit);
//----------------------------------------------------------------------------
void
*/
virtual
bool
- SetInput();
+ SetInput(bool theReInit);
//! Restore input parameters if Apply function fails
virtual
//----------------------------------------------------------------------------
void
VISU::ScalarMap_i
-::DoSetInput(bool theIsInitilizePipe)
+::DoSetInput(bool theIsInitilizePipe, bool theReInit)
{
VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
if(!anInput)
}
// To update scalar range according to the new input
- if(!IsTimeStampFixed() && !IsRangeFixed())
+ if(!IsTimeStampFixed() && !IsRangeFixed() || theReInit)
SetSourceRange();
}
//! Redefines VISU_ColoredPrs3d_i::DoSetInput
virtual
void
- DoSetInput(bool theIsInitilizePipe);
+ DoSetInput(bool theIsInitilizePipe, bool theReInit);
//! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
virtual
CASCatch_TRY{
try{
#endif
- if(aPresent->Apply()){
+ if(aPresent->Apply(false)){
anIsCreated = true;
theData.myPrs[aFrameId++] = aPresent;
aMin = std::min(aPresent->GetMin(), aMin);