//----------------------------------------------------------------------------
void
VISU_ScalarMapPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
+{
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+ if(this != thePipeLine){
+ if(VISU_ScalarMapPL *aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine)){
+ if(aPipeLine->IsExternalGeometryUsed()){
+ ClearGeometry();
+ int aNbOfGeometry = aPipeLine->GetNumberOfGeometry();
+ for(int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++)
+ AddGeometry(aPipeLine->GetGeometry(aGeomNumber));
+ }else
+ SetSourceGeometry();
+ }
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::SetSourceGeometry()
+{
+ if(IsExternalGeometryUsed()){
+ ClearGeometry();
+ myAppendFilter->AddInput(Superclass::InsertCustomPL());
+ }
+}
+
+
+//----------------------------------------------------------------------------
+int
+VISU_ScalarMapPL
::AddGeometry(vtkDataSet* theGeometry)
{
myAppendFilter->AddInput(theGeometry);
+ return GetNumberOfGeometry();
}
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_ScalarMapPL
+::GetGeometry(int theGeomNumber)
+{
+ return vtkDataSet::SafeDownCast(myAppendFilter->GetInput(theGeomNumber));
+}
+
+
//----------------------------------------------------------------------------
int
VISU_ScalarMapPL
return myAppendFilter->GetNumberOfInputConnections(0);
}
+
+//----------------------------------------------------------------------------
+bool
+VISU_ScalarMapPL
+::IsExternalGeometryUsed()
+{
+ vtkDataObject* aDataObject = myAppendFilter->GetInput();
+ return aDataObject && aDataObject != Superclass::InsertCustomPL();
+}
+
+
//----------------------------------------------------------------------------
void
VISU_ScalarMapPL
myAppendFilter->RemoveAllInputs();
}
+
//----------------------------------------------------------------------------
vtkDataSet*
VISU_ScalarMapPL
virtual
void
+ SetSourceGeometry();
+
+ virtual
+ int
AddGeometry(vtkDataSet* theGeometry);
+ virtual
+ vtkDataSet*
+ GetGeometry(int theGeomNumber);
+
virtual
int
GetNumberOfGeometry();
+ bool
+ IsExternalGeometryUsed();
+
virtual
void
ClearGeometry();
void
Build();
+ virtual
+ void
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+
private:
vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
vtkSmartPointer<VISU_MergeFilter> myMergeFilter;
msgid "VISU_PREF_SECOND_TAB"
msgstr "Scalar range, Sweep, MED import, Shading"
-msgid "PRS_ON_GROUPS"
-msgstr "Build presentation on groups"
-
msgid "NO_GROUPS"
msgstr "No groups in the mesh"
#: VisuGUI_InputPane.cxx
+msgid "VisuGUI_InputPane::PRS_DATA_SOUIRCE"
+msgstr "Data Source"
+
msgid "VisuGUI_InputPane::MED_FILE"
-msgstr "Med File :"
+msgstr "Source File :"
msgid "VisuGUI_InputPane::MESH"
msgstr "Mesh :"
msgstr "Time Stamp :"
msgid "VisuGUI_InputPane::REINITIALIZE"
-msgstr "Reinitialize"
+msgstr "Auto Update"
+msgid "PRS_ON_GROUPS"
+msgstr "Use Only Groups"
#: VisuGUI_ScalarBarDlg.cxx
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
//------------------------------------------------------------------------------
int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
{
- myScalarPane->storeToPrsObject(myPrsCopy);
-
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
- myInputPane->storeToPrsObject( myPrsCopy );
- }
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
myPrsCopy->SetOrientation(getOrientaion(),
myRotXSpn->value()*PI/180.,
VISU::TSameAsFactory<VISU::TCUTLINES>().Copy(thePrs, myPrsCopy);
- return 1;
+ return anIsOk;
}
//------------------------------------------------------------------------------
myScalarPane->initFromPrsObject(myPrsCopy);
myCutPane->initFromPrsObject(myPrsCopy);
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
{
- int ok = 1;
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
-
- ok = myInputPane->storeToPrsObject(myPrsCopy);
- }
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
- ok = ok && myScalarPane->storeToPrsObject(myPrsCopy) && myCutPane->storeToPrsObject(myPrsCopy);
+ int anIsOk = myInputPane->storeToPrsObject(myPrsCopy);
+ anIsOk &= myScalarPane->storeToPrsObject(myPrsCopy);
+ anIsOk &= myCutPane->storeToPrsObject(myPrsCopy);
VISU::TSameAsFactory<VISU::TCUTPLANES>().Copy(thePrs, myPrsCopy);
- return ok;
+ return anIsOk;
}
void VisuGUI_CutPlanesDlg::accept()
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
-int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
- myScalarPane->storeToPrsObject(myPrsCopy);
+int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
+{
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
- myInputPane->storeToPrsObject( myPrsCopy );
- }
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
myPrsCopy->SetScale(getFactor());
myPrsCopy->ShowColored(isColored());
VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
- return 1;
+ return anIsOk;
}
void VisuGUI_DeformedShapeDlg::accept() {
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
{
+ if(!myInputPane->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+
myPrsCopy->SetIsDeformed( myDefShapeButton->isChecked() );
myPrsCopy->SetScaleFactor( myScaleSpinBox->value() );
myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
- int ok = 1;
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
-
- ok = myInputPane->storeToPrsObject( myPrsCopy );
- }
- ok = ok && myScalarPane->storeToPrsObject( myPrsCopy );
-
VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(thePrs, myPrsCopy);
- return ok;
+ return anIsOk;
}
void VisuGUI_GaussPointsDlg::onToggleDefShape( bool on )
#include "VisuGUI_Tools.h"
#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_ScalarMap_i.hh"
#include "VISU_Result_i.hh"
+#include "VISU_Convertor.hxx"
#include "SUIT_ResourceMgr.h"
#include "SALOMEDSClient_AttributeString.hxx"
#include "SALOMEDSClient_AttributeName.hxx"
+#include "QtxListBox.h"
+
#include <qcheckbox.h>
#include <qcombobox.h>
+#include <qtoolbutton.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
-using namespace VISU;
+//---------------------------------------------------------------
+class VisuGUI_ListBox: public QtxListBox
+{
+ public:
+ VisuGUI_ListBox( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ):
+ QtxListBox(parent, name, f)
+ {};
+
+ virtual QSize sizeHint() const
+ {
+ return minimumSizeHint(); }
+ ;
+};
+
+
+//---------------------------------------------------------------
VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType,
SalomeApp_Module* theModule,
VisuGUI_Prs3dDlg* theDialog ) :
- QGroupBox( 2, Qt::Horizontal, theDialog ),
+ QGroupBox( theDialog ),
myModule( theModule ),
myDialog( theDialog ),
myPrs( NULL )
{
- setFrameStyle( QFrame::Box | QFrame::Sunken );
+ setFrameStyle( QFrame::NoFrame );
- connect( GetSelectionMgr( theModule ), SIGNAL( selectionChanged() ), SLOT( onSelectionChanged() ) );
+ connect( VISU::GetSelectionMgr( theModule ), SIGNAL( selectionChanged() ), SLOT( onSelectionChanged() ) );
- new QLabel( tr( "MED_FILE" ), this );
- myMedFile = new QLineEdit( this );
- myMedFile->setReadOnly( true );
- myMedFile->setEnabled( false );
- myMedFile->setPaletteForegroundColor( Qt::black );
+ QGridLayout* aMainLayout = new QGridLayout( this, 1, 1, 11, 6 );
- new QLabel( tr( "MESH" ), this );
- myMeshName = new QLineEdit( this );
- myMeshName->setReadOnly( true );
- myMeshName->setEnabled( false );
- myMeshName->setPaletteForegroundColor( Qt::black );
+ // Definition of data source
+ myDataSourceGroupBox = new QGroupBox( this );
+ aMainLayout->addWidget( myDataSourceGroupBox, 0, 0 );
+ myDataSourceGroupBox->setTitle( tr( "PRS_DATA_SOUIRCE" ) );
+ {
+ QGroupBox* aGroupBox = myDataSourceGroupBox;
+ aGroupBox->setColumnLayout(0, Qt::Vertical );
+ aGroupBox->layout()->setSpacing( 6 );
+ aGroupBox->layout()->setMargin( 11 );
- new QLabel( tr( "ENTITY" ), this );
- myEntityName = new QLineEdit( this );
- myEntityName->setReadOnly( true );
- myEntityName->setEnabled( false );
- myEntityName->setPaletteForegroundColor( Qt::black );
+ QGridLayout* aGroupBoxLayout = new QGridLayout( aGroupBox->layout() );
+ aGroupBoxLayout->setAlignment( Qt::AlignTop );
+ {
+ QLabel* aLabel = new QLabel( tr( "MED_FILE" ), aGroupBox );
+ aGroupBoxLayout->addWidget( aLabel, 0, 0 );
+
+ myMedFile = new QLineEdit( aGroupBox );
+ myMedFile->setReadOnly( true );
+ myMedFile->setEnabled( false );
+ myMedFile->setPaletteForegroundColor( Qt::black );
+ aGroupBoxLayout->addWidget( myMedFile, 0, 1 );
+ }
+ {
+ QLabel* aLabel = new QLabel( tr( "MESH" ), aGroupBox );
+ aGroupBoxLayout->addWidget( aLabel, 1, 0 );
+
+ myMeshName = new QLineEdit( aGroupBox );
+ myMeshName->setReadOnly( true );
+ myMeshName->setEnabled( false );
+ myMeshName->setPaletteForegroundColor( Qt::black );
+ aGroupBoxLayout->addWidget( myMeshName, 1, 1 );
+ }
+ {
+ QLabel* aLabel = new QLabel( tr( "ENTITY" ), aGroupBox );
+ aGroupBoxLayout->addWidget( aLabel, 2, 0 );
+
+ myEntityName = new QLineEdit( aGroupBox );
+ myEntityName->setReadOnly( true );
+ myEntityName->setEnabled( false );
+ myEntityName->setPaletteForegroundColor( Qt::black );
+ aGroupBoxLayout->addWidget( myEntityName, 2, 1 );
+ }
+ {
+ QLabel* aLabel = new QLabel( tr( "FIELD" ), aGroupBox );
+ aGroupBoxLayout->addWidget( aLabel, 3, 0 );
+
+ myFieldName = new QLineEdit( aGroupBox );
+ myFieldName->setReadOnly( true );
+ aGroupBoxLayout->addWidget( myFieldName, 3, 1 );
+ }
+ {
+ QLabel* aLabel = new QLabel( tr( "TIME_STAMP" ), aGroupBox );
+ aGroupBoxLayout->addWidget( aLabel, 4, 0 );
+
+ myTimeStamps = new QComboBox( aGroupBox );
+ aGroupBoxLayout->addWidget( myTimeStamps, 4, 1 );
+ }
- new QLabel( tr( "FIELD" ), this );
- myFieldName = new QLineEdit( this );
- myFieldName->setReadOnly( true );
+ myReInit = new QCheckBox( tr( "REINITIALIZE" ), aGroupBox );
+ myReInit->setChecked( true );
+ aGroupBoxLayout->addWidget( myReInit, 5, 1 );
+ }
- new QLabel( tr( "TIME_STAMP" ), this );
- myTimeStamps = new QComboBox( this );
+ // Definition of used groups
+ myUseGroupsGroupBox = new QGroupBox( this );
+ aMainLayout->addWidget( myUseGroupsGroupBox, 1, 0 );
+ myUseGroupsGroupBox->setTitle( tr( "PRS_ON_GROUPS" ) );
+ myUseGroupsGroupBox->setCheckable( TRUE );
+ {
+ QGroupBox* aGroupBox = myUseGroupsGroupBox;
+ aGroupBox->setColumnLayout(0, Qt::Vertical );
+ aGroupBox->layout()->setSpacing( 6 );
+ aGroupBox->layout()->setMargin( 11 );
- myReInit = new QCheckBox( tr( "REINITIALIZE" ), this );
- myReInit->setChecked( true );
+ QGridLayout* aGroupBoxLayout = new QGridLayout( aGroupBox->layout() );
+ aGroupBoxLayout->setAlignment( Qt::AlignTop );
+ {
+ myAllGroups = new VisuGUI_ListBox(aGroupBox, "myAllGroups");
+ myAllGroups->setSelectionMode(QListBox::Extended);
+ aGroupBoxLayout->addMultiCellWidget( myAllGroups, 0, 3, 0, 0 );
+ }
+ {
+ mySelectedGroups = new VisuGUI_ListBox(aGroupBox, "mySelectedGroups");
+ mySelectedGroups->setSelectionMode(QListBox::Extended);
+ mySelectedGroups->installEventFilter(this);
+ aGroupBoxLayout->addMultiCellWidget( mySelectedGroups, 0, 3, 2, 2 );
+ }
+ {
+ myAddButton = new QToolButton(aGroupBox);
+ myAddButton->setPixmap( VISU::GetResourceMgr()->loadPixmap("VISU", tr("ICON_ADD")) );
+ aGroupBoxLayout->addWidget( myAddButton, 1, 1 );
+ }
+ {
+ myRemoveButton = new QToolButton(aGroupBox);
+ myRemoveButton->setPixmap( VISU::GetResourceMgr()->loadPixmap("VISU", tr("ICON_REMOVE")) );
+ aGroupBoxLayout->addWidget( myRemoveButton, 2, 1 );
+ }
+ {
+ QSpacerItem* aSpacer = new QSpacerItem( 20, 51, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ aGroupBoxLayout->addItem( aSpacer, 0, 1 );
+ }
+ {
+ QSpacerItem* aSpacer = new QSpacerItem( 20, 61, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ aGroupBoxLayout->addItem( aSpacer, 3, 1 );
+ }
+ }
connect( myReInit, SIGNAL( toggled( bool ) ), SLOT( onReInitialize( bool ) ) );
+ connect( myUseGroupsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( onTypeChanged() ) );
+ connect( myAllGroups, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onListDoubleClicked( QListBoxItem* ) ) );
+ connect( mySelectedGroups, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onListDoubleClicked( QListBoxItem* ) ) );
+ connect( myAddButton, SIGNAL(clicked()), this, SLOT(onAdd()));
+ connect( myRemoveButton, SIGNAL(clicked()), this, SLOT(onRemove()));
+ onTypeChanged();
onSelectionChanged();
myFieldFilter = new VisuGUI_FieldFilter( theType );
hide();
}
+
+//---------------------------------------------------------------
VisuGUI_InputPane::~VisuGUI_InputPane()
{
if( myFieldFilter )
{
- GetSelectionMgr( myModule )->removeFilter( myFieldFilter );
+ VISU::GetSelectionMgr( myModule )->removeFilter( myFieldFilter );
delete myFieldFilter;
}
}
+
+//---------------------------------------------------------------
+/*!
+ Event filter
+*/
+bool VisuGUI_InputPane::eventFilter (QObject* object, QEvent* event)
+{
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent* aKeyEvent = (QKeyEvent*)event;
+ if (object == mySelectedGroups && aKeyEvent->key() == Key_Delete)
+ onRemove();
+ }
+ return QObject::eventFilter(object, event);
+}
+
+
+//---------------------------------------------------------------
+/*!
+ Called when the checkbox is toggled
+*/
+void VisuGUI_InputPane::onTypeChanged( )
+{
+ bool toEnable = myUseGroupsGroupBox->isChecked();
+ if (!toEnable)
+ {
+ myAllGroups->clearSelection();
+ mySelectedGroups->clearSelection();
+ }
+ myAllGroups->setEnabled( toEnable );
+ mySelectedGroups->setEnabled( toEnable );
+ myAddButton->setEnabled( toEnable );
+ myRemoveButton->setEnabled( toEnable );
+}
+
+
+//---------------------------------------------------------------
+/*!
+ Called when add button is clicked, adds item to choosen groups
+*/
+void VisuGUI_InputPane::onAdd()
+{
+ QStringList aList;
+
+ for (int i = 0; i < myAllGroups->count(); i++)
+ if (myAllGroups->isSelected(i))
+ aList.append(myAllGroups->text(i));
+
+ for (int i = 0; i < mySelectedGroups->count(); i++)
+ aList.remove(mySelectedGroups->text(i));
+
+ mySelectedGroups->insertStringList(aList);
+}
+
+
+//---------------------------------------------------------------
+/*!
+ Called when remove button is clicked, remove selected items from choosen
+*/
+void VisuGUI_InputPane::onRemove()
+{
+ QPtrList<QListBoxItem> aList;
+ aList.setAutoDelete(false);
+ for (int i = 0; i < mySelectedGroups->count(); i++)
+ if (mySelectedGroups->isSelected(i))
+ aList.append(mySelectedGroups->item(i));
+
+ for (int i = 0; i < aList.count(); i++)
+ delete aList.at(i);
+}
+
+
+//---------------------------------------------------------------
+/*!
+ Called when an item of listbox is double-clicked
+*/
+void VisuGUI_InputPane::onListDoubleClicked( QListBoxItem* theItem )
+{
+ QListBox* aListBox = theItem->listBox();
+
+ if (aListBox == myAllGroups)
+ {
+ if (!mySelectedGroups->findItem( theItem->text(), Qt::ExactMatch ))
+ mySelectedGroups->insertItem(theItem->text());
+ }
+ else if (aListBox == mySelectedGroups)
+ delete theItem;
+}
+
+
+//---------------------------------------------------------------
bool VisuGUI_InputPane::check()
{
return myTimeStamps->count() != 0;
}
+
+//---------------------------------------------------------------
void VisuGUI_InputPane::clear()
{
myMedFile->clear();
myTimeStamps->clear();
}
+
+//---------------------------------------------------------------
void VisuGUI_InputPane::onSelectionChanged()
{
//clear();
SALOME_ListIO aListIO;
- GetSelectionMgr( myModule )->selectedObjects(aListIO);
+ VISU::GetSelectionMgr( myModule )->selectedObjects(aListIO);
if (aListIO.Extent() != 1)
return;
const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
- _PTR(Study) aCStudy = GetCStudy(GetAppStudy(myModule));
+ _PTR(Study) aCStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
if (!aSObject)
return;
}
}
- myResult = FindResult( VISU::GetSObject( aSObject ).in() );
+ myResult = VISU::FindResult( VISU::GetSObject( aSObject ).in() );
myEntity = VISU::getValue( aSObject, "myEntityId" ).toInt();
}
}
+
+//---------------------------------------------------------------
void VisuGUI_InputPane::onReInitialize( bool on )
{
if( on )
onSelectionChanged();
}
+
+//---------------------------------------------------------------
void VisuGUI_InputPane::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs )
{
if( myPrs == thePrs )
QString anEntityName;
switch( myEntity )
{
- case NODE_ENTITY: anEntityName = "onNodes"; break;
- case EDGE_ENTITY: anEntityName = "onEdges"; break;
- case FACE_ENTITY: anEntityName = "onFaces"; break;
- case CELL_ENTITY: anEntityName = "onCells"; break;
+ case VISU::NODE_ENTITY:
+ anEntityName = "onNodes";
+ break;
+ case VISU::EDGE_ENTITY:
+ anEntityName = "onEdges";
+ break;
+ case VISU::FACE_ENTITY:
+ anEntityName = "onFaces";
+ break;
+ case VISU::CELL_ENTITY:
+ anEntityName = "onCells";
+ break;
default: break;
}
myEntityName->setText( anEntityName );
myTimeStamps->setCurrentItem( thePrs->GetTimeStampIndexByNumber( aTimeStampNumber ) );
myFieldFilter->setPrs3dEntry( thePrs->GetHolderEntry() );
- GetSelectionMgr( myModule )->installFilter( myFieldFilter );
+ bool anIsTimeStampFixed = myPrs->IsTimeStampFixed();
+ myDataSourceGroupBox->setEnabled(!anIsTimeStampFixed);
+ if(!anIsTimeStampFixed)
+ VISU::GetSelectionMgr( myModule )->installFilter( myFieldFilter );
+
+ // type of presentation and groups
+ VISU_Convertor* anInput = aResult->GetInput();
+ const VISU::TMeshMap& aMeshMap = anInput->GetMeshMap();
+ std::string aMeshName = thePrs->GetCMeshName();
+ VISU::TMeshMap::const_iterator aMeshIter = aMeshMap.find(aMeshName);
+ if(aMeshIter != aMeshMap.end()){
+ const VISU::PMesh& aMesh = aMeshIter->second;
+ const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+ VISU::TGroupMap::const_iterator aGroupIter = aGroupMap.begin();
+ for(; aGroupIter != aGroupMap.end(); aGroupIter++){
+ const std::string& aGroupName = aGroupIter->first;
+ myAllGroups->insertItem(QString(aGroupName));
+ }
+ }
+
+ if(myAllGroups->count() < 1){
+ myAllGroups->insertItem( tr("NO_GROUPS") );
+ myUseGroupsGroupBox->setEnabled(false);
+ }else if(VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(thePrs)){
+ const VISU::ScalarMap_i::TGroupNames& aGroupNames = aPrs->GetGroupNames();
+ VISU::ScalarMap_i::TGroupNames::const_iterator anIter = aGroupNames.begin();
+ for(; anIter != aGroupNames.end(); anIter++){
+ const std::string aGroupName = *anIter;
+ mySelectedGroups->insertItem(QString(aGroupName));
+ }
+ }
+ myUseGroupsGroupBox->setChecked(mySelectedGroups->count() > 0);
}
+
+//---------------------------------------------------------------
int VisuGUI_InputPane::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
{
+ if(VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(thePrs)){
+ if(myUseGroupsGroupBox->isChecked()){
+ aPrs->RemoveAllGeom();
+ std::string aMeshName = aPrs->GetCMeshName();
+ for(int i = 0; i < mySelectedGroups->count(); i++)
+ aPrs->AddMeshOnGroup( aMeshName.c_str() , mySelectedGroups->text(i) );
+ }else
+ aPrs->SetSourceGeometry();
+ }
+
thePrs->SetResultObject( myResult );
thePrs->SetMeshName( myMeshName->text().latin1() );
thePrs->SetTimeStampNumber( thePrs->GetTimeStampNumberByIndex( myTimeStamps->currentItem() ) );
return ( int )thePrs->Apply( false );
}
+
+
+//---------------------------------------------------------------
class QCheckBox;
class QComboBox;
class QLineEdit;
+class QListBoxItem;
+class QToolButton;
class SalomeApp_Module;
class LightApp_SelectionMgr;
+class VisuGUI_ListBox;
class VisuGUI_Prs3dDlg;
class VisuGUI_FieldFilter;
void initFromPrsObject( VISU::ColoredPrs3d_i* );
int storeToPrsObject( VISU::ColoredPrs3d_i* );
+ bool eventFilter (QObject* object, QEvent* event);
+
public slots:
virtual void onSelectionChanged();
virtual void onReInitialize( bool );
+private slots:
+ void onTypeChanged();
+ void onListDoubleClicked( QListBoxItem* theItem );
+ void onAdd();
+ void onRemove();
+
private:
SalomeApp_Module* myModule;
- VisuGUI_Prs3dDlg* myDialog;
+ VisuGUI_Prs3dDlg* myDialog;
VISU::ColoredPrs3d_i* myPrs;
+ QGroupBox* myUseGroupsGroupBox;
+ VisuGUI_ListBox* myAllGroups;
+ VisuGUI_ListBox* mySelectedGroups;
+ QToolButton* myAddButton;
+ QToolButton* myRemoveButton;
+
+ QGroupBox* myDataSourceGroupBox;
QLineEdit* myMedFile;
QLineEdit* myMeshName;
QLineEdit* myEntityName;
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
int VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
{
- int ok = 1;
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
-
- ok = myInputPane->storeToPrsObject( myPrsCopy );
- }
-
- ok = ok && myScalarPane->storeToPrsObject( myPrsCopy ) && myIsoPane->storeToPrsObject(myPrsCopy);
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
VISU::TSameAsFactory<VISU::TISOSURFACE>().Copy(thePrs, myPrsCopy);
- return ok;
+ return anIsOk;
}
void VisuGUI_IsoSurfacesDlg::onHelp()
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
//=======================================================================
int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
{
- int ok = 1;
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
-
- ok = myInputPane->storeToPrsObject( myPrsCopy );
- }
- ok = ok && myScalarPane->storeToPrsObject(myPrsCopy) && myIsoPane->storeToPrsObject(myPrsCopy);
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(thePrs, myPrsCopy);
- return ok;
+ return anIsOk;
}
//=======================================================================
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
*/
int VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
{
- int ok = 1;
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
-
- ok = myInputPane->storeToPrsObject( myPrsCopy );
- }
-
- ok = ok && myScalarPane->storeToPrsObject( myPrsCopy );
-
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+
VISU::TSameAsFactory<VISU::TSCALARMAP>().Copy(thePrs, myPrsCopy);
-
- return ok;
+
+ return anIsOk;
}
/*!
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
VisuGUI_ScalarMapOnDeformedShapeDlg
::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
{
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+
myPrsCopy->SetScale(getFactor());
CORBA::String_var aMeshName = myPrsCopy->GetMeshName();
myPrsCopy->ShowColored(true);
- myScalarPane->storeToPrsObject(myPrsCopy);
-
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
- myInputPane->storeToPrsObject( myPrsCopy );
- }
-
VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
- return 1;
+ return anIsOk;
}
int VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarFieldNamePos(){
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
{
- bool isAccepted = myScalarPane->storeToPrsObject(myPrsCopy);
-
- if( isAccepted && !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
- isAccepted = myInputPane->storeToPrsObject( myPrsCopy );
- }
-
- if (isAccepted) {
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+
+ if (anIsOk) {
myPrsCopy->ShowColored(myUseScalar->isChecked());
if (!myPrsCopy->IsColored()) {
SALOMEDS::Color aColor;
aPrs = createMesh(aType, aName);
}
}
- isAccepted = myPrsCopy->SetParams(myIntegStepLen->value(),
+ anIsOk &= myPrsCopy->SetParams(myIntegStepLen->value(),
myPropTime->value(),
myStepLen->value(),
aPrs,
VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(thePrs, myPrsCopy);
- return isAccepted;
+ return anIsOk;
}
/*!
if( !theInit )
return;
- if( myPrsCopy->IsTimeStampFixed() )
- myTabBox->removePage( myInputPane );
- else
- {
- myInputPane->initFromPrsObject( myPrsCopy );
- myTabBox->showPage( myInputPane );
- }
+ myInputPane->initFromPrsObject( myPrsCopy );
myTabBox->setCurrentPage( 0 );
}
-int VisuGUI_VectorsDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
- myScalarPane->storeToPrsObject(myPrsCopy);
- if( !myPrsCopy->IsTimeStampFixed() )
- {
- if( !myInputPane->check() )
- return 0;
- myInputPane->storeToPrsObject( myPrsCopy );
- }
+int VisuGUI_VectorsDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
+{
+ if(!myInputPane->check() || !myScalarPane->check())
+ return 0;
+
+ int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+ anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+
myPrsCopy->SetScale(getScaleFactor());
myPrsCopy->SetLineWidth(getLineWidth());
myPrsCopy->ShowColored(getUseMagnColor());
VISU::TSameAsFactory<VISU::TVECTORS>().Copy(thePrs, myPrsCopy);
- return 1;
+ return anIsOk;
}
VISU::ScalarMap_i
::UpdateIcon()
{
+ SALOMEDS::SObject_var aSObject = GetSObject();
+ if(CORBA::is_nil(aSObject))
+ return;
+
SALOMEDS::Study_var aStudyDocument = GetStudyDocument();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDocument->NewBuilder();
// Check if the icon needs to be updated, update if necessary
- SALOMEDS::SObject_var aSObject = GetSObject();
-
SALOMEDS::GenericAttribute_var anAttr =
aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributePixMap");
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
SetScaling(anOrigin->GetScaling());
+ myGroupNames = anOrigin->GetGroupNames();
+
Update();
}
}
UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt());
+ QString aGeomNames = VISU::Storable::FindValue(theMap, "myGeomNameList");
+ QStringList aGeomNameList = QStringList::split("|", aGeomNames);
+ int aNbOfGroups = aGeomNameList.count();
+ if(aNbOfGroups > 0){
+ RemoveAllGeom();
+ std::string aMeshName = GetCMeshName();
+ for(int aGroupNum = 0; aGroupNum < aNbOfGroups; aGroupNum++){
+ QString aGroupName = aGeomNameList[aGroupNum];
+ AddMeshOnGroup(aMeshName.c_str(), aGroupName.latin1());
+ }
+ }
+
return this;
}
Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() );
Storable::DataToStream( theStr, "myScaling", GetScaling() );
+
+ std::ostringstream aGeomNameList;
+ std::string aMeshName = GetCMeshName();
+ const TGroupNames& aGroupNames = GetGroupNames();
+ TGroupNames::const_iterator anIter = aGroupNames.begin();
+ for(; anIter != aGroupNames.end(); anIter++){
+ const std::string& aGroupName = *anIter;
+ aGeomNameList<<aGroupName<<"|";
+ }
+ Storable::DataToStream(theStr, "myGeomNameList", aGeomNameList.str());
}
//----------------------------------------------------------------------------
void
-VISU::ScalarMap_i::
-AddMeshOnGroup(const char* theMeshName,
- const char* theGroupName)
+VISU::ScalarMap_i
+::SetSourceGeometry()
+{
+ int aNbGroups = myGroupNames.size();
+ if(aNbGroups != 0){
+ GetSpecificPL()->SetSourceGeometry();
+ myGroupNames.clear();
+ UpdateIcon();
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::ScalarMap_i
+::AddMeshOnGroup(const char* theMeshName,
+ const char* theGroupName)
{
VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
VISU::PUnstructuredGridIDMapper anIDMapper = anInput->GetMeshOnGroup(theMeshName, theGroupName);
if(anIDMapper){
int aNbGroups = myGroupNames.size();
- if(myGroupNames.find(theGroupName) != myGroupNames.end()){
+ if(myGroupNames.find(theGroupName) == myGroupNames.end()){
GetSpecificPL()->AddGeometry(anIDMapper->GetOutput());
myGroupNames.insert(theGroupName);
if(aNbGroups == 0)
::RemoveAllGeom()
{
int aNbGroups = myGroupNames.size();
- if(aNbGroups != 0){
- GetSpecificPL()->ClearGeometry();
- myGroupNames.clear();
+ GetSpecificPL()->ClearGeometry();
+ myGroupNames.clear();
+ if(aNbGroups != 0)
UpdateIcon();
- }
}
GetBarOrientation();
//----------------------------------------------------------------------------
+ //! Sets initial source geometry
+ virtual
+ void
+ SetSourceGeometry();
+
//! Add geometry of mesh as group. \retval the id of added group.
virtual
void